linux-2.6-microblaze.git
2 years agostaging: rtl8192e: Remove unnecessary u8 argument cast
Solomon Tan [Sat, 23 Apr 2022 13:01:45 +0000 (21:01 +0800)]
staging: rtl8192e: Remove unnecessary u8 argument cast

Remove the unnecessary explicit u8 casts for u8 arguments in function
calls. These functions have declared their parameters to be of type u8,
so the arguments given to those parameters will be automatically coerced
to u8. Therefore, an explicit cast is unnecessary.

Signed-off-by: Solomon Tan <wjsota@gmail.com>
Link: https://lore.kernel.org/r/20220423130150.161903-3-wjsota@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: rtl8192e: Remove unnecessary u8 assignment cast
Solomon Tan [Sat, 23 Apr 2022 13:01:44 +0000 (21:01 +0800)]
staging: rtl8192e: Remove unnecessary u8 assignment cast

Remove the explicit casts in assignment statements for u8 variables.
Because these variables are declared as u8, there is implicit conversion
to u8 during the assignment, so an explicit cast is unnecessary.

Signed-off-by: Solomon Tan <wjsota@gmail.com>
Link: https://lore.kernel.org/r/20220423130150.161903-2-wjsota@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: drop unnecessary wrapper _rtw_dequeue_cmd
Vihas Makwana [Fri, 22 Apr 2022 19:32:23 +0000 (01:02 +0530)]
staging: r8188eu: drop unnecessary wrapper _rtw_dequeue_cmd

Drop unnecessary wrapper _rtw_dequeue_cmd and move its logic to
rtw_dequeue_cmd.

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Vihas Makwana <makvihas@gmail.com>
Link: https://lore.kernel.org/r/20220422193223.11948-8-makvihas@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: drop unnecessary wrapper _rtw_alloc_network
Vihas Makwana [Fri, 22 Apr 2022 19:32:22 +0000 (01:02 +0530)]
staging: r8188eu: drop unnecessary wrapper _rtw_alloc_network

Drop unnecessary wrapper _rtw_alloc_network and move its logic to
rtw_alloc_network.

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Vihas Makwana <makvihas@gmail.com>
Link: https://lore.kernel.org/r/20220422193223.11948-7-makvihas@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: drop unnecessary wrapper _rtw_free_mlme_priv
Vihas Makwana [Fri, 22 Apr 2022 19:32:21 +0000 (01:02 +0530)]
staging: r8188eu: drop unnecessary wrapper _rtw_free_mlme_priv

Drop unnecessary wrapper _rtw_free_mlme_priv and move its logic to
rtw_free_mlme_priv.

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Vihas Makwana <makvihas@gmail.com>
Link: https://lore.kernel.org/r/20220422193223.11948-6-makvihas@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: drop unnecessary wrapper _rtw_init_mlme_priv
Vihas Makwana [Fri, 22 Apr 2022 19:32:20 +0000 (01:02 +0530)]
staging: r8188eu: drop unnecessary wrapper _rtw_init_mlme_priv

Drop unnecessary wrapper _rtw_init_mlme_priv and move its logic to
rtw_init_mlme_priv.

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Vihas Makwana <makvihas@gmail.com>
Link: https://lore.kernel.org/r/20220422193223.11948-5-makvihas@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: drop unnecessary wrapper _rtw_init_evt_priv
Vihas Makwana [Fri, 22 Apr 2022 19:32:19 +0000 (01:02 +0530)]
staging: r8188eu: drop unnecessary wrapper _rtw_init_evt_priv

Drop unnecessary wrapper _rtw_init_evt_priv and move its logic to
rtw_init_evt_priv.

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Vihas Makwana <makvihas@gmail.com>
Link: https://lore.kernel.org/r/20220422193223.11948-4-makvihas@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: drop unnecessary wrapper _rtw_init_cmd_priv
Vihas Makwana [Fri, 22 Apr 2022 19:32:18 +0000 (01:02 +0530)]
staging: r8188eu: drop unnecessary wrapper _rtw_init_cmd_priv

Drop unnecessary wrapper _rtw_init_cmd_priv and move its logic to
rtw_init_cmd_priv.

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Vihas Makwana <makvihas@gmail.com>
Link: https://lore.kernel.org/r/20220422193223.11948-3-makvihas@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: drop unnecessary wrapper _rtw_free_cmd_priv
Vihas Makwana [Fri, 22 Apr 2022 19:32:17 +0000 (01:02 +0530)]
staging: r8188eu: drop unnecessary wrapper _rtw_free_cmd_priv

Drop unnecessary wrapper _rtw_free_cmd_priv and move its logic to
rtw_free_cmd_priv.

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Vihas Makwana <makvihas@gmail.com>
Link: https://lore.kernel.org/r/20220422193223.11948-2-makvihas@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: greybus: tools: fix spelling
Vaibhav Nagare [Mon, 25 Apr 2022 13:31:11 +0000 (19:01 +0530)]
staging: greybus: tools: fix spelling

Fixed the spelling mistake of appendation to appending.

Signed-off-by: Vaibhav Nagare <vnagare@redhat.com>
Link: https://lore.kernel.org/r/20220425133111.118257-1-vnagare@redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: vc04_services: Re-add dependency on HAS_DMA to BCM2835_VCHIQ
Geert Uytterhoeven [Mon, 25 Apr 2022 12:18:25 +0000 (14:18 +0200)]
staging: vc04_services: Re-add dependency on HAS_DMA to BCM2835_VCHIQ

Thanks to stubs for the NO_DMA=y case, drivers that use the DMA API can
be compile-tested on systems that do not support DMA.  Hence the
dependency of BCM2835_VCHIQ on HAS_DMA was dropped to increase compile
coverage.

Unfortunately compilers became smarter, leading to new failures.
E.g. for a CONFIG_SUN3=y allmodconfig kernel with gcc 9.4.0:

    drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c: In function ‘free_pagelist’:
    arch/m68k/include/asm/string.h:72:25: warning: argument 2 null where non-null expected [-Wnonnull]
       72 | #define memcpy(d, s, n) __builtin_memcpy(d, s, n)
  |                         ^~~~~~~~~~~~~~~~~~~~~~~~~
    drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c:614:4: note: in expansion of macro ‘memcpy’
      614 |    memcpy((char *)kmap(pages[0]) +
  |    ^~~~~~
    arch/m68k/include/asm/string.h:72:25: note: in a call to built-in function ‘__builtin_memcpy’
       72 | #define memcpy(d, s, n) __builtin_memcpy(d, s, n)
  |                         ^~~~~~~~~~~~~~~~~~~~~~~~~
    drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c:614:4: note: in expansion of macro ‘memcpy’
      614 |    memcpy((char *)kmap(pages[0]) +
  |    ^~~~~~

This happens because the compiler can trace back the source pointer to a
allocation by dma_alloc_attrs(), which always returns NULL if NO_DMA=y.

Avoid this reinstating the dependency of the BCM2835_VCHIQ symbol on
HAS_DMA, and by restricting the selection of BCM2835_VCHIQ.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Link: https://lore.kernel.org/r/da55bd87eebf1a969dc8ccd807843319833f6c40.1650888813.git.geert@linux-m68k.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agoRevert "staging: r8188eu: use in-kernel ieee channel"
Solomon Tan [Mon, 25 Apr 2022 05:28:03 +0000 (13:28 +0800)]
Revert "staging: r8188eu: use in-kernel ieee channel"

This reverts commit 0afaa121813ed602bd203759c339cb639493f8c2 as changing
rtw_ieee80211_channel to ieee80211_channel causes a memcpy bug as
reported in:
https://lore.kernel.org/linux-staging/67e2d10b-7f0f-9c5a-ce31-376b83ffba9e@gmail.com/
due to their size differences.

Fixes: 0afaa121813e ("staging: r8188eu: use in-kernel ieee channel")
Reported-by: Michael Straube <straube.linux@gmail.com>
Signed-off-by: Solomon Tan <wjsota@gmail.com>
Link: https://lore.kernel.org/r/20220425052802.2419-1-wjsota@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: bcm2835-audio: delete TODO
Adrien Thierry [Wed, 20 Apr 2022 17:44:00 +0000 (13:44 -0400)]
staging: bcm2835-audio: delete TODO

Delete TODO since all tasks were completed:

1 - fixed here:
https://lore.kernel.org/all/20220408150359.26661-1-athierry@redhat.com/

2 - there are no remaining checkpatch.pl errors or warnings

Signed-off-by: Adrien Thierry <athierry@redhat.com>
Link: https://lore.kernel.org/r/20220420174401.305964-1-athierry@redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: rtl8192u: Fix signedness bug in ieee80211_check_auth_response()
Haowen Bai [Fri, 22 Apr 2022 02:10:35 +0000 (10:10 +0800)]
staging: rtl8192u: Fix signedness bug in ieee80211_check_auth_response()

The ieee80211_check_auth_response() function has a signedness bug because
it's a declared as a u16 but it return -ENOMEM.  When you look at it more
closely it returns a mix of error codes including 0xcafe, -ENOMEM, and
a->status which is WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG.  This is a mess.

Clean it up to just return standard kernel error codes.  We can print
out the a->status before returning a regular error code.  The printks
in the caller need to be adjusted as well.

Signed-off-by: Haowen Bai <baihaowen@meizu.com>
Link: https://lore.kernel.org/r/1650593435-9017-1-git-send-email-baihaowen@meizu.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: Remove unneeded variable ret in rtw_suspend()
Wan Jiabing [Fri, 22 Apr 2022 02:10:38 +0000 (10:10 +0800)]
staging: r8188eu: Remove unneeded variable ret in rtw_suspend()

Fix the following coccicheck error:
drivers/staging/r8188eu/os_dep/usb_intf.c:202:5-8: Unneeded variable: "ret". Return "0" on line 242

Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>
Link: https://lore.kernel.org/r/20220422021046.121870-1-wanjiabing@vivo.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: fieldbus: Fix the error handling path in anybuss_host_common_probe()
Christophe JAILLET [Fri, 22 Apr 2022 06:48:18 +0000 (08:48 +0200)]
staging: fieldbus: Fix the error handling path in anybuss_host_common_probe()

If device_register() fails, device_unregister() should not be called
because it will free some resources that are not allocated.
put_device() should be used instead.

Fixes: 308ee87a2f1e ("staging: fieldbus: anybus-s: support HMS Anybus-S bus")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/5401a519608d6e1a4e7435c20f4f20b0c5c36c23.1650610082.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: vchiq:remove unneeded flush_workqueue
ran jianping [Fri, 22 Apr 2022 09:33:40 +0000 (09:33 +0000)]
staging: vchiq:remove unneeded flush_workqueue

All work currently pending will be done first by calling destroy_workqueue,
so there is no need to flush it explicitly.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: ran jianping <ran.jianping@zte.com.cn>
Link: https://lore.kernel.org/r/20220422093340.2781311-1-ran.jianping@zte.com.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: fix the index check in mgt_dispatcher
Martin Kaiser [Fri, 22 Apr 2022 14:09:58 +0000 (16:09 +0200)]
staging: r8188eu: fix the index check in mgt_dispatcher

In mgt_dispatcher, we check that index is a valid index for the
mlme_sta_tbl array. The valid indices for this array are from 0 to
ARRAY_SIZE(mlme_sta_tbl) - 1.

An invalid index is >= ARRAY_SIZE(mlme_sta_tbl). Fix the off by one error
in the check.

Fixes: db84803cd8de ("staging: r8188eu: use ARRAY_SIZE for mlme_sta_tbl")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220422140958.239767-1-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: vme: Move 'vme/devices/' to 'vme_user/'
Bruno Moreira-Guedes [Thu, 21 Apr 2022 14:59:34 +0000 (11:59 -0300)]
staging: vme: Move 'vme/devices/' to 'vme_user/'

In <db3b9e990e75573402cda22faf933760f076c033> ("Staging: VME: move VME
drivers out of staging") the vme code, board and bridge drivers were
moved out of the staging tree, remaining only the VME user device
driver.

Since this driver is the only one remaining in staging, such multi-level
structure confuses more than helps. The current structure is as follows:

 - drivers/staging/vme/
                       Makefile
                       devices/
                               Kconfig
                               Makefile
                               vme_user.c
                               vme_user.h

The top-level Makefile has the only function of calling another Makefile
into the devices/ subdirectory. This latter only compiles the vme_user
driver, since there is no other in the staging tree.

This patch removes the unnecessary Makefile from the 'vme/' dir, move
the contents of 'vme/devices' into the 'vme/' dir, and renames it to
'vme_user/' (the driver name), allowing a straightforward understanding
of this driver's contents. Furthermore, it updates the MAINTAINERS file
to properly reflect the new paths.

Signed-off-by: Bruno Moreira-Guedes <codeagain@codeagain.dev>
Link: https://lore.kernel.org/r/2cd7de9a426c443a5ea618682d605ecfd751d798.1650544175.git.codeagain@codeagain.dev
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: vme: Add VME_BUS dependency to Kconfig
Bruno Moreira-Guedes [Thu, 21 Apr 2022 14:59:02 +0000 (11:59 -0300)]
staging: vme: Add VME_BUS dependency to Kconfig

The KConfig file for VME_USER ('drivers/staging/vme/devices/Kconfig')
sourced at "drivers/vme/boards/KConfig" misses a `depends on` line for
VME_BUS, which is unnoticeable for menuconfig users who aren't be able
to select it through this interface without setting the CONFIG_VME_BUS
option because it's nested on VME_BUS menu entry.

A patch to move appropriately this driver to the "Staging" submenu
([PATCH 1/3], originally sent as a single patch submitted at
https://lore.kernel.org/linux-staging/3fbc5325e94b9ae0666a1f5a56a4e5372bfcea1d.camel@codeagain.dev/T/#t),
however, unveiled this missing `depends on` line, since it moved the
`source` line for VME_USER's KConfig to somewhere else, allowing it to
be compiled without the support for VME_BUS. While it compiles fine and
seems to initialize the driver fine (tested both as module and as built-
in), it seems to make no sense having VME_USER without VME_BUS.

This patches addresses it by adding the VME_BUS to the `depends on` line
at "drivers/staging/vme/devices/Kconfig".

Signed-off-by: Bruno Moreira-Guedes <codeagain@codeagain.dev>
Link: https://lore.kernel.org/r/00de5644d7c2f8c8878eccf86b761e0602732089.1650544175.git.codeagain@codeagain.dev
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: vme: Move vme_user to staging KConfig
Bruno Moreira-Guedes [Thu, 21 Apr 2022 14:58:24 +0000 (11:58 -0300)]
staging: vme: Move vme_user to staging KConfig

Currently, the VME_USER driver is in the staging tree Kconfig, unlike
other VME drivers already moved to the main portions of the kernel tree.
Its configuration is, however, nested into the VME_BUS config option,
which might be misleading.

Since the staging tree "[...] is used to hold stand-alone drivers and
filesystem that are not ready to be merged into the main portion of the
Linux kernel tree [...]"(from
https://lore.kernel.org/all/20090320172502.GA14647@kroah.com/T/),
staging drivers should appear nested into the Main Menu -> Device
Drivers -> Staging Drivers to make sure the user don't pick it without
being fully aware of its staging status as it could be the case in
Menu -> Device Drivers -> VME bridge support (the current location).

With this change menuconfig users will clearly know this is not a driver
in the main portion of the kernel tree and decide whether to build it or
not with that clearly in mind.

This change goes into the same direction of commit
<4b4cdf3979c32fa3d042d150f49449c74d048553> ("STAGING: Move staging
drivers back to staging-specific menu")

Signed-off-by: Bruno Moreira-Guedes <codeagain@codeagain.dev>
Link: https://lore.kernel.org/r/f6e6d1d2b02385f11848022f154007ef191181c1.1650544175.git.codeagain@codeagain.dev
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: use in-kernel ieee channel
Solomon Tan [Thu, 21 Apr 2022 23:52:38 +0000 (07:52 +0800)]
staging: r8188eu: use in-kernel ieee channel

Use the in-kernel structure and flags instead of defining a separate
one. The rtw_ieee80211_channel structure and flags can be replaced by
the ieee80211_channel defined in include/net/cfg80211.h since the flags
serve the same purpose and the ieee80211_channel struct includes the
elements used in the rtw_ieee80211_channel struct.

Signed-off-by: Solomon Tan <wjsota@gmail.com>
Link: https://lore.kernel.org/r/20220421235237.4218-1-wjsota@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: correct typo in comments
Jaehee Park [Thu, 21 Apr 2022 19:20:31 +0000 (15:20 -0400)]
staging: r8188eu: correct typo in comments

Correct misspellings in the comments. Issue found with checkpatch.

Signed-off-by: Jaehee Park <jhpark1013@gmail.com>
Link: https://lore.kernel.org/r/56b25e4394396823d52f1fe1b312c5a307aea0fc.1650568579.git.jhpark1013@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: replace spaces with tabs
Jaehee Park [Thu, 21 Apr 2022 19:20:30 +0000 (15:20 -0400)]
staging: r8188eu: replace spaces with tabs

Use tabs instead of spaces. Issue found with checkpatch.
WARNING: suspect code indent for conditional statements

Signed-off-by: Jaehee Park <jhpark1013@gmail.com>
Link: https://lore.kernel.org/r/fd4a66013be081bc5adb491c6dc7774362d1ac82.1650568579.git.jhpark1013@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: remove 'added by' author comments
Jaehee Park [Thu, 21 Apr 2022 19:20:28 +0000 (15:20 -0400)]
staging: r8188eu: remove 'added by' author comments

Author comments "Added by Albert" and "Added by Annie" are sprinkled
through the file. These comments are not useful and can be removed.

Suggested-by: Alison Schofield <alison.schofield@intel.com>
Signed-off-by: Jaehee Park <jhpark1013@gmail.com>
Link: https://lore.kernel.org/r/dd22bbe6b018aadec620d1ef8215e19852099f7c.1650568579.git.jhpark1013@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: remove spaces before tabs
Jaehee Park [Thu, 21 Apr 2022 19:20:27 +0000 (15:20 -0400)]
staging: r8188eu: remove spaces before tabs

Delete spaces before tabs in the comments. Issue found with checkpatch.
WARNING: please, no space before tabs

Signed-off-by: Jaehee Park <jhpark1013@gmail.com>
Link: https://lore.kernel.org/r/1b1e8cda03ca5d3fdf26c511da76258f7a2ab8d5.1650568579.git.jhpark1013@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: remove unnecessary braces in single statement block
Jaehee Park [Thu, 21 Apr 2022 19:20:26 +0000 (15:20 -0400)]
staging: r8188eu: remove unnecessary braces in single statement block

Remove braces for single statement block to minimize the number of
empty lines, without loss of readability. Issue found with checkpatch.
WARNING: braces {} are not necessary for single statement blocks

Signed-off-by: Jaehee Park <jhpark1013@gmail.com>
Link: https://lore.kernel.org/r/b96ae957e2ddc519e56813a1c56e770168f67a2d.1650568579.git.jhpark1013@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: remove OnAction_dls
Martin Kaiser [Thu, 21 Apr 2022 20:08:04 +0000 (22:08 +0200)]
staging: r8188eu: remove OnAction_dls

Remove the empty function OnAction_dls and its entry in OnAction_tbl.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220421200805.192083-5-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: remove OnAction_qos
Martin Kaiser [Thu, 21 Apr 2022 20:08:03 +0000 (22:08 +0200)]
staging: r8188eu: remove OnAction_qos

Remove the empty function OnAction_qos and its entry in OnAction_tbl.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220421200805.192083-4-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: on_action_spct does nothing
Martin Kaiser [Thu, 21 Apr 2022 20:08:02 +0000 (22:08 +0200)]
staging: r8188eu: on_action_spct does nothing

One of the entries in OnAction_tbl refers to on_action_spct. This function
reads some information but it performs no action. Remove on_action_spct
and its entry in OnAction_tbl.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220421200805.192083-3-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: remove dummy entries from OnAction_tbl
Martin Kaiser [Thu, 21 Apr 2022 20:08:01 +0000 (22:08 +0200)]
staging: r8188eu: remove dummy entries from OnAction_tbl

Unlike mlme_sta_tbl, OnAction_tbl is an array of structs.

OnAction iterates over the array to find the entry for a specific action
category. No action is performed if a category has no entry.

We can remove the entries that point to the dummy function DoReserved.
These were the last users of DoReserved, the function itself can be
removed as well.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220421200805.192083-2-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: remove OnAtim
Martin Kaiser [Thu, 21 Apr 2022 20:04:49 +0000 (22:04 +0200)]
staging: r8188eu: remove OnAtim

Remove the empty OnAtim function. We can set the function pointer in
mlme_sta_tbl to NULL if no action is required for this management frame
subtype.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220421200449.191983-1-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: rtl8192e: Fix signedness bug in rtllib_rx_assoc_resp()
Haowen Bai [Thu, 21 Apr 2022 08:21:17 +0000 (16:21 +0800)]
staging: rtl8192e: Fix signedness bug in rtllib_rx_assoc_resp()

The rtllib_rx_assoc_resp() function has a signedness bug because it's
a declared as a u16 but it return -ENOMEM.  When you look at it more
closely it returns a mix of error codes including 0xcafe, -ENOMEM, and
a->status which is WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG.  This is a mess.

Clean it up to just return standard kernel error codes.  We can print
out the a->status before returning a regular error code.  The printks
in the caller need to be adjusted as well.

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Haowen Bai <baihaowen@meizu.com>
Link: https://lore.kernel.org/r/1650529277-7893-1-git-send-email-baihaowen@meizu.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: Drop redundant memset
Haowen Bai [Thu, 21 Apr 2022 09:20:43 +0000 (17:20 +0800)]
staging: r8188eu: Drop redundant memset

The region set by the call to memset is immediately overwritten by the
subsequent call to memcpy. So we drop redundant memset.

Signed-off-by: Haowen Bai <baihaowen@meizu.com>
Link: https://lore.kernel.org/r/1650532843-28132-1-git-send-email-baihaowen@meizu.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: rtl8723bs: remove leftover code for other chips
Artur Bujdoso [Thu, 21 Apr 2022 06:52:19 +0000 (08:52 +0200)]
staging: rtl8723bs: remove leftover code for other chips

Clean up unreferenced definitions in hal headers and code.

Signed-off-by: Artur Bujdoso <artur.bujdoso@gmail.com>
Link: https://lore.kernel.org/r/YmD/I19v8sJLrOQo@crux
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: rtl8192u: change get_key functions to return 0 instead of -1
Rebecca Mckeever [Wed, 20 Apr 2022 12:23:28 +0000 (07:23 -0500)]
staging: rtl8192u: change get_key functions to return 0 instead of -1

Currently, these three get_key functions return -1 when the provided len
value is less a specific key length value, which can result in buffer
overflow depending on how the returned value is used. These functions are
used in three places in ieee80211/ieee80211_wx.c:

  ieee80211_wx_get_encode() :
    The behavior of this function will be unchanged.

  ieee80211_wx_get_encode_ext() :
    The result of the get_key function is written to ext->key_len,
    resulting in a buffer overflow if the result is negative.

  ieee80211_wx_set_encode() :
    The behavior of this function will change. When len is less than the
    key length value, it will set a default key of all 0.

Suggested-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Rebecca Mckeever <remckee0@gmail.com>
Link: https://lore.kernel.org/r/Yl/7QPKXer7YtXOs@bertie
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: rtl8192e: Remove space after cast
Solomon Tan [Tue, 19 Apr 2022 12:43:19 +0000 (20:43 +0800)]
staging: rtl8192e: Remove space after cast

This patch addresses the checkpatch.pl flag that there should not be a
space after a cast.

Signed-off-by: Solomon Tan <wjsota@gmail.com>
Link: https://lore.kernel.org/r/20220419124318.8028-1-wjsota@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agodrivers: staging: rtl8192e: Fix deadlock in rtllib_beacons_stop()
Duoming Zhou [Sun, 17 Apr 2022 14:16:41 +0000 (22:16 +0800)]
drivers: staging: rtl8192e: Fix deadlock in rtllib_beacons_stop()

There is a deadlock in rtllib_beacons_stop(), which is shown
below:

   (Thread 1)              |      (Thread 2)
                           | rtllib_send_beacon()
rtllib_beacons_stop()      |  mod_timer()
 spin_lock_irqsave() //(1) |  (wait a time)
 ...                       | rtllib_send_beacon_cb()
 del_timer_sync()          |  spin_lock_irqsave() //(2)
 (wait timer to stop)      |  ...

We hold ieee->beacon_lock in position (1) of thread 1 and
use del_timer_sync() to wait timer to stop, but timer handler
also need ieee->beacon_lock in position (2) of thread 2.
As a result, rtllib_beacons_stop() will block forever.

This patch extracts del_timer_sync() from the protection of
spin_lock_irqsave(), which could let timer handler to obtain
the needed lock.

Signed-off-by: Duoming Zhou <duoming@zju.edu.cn>
Link: https://lore.kernel.org/r/20220417141641.124388-1-duoming@zju.edu.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agodrivers: staging: rtl8192u: Fix deadlock in ieee80211_beacons_stop()
Duoming Zhou [Sun, 17 Apr 2022 13:54:07 +0000 (21:54 +0800)]
drivers: staging: rtl8192u: Fix deadlock in ieee80211_beacons_stop()

There is a deadlock in ieee80211_beacons_stop(), which is shown below:

   (Thread 1)              |      (Thread 2)
                           | ieee80211_send_beacon()
ieee80211_beacons_stop()   |  mod_timer()
 spin_lock_irqsave() //(1) |  (wait a time)
 ...                       | ieee80211_send_beacon_cb()
 del_timer_sync()          |  spin_lock_irqsave() //(2)
 (wait timer to stop)      |  ...

We hold ieee->beacon_lock in position (1) of thread 1 and use
del_timer_sync() to wait timer to stop, but timer handler
also need ieee->beacon_lock in position (2) of thread 2.
As a result, ieee80211_beacons_stop() will block forever.

This patch extracts del_timer_sync() from the protection of
spin_lock_irqsave(), which could let timer handler to obtain
the needed lock.

Signed-off-by: Duoming Zhou <duoming@zju.edu.cn>
Link: https://lore.kernel.org/r/20220417135407.109536-1-duoming@zju.edu.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: rtl8192u: compare strcmp result to zero
Rebecca Mckeever [Sat, 16 Apr 2022 10:24:34 +0000 (05:24 -0500)]
staging: rtl8192u: compare strcmp result to zero

Add " == 0" to the condition in both else if branches to address a
possible bug. strcmp returns 0 when its arguments are equal, which
evaluates to false, often leading to errors when used in if statements.

Currently, the statement in the first else if branch does not execute
when its arguments are equal, but it does execute when crypt->ops->name
equals any string other than "WEP" or "TKIP".

Similarly, the second else if branch does not execute when its arguments
are equal, and it only executes when crypt->ops->name equals "TKIP".
The else branch never executes.

It is unlikely that this is working as intended.

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Rebecca Mckeever <remckee0@gmail.com>
Link: https://lore.kernel.org/r/20220416102434.97567-1-remckee0@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: iio: ad2s1210: remove redundant assignment to variable negative
Colin Ian King [Mon, 18 Apr 2022 13:46:03 +0000 (14:46 +0100)]
staging: iio: ad2s1210: remove redundant assignment to variable negative

Variable negative is being assigned a value that is never read, it is
being re-assigned later. The assignment is redundant and can be removed.

Cleans up clang scan build warning:
drivers/staging/iio/resolver/ad2s1210.c:502:3: warning: Value stored
to 'negative' is never read [deadcode.DeadStores]

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Link: https://lore.kernel.org/r/20220418134603.81336-1-colin.i.king@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: vt6655: Replace VNSvInPortB with ioread8
Philipp Hortmann [Sat, 16 Apr 2022 08:00:55 +0000 (10:00 +0200)]
staging: vt6655: Replace VNSvInPortB with ioread8

Replace macro VNSvInPortB with ioread8. Avoid cast of the return
value is possible with one exception.
The name of macro and the arguments use CamelCase which
is not accepted by checkpatch.pl

Since there are more than one checkpatch issue per line,
more steps are rquired to fix.

Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
Link: https://lore.kernel.org/r/fd71797d9d55d53f95c5c4e2df826bf85dd4626a.1650094595.git.philipp.g.hortmann@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: vt6655: Replace MACvGPIOIn with VNSvInPortB
Philipp Hortmann [Sat, 16 Apr 2022 08:00:50 +0000 (10:00 +0200)]
staging: vt6655: Replace MACvGPIOIn with VNSvInPortB

Replace macro MACvGPIOIn with VNSvInPortB.
Next patch will replace all macros VNSvInPortB with ioread8.
The names of macros and the arguments use CamelCase which
is not accepted by checkpatch.pl

Since there are more than one checkpatch issue per line,
more steps are rquired to fix.

Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
Link: https://lore.kernel.org/r/0a3c3eb0d4dad544fa281b34c5a70d4a3ab2d9f1.1650094595.git.philipp.g.hortmann@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: rtl8712: Remove unnecessary int typecast
Solomon Tan [Sun, 17 Apr 2022 16:54:48 +0000 (16:54 +0000)]
staging: rtl8712: Remove unnecessary int typecast

This patch gets rid of the following error from checkpatch.pl:
WARNING: Unnecessary typecast of c90 int constant.

Signed-off-by: Solomon Tan <solomonbstoner@protonmail.ch>
Link: https://lore.kernel.org/r/YlxGTMBsLqdOIrpC@ArchDesktop
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: qlge: add blank line after function declaration
Soumya Negi [Sat, 16 Apr 2022 19:17:45 +0000 (12:17 -0700)]
staging: qlge: add blank line after function declaration

Adhere to linux coding style. Reported by checkpatch:
CHECK: Please use a blank line after function/struct/union/enum declarations

Signed-off-by: Soumya Negi <soumya.negi97@gmail.com>
Link: https://lore.kernel.org/r/20220416191745.7079-1-soumya.negi97@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: vt6655: Delete tmacro.h
Philipp Hortmann [Sat, 16 Apr 2022 19:16:22 +0000 (21:16 +0200)]
staging: vt6655: Delete tmacro.h

Relocate the only macro MAKEWORD that is in use and remove file
tmacro.h. File needs to be changed anyhow because of use of CamelCase
which is not accepted by checkpatch.pl. Reduced code provides
a better overview.

Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
Link: https://lore.kernel.org/r/20220416191622.GA11596@matrix-ESPRIMO-P710
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: Remove the drivers for the Unisys s-Par
Fabio M. De Francesco [Thu, 14 Apr 2022 10:32:17 +0000 (12:32 +0200)]
staging: Remove the drivers for the Unisys s-Par

The Unisys sub-tree of drivers/staging contains three drivers for the
"Unisys Secure Partition" (s-Par(R)): visorhba, visorinput, visornic.

They have no maintainers, in fact the only one that is listed in
MAINTAINERS has an unreacheable email address. During 2021 and 2022
several patches have been submitted to these drivers but nobody at
Unisys cared of reviewing the changes. Probably, also the
"sparmaintainer" internal list of unisys.com is not anymore read by
interested Unisys' engineers.

Therefore, remove the drivers/staging/unisys directory and delete the
relevant entries in the MAINTAINERS, Kconfig, Makefile files, then
remove also the drivers/visorbus directory which is not anymore needed
(it contained the driver for the virtualized bus for the Unisys s-Par
firmware).

Cc: David Kershner <david.kershner@unisys.com>
Cc: <sparmaintainer@unisys.com>
Cc: Ken Cox <jkc@redhat.com>
Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
Link: https://lore.kernel.org/r/20220414103217.32058-1-fmdefrancesco@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: use in-kernel ieee80211 header structures
Michael Straube [Mon, 18 Apr 2022 18:09:16 +0000 (20:09 +0200)]
staging: r8188eu: use in-kernel ieee80211 header structures

The structures

rtw_ieee80211_hdr
rtw_ieee80211_hdr_3addr
rtw_ieee80211_hdr_3addr_qos

in drivers/staging/r8188eu/include/ieee80211.h just duplicate the
in-kernel structures from include/linux/ieee80211.h.

ieee80211_hdr
ieee80211_hdr_3addr
ieee80211_qos_hdr

Remove the rtw_ prefixed structures and use the in-kernel versions.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220418180916.11311-1-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agor8188eu: remove unused urbs from struct xmit_buf
Ivan Safonov [Sun, 17 Apr 2022 16:36:08 +0000 (19:36 +0300)]
r8188eu: remove unused urbs from struct xmit_buf

Driver allocates eighth urbs per xmit_buf, but uses only first urb.
Allocation of seven remaining urbs wastes memory for nothing.

Reviewed-by: Pavel Skripkin <paskripkin@gmail.com>
Signed-off-by: Ivan Safonov <insafonov@gmail.com>
Link: https://lore.kernel.org/r/20220417163608.42917-1-insafonov@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: use ARRAY_SIZE for mlme_sta_tbl
Martin Kaiser [Sun, 17 Apr 2022 10:22:21 +0000 (12:22 +0200)]
staging: r8188eu: use ARRAY_SIZE for mlme_sta_tbl

Use ARRAY_SIZE instead of hard-coding the number of entries in the
mlme_sta_tbl array.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220417102221.466524-7-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: don't call empty DoReserved function
Martin Kaiser [Sun, 17 Apr 2022 10:22:20 +0000 (12:22 +0200)]
staging: r8188eu: don't call empty DoReserved function

Replace the DoReserved function pointer with NULL in mlme_sta_tbl. We can
skip the function call for reserved subtypes.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220417102221.466524-6-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: replace mlme_handler with function pointer
Martin Kaiser [Sun, 17 Apr 2022 10:22:19 +0000 (12:22 +0200)]
staging: r8188eu: replace mlme_handler with function pointer

mlme_sta_tbl is an array of struct mlme_handler. mlme_handler's num and
str components are not used. The code in mgt_dispatcher uses the subtype
number of the incoming frame to select the array entry for compiling the
repsonse.

We can remove struct mlme_handler and make mlme_sta_tbl an array of
function pointers.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220417102221.466524-5-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: the frame type is shifted out
Martin Kaiser [Sun, 17 Apr 2022 10:22:18 +0000 (12:22 +0200)]
staging: r8188eu: the frame type is shifted out

The index calculation in mgt_dispatcher does not use the frame type. The
4-bit right shift ignores protocol version and frame type.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220417102221.466524-4-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: replace the GetFrameSubType call
Martin Kaiser [Sun, 17 Apr 2022 10:22:17 +0000 (12:22 +0200)]
staging: r8188eu: replace the GetFrameSubType call

The driver's local GetFrameSubType macro returns both frame type and
subtype.

Use the ieee80211 framework to extract the two fields. This shows more
clearly that both type and subtype are read.

Convert everything to host endianness before we use bit operations.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220417102221.466524-3-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: check receiver address only once
Martin Kaiser [Sun, 17 Apr 2022 10:22:16 +0000 (12:22 +0200)]
staging: r8188eu: check receiver address only once

Check only once in mgt_dispatcher that the receiver address is the local
address or the broadcast address. The second identical check can be
removed.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220417102221.466524-2-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: place constants in right side in a comparison
Mahak Gupta [Thu, 14 Apr 2022 23:07:57 +0000 (04:37 +0530)]
staging: r8188eu: place constants in right side in a comparison

reported by checkpatch:

Comparisons should place the constant on the right side of the test.

Fix these warnings.

Signed-off-by: Mahak Gupta <mahak_g@cs.iitr.ac.in>
Link: https://lore.kernel.org/r/20220414230757.19348-1-mahak_g@cs.iitr.ac.in
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: check firmware header existence before access
Michael Straube [Sun, 17 Apr 2022 17:54:41 +0000 (19:54 +0200)]
staging: r8188eu: check firmware header existence before access

We should access the fields of fwhdr only if the check for firmware
header existence is true. Move the affected code into the if block
that checks firmware header existence.

Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220417175441.13830-9-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: use pr_info_once() to log the firmware version
Michael Straube [Sun, 17 Apr 2022 17:54:40 +0000 (19:54 +0200)]
staging: r8188eu: use pr_info_once() to log the firmware version

Use pr_info_once() instead of a static variable and an if statement
to log the firmware version only once.

Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220417175441.13830-8-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: remove variables from rtl8188e_firmware_download()
Michael Straube [Sun, 17 Apr 2022 17:54:39 +0000 (19:54 +0200)]
staging: r8188eu: remove variables from rtl8188e_firmware_download()

The local variables fw_version, fw_subversion, fw_signature in
rtl8188e_firmware_download() are only used in one place. Use the
assigned values directly and remove the variables to make the code
shorter and cleaner.

Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220417175441.13830-7-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: use sizeof instead of hardcoded firmware header size
Michael Straube [Sun, 17 Apr 2022 17:54:38 +0000 (19:54 +0200)]
staging: r8188eu: use sizeof instead of hardcoded firmware header size

Use sizeof() instead of hardcoding the firmware header size and add
a compile time check to ensure struct rt_firmware_hdr has the correct
size.

Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220417175441.13830-6-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: rename fields of struct rt_firmware_hdr
Michael Straube [Sun, 17 Apr 2022 17:54:37 +0000 (19:54 +0200)]
staging: r8188eu: rename fields of struct rt_firmware_hdr

Rename the fields of struct rt_firmware_hdr to avoid camel case.

Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220417175441.13830-5-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: clean up comments in struct rt_firmware_hdr
Michael Straube [Sun, 17 Apr 2022 17:54:36 +0000 (19:54 +0200)]
staging: r8188eu: clean up comments in struct rt_firmware_hdr

Remove unnecessary comments from struct rt_firmware_hdr. While at it
align the in-line comments.

Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220417175441.13830-4-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: convert u32 fields of rt_firmware_hdr to __le32
Michael Straube [Sun, 17 Apr 2022 17:54:35 +0000 (19:54 +0200)]
staging: r8188eu: convert u32 fields of rt_firmware_hdr to __le32

Convert the u32 fields of struct rt_firmware_hdr to __le32 for
consistency.

Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220417175441.13830-3-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: fix struct rt_firmware_hdr
Michael Straube [Sun, 17 Apr 2022 17:54:34 +0000 (19:54 +0200)]
staging: r8188eu: fix struct rt_firmware_hdr

The size of struct rt_firmware_hdr is 36 bytes.

$ pahole -C rt_firmware_hdr drivers/staging/r8188eu/r8188eu.o
struct rt_firmware_hdr {
        __le16                     Signature;            /*     0     2 */
        u8                         Category;             /*     2     1 */
        u8                         Function;             /*     3     1 */
        __le16                     Version;              /*     4     2 */
        u8                         Subversion;           /*     6     1 */

        /* XXX 1 byte hole, try to pack */

        u16                        Rsvd1;                /*     8     2 */
        u8                         Month;                /*    10     1 */
        u8                         Date;                 /*    11     1 */
        u8                         Hour;                 /*    12     1 */
        u8                         Minute;               /*    13     1 */
        __le16                     RamCodeSize;          /*    14     2 */
        u8                         Foundry;              /*    16     1 */
        u8                         Rsvd2;                /*    17     1 */

        /* XXX 2 bytes hole, try to pack */

        __le32                     SvnIdx;               /*    20     4 */
        u32                        Rsvd3;                /*    24     4 */
        u32                        Rsvd4;                /*    28     4 */
        u32                        Rsvd5;                /*    32     4 */

        /* size: 36, cachelines: 1, members: 17 */
        /* sum members: 33, holes: 2, sum holes: 3 */
        /* last cacheline: 36 bytes */
};

But the header in the firmware file is only 32 bytes long.

The hexdump of rtl8188eufw.bin shows that the field Rsvd1 should be u8
instead of __le16.

OFFSET      rtl8188eufw.bin
-----------------------------------------------------------
0x00000000  E1 88 10 00 0B 00 01 00 01 21 11 27 30 36 00 00
0x00000010  2D 07 00 00 00 00 00 00 00 00 00 00 00 00 00 00

0x00000000  E1 88 10 00 0B 00 01  00     01     21    11    27 30 36 00 00
                              ^   ^      ^      ^     ^     ^
                     Subversion   Rsvd1  Month  Date  Hour  Minute

With the change of field Rsvd1 from __le16 to u8 the structure has the
correct size 32.

$ pahole -C rt_firmware_hdr drivers/staging/r8188eu/r8188eu.o
struct rt_firmware_hdr {
        __le16                     Signature;            /*     0     2 */
        u8                         Category;             /*     2     1 */
        u8                         Function;             /*     3     1 */
        __le16                     Version;              /*     4     2 */
        u8                         Subversion;           /*     6     1 */
        u8                         Rsvd1;                /*     7     1 */
        u8                         Month;                /*     8     1 */
        u8                         Date;                 /*     9     1 */
        u8                         Hour;                 /*    10     1 */
        u8                         Minute;               /*    11     1 */
        __le16                     RamCodeSize;          /*    12     2 */
        u8                         Foundry;              /*    14     1 */
        u8                         Rsvd2;                /*    15     1 */
        __le32                     SvnIdx;               /*    16     4 */
        u32                        Rsvd3;                /*    20     4 */
        u32                        Rsvd4;                /*    24     4 */
        u32                        Rsvd5;                /*    28     4 */

        /* size: 32, cachelines: 1, members: 17 */
        /* last cacheline: 32 bytes */

The wrong size had no effect because the header size is hardcoded to
32 where it is used in the code and the fields after Subversion are
not used.

Fixes: 7884fc0a1473 ("staging: r8188eu: introduce new include dir for RTL8188eu driver")
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220417175441.13830-2-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: bcm2835-audio: fix mutex definition without comment
Adrien Thierry [Thu, 14 Apr 2022 18:16:22 +0000 (14:16 -0400)]
staging: bcm2835-audio: fix mutex definition without comment

Fix issue reported by checkpatch:

CHECK: struct mutex definition without comment
FILE: drivers/staging/vc04_services/bcm2835-audio/bcm2835.h:64:

Signed-off-by: Adrien Thierry <athierry@redhat.com>
Link: https://lore.kernel.org/r/20220414181622.102049-6-athierry@redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: bcm2835-audio: fix mutex definition without comment
Adrien Thierry [Thu, 14 Apr 2022 18:16:21 +0000 (14:16 -0400)]
staging: bcm2835-audio: fix mutex definition without comment

Fix issue reported by checkpatch:

CHECK: struct mutex definition without comment
FILE: drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c:14:

Signed-off-by: Adrien Thierry <athierry@redhat.com>
Link: https://lore.kernel.org/r/20220414181622.102049-5-athierry@redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: bcm2835-audio: fix unnecessary space after cast
Adrien Thierry [Thu, 14 Apr 2022 18:16:20 +0000 (14:16 -0400)]
staging: bcm2835-audio: fix unnecessary space after cast

Fix issue reported by checkpatch:

CHECK: No space is necessary after a cast
FILE: drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c:240:

Signed-off-by: Adrien Thierry <athierry@redhat.com>
Link: https://lore.kernel.org/r/20220414181622.102049-4-athierry@redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: bcm2835-audio: fix line ending with '('
Adrien Thierry [Thu, 14 Apr 2022 18:16:19 +0000 (14:16 -0400)]
staging: bcm2835-audio: fix line ending with '('

Fix issue reported by checkpatch:

CHECK: Lines should not end with a '('
FILE: drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c:85:

Signed-off-by: Adrien Thierry <athierry@redhat.com>
Link: https://lore.kernel.org/r/20220414181622.102049-3-athierry@redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: bcm2835-audio: fully describe config symbol
Adrien Thierry [Thu, 14 Apr 2022 18:16:18 +0000 (14:16 -0400)]
staging: bcm2835-audio: fully describe config symbol

Explain SND_BCM2835 config option in more detail to fix checkpatch
warning:

WARNING: please write a help paragraph that fully describes the config
symbol
FILE: drivers/staging/vc04_services/bcm2835-audio/Kconfig:2

Signed-off-by: Adrien Thierry <athierry@redhat.com>
Link: https://lore.kernel.org/r/20220414181622.102049-2-athierry@redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: rtl8192u: make read-only array EWC11NHTCap static const
Colin Ian King [Thu, 14 Apr 2022 10:36:50 +0000 (11:36 +0100)]
staging: rtl8192u: make read-only array EWC11NHTCap static const

Don't populate the read-only array EWC11NHTCap on the stack but instead
make it static const. Also makes the object code a little smaller.
Remove comment.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Link: https://lore.kernel.org/r/20220414103650.297396-1-colin.i.king@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: ks7010: coding style fix: use tabs for indent
Aliya Rahmani [Wed, 13 Apr 2022 20:46:49 +0000 (02:16 +0530)]
staging: ks7010: coding style fix: use tabs for indent

Added tabs for indent to fix the checkpatch error.

Signed-off-by: Aliya Rahmani <aliyarahmani786@gmail.com>
Link: https://lore.kernel.org/r/20220413204648.60358-1-aliyarahmani786@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: rtl8712: Remove unnecessary parentheses
Aliya Rahmani [Wed, 13 Apr 2022 18:23:04 +0000 (23:53 +0530)]
staging: rtl8712: Remove unnecessary parentheses

Remove redundant parentheses reported by checkpatch.

Signed-off-by: Aliya Rahmani <aliyarahmani786@gmail.com>
Link: https://lore.kernel.org/r/20220413182303.34807-1-aliyarahmani786@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: rtl8712: cmd: remove redundant space after cast
Aliya Rahmani [Wed, 13 Apr 2022 11:35:31 +0000 (17:05 +0530)]
staging: rtl8712: cmd: remove redundant space after cast

Remove the unnecessary space immediately after a cast. Identified by
checkpatch: CHECK: No space is necessary after a cast.

Signed-off-by: Aliya Rahmani <aliyarahmani786@gmail.com>
Link: https://lore.kernel.org/r/20220413113531.31224-1-aliyarahmani786@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: pkt_newalloc is not used
Martin Kaiser [Wed, 13 Apr 2022 20:07:42 +0000 (22:07 +0200)]
staging: r8188eu: pkt_newalloc is not used

pkg_newalloc in struct recv_buf is not used. Remove it.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220413200742.276806-5-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: use ieee80211 helpers in mgt_dispatcher
Martin Kaiser [Wed, 13 Apr 2022 20:07:41 +0000 (22:07 +0200)]
staging: r8188eu: use ieee80211 helpers in mgt_dispatcher

Use structs and functions from ieee80211.h in mgt_dispatcher to parse
the incoming frame.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220413200742.276806-4-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: merge _mgt_dispatcher into mgt_dispatcher
Martin Kaiser [Wed, 13 Apr 2022 20:07:40 +0000 (22:07 +0200)]
staging: r8188eu: merge _mgt_dispatcher into mgt_dispatcher

All that the _mgt_dispatcher function does is to call a function from
a function pointer. It's not worth having a separate function for this.

Merge _mgt_dispatcher into mgt_dispatcher.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220413200742.276806-3-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: use ieee80211 helper to read the qos tid
Martin Kaiser [Wed, 13 Apr 2022 20:07:39 +0000 (22:07 +0200)]
staging: r8188eu: use ieee80211 helper to read the qos tid

Replace the driver-specific GetPriority macro with ieee80211_get_tid,
which does exactly the same thing.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220413200742.276806-2-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: remove unused timer functions
Martin Kaiser [Wed, 13 Apr 2022 19:36:54 +0000 (21:36 +0200)]
staging: r8188eu: remove unused timer functions

rtw_get_passing_time_ms and rtw_systime_to_ms are not used any more.
Remove them.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220413193654.258507-9-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: remove the bInSuspend loop
Martin Kaiser [Wed, 13 Apr 2022 19:36:53 +0000 (21:36 +0200)]
staging: r8188eu: remove the bInSuspend loop

Remove the loop in rtw_pwr_wakeup that waits while the system is
suspended.

pwrpriv->bInSuspend is set in rtw_suspend and cleared in rtw_resume. These
functions are the .suspend and .resume functions of the struct usb_driver
for r8188eu.

A usb_driver's suspend and resume functions are called when the entire
system goes into suspend or runtime suspend.

All of the code paths for rtw_pwr_wakeup start at ioctl handlers.

We can remove the loop that checks bInSuspend. It's not possible to call
an ioctl while the entire system is suspended.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220413193654.258507-8-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: clean up the code to set ips_deny_time
Martin Kaiser [Wed, 13 Apr 2022 19:36:52 +0000 (21:36 +0200)]
staging: r8188eu: clean up the code to set ips_deny_time

Clean up the code in rtw_pwr_wakeup that sets pwrpriv->ips_deny_time.

Make ips_deny_time an unsigned long, this type is used by the kernel
functions that process jiffies.

Remove the temporary variable ips_deffer_ms and use
RTW_PWR_STATE_CHK_INTERVAL directly.

There's no need to set ips_deny_time twice, it's sufficient to set it at
the end of rtw_pwr_wakeup.

Use time_before to check if ips_deny_time should be updated.

We can now remove rtw_ms_to_systime, this function is not used any more.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220413193654.258507-7-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: use kernel functions for timeout handling
Martin Kaiser [Wed, 13 Apr 2022 19:36:51 +0000 (21:36 +0200)]
staging: r8188eu: use kernel functions for timeout handling

Use the kernel functions to set a timeout and to check if it's expired.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220413193654.258507-6-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: summarize two if statements
Martin Kaiser [Wed, 13 Apr 2022 19:36:50 +0000 (21:36 +0200)]
staging: r8188eu: summarize two if statements

Summarize two if statements in rtw_pwr_wakeup and place the constants
on the right side of the comparison.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220413193654.258507-5-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: simplify the ps_processing check
Martin Kaiser [Wed, 13 Apr 2022 19:36:49 +0000 (21:36 +0200)]
staging: r8188eu: simplify the ps_processing check

It's sufficient to check pwrpriv->ps_processing as part of the while-loop.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220413193654.258507-4-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: make return values consistent
Martin Kaiser [Wed, 13 Apr 2022 19:36:48 +0000 (21:36 +0200)]
staging: r8188eu: make return values consistent

rtw_pwr_wakeup should return _SUCCESS or _FAIL.

Replace false with _FAIL in one place and reformat the if-statement.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220413193654.258507-3-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: simplify delay conditions in rtw_pwr_wakeup
Martin Kaiser [Wed, 13 Apr 2022 19:36:47 +0000 (21:36 +0200)]
staging: r8188eu: simplify delay conditions in rtw_pwr_wakeup

Simplify the conditions for a loop in rtw_pwr_wakeup that waits while
the system is suspended.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220413193654.258507-2-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: clean up long lines in block_write()
Michael Straube [Tue, 12 Apr 2022 18:57:54 +0000 (20:57 +0200)]
staging: r8188eu: clean up long lines in block_write()

Store the address and the data pointer for calls to rtw_writeN() and
rtw_write8() in local variables. This avoids long lines and improves
readability.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220412185754.8695-7-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: remove unneeded initializations
Michael Straube [Tue, 12 Apr 2022 18:57:53 +0000 (20:57 +0200)]
staging: r8188eu: remove unneeded initializations

The variables i and offset in block_write() are set in the code
before they are used. Remove the unneeded initializations.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220412185754.8695-6-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: reduce variables in block_write()
Michael Straube [Tue, 12 Apr 2022 18:57:52 +0000 (20:57 +0200)]
staging: r8188eu: reduce variables in block_write()

For cleaner code and improved readability we can reduce the number
of local variables in block_write(). Use a single variable for block
size, number of blocks and remaining size.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220412185754.8695-5-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: change void parameters to u8
Michael Straube [Tue, 12 Apr 2022 18:57:51 +0000 (20:57 +0200)]
staging: r8188eu: change void parameters to u8

The second parameter of write_fw(), page_write() and block_write()
is a void pointer, but we always pass an u8 pointer. We can convert
this parameter to an u8 pointer. The pointer is not changed in the
functions, so we can safely remove the local variable bufferPtr.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220412185754.8695-4-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: rename parameter of block_write()
Michael Straube [Tue, 12 Apr 2022 18:57:50 +0000 (20:57 +0200)]
staging: r8188eu: rename parameter of block_write()

Rename the parameter buffSize of block_write() to avoid camel case.

buffSize -> size

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220412185754.8695-3-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: correct macro spelling mistake
Michael Straube [Tue, 12 Apr 2022 18:57:49 +0000 (20:57 +0200)]
staging: r8188eu: correct macro spelling mistake

Correct a macro spelling mistake in rtw_fw.c.

MAX_REG_BOLCK_SIZE -> MAX_REG_BLOCK_SIZE

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220412185754.8695-2-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agodrivers: staging: rtl8192eu: Fix deadlock in rtw_joinbss_event_prehandle
Duoming Zhou [Sat, 9 Apr 2022 07:21:35 +0000 (15:21 +0800)]
drivers: staging: rtl8192eu: Fix deadlock in rtw_joinbss_event_prehandle

There is a deadlock in rtw_joinbss_event_prehandle(), which is shown below:

   (Thread 1)                |      (Thread 2)
                             | _set_timer()
rtw_joinbss_event_prehandle()|  mod_timer()
 spin_lock_bh() //(1)        |  (wait a time)
 ...                         | rtw_join_timeout_handler()
                             |  _rtw_join_timeout_handler()
 del_timer_sync()            |   spin_lock_bh() //(2)
 (wait timer to stop)        |   ...

We hold pmlmepriv->lock in position (1) of thread 1 and
use del_timer_sync() to wait timer to stop, but timer handler
also need pmlmepriv->lock in position (2) of thread 2.
As a result, rtw_joinbss_event_prehandle() will block forever.

This patch extracts del_timer_sync() from the protection of
spin_lock_bh(), which could let timer handler to obtain
the needed lock. What`s more, we change spin_lock_bh() to
spin_lock_irq() in _rtw_join_timeout_handler() in order to
prevent deadlock.

Signed-off-by: Duoming Zhou <duoming@zju.edu.cn>
Link: https://lore.kernel.org/r/20220409072135.74248-1-duoming@zju.edu.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agodrivers: staging: rtl8192bs: Fix deadlock in rtw_joinbss_event_prehandle()
Duoming Zhou [Sat, 9 Apr 2022 06:49:53 +0000 (14:49 +0800)]
drivers: staging: rtl8192bs: Fix deadlock in rtw_joinbss_event_prehandle()

There is a deadlock in rtw_joinbss_event_prehandle(), which is shown
below:

   (Thread 1)                |      (Thread 2)
                             | _set_timer()
rtw_joinbss_event_prehandle()|  mod_timer()
 spin_lock_bh() //(1)        |  (wait a time)
 ...                         | _rtw_join_timeout_handler()
 del_timer_sync()            |  spin_lock_bh() //(2)
 (wait timer to stop)        |  ...

We hold pmlmepriv->lock in position (1) of thread 1 and
use del_timer_sync() to wait timer to stop, but timer handler
also need pmlmepriv->lock in position (2) of thread 2.
As a result, rtw_joinbss_event_prehandle() will block forever.

This patch extracts del_timer_sync() from the protection of
spin_lock_bh(), which could let timer handler to obtain
the needed lock. What`s more, we change spin_lock_bh() to
spin_lock_irq() in _rtw_join_timeout_handler() in order to
prevent deadlock.

Signed-off-by: Duoming Zhou <duoming@zju.edu.cn>
Link: https://lore.kernel.org/r/20220409064953.67420-1-duoming@zju.edu.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agodrivers: staging: rtl8723bs: Fix deadlock in rtw_surveydone_event_callback()
Duoming Zhou [Sat, 9 Apr 2022 06:18:35 +0000 (14:18 +0800)]
drivers: staging: rtl8723bs: Fix deadlock in rtw_surveydone_event_callback()

There is a deadlock in rtw_surveydone_event_callback(),
which is shown below:

   (Thread 1)                  |      (Thread 2)
                               | _set_timer()
rtw_surveydone_event_callback()|  mod_timer()
 spin_lock_bh() //(1)          |  (wait a time)
 ...                           | rtw_scan_timeout_handler()
 del_timer_sync()              |  spin_lock_bh() //(2)
 (wait timer to stop)          |  ...

We hold pmlmepriv->lock in position (1) of thread 1 and use
del_timer_sync() to wait timer to stop, but timer handler
also need pmlmepriv->lock in position (2) of thread 2.
As a result, rtw_surveydone_event_callback() will block forever.

This patch extracts del_timer_sync() from the protection of
spin_lock_bh(), which could let timer handler to obtain
the needed lock. What`s more, we change spin_lock_bh() in
rtw_scan_timeout_handler() to spin_lock_irq(). Otherwise,
spin_lock_bh() will also cause deadlock() in timer handler.

Signed-off-by: Duoming Zhou <duoming@zju.edu.cn>
Link: https://lore.kernel.org/r/20220409061836.60529-1-duoming@zju.edu.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: add space around operators
Mahak Gupta [Wed, 13 Apr 2022 05:45:17 +0000 (11:15 +0530)]
staging: r8188eu: add space around operators

Adhere to linux coding style.

Reported by checkpatch:

spaces preferred around that '{operator}'.

Signed-off-by: Mahak Gupta <mahak_g@cs.iitr.ac.in>
Link: https://lore.kernel.org/r/20220413054517.6343-1-mahak_g@cs.iitr.ac.in
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: greybus: remove empty callback function
Jaehee Park [Wed, 13 Apr 2022 04:38:52 +0000 (00:38 -0400)]
staging: greybus: remove empty callback function

Remove the optional remove callback for the soc_codec_dev_gbaudio
structure. The only place it is referenced is
snd_soc_component_remove() which is only called if the sound_component
pointer is non-null. The null function pointers here can be optionally
ommitted. When a sound component is registered this way, the remove
callback is optional. We can safely remove the whole gbcodec_remove
function, which used to be an empty function with a void return type.

Suggested-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jaehee Park <jhpark1013@gmail.com>
Link: https://lore.kernel.org/r/12037ae2502ad7d0311bcdf2178c3d2156293236.1649824370.git.jhpark1013@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: greybus: correct typo in comment
Jaehee Park [Wed, 13 Apr 2022 04:38:51 +0000 (00:38 -0400)]
staging: greybus: correct typo in comment

Correct a spelling typo from 'Atleast' to 'At least' in comment.
Issue found by checkpatch.

Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Jaehee Park <jhpark1013@gmail.com>
Link: https://lore.kernel.org/r/2feb03de97ca4dbd27c22cf40f8e185f7dfaae29.1649824370.git.jhpark1013@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: remove else after return and break statements
Mahak Gupta [Wed, 13 Apr 2022 05:27:58 +0000 (10:57 +0530)]
staging: r8188eu: remove else after return and break statements

Else is not necessary after return and break statements, hence remove
it.

Reported by checkpatch:

WARNING: else is not generally useful after a break or return

Signed-off-by: Mahak Gupta <mahak_g@cs.iitr.ac.in>
Link: https://lore.kernel.org/r/20220413052759.4859-1-mahak_g@cs.iitr.ac.in
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: bcm2835-audio: remove compat ALSA card
Adrien Thierry [Fri, 8 Apr 2022 15:03:58 +0000 (11:03 -0400)]
staging: bcm2835-audio: remove compat ALSA card

Remove compat ALSA card, which has overlapping functionality with the
two other cards described by the driver (HDMI and headphones)

This handles TODO item "Revisit multi-cards options and PCM route mixer
control".

Move the S/PDIF device that was part of the compat ALSA card to the HDMI
card.

Only enable headphones card by default, because HDMI breaks when using
both vc4 and bcm2835-audio with HDMI card enabled.

Signed-off-by: Adrien Thierry <athierry@redhat.com>
Link: https://lore.kernel.org/r/20220408150359.26661-1-athierry@redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging/rtl8192e,ieee80211: replace ps tasklet with work
Davidlohr Bueso [Mon, 11 Apr 2022 15:16:20 +0000 (08:16 -0700)]
staging/rtl8192e,ieee80211: replace ps tasklet with work

Tasklets have long been deprecated as being too heavy on the system
by running in irq context - and this is not a performance critical
path. If a higher priority process wants to run, it must wait for
the tasklet to finish before doing so.

rtllib_sta_ps() and ieee80211_sta_ps() will now run in process context
and have further concurrency (tasklets being serialized among themselves),
but this is done holding the ieee->lock, so it should be fine.

Signed-off-by: Davidlohr Bueso <dave@stgolabs.net>
Link: https://lore.kernel.org/r/20220411151620.129178-7-dave@stgolabs.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>