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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Davidlohr Bueso [Mon, 11 Apr 2022 15:16:19 +0000 (08:16 -0700)]
staging/rtl8712: remove event_tasklet
This is unused.
Signed-off-by: Davidlohr Bueso <dave@stgolabs.net>
Link: https://lore.kernel.org/r/20220411151620.129178-6-dave@stgolabs.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Davidlohr Bueso [Mon, 11 Apr 2022 15:16:18 +0000 (08:16 -0700)]
staging/ks7010: replace SME taslet 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.
The execution of the SME event will now occur in task context. There
are, however, changes in concurrency. Workqueues, unlike tasklets,
are not serialized among themselves and can run concurrently
updating sme_i.qhead. However, the current code is already exposed
in same ways, regardless of the deferral mechanism, in that
hostif_sme_enqueue() does unserialized enqueues updating sme_i.qtail.
Also get rid of the bogus (power save) tasklet enabling, as it
is never disabled to begin with.
Signed-off-by: Davidlohr Bueso <dave@stgolabs.net>
Link: https://lore.kernel.org/r/20220411151620.129178-5-dave@stgolabs.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Davidlohr Bueso [Mon, 11 Apr 2022 15:16:17 +0000 (08:16 -0700)]
staging/wlan-ng, prism2usb: replace completion_bh 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.
The completion_bh tasklet will now run in process context and have
further concurrency (tasklets being serialized among themselves),
but this is done holding the ctlxq.lock, so it should be fine.
Signed-off-by: Davidlohr Bueso <dave@stgolabs.net>
Link: https://lore.kernel.org/r/20220411151620.129178-4-dave@stgolabs.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Davidlohr Bueso [Mon, 11 Apr 2022 15:16:16 +0000 (08:16 -0700)]
staging/wlan-ng, prism2usb: replace reaper_bh 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.
The reaper_bh tasklet will now run in process context and have further
concurrency (tasklets being serialized among themselves), but this
is done holding the ctlxq.lock, so it should be fine.
Signed-off-by: Davidlohr Bueso <dave@stgolabs.net>
Link: https://lore.kernel.org/r/20220411151620.129178-3-dave@stgolabs.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Davidlohr Bueso [Mon, 11 Apr 2022 15:16:15 +0000 (08:16 -0700)]
staging/most, dim2: convert dim2_tasklet to threaded irq
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. A more suitable equivalent
is to converted to threaded irq instead and service channels in
regular task context.
Signed-off-by: Davidlohr Bueso <dave@stgolabs.net>
Link: https://lore.kernel.org/r/20220411151620.129178-2-dave@stgolabs.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Philipp Hortmann [Mon, 11 Apr 2022 20:49:54 +0000 (22:49 +0200)]
staging: vt6655: Remove macro PCAvDelayByIO
Remove do-while(0) and CamelCase macro PCAvDelayByIO as
it is not accepted by checkpatch.pl
As the macro is just used once with a constant <= 50 the
functionality of the macro is implemented by using
udelay() directly.
Signed-off-by: Philipp Hortmann <philipp.g.hortmann@gmail.com>
Link: https://lore.kernel.org/r/e8267e7566d389f318a72d911083e52b02e37210.1649706687.git.philipp.g.hortmann@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Aliya Rahmani [Tue, 12 Apr 2022 07:14:57 +0000 (12:44 +0530)]
staging: rtl8712: efuse: code style - avoid macro argument precedence issues
This patch fixes checkpatch warnings of precedence issues. Added parentheses
around macro arguments 'offset' and 'word_en'.
Signed-off-by: Aliya Rahmani <aliyarahmani786@gmail.com>
Link: https://lore.kernel.org/r/20220412071456.40980-1-aliyarahmani786@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Martin Kaiser [Sat, 9 Apr 2022 16:32:11 +0000 (18:32 +0200)]
staging: r8188eu: improve timeout handling in efuse_read_phymap_from_txpktbuf
Use the standard kernel functions to define and check the timeout in
efuse_read_phymap_from_txpktbuf.
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220409163212.241122-10-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Martin Kaiser [Sat, 9 Apr 2022 16:32:10 +0000 (18:32 +0200)]
staging: r8188eu: improve timeout handling in iol_execute
Use the standard kernel functions to define and check the timeout in
iol_execute.
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220409163212.241122-9-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Martin Kaiser [Sat, 9 Apr 2022 16:32:09 +0000 (18:32 +0200)]
staging: r8188eu: improve timeout handling in LPS_RF_ON_check
Use the standard kernel functions to define and check the timeout in
LPS_RF_ON_check.
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220409163212.241122-8-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Martin Kaiser [Sat, 9 Apr 2022 16:32:08 +0000 (18:32 +0200)]
staging: r8188eu: make LPS_RF_ON_check static
LPS_RF_ON_check is used only in rtw_pwrctrl.c. Make it a static function.
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220409163212.241122-7-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Martin Kaiser [Sat, 9 Apr 2022 16:32:07 +0000 (18:32 +0200)]
staging: r8188eu: improve timeout handling in rtw_check_join_candidate
Use the standard kernel functions to define and check the timeout in
rtw_check_join_candidate.
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220409163212.241122-6-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Martin Kaiser [Sat, 9 Apr 2022 16:32:06 +0000 (18:32 +0200)]
staging: r8188eu: improve timeout handling in rtl8188e_firmware_download
Use the standard kernel functions to define and check the timeout in
rtl8188e_firmware_download.
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220409163212.241122-5-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Martin Kaiser [Sat, 9 Apr 2022 16:32:05 +0000 (18:32 +0200)]
staging: r8188eu: summarize two if statements
Summarize the two if statements at the end of send_beacon.
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220409163212.241122-4-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Martin Kaiser [Sat, 9 Apr 2022 16:32:04 +0000 (18:32 +0200)]
staging: r8188eu: remove unnecessary rtw_get_passing_time_ms call
Remove the rtw_get_passing_time_ms call in send_beacon.
Calling rtw_get_passing_time_ms makes no sense if we discard the result.
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220409163212.241122-3-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Martin Kaiser [Sat, 9 Apr 2022 16:32:03 +0000 (18:32 +0200)]
staging: r8188eu: no need for an else after return
The else branch at the end of send_beacon is not necessary. We return in
the if branch.
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220409163212.241122-2-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Uwe Kleine-König [Mon, 11 Apr 2022 11:30:10 +0000 (13:30 +0200)]
staging: greybus: pwm: Drop assignment to struct pwm_chip::base
Since commit
f9a8ee8c8bcd ("pwm: Always allocate PWM chip base ID
dynamically") the value held in base isn't used any more in the PWM
framework. All PMWs get assigned a dynamic ID, so the assignment is
redundant and can be dropped.
Reviewed-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20220411113010.208500-1-u.kleine-koenig@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Michael Straube [Sat, 9 Apr 2022 12:06:27 +0000 (14:06 +0200)]
staging: r8188eu: remove HW_VAR_H2C_FW_PWRMODE
Remove the HW_VAR_H2C_FW_PWRMODE case from SetHwReg8188EU() and move
its functionality to a new function in rtw_pwrctrl.c. This is part of
the ongoing effort to get rid of the unwanted hal layer.
Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220409120627.10633-5-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Michael Straube [Sat, 9 Apr 2022 12:06:26 +0000 (14:06 +0200)]
staging: r8188eu: remove HW_VAR_FIFO_CLEARN_UP
Remove the HW_VAR_FIFO_CLEARN_UP case from SetHwReg8188EU() and move
its functionality to a new static function in os_intfs.c. This is part
of the ongoing effort to get rid of the unwanted hal layer.
Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220409120627.10633-4-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>