Don't populate the array 'broadcast' on the stack but instead make it
static. Makes the object code smaller by 53 bytes:
Before:
text data bss dec hex filename
10511 1521 448 12480 30c0 drivers/staging/most/net/net.o
After:
text data bss dec hex filename
10394 1585 448 12427 308b drivers/staging/most/net/net.o
(gcc version 8.2.0 x86_64)
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Instead of creating a dummy child device to manage the card object,
just use devm stuff directly for releasing with snd_card_free().
This results in a lot of code reduction.
Since the dummy child devices are gone, the device object to be passed
to the memory allocator needs to be adjusted as well.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Just a minor code refactoring and adding some const prefix.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
All three functions to create PCM objects are fairly resemble, and can
be unified to a single common helper.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The recent ALSA PCM core supports the SNDRV_PCM_INFO_SYNC_APPLPTR flag
indicating that the driver needs the ack call at each appl_ptr
update. This is requirement for the indirect PCM implementations like
bcm2835-audio driver, too.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The memory access to the pages allocated with
SNDRV_DMA_TYPE_CONTINUOUS are basically non-coherent, and it becomes a
problem when a process accesses via mmap.
For the more consistent access, use the device coherent memory, just
by replacing the call pattern in the allocator helpers.
The only point we need to be careful for is the device object passed
there; since bcm2835-audio driver creates fake devices and each card
is created on top of that, we need to pass its parent device as the
real device object.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
For more consistency, move the module parameter description right
after its variable definition.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Yet a few header files are included unnecessarily. Drop them.
Also remove trivial comments.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
For making the whole code more consistent, replace the home-made debug
print macros with the standard dev_err() & co.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Instead of allocating a separate snd_device object, let snd_card_new()
allocate the private resource. This simplifies the code.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This is the most significant part in the patch series.
The bcm2835-audio driver used to queue the commands to vc04 core via
workqueue, but basically the whole accesses to vc04 core are done in
the sleepable context, including the callback calls. In such a case,
rewriting the code using non-atomic PCM ops will simplify the logic a
lot.
This patch does it: all workqueue are gone and each former-work
implementation is now directly called from PCM ops like trigger and
write transfer.
Along with it, the DMA position updater, bcm2835_playback_fifo(), was
also rewritten to use a simpler logic. Now it handles the XRUN and
draining properly by calling snd_pcm_stop() conditionally.
The current position is kept in atomic_t value so that it can be read
concurrently from the pointer callback.
Also, the bcm2835_audio_instance object is allocated at the beginning
of bcm2835_audio_open(). This makes the resource management clearer.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This is a cleanup and code refactoring in bcm2835-vchiq.c.
The major code changes are to provide local helpers for easier use of
lock / unlock, and message passing with/without response wait. This
allows us to reduce lots of open codes.
Also, the max packet is set at opening the stream, not at each time
when the write gets called.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The bcm2835_audio_instance object contains the array of
VCHI_SERVICE_HANDLE_T, while the code assumes and uses only the first
element explicitly. Let's reduce to a single vchi handle for
simplifying the code.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
It seems that the resolution of vc04 callback is in 10 msec; i.e. the
minimal period size is also 10 msec.
This patch adds the corresponding hw constraint.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The chip->audio_mutex is used basically for protecting the opened
stream assignment, and the prepare callback is irrelevant with it.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
These debug messages worsen the code readability a lot while they give
little debuggability (which we already have via tracing, in anyway).
Let's clean them up. This allows us to reduce the
snd_bcm2835_pcm_lib_ioctl() function to be a direct call of the
snd_pcm_lib_ioctl callback (like most other drivers do), too.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
When the parameter setup fails, the driver should propagate the error
code instead of silently ignoring it.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
alsa_stream->chip can be never NULL.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The hw_queue_size of PCM indirect helper doesn't need to be set up if
you use the whole given buffer size. Drop the useless
initialization, which just confuses readers.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Some fields in alsa_stream are the values we keep already in PCM
runtime object, hence they are redundant. Use the standard PCM
runtime values instead of the private copies.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The alsa_stream->lock is never used. Kill it.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The handling of SNDRV_PCM_TRIGGER_STOP at the trigger callback is
incorrect: when the STOP is issued, the driver is supposed to drop the
stream immediately. Meanwhile bcm2835 driver checks the DRAINING
state and tries to issue some different command.
This patch straightens things a bit, dropping the incorrect state
checks. The draining behavior would be still not perfect at this
point, but will be improved in a later patch.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The running flag of alsa_stream is basically useless. The running
state is strictly controlled in ALSA PCM core side, hence the check in
PCM trigger and close callbacks are superfluous.
Also, the prefill ack at trigger start became superfluous nowadays
with the ALSA PCM core update.
Let's rip them off.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
All the alsa_stream->open flag checks in the current code are
redundant, and they cannot be racy. For the code simplification,
let's remove the flag and its check.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
bcm2835_audio_setup(), bcm2835_audio_flush_buffers() and
bcm2835_audio_flush_playback_buffers() functions do implement
nothing.
Also, bcm2835_audio_set_ctls() is already called inside
bcm2835_audio_set_params(), so the later call is superfluous.
This patch removes these superfluous implementations.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
In the current code, the mute control is dealt in a special manner,
modifying the current volume and saving the old volume, etc. This is
inconsistent (e.g. change the volume while muted, then unmute), and
way too complex.
Also, the whole volume handling code has conversion between ALSA
volume and raw volume values, which can lead to another
inconsistency and complexity.
This patch simplifies these points:
- The ALSA volume value is saved in chip->volume
- volume->mute saves the mute state
- The mute state is evaluated only when the actual volume is passed to
the hardware, bcm2835_audio_set_ctls()
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The avail_substreams bit mask is checked for the possible racy
accesses, but this cannot happen in practice; i.e. the assignment and
the check are superfluous.
Let's rip them off.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Only a few of them are really needed.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The "IEC958 Playback Stream" control does basically the very same
thing as "IEC958 Playback Default" redundantly. The former should
have been stream-specific and restored after closing the stream, but
we don't do in that way.
Since it's nothing but confusion, remove this fake.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
snd-bcm2835 driver takes the lock with mutex_lock_interruptible() in
all places, which don't make sense. Replace them with the simple
mutex_lock().
Also taking a mutex lock right after creating it for each PCM object
is nonsense, too. It cannot be racy at that point. We can get rid of
it.
Last but not least, initializing chip->audio_mutex at each place is
error-prone. Initialize properly at creating the chip object in
snd_bcm2835_create() instead.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
PCI host drivers have already matched on compatible strings, so checking
device_type is redundant. Also, device_type is considered deprecated for
FDT though we've still been requiring it for PCI hosts as it is useful
for finding PCI buses.
Cc: devel@driverdev.osuosl.org
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Functions port_vlans_add() and port_vlans_del() could,
in theory, return an uninitialized variable. Fix this
by initializing the variable in question at declaration.
Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Rename 'pDot11dInfo', this member variable of the structure
ieee80211_device causes a checkpatch issue, CamelCase naming. The
member has been renamed 'dot11d_info' to clear this issue.
This is a coding style change which should have no impact on runtime
code execution.
Signed-off-by: John Whitmore <johnfwhitmore@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The structure rt_dot11d_info contains a memeber variable 'enabled',
which causes a checkpatch issue as it is declared as being of type
bool. The type of the variable has been changed to a 'u8', to clear
the issue.
Additionally to aid searching for the member variable in code it
has been renamed from 'enabled' to 'dot11d_enabled'.
These are purely coding style changes which should not impact runtime
code execution.
Signed-off-by: John Whitmore <johnfwhitmore@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Add the required SPDX-License-Identifier to the file r8180_93cx6.h,
this clears a checkpatch issue.
This is a coding style change which should have no impact on runtime
code execution.
Signed-off-by: John Whitmore <johnfwhitmore@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Remove unused definitions from the file r8180_93cx6.h.
This is a coding style change which should have no impact on runtime
code execution.
Signed-off-by: John Whitmore <johnfwhitmore@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ION had supported heap debug info under /sys/kernel/debug/ion/<heap_name>.
This support have been removed but some leftovers (dead code) still exist.
This patch removes the existing dead code.
Fixes: 15c6098cfe ("staging: android: ion: Remove ion_handle and ion_client")
Signed-off-by: Alexey Skidanov <alexey.skidanov@intel.com>
Acked-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The function dot11d_init() was previously renamed to clear a style
issue. Unfortunately the new name used, dot11d_init(), clashes with
a sybmol which is exported with the same name. To correct this
problem the function has been renamed to rtl8192u_dot11d_init().
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: John Whitmore <johnfwhitmore@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Pointer 'port_priv' is being assigned but is never used hence it is
redundant and can be removed.
Cleans up clang warning:
variable 'port_priv' set but not used [-Wunused-but-set-variable]
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
In preparation to remove the node name pointer from struct device_node,
convert printf users to use the %pOFn format specifier.
Cc: Steve Longerbeam <slongerbeam@gmail.com>
Cc: Philipp Zabel <p.zabel@pengutronix.de>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-media@vger.kernel.org
Cc: devel@driverdev.osuosl.org
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
When strncpy() is called with source and destination strings the same
length, gcc 8 warns that there may be an unterminated string. Using
strlcpy() rather than strncpy() forces a null at the end and quiets the
warning.
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
When strncpy() is called with source and destination strings the same
length, gcc 8 warns that there may be an unterminated string. This section
is completely reworked to use the known lengths of the strings.
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This patch does not change the logic, it only
corrects the formatting and checkpatch checks by
braces {} should be used on all arms of this statement,
unbalanced braces around else statement and warning by
braces {} are not necessary for any arm of this statement.
The patch fixes 9 checks of type:
"Check: braces {} should be used on all arms of this statement";
"Check: Unbalanced braces around else statement";
and 1 warning of type:
"WARNING: braces {} are not necessary for any arm of this statement".
Signed-off-by: Pavel Zemlyanoy <zemlyanoy@ispras.ru>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Reviewed-by: Gao Xiang <gaoxiang25@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This patch does not change the logic, it only
corrects the formatting and checkpatch check by
alignment should match open parenthesis.
The patch fixes 2 check of type:
"Check: Alignment should match open parenthesis".
Signed-off-by: Pavel Zemlyanoy <zemlyanoy@ispras.ru>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Reviewed-by: Gao Xiang <gaoxiang25@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This patch does not change the logic, it only
corrects the formatting and checkpatch check by
adding spaces around '*'.
The patch fixes 1 check of type:
"Check: spaces preferred around that '*'".
Signed-off-by: Pavel Zemlyanoy <zemlyanoy@ispras.ru>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Reviewed-by: Gao Xiang <gaoxiang25@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This patch does not change the logic, it only
corrects the formatting and checkpatch checks by
adding spaces around '-'.
The patch fixes 4 checks of type:
"Check: spaces preferred around that '-'".
Signed-off-by: Pavel Zemlyanoy <zemlyanoy@ispras.ru>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Reviewed-by: Gao Xiang <gaoxiang25@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This patch does not change the logic, it only
corrects the formatting and checkpatch checks by
to NULL comparison.
The patch fixes 5 checks of type:
"Comparison to NULL could be written".
Signed-off-by: Pavel Zemlyanoy <zemlyanoy@ispras.ru>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Reviewed-by: Gao Xiang <gaoxiang25@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This patch does not change the logic, it only
corrects the formatting and checkpatch warnings by
adding "int" to the unsigned type.
The patch fixes 11 warnings of the type:
"WARNING: Prefer 'unsigned int' to bare use of 'unsigned'"
Signed-off-by: Pavel Zemlyanoy <zemlyanoy@ispras.ru>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Reviewed-by: Gao Xiang <gaoxiang25@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This reverts commit 156c3df8d4.
Since XArray and the new mount apis aren't merged in 4.19-rc1
merge window, the BROKEN mark can be reverted directly without
any problems.
Fixes: 156c3df8d4 ("staging: erofs: disable compiling temporarile")
Cc: Matthew Wilcox <willy@infradead.org>
Cc: David Howells <dhowells@redhat.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>