platform/kernel/linux-rpi.git
6 years agostaging:rtl8192u: Remove write_cam() - Style
John Whitmore [Fri, 31 Aug 2018 23:02:31 +0000 (00:02 +0100)]
staging:rtl8192u: Remove write_cam() - Style

Remove the function write_cam() as it is unused.

Simple style change which should not impact runtime code execution.

Signed-off-by: John Whitmore <johnfwhitmore@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoStaging: rtlwifi: efuse: Fixed a line length code styling issue.
Tom Todd [Sat, 1 Sep 2018 12:28:06 +0000 (13:28 +0100)]
Staging: rtlwifi: efuse: Fixed a line length code styling issue.

Fixed a code styling issue.

Signed-off-by: Tom Todd <thomas.m.a.todd@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: mt7621-mmc: Fix debug macro ERR_MSG and its usages
Nishad Kamdar [Fri, 31 Aug 2018 22:19:43 +0000 (03:49 +0530)]
staging: mt7621-mmc: Fix debug macro ERR_MSG and its usages

Replace all usages of ERR_MSG with with dev_<level> without __func__
or __LINE__ or current->comm and current->pid. Remove the do {}
while(0) loop for the single statement macro. Delete commented
ERR_MSG() usage. Drop ERR_MSG from dbg.h. Issue found by checkpatch.

Signed-off-by: Nishad Kamdar <nishadkamdar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: mt7621-mmc: Delete N_MSG() and all its users
Nishad Kamdar [Fri, 31 Aug 2018 22:17:15 +0000 (03:47 +0530)]
staging: mt7621-mmc: Delete N_MSG() and all its users

This patch removes N_MSG() and all its users since it is a no-op.

Signed-off-by: Nishad Kamdar <nishadkamdar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging/vboxvideo: Replace ttm_bo_unref with ttm_bo_put
Thomas Zimmermann [Mon, 10 Sep 2018 09:36:44 +0000 (11:36 +0200)]
staging/vboxvideo: Replace ttm_bo_unref with ttm_bo_put

The function ttm_bo_put releases a reference to a TTM buffer object. The
function's name is more aligned to the Linux kernel convention of naming
ref-counting function _get and _put.

A call to ttm_bo_unref takes the address of the TTM BO object's pointer and
clears the pointer's value to NULL. This is not necessary in most cases and
sometimes even worked around by the calling code. A call to ttm_bo_put only
releases the reference without clearing the pointer.

The current behaviour of cleaning the pointer is kept in the calling code,
but should be removed if not required in a later patch.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: wlan-ng: remove redundant code in "#if 0" blocks
Tim Collier [Tue, 28 Aug 2018 19:26:12 +0000 (20:26 +0100)]
staging: wlan-ng: remove redundant code in "#if 0" blocks

Remove two blocks of code that checkpatch identified as redundant
because they were enclosed in "#if...#endif". In the case of
prism2fw.c the associated "TODO" comment was retained.

Signed-off-by: Tim Collier <osdevtc@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: rtl8188eu: remove unnecessary parentheses
Michael Straube [Mon, 3 Sep 2018 18:24:45 +0000 (20:24 +0200)]
staging: rtl8188eu: remove unnecessary parentheses

Remove unnecessary parentheses to follow kernel coding style
and clean checkpatch issues.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: rtl8188eu: remove whitespace
Michael Straube [Mon, 3 Sep 2018 18:24:44 +0000 (20:24 +0200)]
staging: rtl8188eu: remove whitespace

Replace tabs with spaces where appropriate.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: rtl8188eu: fix comparsions to true
Michael Straube [Mon, 3 Sep 2018 18:24:43 +0000 (20:24 +0200)]
staging: rtl8188eu: fix comparsions to true

Use if(x) instead of if(x == true).

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: rtl8188eu: Remove code valid only for 5 GHz
Michael Straube [Mon, 3 Sep 2018 18:24:42 +0000 (20:24 +0200)]
staging: rtl8188eu: Remove code valid only for 5 GHz

Remove code that is only valid for channels > 14.
This addresses the below TODO item.

- find and remove remaining code valid only for 5 GHz. Most of the obvious
  ones have been removed, but things like channel > 14 still exist.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: rtl8188eu: remove pointless comment
Michael Straube [Mon, 3 Sep 2018 20:09:52 +0000 (22:09 +0200)]
staging: rtl8188eu: remove pointless comment

This comment adds no useful information to the code,
so remove it.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: rtl8188eu: simplify function comment
Michael Straube [Mon, 3 Sep 2018 19:59:18 +0000 (21:59 +0200)]
staging: rtl8188eu: simplify function comment

Simplify function comment to a single line.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: rtl8188eu: Fix two sleep-in-atomic-context bugs in rtw_chk_hi_queue_cmd()
Jia-Ju Bai [Sat, 1 Sep 2018 08:58:29 +0000 (16:58 +0800)]
staging: rtl8188eu: Fix two sleep-in-atomic-context bugs in rtw_chk_hi_queue_cmd()

usb_write_port_complete() in usb_ops_linux.c is a completion handler
function for the USB driver. So it should not sleep, but it is can sleep
according to the function call paths (from bottom to top) in Linux-4.16:

[FUNC] kzalloc(GFP_KERNEL)
drivers/staging/rtl8188eu/core/rtw_cmd.c, 1081:
kzalloc in rtw_chk_hi_queue_cmd
drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c, 604:
rtw_chk_hi_queue_cmd in usb_write_port_complete

[FUNC] kzalloc(GFP_KERNEL)
drivers/staging/rtl8188eu/core/rtw_cmd.c, 1075:
kzalloc in rtw_chk_hi_queue_cmd
drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c, 604:
rtw_chk_hi_queue_cmd in usb_write_port_complete

To fix these bugs, GFP_KERNEL is replaced with GFP_ATOMIC.

These bugs are found by my static analysis tool DSAC.

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: most: video: fix registration of an empty comp core_component
Colin Ian King [Wed, 5 Sep 2018 09:46:05 +0000 (10:46 +0100)]
staging: most: video: fix registration of an empty comp core_component

Currently we have structrues comp (which is empty) and comp_info being
used to register and deregister the component.  This mismatch in naming
occurred from a previous commit that renamed aim_info to comp. Fix this
to use consistent component naming in line with most/net, most/sound etc.

This fixes the message two issues, one with a null empty name when
loading the module:

[ 1485.269515] most_core: registered new core component (null)

and an Oops when removing the module:

[ 1485.277971] BUG: unable to handle kernel NULL pointer dereference at 0000000000000008
[ 1485.278648] PGD 0 P4D 0
[ 1485.279253] Oops: 0002 [#2] SMP PTI
[ 1485.279847] CPU: 1 PID: 32629 Comm: modprobe Tainted: P      D WC OE     4.18.0-8-generic #9
[ 1485.280442] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 0.0.0 02/06/2015
[ 1485.281040] RIP: 0010:most_deregister_component+0x3c/0x70 [most_core]
.. etc

Fixes: 1b10a0316e2d ("staging: most: video: remove aim designators")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: most: net: make array 'broadcast' static, shrinks object size
Colin Ian King [Tue, 4 Sep 2018 15:47:07 +0000 (16:47 +0100)]
staging: most: net: make array 'broadcast' static, shrinks object size

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>
6 years agostaging: bcm2835-audio: Simplify card object management
Takashi Iwai [Tue, 4 Sep 2018 15:58:58 +0000 (17:58 +0200)]
staging: bcm2835-audio: Simplify card object management

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>
6 years agostaging: bcm2835-audio: Simplify kctl creation helpers
Takashi Iwai [Tue, 4 Sep 2018 15:58:57 +0000 (17:58 +0200)]
staging: bcm2835-audio: Simplify kctl creation helpers

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>
6 years agostaging: bcm2835-audio: Simplify PCM creation helpers
Takashi Iwai [Tue, 4 Sep 2018 15:58:56 +0000 (17:58 +0200)]
staging: bcm2835-audio: Simplify PCM creation helpers

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>
6 years agostaging: bcm2835-audio: Set SNDRV_PCM_INFO_SYNC_APPLPTR
Takashi Iwai [Tue, 4 Sep 2018 15:58:55 +0000 (17:58 +0200)]
staging: bcm2835-audio: Set SNDRV_PCM_INFO_SYNC_APPLPTR

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>
6 years agostaging: bcm2835-audio: Use coherent device buffers
Takashi Iwai [Tue, 4 Sep 2018 15:58:54 +0000 (17:58 +0200)]
staging: bcm2835-audio: Use coherent device buffers

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>
6 years agostaging: bcm2835-audio: Move module parameter description
Takashi Iwai [Tue, 4 Sep 2018 15:58:53 +0000 (17:58 +0200)]
staging: bcm2835-audio: Move module parameter description

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>
6 years agostaging: bcm2835-audio: Remove unnecessary header file includes
Takashi Iwai [Tue, 4 Sep 2018 15:58:52 +0000 (17:58 +0200)]
staging: bcm2835-audio: Remove unnecessary header file includes

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>
6 years agostaging: bcm2835-audio: Use standard error print helpers
Takashi Iwai [Tue, 4 Sep 2018 15:58:51 +0000 (17:58 +0200)]
staging: bcm2835-audio: Use standard error print helpers

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>
6 years agostaging: bcm2835-audio: Use card->private_data
Takashi Iwai [Tue, 4 Sep 2018 15:58:50 +0000 (17:58 +0200)]
staging: bcm2835-audio: Use card->private_data

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>
6 years agostaging: bcm2835-audio: Operate non-atomic PCM ops
Takashi Iwai [Tue, 4 Sep 2018 15:58:49 +0000 (17:58 +0200)]
staging: bcm2835-audio: Operate non-atomic PCM ops

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>
6 years agostaging: bcm2835-audio: Code refactoring of vchiq accessor codes
Takashi Iwai [Tue, 4 Sep 2018 15:58:48 +0000 (17:58 +0200)]
staging: bcm2835-audio: Code refactoring of vchiq accessor codes

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>
6 years agostaging: bcm2835-audio: Make single vchi handle
Takashi Iwai [Tue, 4 Sep 2018 15:58:47 +0000 (17:58 +0200)]
staging: bcm2835-audio: Make single vchi handle

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>
6 years agostaging: bcm2835-audio: Add 10ms period constraint
Takashi Iwai [Tue, 4 Sep 2018 15:58:46 +0000 (17:58 +0200)]
staging: bcm2835-audio: Add 10ms period constraint

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>
6 years agostaging: bcm2835-audio: Drop superfluous mutex lock during prepare
Takashi Iwai [Tue, 4 Sep 2018 15:58:45 +0000 (17:58 +0200)]
staging: bcm2835-audio: Drop superfluous mutex lock during prepare

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>
6 years agostaging: bcm2835-audio: Drop debug messages in bcm2835-pcm.c
Takashi Iwai [Tue, 4 Sep 2018 15:58:44 +0000 (17:58 +0200)]
staging: bcm2835-audio: Drop debug messages in bcm2835-pcm.c

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>
6 years agostaging: bcm2835-audio: Propagate parameter setup error
Takashi Iwai [Tue, 4 Sep 2018 15:58:43 +0000 (17:58 +0200)]
staging: bcm2835-audio: Propagate parameter setup error

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>
6 years agostaging: bcm2835-audio: Drop useless NULL check
Takashi Iwai [Tue, 4 Sep 2018 15:58:42 +0000 (17:58 +0200)]
staging: bcm2835-audio: Drop useless NULL check

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>
6 years agostaging: bcm2835-audio: Drop unnecessary pcm indirect setup
Takashi Iwai [Tue, 4 Sep 2018 15:58:41 +0000 (17:58 +0200)]
staging: bcm2835-audio: Drop unnecessary pcm indirect setup

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>
6 years agostaging: bcm2835-audio: Use PCM runtime values instead
Takashi Iwai [Tue, 4 Sep 2018 15:58:40 +0000 (17:58 +0200)]
staging: bcm2835-audio: Use PCM runtime values instead

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>
6 years agostaging: bcm2835-audio: Kill unused spinlock
Takashi Iwai [Tue, 4 Sep 2018 15:58:39 +0000 (17:58 +0200)]
staging: bcm2835-audio: Kill unused spinlock

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>
6 years agostaging: bcm2835-audio: Fix incorrect draining handling
Takashi Iwai [Tue, 4 Sep 2018 15:58:38 +0000 (17:58 +0200)]
staging: bcm2835-audio: Fix incorrect draining handling

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>
6 years agostaging: bcm2835-audio: Drop useless running flag and check
Takashi Iwai [Tue, 4 Sep 2018 15:58:37 +0000 (17:58 +0200)]
staging: bcm2835-audio: Drop useless running flag and check

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>
6 years agostaging: bcm2835-audio: Remove superfluous open flag
Takashi Iwai [Tue, 4 Sep 2018 15:58:36 +0000 (17:58 +0200)]
staging: bcm2835-audio: Remove superfluous open flag

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>
6 years agostaging: bcm2835-audio: Remove redundant function calls
Takashi Iwai [Tue, 4 Sep 2018 15:58:35 +0000 (17:58 +0200)]
staging: bcm2835-audio: Remove redundant function calls

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>
6 years agostaging: bcm2835-audio: Fix mute controls, volume handling cleanup
Takashi Iwai [Tue, 4 Sep 2018 15:58:34 +0000 (17:58 +0200)]
staging: bcm2835-audio: Fix mute controls, volume handling cleanup

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>
6 years agostaging: bcm2835-audio: Remove redundant substream mask checks
Takashi Iwai [Tue, 4 Sep 2018 15:58:33 +0000 (17:58 +0200)]
staging: bcm2835-audio: Remove redundant substream mask checks

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>
6 years agostaging: bcm2835-audio: Clean up include files in bcm2835-ctl.c
Takashi Iwai [Tue, 4 Sep 2018 15:58:32 +0000 (17:58 +0200)]
staging: bcm2835-audio: Clean up include files in bcm2835-ctl.c

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>
6 years agostaging: bcm2835-audio: Remove redundant spdif stream ctls
Takashi Iwai [Tue, 4 Sep 2018 15:58:31 +0000 (17:58 +0200)]
staging: bcm2835-audio: Remove redundant spdif stream ctls

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>
6 years agostaging: bcm2835-audio: Clean up mutex locks
Takashi Iwai [Tue, 4 Sep 2018 15:58:30 +0000 (17:58 +0200)]
staging: bcm2835-audio: Clean up mutex locks

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>
6 years agostaging: mt7621-pci: remove unnecessary check of device_type == pci
Rob Herring [Wed, 29 Aug 2018 18:34:03 +0000 (13:34 -0500)]
staging: mt7621-pci: remove unnecessary check of device_type == pci

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>
6 years agostaging: fsl-dpaa2/ethsw: Fix uninitialized variables
Ioana Radulescu [Thu, 30 Aug 2018 13:17:08 +0000 (16:17 +0300)]
staging: fsl-dpaa2/ethsw: Fix uninitialized variables

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>
6 years agostaging:rtl8192u: Rename member pDot11dInfo - Style
John Whitmore [Tue, 28 Aug 2018 18:55:35 +0000 (19:55 +0100)]
staging:rtl8192u: Rename member pDot11dInfo - Style

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>
6 years agostaging:rtl8192u: Refactor member variable enabled - Style
John Whitmore [Tue, 28 Aug 2018 18:55:34 +0000 (19:55 +0100)]
staging:rtl8192u: Refactor member variable enabled - Style

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>
6 years agostaging:rtl8192u: Add required SPDX-License-Identifier - Style
John Whitmore [Tue, 28 Aug 2018 18:55:33 +0000 (19:55 +0100)]
staging:rtl8192u: Add required SPDX-License-Identifier - Style

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>
6 years agostaging:rtl8192u: Remove unused definitions - Style
John Whitmore [Tue, 28 Aug 2018 18:55:32 +0000 (19:55 +0100)]
staging:rtl8192u: Remove unused definitions - Style

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>
6 years agostaging: android: ion: Clean unused debug_show memeber of the heap object
Alexey Skidanov [Wed, 5 Sep 2018 05:03:15 +0000 (08:03 +0300)]
staging: android: ion: Clean unused debug_show memeber of the heap object

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: 15c6098cfec5 ("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>
6 years agostaging:rtl8192u: Rename dot11d_init to fix name clash
John Whitmore [Tue, 4 Sep 2018 10:56:23 +0000 (11:56 +0100)]
staging:rtl8192u: Rename dot11d_init to fix name clash

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>
6 years agostaging: fsl-dpaa2/ethsw: remove redundant pointer 'port_priv'
Colin Ian King [Wed, 29 Aug 2018 09:35:30 +0000 (10:35 +0100)]
staging: fsl-dpaa2/ethsw: remove redundant pointer 'port_priv'

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>
6 years agostaging: Convert to using %pOFn instead of device_node.name
Rob Herring [Tue, 28 Aug 2018 15:44:33 +0000 (10:44 -0500)]
staging: Convert to using %pOFn instead of device_node.name

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>
6 years agostaging: rtl8712u: Fix compiler warning about strncpy
Larry Finger [Mon, 27 Aug 2018 18:46:46 +0000 (13:46 -0500)]
staging: rtl8712u: Fix compiler warning about strncpy

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>
6 years agostaging: rtl8192e: Fix compiler warning from strncpy()
Larry Finger [Mon, 27 Aug 2018 18:46:45 +0000 (13:46 -0500)]
staging: rtl8192e: Fix compiler warning from strncpy()

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>
6 years agostaging: erofs: fix 1 warning and 9 checks
Pavel Zemlyanoy [Thu, 30 Aug 2018 15:14:02 +0000 (18:14 +0300)]
staging: erofs: fix 1 warning and 9 checks

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>
6 years agostaging: erofs: formatting alignment parenthesis
Pavel Zemlyanoy [Thu, 30 Aug 2018 15:14:01 +0000 (18:14 +0300)]
staging: erofs: formatting alignment parenthesis

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>
6 years agostaging: erofs: formatting add spaces arround '*'
Pavel Zemlyanoy [Thu, 30 Aug 2018 15:14:00 +0000 (18:14 +0300)]
staging: erofs: formatting add spaces arround '*'

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>
6 years agostaging: erofs: formatting spaces around '-'
Pavel Zemlyanoy [Thu, 30 Aug 2018 15:13:59 +0000 (18:13 +0300)]
staging: erofs: formatting spaces around '-'

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>
6 years agostaging: erofs: formatting fix to NULL comparison
Pavel Zemlyanoy [Thu, 30 Aug 2018 15:13:58 +0000 (18:13 +0300)]
staging: erofs: formatting fix to NULL comparison

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>
6 years agostaging: erofs: formatting fix in unzip_vle_lz4.c
Pavel Zemlyanoy [Thu, 30 Aug 2018 15:13:57 +0000 (18:13 +0300)]
staging: erofs: formatting fix in unzip_vle_lz4.c

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>
6 years agoRevert "staging: erofs: disable compiling temporarile"
Gao Xiang [Tue, 28 Aug 2018 03:39:48 +0000 (11:39 +0800)]
Revert "staging: erofs: disable compiling temporarile"

This reverts commit 156c3df8d4db4e693c062978186f44079413d74d.

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: 156c3df8d4db ("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>
6 years agoStaging: octeon-usb: Replaces CVMX_WAIT_FOR_FIELD32 macro with a function
Georgios Tsotsos [Mon, 13 Aug 2018 16:25:29 +0000 (19:25 +0300)]
Staging: octeon-usb: Replaces CVMX_WAIT_FOR_FIELD32 macro with a function

Replaces CVMX_WAIT_FOR_FIELD32 macro with equivalent function.

Signed-off-by: Georgios Tsotsos <tsotsos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoStaging: One Laptop Per Child: fix SPDX-License-Identifier issue
Arkadiusz Lis [Wed, 8 Aug 2018 15:42:29 +0000 (17:42 +0200)]
Staging: One Laptop Per Child: fix SPDX-License-Identifier issue

Add SPDX-License-Identifier to the source files.
Remove redundant, old license.

Signed-off-by: Arkadiusz Lis <areklis909@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: most: do not make interface dependent attrs default for all channels
Christian Gromm [Mon, 13 Aug 2018 13:02:29 +0000 (15:02 +0200)]
staging: most: do not make interface dependent attrs default for all channels

The channel attribute dbr_size is only relevant for the DIM2 interface. so
is the packets_per_xact for USB. This patch cleans up the driver's ABI by
not showing all attributes by default for each channel, but only on those
they belong to.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: most: register channel device after init of struct members
Christian Gromm [Mon, 13 Aug 2018 13:02:28 +0000 (15:02 +0200)]
staging: most: register channel device after init of struct members

This patch moves the call to device_register to the end of the channel
initialization section that the devcie belongs to. It is needed to
avoid NULL pointer dereferences once the device is registered with
sysfs.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: rtl8712: remove unused array iw_operation_mode
Colin Ian King [Thu, 9 Aug 2018 10:51:20 +0000 (11:51 +0100)]
staging: rtl8712: remove unused array iw_operation_mode

Array iw_operation_mode is defined but is never used hence it is
redundant and can be removed. This array has been like this since
the driver was added back in 2010

Cleans up clang warning:
warning: 'iw_operation_mode' defined but not used [-Wunused-const-variable=]

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: erofs: fix potential overflow in z_erofs_vle_normalaccess_readpage{,s}
Gao Xiang [Fri, 24 Aug 2018 02:02:40 +0000 (10:02 +0800)]
staging: erofs: fix potential overflow in z_erofs_vle_normalaccess_readpage{,s}

As Dan reported in the LKP mailing list:
https://lists.01.org/pipermail/kbuild-all/2018-August/051558.html

New smatch warnings:
drivers/staging/erofs/unzip_vle.c:1359 z_erofs_vle_normalaccess_readpages() warn: should '()->index << 12' be a 64 bit type?

Old smatch warnings:
drivers/staging/erofs/unzip_vle.c:1322 z_erofs_vle_normalaccess_readpage() warn: should 'page->index << 12' be a 64 bit type?

It needs to cast variable's type to erofs_off_t before left shifting.

Reported-by: Dan Carpenter <dan.carpenter@oracle.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>
6 years agostaging: erofs: change 'unsigned' to 'unsigned int'
Leon Imhof [Mon, 13 Aug 2018 15:20:11 +0000 (17:20 +0200)]
staging: erofs: change 'unsigned' to 'unsigned int'

Fix coding style issue "Prefer 'unsigned int' to bare use of 'unsigned'"
detected by checkpatch.pl

Signed-off-by: Leon Imhof <leon.imhof@in.tum.de>
Reviewed-by: Gao Xiang <gaoxiang25@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: erofs: fix potential overflow in erofs_grab_bio()
Chao Yu [Tue, 21 Aug 2018 14:49:37 +0000 (22:49 +0800)]
staging: erofs: fix potential overflow in erofs_grab_bio()

As Dan reported in LKP's mailing list:

https://lists.01.org/pipermail/kbuild-all/2018-August/051419.html

New smatch warnings:
drivers/staging/erofs/internal.h:446 erofs_grab_bio() warn: should 'blkaddr << (12 - 9)' be a 64 bit type?
drivers/staging/erofs/data.c:78 __erofs_get_meta_page() error: 'bio' dereferencing possible ERR_PTR()
drivers/staging/erofs/internal.h:446 erofs_grab_bio() warn: should 'blkaddr << (12 - 9)' be a 64 bit type?

Old smatch warnings:
drivers/staging/erofs/unzip_vle.c:989 z_erofs_vle_unzip() error: double unlock 'mutex:&z_pagemap_global_lock'
drivers/staging/erofs/unzip_vle.c:1318 z_erofs_vle_normalaccess_readpage() warn: should 'page->index << 12' be a 64 bit type?
drivers/staging/erofs/unzip_vle.c:1351 __z_erofs_vle_normalaccess_readpages() warn: should '()->index << 12' be a 64 bit type?

It needs to cast varable's type to sector_t before left shifting.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Gao Xiang <gaoxiang25@huawei.com>
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: erofs: fix compression mapping beyond EOF
Gao Xiang [Tue, 21 Aug 2018 14:49:36 +0000 (22:49 +0800)]
staging: erofs: fix compression mapping beyond EOF

Logical address of EOF LTP mapping should start at
`inode->i_size' rather than `inode->i_size - 1' to
`m_la(in)', fix it.

Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: erofs: fix integer overflow on 32-bit platform
Gao Xiang [Tue, 21 Aug 2018 14:49:35 +0000 (22:49 +0800)]
staging: erofs: fix integer overflow on 32-bit platform

This patch fixes integer overflow on multiplication
of 32-bit `lcn' in z_erofs_map_blocks_iter.

Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: erofs: fix vle_decompressed_index_clusterofs
Gao Xiang [Tue, 21 Aug 2018 14:49:34 +0000 (22:49 +0800)]
staging: erofs: fix vle_decompressed_index_clusterofs

This patch adds error handing code, and fixes a missing
endian conversion in vle_decompressed_index_clusterofs.

Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: erofs: rearrange vle clustertype definitions
Gao Xiang [Tue, 21 Aug 2018 14:49:33 +0000 (22:49 +0800)]
staging: erofs: rearrange vle clustertype definitions

This patch moves vle clustertype definitions to erofs_fs.h
since they are part of on-disk format.

It also adds compile time check for Z_EROFS_VLE_DI_CLUSTER_TYPE_BITS

Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: erofs: cleanup z_erofs_vle_work_{lookup, register}
Gao Xiang [Tue, 21 Aug 2018 14:49:32 +0000 (22:49 +0800)]
staging: erofs: cleanup z_erofs_vle_work_{lookup, register}

This patch introduces 'struct z_erofs_vle_work_finder' to clean up
arguments of z_erofs_vle_work_lookup and z_erofs_vle_work_register.

Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: erofs: add error handling for xattr submodule
Gao Xiang [Tue, 21 Aug 2018 14:49:31 +0000 (22:49 +0800)]
staging: erofs: add error handling for xattr submodule

This patch enhances the missing error handling code for
xattr submodule, which improves the stability for the rare cases.

Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: erofs: separate erofs_get_meta_page
Gao Xiang [Tue, 21 Aug 2018 14:49:30 +0000 (22:49 +0800)]
staging: erofs: separate erofs_get_meta_page

This patch separates 'erofs_get_meta_page' into 'erofs_get_meta_page'
and 'erofs_get_meta_page_nofail'. The second one ensures that it
should not fail under memory pressure and should make best efforts
if IO errors occur.

It also adds auxiliary variables in order to fulfill 80 character limit.

Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: erofs: introduce erofs_grab_bio
Gao Xiang [Tue, 21 Aug 2018 14:49:29 +0000 (22:49 +0800)]
staging: erofs: introduce erofs_grab_bio

this patch renames prepare_bio to erofs_grab_bio, and
adds a nofail option in order to retry in the bio allocator
under memory pressure.

Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: gasket: interrupt: remove unimplemented interrupt types
Todd Poynor [Fri, 10 Aug 2018 03:21:11 +0000 (20:21 -0700)]
staging: gasket: interrupt: remove unimplemented interrupt types

Interrupt types PCI_MSI and PLATFORM_WIRE are unused and unimplemented.
Remove these.

Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: gasket: interrupt: simplify interrupt init parameters
Todd Poynor [Fri, 10 Aug 2018 03:21:10 +0000 (20:21 -0700)]
staging: gasket: interrupt: simplify interrupt init parameters

Pass the gasket driver descriptor to the interrupt init function, rather
than exploding out separate parameters from various fields of that
structure.  This allows us to make more localized changes to the types
of interrupts supported (MSIX vs. wire, etc.) without affecting the
calling sequence, and seems nicer for simplification purposes.

Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: gasket: interrupt: refactor PCI MSIX-specific handler code
Todd Poynor [Fri, 10 Aug 2018 03:21:09 +0000 (20:21 -0700)]
staging: gasket: interrupt: refactor PCI MSIX-specific handler code

Split interrupt handler into PCI MSIX-specific and generic functions,
for adding non-MSIX handlers in the future.  Move MSIX init code
together,, out of generic init path.

Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: gasket: core: rename lookup_internal_desc to be PCI-specific
Todd Poynor [Fri, 10 Aug 2018 03:21:08 +0000 (20:21 -0700)]
staging: gasket: core: rename lookup_internal_desc to be PCI-specific

Rename lookup_internal_desc() to lookup_pci_internal_desc() to reflect
use for PCI devices only, in prep for non-PCI devices in the future.

Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: gasket: core: factor out generic device remove code from PCI
Todd Poynor [Fri, 10 Aug 2018 03:21:07 +0000 (20:21 -0700)]
staging: gasket: core: factor out generic device remove code from PCI

Separate code for generic parts of gasket device removal sequence from
the PCI device removal code, in prep for non-PCI devices later.

Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: gasket: core: factor out generic device add code from PCI code
Todd Poynor [Fri, 10 Aug 2018 03:21:06 +0000 (20:21 -0700)]
staging: gasket: core: factor out generic device add code from PCI code

Split out generic gasket device add code from the code for adding a PCI
gasket device, in prep for other gasket device types in the future.

Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: gasket: page table: remove extraneous memory barriers
Todd Poynor [Fri, 10 Aug 2018 03:21:05 +0000 (20:21 -0700)]
staging: gasket: page table: remove extraneous memory barriers

Some explicit memory barriers in the page table code are not necessary,
either because:

(a) The barrier follows a non-relaxed MMIO access that already performs
a read or write memory barrier.

(b) The barrier follows DMA API calls for which the device-visible
effects of IOMMU programming are guaranteed to be flushed to the IOMMU
prior to the call returning, and doesn't need to sync with normal memory
access.

Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: gasket: core: switch to relaxed memory-mapped I/O
Todd Poynor [Fri, 10 Aug 2018 03:21:04 +0000 (20:21 -0700)]
staging: gasket: core: switch to relaxed memory-mapped I/O

Use of readl() is deprecated; readl_relaxed() with appropriate memory
barriers is preferred.  Switch to relaxed reads and writes for better
performance as well.  Memory barriers required for I/O vs. normal
memory access on Apex devices have already been explicitly coded in the
page table routines.

Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: gasket: page table: use dma_mapping_error for error detection
Todd Poynor [Fri, 10 Aug 2018 03:21:03 +0000 (20:21 -0700)]
staging: gasket: page table: use dma_mapping_error for error detection

gasket_perform_mapping() call dma_mapping_error() to determine if
mapping failed.

Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: gasket: remove gasket_exit()
Todd Poynor [Fri, 10 Aug 2018 03:21:01 +0000 (20:21 -0700)]
staging: gasket: remove gasket_exit()

Remove now-empty gasket_exit() function.

Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: gasket: core: remove ftrace-style debug logs
Todd Poynor [Fri, 10 Aug 2018 03:21:00 +0000 (20:21 -0700)]
staging: gasket: core: remove ftrace-style debug logs

Remove debug logs that only indicate the name of the entered function,
in favor of using ftrace for function tracing style logs.

Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: gasket: core: remove kobj_name param from gasket_alloc_dev
Todd Poynor [Fri, 10 Aug 2018 03:20:59 +0000 (20:20 -0700)]
staging: gasket: core: remove kobj_name param from gasket_alloc_dev

gasket_alloc_dev can retrieve the device name from the parent parameter,
a separate parameter isn't needed for this.  Rename the variable to
better reflect its meaning, as the name of the parent device for which a
gasket device is being allocated.

Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: gasket: core: fix line continuation indent in gasket_alloc_dev
Todd Poynor [Fri, 10 Aug 2018 03:20:58 +0000 (20:20 -0700)]
staging: gasket: core: fix line continuation indent in gasket_alloc_dev

Previous cleanups missed a case of multi-line function call with line
continuation parameters not aligned per kernel style.

Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: gasket: core: remove debug log that could crash
Todd Poynor [Fri, 10 Aug 2018 03:20:57 +0000 (20:20 -0700)]
staging: gasket: core: remove debug log that could crash

A debug log in gasket_alloc_dev() is issued regardless of whether the
device pointer used returned success or error.  The log isn't that
useful anyway, remove it.

Signed-off-by: Todd Poynor <toddpoynor@google.com>
Reviewed-by: Rob Springer <rspringer@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: gasket: apex: remove unused array cm_mappable_regions
Colin Ian King [Thu, 9 Aug 2018 10:44:32 +0000 (11:44 +0100)]
staging: gasket: apex: remove unused array cm_mappable_regions

Array cm_mappable_regions is defined but is never used hence it is
redundant and can be removed.

Cleans up clang warning:
warning: 'cm_mappable_regions' defined but not used [-Wunused-const-variable=]

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: gasket: remove null ptr check before kfree
Sumit Kumar [Sun, 12 Aug 2018 07:08:19 +0000 (12:38 +0530)]
staging: gasket: remove null ptr check before kfree

Remove null ptr check before kfree because kfree is null ptr safe.
Issue found by checkpatch.

Signed-off-by: Sumit Kumar <sumit686215@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: fbtft: Adds space around "/"
Leonardo Brás [Thu, 9 Aug 2018 23:29:34 +0000 (20:29 -0300)]
staging: fbtft: Adds space around "/"

Kernel coding style recommends a space char around "/".

Signed-off-by: Leonardo Brás <leobras.c@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: mt7621-mmc: Remove macro INIT_MSG and its usages
Nishad Kamdar [Thu, 23 Aug 2018 17:31:11 +0000 (23:01 +0530)]
staging: mt7621-mmc: Remove macro INIT_MSG and its usages

Removed all usages of INIT_MSG and dropped it from dbg.h.

Signed-off-by: Nishad Kamdar <nishadkamdar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: mt7621-pci: show N_FTS status using a loop
Sergio Paracuellos [Fri, 10 Aug 2018 16:58:46 +0000 (18:58 +0200)]
staging: mt7621-pci: show N_FTS status using a loop

There are some printk's which can be replaced properly
using dev_* kernel functions. Use dev_info to show
N_FTS status for each port using a loop instead of duplicating
lines of code.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: mt7621-pci: make some function static
Sergio Paracuellos [Fri, 10 Aug 2018 16:58:45 +0000 (18:58 +0200)]
staging: mt7621-pci: make some function static

There are some functions in driver code that can be declared
'static'. Just do it.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agostaging: mt7621-mmc: place a check for sscanf
Sumit Pundir [Fri, 10 Aug 2018 12:31:40 +0000 (18:01 +0530)]
staging: mt7621-mmc: place a check for sscanf

Placed a check for the return value of sscanf. -EINVAL is returned if
the value is anything other than expected. Reported by checkpatch.pl

Signed-off-by: Sumit Pundir <pundirsumit11@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>