Gaston Gonzalez [Fri, 29 Oct 2021 20:00:12 +0000 (17:00 -0300)]
staging: vchiq_core: get rid of typedef
The typedef BITSET_T is acting as a synonym of u32. However, using the type u32
directly makes the code more readable. Furthermore, typedef should only be used
in some cases, [1]. Hence, get rid of it.
Ajith P V [Fri, 29 Oct 2021 13:27:00 +0000 (18:57 +0530)]
staging: fieldbus: anybus: reframe comment to avoid warning
host.c file comment produce warning with checkpatch as below:
WARNING: Possible repeated word: 'interrupt'
Reframe the comment into bullet points or steps avoid this warning.
Yang Yingliang [Thu, 28 Oct 2021 09:40:38 +0000 (17:40 +0800)]
staging: r8188eu: fix missing unlock in rtw_resume()
Add the missing unlock before return from rtw_resume().
Fixes: 2b42bd58b321 ("staging: r8188eu: introduce new os_dep dir for RTL8188eu driver") Reported-by: Hulk Robot <hulkci@huawei.com> Acked-by: Fabio M. De Francesco <fmdefrancesco@gmail.com> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Link: https://lore.kernel.org/r/20211028094038.2877341-1-yangyingliang@huawei.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Saurav Girepunje [Tue, 26 Oct 2021 03:55:45 +0000 (09:25 +0530)]
staging: r8188eu: core: remove the goto from rtw_IOL_accquire_xmit_frame
Remove the goto statement from rtw_IOL_accquire_xmit_frame(). In this
function goto can be replace by return statement. As on goto label
exit, function only return it is not performing any cleanup. Avoiding
goto will improve the function readability.
Remove the assignment of NULL to local variable xmit_frame just before
return of function. As function return, local variable will be not
available on memory. So assigning a NULL value to local variable just
before function return does not required.
Saurav Girepunje [Mon, 25 Oct 2021 12:15:10 +0000 (17:45 +0530)]
staging: r8188eu: core: remove goto statement
Remove the goto statement from rtw_do_join(). In this function goto
can be replace by return statement. As on goto label exit, function only
return it is not performing any cleanup. Avoiding goto will improve
the function readability.
Johan Hovold [Mon, 25 Oct 2021 12:09:10 +0000 (14:09 +0200)]
staging: r8712u: fix control-message timeout
USB control-message timeouts are specified in milliseconds and should
specifically not vary with CONFIG_HZ.
Fixes: 2865d42c78a9 ("staging: r8712u: Add the new driver to the mainline kernel") Cc: stable@vger.kernel.org # 2.6.37 Acked-by: Larry Finger <Larry.Finger@lwfinger.net> Signed-off-by: Johan Hovold <johan@kernel.org> Link: https://lore.kernel.org/r/20211025120910.6339-3-johan@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Gaston Gonzalez [Sun, 24 Oct 2021 21:38:39 +0000 (18:38 -0300)]
staging: vchiq_core: fix quoted strings split across lines
Quoted strings should not be split across lines. As put it in [1]:
"never break user-visible strings such as printk messages because that
breaks the ability to grep for them."
While at it, fix the alignment of the arguments in the sentence.
Note: this introduce a checkpatch CHECK: line length of 123 exceeds 100
columns, as the line now is:
vchiq_loud_error("%d: service %d (%c%c%c%c) version mismatch - local (%d, min %d) vs. remote (%d, min %d)",
But now the string is grep-able and the whole function call more
clear.
Gaston Gonzalez [Sun, 24 Oct 2021 21:25:19 +0000 (18:25 -0300)]
staging: vchiq_core.h: fix CamelCase in function declaration
Renaming function declaration to avoid CamelCase use.
As this was already fixed in the function definition in commit 801b1aa002d3 ("staging: vc04_services: fix CamelCase"), the current
change make the names of the variables in the function definition and
declartion match.
Martin Kaiser [Sun, 24 Oct 2021 18:04:48 +0000 (20:04 +0200)]
staging: r8188eu: remove the sreset_priv structure
last_tx_time from struct sreset_priv is no longer used now that
last_tx_complete_time is gone.
This patch removes last_tx_time. This was the last remaining component of
struct sreset_priv, we can now remove the structure itself.
After removing include/rtw_sreset.h, it turned out that some definitions
in .c files were pulled in via rtw_sreset.h. Add the required include
files directly to make compilation succeed without rtw_sreset.h.
Martin Kaiser [Sun, 24 Oct 2021 18:04:47 +0000 (20:04 +0200)]
staging: r8188eu: remove last_tx_complete_time
last_tx_complete_time from struct sreset_priv is set / calculated when a
packet is sent out. Like other sreset_priv components, it is not read and
can be removed.
staging: r8188eu: Use a Mutex instead of a binary Semaphore
Use a Mutex instead of a binary Semaphore for the purpose of enforcing
mutual exclusive access to the "pwrctrl_priv" structure.
Mutexes are sleeping locks similar to Semaphores with a 'count' of one
(like binary Semaphores), however they have a simpler interface, more
efficient performance, and additional constraints.
There is no change in the logic of the new code; however it is more
simple because it gets rid of four unnecessary wrappers:
_init_pwrlock(), _enter_pwrlock(),_exit_pwrlock(), _rtw_down_sema().
Actually, there is a change in the state in which the code waits for
acquiring locks, because it makes it in an uninterruptible state
(instead the old code used down_interruptibe()). Interruptible
waits are neither required nor wanted in this driver.
Tested with ASUSTek Computer, Inc. Realtek 8188EUS [USB-N10 Nano].
Kushal Kothari [Sat, 23 Oct 2021 07:35:47 +0000 (13:05 +0530)]
staging: rtl8723bs: core: Remove true and false comparison
Remove comparison to true and false in if statement.
Issue found with checkpatch.pl.
CHECK: Using comparison to true is error prone
CHECK: Using comparison to false is error prone
Karolina Drobnik [Thu, 21 Oct 2021 09:27:53 +0000 (10:27 +0100)]
staging: vt6655: Use named constants when checking preamble type
Compare `preamble_type` to a predefined constant, `PREAMBLE_SHORT`,
instead of a literal in `bb_get_frame_time` and `vnt_get_phy_field`
functions. Thanks to this change, it is clear that we check
the type of a preamble, not just compare it against an arbitrary value.
Remove a redundant comment.
DMFlag is only written to, but never read.
InitDMFlag is assigned to DMFlag and not used elsewhere.
DM_Type is also write-only.
UndecoratedSmoothedPWDB and UndecoratedSmoothedCCK are not used at all.
Kushal Kothari [Wed, 20 Oct 2021 11:56:21 +0000 (17:26 +0530)]
staging: rtl8723bs: core: Remove true and false comparison
Remove comparison to true and false in if statement.
Issue found with checkpatch.pl.
CHECK: Using comparison to true is error prone
CHECK: Using comparison to false is error prone
Martin Kaiser [Tue, 19 Oct 2021 20:23:56 +0000 (22:23 +0200)]
staging: r8188eu: fix memleak in rtw_wx_set_enc_ext
Free the param struct if the caller sets an unsupported algorithm
and we return an error.
Fixes: 2b42bd58b321 ("staging: r8188eu: introduce new os_dep dir for RTL8188eu driver") Cc: stable <stable@vger.kernel.org> Signed-off-by: Martin Kaiser <martin@kaiser.cx> Link: https://lore.kernel.org/r/20211019202356.12572-1-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Pavel Skripkin [Tue, 19 Oct 2021 21:17:18 +0000 (00:17 +0300)]
staging: rtl8712: fix use-after-free in rtl8712_dl_fw
Syzbot reported use-after-free in rtl8712_dl_fw(). The problem was in
race condition between r871xu_dev_remove() ->ndo_open() callback.
It's easy to see from crash log, that driver accesses released firmware
in ->ndo_open() callback. It may happen, since driver was releasing
firmware _before_ unregistering netdev. Fix it by moving
unregister_netdev() before cleaning up resources.
staging: mt7621-dts: make use of 'IRQ_TYPE_LEVEL_HIGH' instead of magic numbers
Nodes 'gdma' and 'hsdma' are using magic number '4' in interrupts property.
Use 'IRQ_TYPE_LEVEL_HIGH' instead to align with the rest of the nodes in
the file.
Jakub Kicinski [Tue, 19 Oct 2021 17:12:43 +0000 (10:12 -0700)]
staging: use eth_hw_addr_set() in orphan drivers
Commit 406f42fa0d3c ("net-next: When a bond have a massive amount
of VLANs...") introduced a rbtree for faster Ethernet address look
up. To maintain netdev->dev_addr in this tree we need to make all
the writes to it got through appropriate helpers.
Jakub Kicinski [Tue, 19 Oct 2021 17:12:42 +0000 (10:12 -0700)]
staging: rtl: use eth_hw_addr_set()
Commit 406f42fa0d3c ("net-next: When a bond have a massive amount
of VLANs...") introduced a rbtree for faster Ethernet address look
up. To maintain netdev->dev_addr in this tree we need to make all
the writes to it got through appropriate helpers.
Jakub Kicinski [Tue, 19 Oct 2021 17:12:41 +0000 (10:12 -0700)]
staging: unisys: use eth_hw_addr_set()
Commit 406f42fa0d3c ("net-next: When a bond have a massive amount
of VLANs...") introduced a rbtree for faster Ethernet address look
up. To maintain netdev->dev_addr in this tree we need to make all
the writes to it got through appropriate helpers.
Jakub Kicinski [Tue, 19 Oct 2021 17:12:39 +0000 (10:12 -0700)]
staging: qlge: use eth_hw_addr_set()
Commit 406f42fa0d3c ("net-next: When a bond have a massive amount
of VLANs...") introduced a rbtree for faster Ethernet address look
up. To maintain netdev->dev_addr in this tree we need to make all
the writes to it got through appropriate helpers.
Jakub Kicinski [Tue, 19 Oct 2021 17:12:37 +0000 (10:12 -0700)]
staging: use eth_hw_addr_set() instead of ether_addr_copy()
Commit 406f42fa0d3c ("net-next: When a bond have a massive amount
of VLANs...") introduced a rbtree for faster Ethernet address look
up. To maintain netdev->dev_addr in this tree we need to make all
the writes to it got through appropriate helpers.
Convert staging from ether_addr_copy() to eth_hw_addr_set():
Jakub Kicinski [Tue, 19 Oct 2021 17:12:36 +0000 (10:12 -0700)]
staging: use eth_hw_addr_set()
Commit 406f42fa0d3c ("net-next: When a bond have a massive amount
of VLANs...") introduced a rbtree for faster Ethernet address look
up. To maintain netdev->dev_addr in this tree we need to make all
the writes to it got through appropriate helpers.
Convert staging drivers from memcpy(... ETH_ADDR) to eth_hw_addr_set():
Michael Straube [Tue, 19 Oct 2021 13:51:37 +0000 (15:51 +0200)]
staging: r8188eu: RFType type is always ODM_1T1R
This driver is for 1T1R chips. The field RfType of odm_dm_struct is
set to ODM_1T1R and never changed. Remove code that initializes RFType,
remove it from odm_dm_struct and remove resulting dead code.
Remove the redundant first 'if' statement of two identical ones.
In rtw_cmd_thread() there are two identical 'if' statement, one
immediately after the other. They check whether or not the device is
removed or the driver is stopped and, if true, they break a 'while'
loop.
The only noteworthy context difference is that the second statement is
within a block labelled "_next". The code has a 'goto' to the "_next"
label so that the checking is performed each time the above directive
is encountered. Instead, the first 'if' is before the "_next" label.
One of the two must be removed and that it must be the one before the
label because "bSurpriseRemoved" as well as "bDriverStopped" may be
changed asynchronously by other code of the driver and so they should be
checked at each jump to "_next".
Tested with "ASUSTek Computer, Inc. Realtek 8188EUS [USB-N10 Nano]".
Acked-by: Martin Kaiser <martin@kaiser.cx> Acked-by: Phillip Potter <phil@philpotter.co.uk> Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com> Link: https://lore.kernel.org/r/20211018162006.5527-4-fmdefrancesco@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: r8188eu: Use completions for signaling enqueueing
rtw_enqueue_cmd() uses a semaphore to notify rtw_cmd_thread() that it
has enqueued commands. rtw_cmd_thread() "down(s)" in interruptible mode
to wait to be notified.
Use completion variables because they are better suited for the purpose.
In rtw_cmd_thread(), wait in uninterruptible mode, even if the original
code uses down_interruptible(), because the interruption of
rtw_cmd_thread() is not allowed and unwanted.
Tested with "ASUSTek Computer, Inc. Realtek 8188EUS [USB-N10 Nano]".
staging: r8188eu: Use completions for signaling start / end kthread
rtw_cmd_thread() "up(s)" a semaphore twice, first to notify callers when
its execution is started and then to notify when it is about to end.
It makes the same semaphore go "up" twice in the same thread. This
construct makes Smatch to warn of duplicate "up(s)".
This thread uses interruptible semaphores where instead completions are
more suitable. For this purpose it calls an helper (_rtw_down_sema())
that returns values that are never checked. It may lead to bugs.
To address the above-mentioned issues, use two completions variables
instead of semaphores. Use the uninterruptible versions of
wake_for_completion*() because the interruptible / killable versions are
not necessary.
Tested with "ASUSTek Computer, Inc. Realtek 8188EUS [USB-N10 Nano]".
The destination buffer size is IEEE_CRYPT_ALG_NAME_LEN and the length
of the string to copy is always < IEEE_CRYPT_ALG_NAME_LEN. So strlcpy
will never truncate the string.
staging: mt7621-dts: get rid of nodes with no in-tree driver
Nodes for 'i2s' and 'nand' have no driver present inside the linux tree.
The normal approach for a dts file to be mainlined is start with those stuff
which is already mainlined and get rid of the other stuff. If needed it will
be properly added afterwards together with the suitable device driver. Hence,
remove both nodes from the device tree include file.
Martin Kaiser [Sat, 16 Oct 2021 18:13:42 +0000 (20:13 +0200)]
staging: r8188eu: daemonize is not defined
Remove dead code that depends on daemonize.
Acked-by: Michael Straube <straube.linux@gmail.com> Acked-by: Fabio M. De Francesco <fmdefrancesco@gmail.com> Signed-off-by: Martin Kaiser <martin@kaiser.cx> Link: https://lore.kernel.org/r/20211016181343.3686-3-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Martin Kaiser [Sat, 16 Oct 2021 18:13:41 +0000 (20:13 +0200)]
staging: r8188eu: res_to_status is unused
The function res_to_status is not used. Remove it.
Acked-by: Fabio M. De Francesco <fmdefrancesco@gmail.com> Acked-by: Michael Straube <straube.linux@gmail.com> Signed-off-by: Martin Kaiser <martin@kaiser.cx> Link: https://lore.kernel.org/r/20211016181343.3686-2-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Martin Kaiser [Sat, 16 Oct 2021 11:30:08 +0000 (13:30 +0200)]
staging: r8188eu: CurrentWirelessMode is not used
CurrentWirelessMode in struct hal_data_8188e is not used. Remove the
component and the enum with its possible values.
Acked-by: Michael Straube <straube.linux@gmail.com> Acked-by: Phillip Potter <phil@philpotter.co.uk> Signed-off-by: Martin Kaiser <martin@kaiser.cx> Link: https://lore.kernel.org/r/20211016113008.27549-9-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Martin Kaiser [Sat, 16 Oct 2021 11:30:07 +0000 (13:30 +0200)]
staging: r8188eu: remove procfs functions
It seems that previous versions of this driver provided a procfs
interface for debugging.
Remove the procfs helper functions which are no longer used.
Acked-by: Michael Straube <straube.linux@gmail.com> Acked-by: Phillip Potter <phil@philpotter.co.uk> Signed-off-by: Martin Kaiser <martin@kaiser.cx> Link: https://lore.kernel.org/r/20211016113008.27549-8-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Martin Kaiser [Sat, 16 Oct 2021 11:30:06 +0000 (13:30 +0200)]
staging: r8188eu: clean up Hal8188EPhyCfg.h
Remove a bunch of unused structs, enums and defines
from Hal8188EPhyCfg.h.
Acked-by: Michael Straube <straube.linux@gmail.com> Acked-by: Phillip Potter <phil@philpotter.co.uk> Signed-off-by: Martin Kaiser <martin@kaiser.cx> Link: https://lore.kernel.org/r/20211016113008.27549-7-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Martin Kaiser [Sat, 16 Oct 2021 11:30:05 +0000 (13:30 +0200)]
staging: r8188eu: PHY_SetRFPathSwitch_8188E is not used
Remove the PHY_SetRFPathSwitch_8188E function which is not used.
It was the only caller of phy_setrfpathswitch_8188e, that function
can be removed as well.
Acked-by: Michael Straube <straube.linux@gmail.com> Acked-by: Phillip Potter <phil@philpotter.co.uk> Signed-off-by: Martin Kaiser <martin@kaiser.cx> Link: https://lore.kernel.org/r/20211016113008.27549-6-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Martin Kaiser [Sat, 16 Oct 2021 11:30:04 +0000 (13:30 +0200)]
staging: r8188eu: remove unused function prototypes
Remove prototypes of functions that aren't present in this driver.
Acked-by: Michael Straube <straube.linux@gmail.com> Acked-by: Phillip Potter <phil@philpotter.co.uk> Signed-off-by: Martin Kaiser <martin@kaiser.cx> Link: https://lore.kernel.org/r/20211016113008.27549-5-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Martin Kaiser [Sat, 16 Oct 2021 11:30:03 +0000 (13:30 +0200)]
staging: r8188eu: remove two checks that are always false
Commit aefb1fc5c185 ("staging: r8188eu: odm BoardType is never set")
clarified that the odm board type is always 0.
The CheckCondition functions extract the board type from the hex
parameter and stores it in _board. For _board == 0,
(_board == cond) && cond != 0x00 is always false. Remove the checks.
Acked-by: Michael Straube <straube.linux@gmail.com> Acked-by: Phillip Potter <phil@philpotter.co.uk> Signed-off-by: Martin Kaiser <martin@kaiser.cx> Link: https://lore.kernel.org/r/20211016113008.27549-4-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Martin Kaiser [Sat, 16 Oct 2021 11:30:02 +0000 (13:30 +0200)]
staging: r8188eu: interface type is always usb
SupportInterface in struct odm_dm_struct is always ODM_ITRF_USB.
Remove the variable and the code to configure the interface.
Acked-by: Michael Straube <straube.linux@gmail.com> Acked-by: Phillip Potter <phil@philpotter.co.uk> Signed-off-by: Martin Kaiser <martin@kaiser.cx> Link: https://lore.kernel.org/r/20211016113008.27549-3-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Martin Kaiser [Sat, 16 Oct 2021 11:30:01 +0000 (13:30 +0200)]
staging: r8188eu: remove empty trigger gpio code
The hal variable HW_VAR_TRIGGER_GPIO_0 and the rtl8192cu_trigger_gpio_0
function are not used. Remove them.
Acked-by: Michael Straube <straube.linux@gmail.com> Acked-by: Phillip Potter <phil@philpotter.co.uk> Signed-off-by: Martin Kaiser <martin@kaiser.cx> Link: https://lore.kernel.org/r/20211016113008.27549-2-martin@kaiser.cx Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Michael Straube [Sun, 17 Oct 2021 11:17:05 +0000 (13:17 +0200)]
staging: r8188eu: remove unused constants and variables
Remove some unused constants and variables that are left over from
previous cleanup patches.
Suggested-by: Martin Kaiser <martin@kaiser.cx> Acked-by: Martin Kaiser <martin@kaiser.cx> Signed-off-by: Michael Straube <straube.linux@gmail.com> Link: https://lore.kernel.org/r/20211017111705.18989-1-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
In ODM_CmnInfoPtrArrayHook() there is only the case
ODM_CMNINFO_STA_STATUS and the function is called only with this value.
Remove ODM_CmnInfoPtrArrayHook() and fix the three places where it is
called.
Acked-by: Martin Kaiser <martin@kaiser.cx> Acked-by: Phillip Potter <phil@philpotter.co.uk> Signed-off-by: Michael Straube <straube.linux@gmail.com> Link: https://lore.kernel.org/r/20211015163507.9091-8-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Michael Straube [Fri, 15 Oct 2021 16:35:06 +0000 (18:35 +0200)]
staging: r8188eu: pMacPhyMode is not used
pMacPhyMode is not used. Remove it from odm_dm_struct and remove
related dead code.
Acked-by: Martin Kaiser <martin@kaiser.cx> Acked-by: Phillip Potter <phil@philpotter.co.uk> Signed-off-by: Michael Straube <straube.linux@gmail.com> Link: https://lore.kernel.org/r/20211015163507.9091-7-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>