platform/kernel/linux-starfive.git
2 years agostaging: r8188eu: Remove redundant code from rtw_free_netdev()
Fabio M. De Francesco [Sat, 2 Apr 2022 14:06:57 +0000 (16:06 +0200)]
staging: r8188eu: Remove redundant code from rtw_free_netdev()

In rtw_free_netdev() there are two redundant tests. The first checks for
a valid pointer to a "struct net_device". This pointer is the argument
of rtw_free_netdev(). The two callers of this function already test this
parameter immediatelly before the calls. The second checks for a valid
pointer to a "struct rtw_netdev_priv_indicator". This pointer is always
valid and, even if it were not, vfree() is a no-op on NULL pointers.

Therefore the above-mentioned two "if" statements are unnecessary and
redundant. For this reason, remove these two tests.

After removing these tests there is no more need of the "RETURN" label.
Therefore, remove also the "RETURN" label.

Cc: Pavel Skripkin <paskripkin@gmail.com>
Cc: Martin Kaiser <martin@kaiser.cx>
Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
Link: https://lore.kernel.org/r/20220402140657.10549-1-fmdefrancesco@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: remove spaces before tabs
Rebecca Mckeever [Sat, 2 Apr 2022 08:50:48 +0000 (03:50 -0500)]
staging: r8188eu: remove spaces before tabs

Conform to Linux kernel coding style.

Reported by checkpatch:

WARNING: please, no space before tabs

Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Rebecca Mckeever <remckee0@gmail.com>
Link: https://lore.kernel.org/r/2fd10f393e3bc7381a85d0bfc1ec04a80af4eabb.1648888462.git.remckee0@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: remove unnecessary braces in conditional statements
Rebecca Mckeever [Sat, 2 Apr 2022 08:50:47 +0000 (03:50 -0500)]
staging: r8188eu: remove unnecessary braces in conditional statements

Conform to Linux kernel coding style.

Reported by checkpatch:

WARNING: braces {} are not necessary for single statement blocks
WARNING: braces {} are not necessary for any arm of this statement

Signed-off-by: Rebecca Mckeever <remckee0@gmail.com>
Link: https://lore.kernel.org/r/2b46501bb3965a8cf27e7134407c50551c36b7e8.1648888462.git.remckee0@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: format block comments
Rebecca Mckeever [Sat, 2 Apr 2022 08:50:46 +0000 (03:50 -0500)]
staging: r8188eu: format block comments

Add ' * ' or ' ' to beginning of block comment lines
to conform to Linux kernel coding style.

Reported by checkpatch:

WARNING: Block comments use * on subsequent lines

Signed-off-by: Rebecca Mckeever <remckee0@gmail.com>
Link: https://lore.kernel.org/r/0387f3df49d89c17acf96cf072e70c98e81e58f7.1648888462.git.remckee0@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: correct misspelling in comment "conider" -> "consider"
Rebecca Mckeever [Sat, 2 Apr 2022 08:50:45 +0000 (03:50 -0500)]
staging: r8188eu: correct misspelling in comment "conider" -> "consider"

Correct spelling typo. Reported by checkpatch:

CHECK: 'conider' may be misspelled - perhaps 'consider'?

Signed-off-by: Rebecca Mckeever <remckee0@gmail.com>
Link: https://lore.kernel.org/r/5799315f84e50db2a7d05b74cd4ed9ec2f28a8e2.1648888461.git.remckee0@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: remove else after return
Rebecca Mckeever [Sat, 2 Apr 2022 08:50:44 +0000 (03:50 -0500)]
staging: r8188eu: remove else after return

Conform to Linux kernel coding style.

Reported by checkpatch:

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

Signed-off-by: Rebecca Mckeever <remckee0@gmail.com>
Link: https://lore.kernel.org/r/84db0348481b54f58cb0b6200fa9ae471ee06b3b.1648888461.git.remckee0@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: place constants on the right side of tests
Rebecca Mckeever [Sat, 2 Apr 2022 08:50:43 +0000 (03:50 -0500)]
staging: r8188eu: place constants on the right side of tests

Conform to Linux kernel coding style.

Reported by checkpatch:

WARNING: Comparisons should place the constant on the right side of the test

Signed-off-by: Rebecca Mckeever <remckee0@gmail.com>
Link: https://lore.kernel.org/r/0f3db3586b3668d6d784e075bc52ffd88b0920d2.1648888461.git.remckee0@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: wlan-ng: Fix Alignment with parenthesis
Alaa Mohamed [Sat, 2 Apr 2022 11:37:33 +0000 (13:37 +0200)]
staging: wlan-ng: Fix Alignment with parenthesis

Fix " CHECK: Alignment should match open parenthesis "
Reported by checkpath

Signed-off-by: Alaa Mohamed <eng.alaamohamedsoliman.am@gmail.com>
Link: https://lore.kernel.org/r/08641d36aaee60797f8c68683b013ebf0215ba2e.1648899123.git.eng.alaamohamedsoliman.am@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: wlan-ng: Fix Lines shouldn't end with '('
Alaa Mohamed [Sat, 2 Apr 2022 11:37:32 +0000 (13:37 +0200)]
staging: wlan-ng: Fix Lines shouldn't end with '('

Fix "CHECK: Lines should not end with a '('"
for lines 331 and 485 Reported By checkpatch

Signed-off-by: Alaa Mohamed <eng.alaamohamedsoliman.am@gmail.com>
Link: https://lore.kernel.org/r/82bb0ca2bad1bafbaca8ded6fe82b94e4761f648.1648899123.git.eng.alaamohamedsoliman.am@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: rtl8723bs: simplify control flow
Sevinj Aghayeva [Fri, 1 Apr 2022 11:46:35 +0000 (07:46 -0400)]
staging: rtl8723bs: simplify control flow

The function iterates an index from 0 to NUM_PMKID_CACHE and returns
the first index for which the condition is true. If no such index is
found, the function returns -1. Current code has a complex control
flow that obfuscates this simple task. Replace it with a loop.

Also, given the shortened function body, replace the long variable
name psecuritypriv with a short variable name p.

Reported by checkpatch:

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

Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Sevinj Aghayeva <sevinj.aghayeva@gmail.com>
Link: https://lore.kernel.org/r/20220401114635.GA567659@euclid
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: vc04_services: Convert kmap() to kmap_local_page()
Fabio M. De Francesco [Wed, 30 Mar 2022 19:14:14 +0000 (21:14 +0200)]
staging: vc04_services: Convert kmap() to kmap_local_page()

The use of kmap() is being deprecated in favor of kmap_local_page()
where it is feasible. In file interface/vchiq_arm/vchiq_arm.c,
function free_pagelist() calls kmap() / kunmap() from two places.

With kmap_local_page(), the mapping is per thread, CPU local and not
globally visible. Therefore, free_pagelist() is a function where the
use of kmap_local_page() in place of kmap() is correctly suited.

Convert to kmap_local_page() but, instead of open coding it, use the
memcpy_to_page() helper.

Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
Link: https://lore.kernel.org/r/20220330191414.23141-1-fmdefrancesco@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: rtl8723bs: refactor rtw_ch2freq()
Michael Straube [Thu, 31 Mar 2022 21:41:46 +0000 (23:41 +0200)]
staging: rtl8723bs: refactor rtw_ch2freq()

Convert the array ch_freq_map to a simple integer array and use
the indices as channel numbers. This simplifies the code and avoids
looping through the array to get the frequency. To avoid out of
bounds array access return a default value for invalid channel values,
like the original code did.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220331214146.15161-3-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: rtl8723bs: remove 5 GHz channels from ch_freq_map
Michael Straube [Thu, 31 Mar 2022 21:41:45 +0000 (23:41 +0200)]
staging: rtl8723bs: remove 5 GHz channels from ch_freq_map

According to the Realtek documentation the chips this driver supports
are 2.4 GHz only chips. Frequencies for 5 GHz channels can be removed
from the ch_freq_map array.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220331214146.15161-2-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: remove handlerOS independent comment
Rebecca Mckeever [Thu, 31 Mar 2022 18:19:45 +0000 (13:19 -0500)]
staging: r8188eu: remove handlerOS independent comment

The "need to make timeout handlerOS independent" comment is incorrect.
Remove the comment to avoid misleading developers.

Suggested-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Rebecca Mckeever <remckee0@gmail.com>
Link: https://lore.kernel.org/r/YkXwwfYBE+P0UObq@bertie
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: use sizeof(*pvar) for allocating structs
Rebecca Mckeever [Thu, 31 Mar 2022 17:16:04 +0000 (12:16 -0500)]
staging: r8188eu: use sizeof(*pvar) for allocating structs

Use sizeof(*pvar) instead of sizeof(struct var) when allocating memory.
This conforms to Linux kernel coding style, improves readability,
and decreases the opportunity for bugs if the pointer variable type is
changed. Issue found by checkpatch messages of the following format:

CHECK: Prefer kzalloc(sizeof(*pvar)...) over kzalloc(sizeof(struct var)...)

Signed-off-by: Rebecca Mckeever <remckee0@gmail.com>
Link: https://lore.kernel.org/r/YkXh1HBqaHwT38UC@bertie
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: unisys: Remove "struct dentry *eth_debugfs_dir"
Fabio M. De Francesco [Thu, 31 Mar 2022 06:47:51 +0000 (08:47 +0200)]
staging: unisys: Remove "struct dentry *eth_debugfs_dir"

There is no need for "struct dentry *eth_debugfs_dir" which is used for
debug / sysfs directories. Therefore, remove this "struct dentry" and
everything related (i.e., creation and removal).

As a side effect of this change, the code has no more need of the
"cleanup_register_netdev" label, which can also be removed.

Suggested-by: Dan Carpenter <dan.carpenter@oracle.com>
Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
Link: https://lore.kernel.org/r/20220331064751.29634-1-fmdefrancesco@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: remove GetHwReg8188EU()
Michael Straube [Thu, 31 Mar 2022 13:05:22 +0000 (15:05 +0200)]
staging: r8188eu: remove GetHwReg8188EU()

The only call to GetHwReg8188EU() that is left over from previous
cleanups sets a variable that is immediately overwritten. This call
is useless and we can finally remove the GetHwReg8188EU() function.
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/20220331130522.6648-6-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: remove HW_VAR_FWLPS_RF_ON from GetHwReg8188EU()
Michael Straube [Thu, 31 Mar 2022 13:05:21 +0000 (15:05 +0200)]
staging: r8188eu: remove HW_VAR_FWLPS_RF_ON from GetHwReg8188EU()

Move the functionality of the HW_VAR_FWLPS_RF_ON case in
GetHwReg8188EU() to a static function in rtw_pwrctrl.c and remove the
HW_VAR_FWLPS_RF_ON case from GetHwReg8188EU(). 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/20220331130522.6648-5-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: remove HW_VAR_CHK_HI_QUEUE_EMPTY from GetHwReg8188EU()
Michael Straube [Thu, 31 Mar 2022 13:05:20 +0000 (15:05 +0200)]
staging: r8188eu: remove HW_VAR_CHK_HI_QUEUE_EMPTY from GetHwReg8188EU()

The HW_VAR_CHK_HI_QUEUE_EMPTY from GetHwReg8188EU() just calls
rtw_read32(). Remove HW_VAR_CHK_HI_QUEUE_EMPTY from GetHwReg8188EU()
and call rtw_read32() directly. Move the call to a new function to
indicate what it actually does. 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/20220331130522.6648-4-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: remove HW_VAR_BCN_VALID from GetHwReg8188EU()
Michael Straube [Thu, 31 Mar 2022 13:05:19 +0000 (15:05 +0200)]
staging: r8188eu: remove HW_VAR_BCN_VALID from GetHwReg8188EU()

The HW_VAR_BCN_VALID from GetHwReg8188EU() just calls rtw_read8().
Remove HW_VAR_BCN_VALID from GetHwReg8188EU() and call rtw_read8()
directly. Move the call to a new function to indicate what it actually
does. 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/20220331130522.6648-3-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: rename clear_bacon_valid_bit()
Michael Straube [Thu, 31 Mar 2022 13:05:18 +0000 (15:05 +0200)]
staging: r8188eu: rename clear_bacon_valid_bit()

Rename clear_bacon_valid_bit(). Actually it should be
clear_beacon_valid_bit().

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220331130522.6648-2-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: rtl8723bs: Fix No space before tabs
Alaa Mohamed [Thu, 31 Mar 2022 13:09:48 +0000 (15:09 +0200)]
staging: rtl8723bs: Fix No space before tabs

Fix "WARNING: please, no space before tabs"
reported by checkpatch

Signed-off-by: Alaa Mohamed <eng.alaamohamedsoliman.am@gmail.com>
Link: https://lore.kernel.org/r/20220331130948.74835-1-eng.alaamohamedsoliman.am@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: rtl8723bs: remove redundant braces in if statements
Sevinj Aghayeva [Thu, 31 Mar 2022 11:32:45 +0000 (07:32 -0400)]
staging: rtl8723bs: remove redundant braces in if statements

Adhere to Linux kernel coding style.

Reported by checkpatch:

WARNING: braces {} are not necessary for single statement blocks

Signed-off-by: Sevinj Aghayeva <sevinj.aghayeva@gmail.com>
Link: https://lore.kernel.org/r/20220331113245.GA425141@euclid
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: remove duplicate assignment
Wang Qing [Thu, 31 Mar 2022 12:08:34 +0000 (05:08 -0700)]
staging: r8188eu: remove duplicate assignment

netdev_alloc_skb() has assigned ssi->netdev to skb->dev if successed,
no need to repeat assignment.

Signed-off-by: Wang Qing <wangqing@vivo.com>
Link: https://lore.kernel.org/r/1648728514-37390-1-git-send-email-wangqing@vivo.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: rtl8723bs: place constants on the right side of tests
Sevinj Aghayeva [Thu, 31 Mar 2022 12:26:18 +0000 (08:26 -0400)]
staging: rtl8723bs: place constants on the right side of tests

Adhere to Linux kernel coding style.

Reported by checkpatch:

WARNING: Comparisons should place the constant on the right side of the test

Signed-off-by: Sevinj Aghayeva <sevinj.aghayeva@gmail.com>
Link: https://lore.kernel.org/r/20220331122618.GA434796@euclid
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: add a check for rtw_cbuf_alloc()
Xiaoke Wang [Wed, 30 Mar 2022 11:30:05 +0000 (19:30 +0800)]
staging: r8188eu: add a check for rtw_cbuf_alloc()

kmalloc() is called by rtw_cbuf_alloc() and it returns pointer of
srtuct rtw_cbuf, NULL for allocation failure. So it is better to check
the return value of it.

Signed-off-by: Xiaoke Wang <xkernel.wang@foxmail.com>
Link: https://lore.kernel.org/r/tencent_D95ACC78B93B1CDD14C4E13E4A66FF892008@qq.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: remove the "dump tx packet" fragments
Martin Kaiser [Wed, 30 Mar 2022 20:12:10 +0000 (22:12 +0200)]
staging: r8188eu: remove the "dump tx packet" fragments

Remove the code fragments for printing outgoing packets.

There's only a hal variable HAL_DEF_DBG_DUMP_TXPKT and the bDumpTxPkt
component of struct hal_data_8188e.

The hal variable is set by a private ioctl, it's never read.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220330201210.175941-3-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: remove the "dump rx packet" fragments
Martin Kaiser [Wed, 30 Mar 2022 20:12:09 +0000 (22:12 +0200)]
staging: r8188eu: remove the "dump rx packet" fragments

Remove the code fragments for printing incoming packets. There's only a
hal variable HAL_DEF_DBG_DUMP_RXPKT and the bDumpRxPkt component of
struct hal_data_8188e.

The hal variable is set by a private ioctl, it's read in
validate_recv_frame but it's not used.

All of this can be removed, there's no code to dump the packets.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220330201210.175941-2-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: rtl8723bs: place constants on the right side of tests
Sevinj Aghayeva [Wed, 30 Mar 2022 12:07:09 +0000 (08:07 -0400)]
staging: rtl8723bs: place constants on the right side of tests

Adhere to Linux kernel coding style.

Reported by checkpatch:

WARNING: Comparisons should place the constant on the right side of the test

Signed-off-by: Sevinj Aghayeva <sevinj.aghayeva@gmail.com>
Link: https://lore.kernel.org/r/20220330120709.GA339788@euclid
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: Fix misspelling in comment "writting" -> "writing"
Haowen Bai [Wed, 30 Mar 2022 10:31:15 +0000 (18:31 +0800)]
staging: r8188eu: Fix misspelling in comment "writting" -> "writing"

This patch fixes some spelling typo in error message reported by
checkpatch.pl

WARNING: 'writting' may be misspelled - perhaps 'writing'?

Signed-off-by: Haowen Bai <baihaowen@meizu.com>
Link: https://lore.kernel.org/r/1648636275-13558-1-git-send-email-baihaowen@meizu.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: Fix misspelling in comment "Tranceiver" -> "Transceiver"
Haowen Bai [Wed, 30 Mar 2022 07:27:21 +0000 (15:27 +0800)]
staging: r8188eu: Fix misspelling in comment "Tranceiver" -> "Transceiver"

This patch fixes some spelling typo in error message reported by
checkpatch.pl

WARNING: 'Tranceiver' may be misspelled - perhaps 'Transceiver'?
WARNING: 'Tranceiver' may be misspelled - perhaps 'Transceiver'?
WARNING: 'Tranceiver' may be misspelled - perhaps 'Transceiver'?
WARNING: 'Tranceiver' may be misspelled - perhaps 'Transceiver'?

Signed-off-by: Haowen Bai <baihaowen@meizu.com>
Link: https://lore.kernel.org/r/1648625242-12678-1-git-send-email-baihaowen@meizu.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: Fix sparse endianness warnings.
Charlie Sands [Wed, 30 Mar 2022 03:14:05 +0000 (23:14 -0400)]
staging: r8188eu: Fix sparse endianness warnings.

This patch fixes sparse warnings about the endianness of different
integers in the driver.

Fixes: 15865124feed ("staging: r8188eu: introduce new core dir for RTL8188eu driver")
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Charlie Sands <sandsch@northvilleschools.net>
Link: https://lore.kernel.org/r/YkPK/QmLAp3BkygY@sckzor-linux.localdomain
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: remove HW_VAR_BCN_VALID from SetHwReg8188EU()
Michael Straube [Tue, 29 Mar 2022 20:21:41 +0000 (22:21 +0200)]
staging: r8188eu: remove HW_VAR_BCN_VALID from SetHwReg8188EU()

The HW_VAR_BCN_VALID case in SetHwReg8188EU() just calls rtw_write8().
Remove HW_VAR_BCN_VALID from SetHwReg8188EU() and call rtw_write8()
directly. Move the call to a new function to indicate what it actually
does. This is part of the ongoing effort to getrid of the unwanted hal
layer.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220329202141.7028-9-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: remove HW_VAR_TX_RPT_MAX_MACID from SetHwReg8188EU()
Michael Straube [Tue, 29 Mar 2022 20:21:40 +0000 (22:21 +0200)]
staging: r8188eu: remove HW_VAR_TX_RPT_MAX_MACID from SetHwReg8188EU()

The HW_VAR_TX_RPT_MAX_MACID case in SetHwReg8188EU() just calls
rtw_write8(). Remove HW_VAR_TX_RPT_MAX_MACID from SetHwReg8188EU() and
call rtw_write8() directly. Move the call to a new function to indicate
what it actually does. 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/20220329202141.7028-8-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: simplify if-else statement
Michael Straube [Tue, 29 Mar 2022 20:21:39 +0000 (22:21 +0200)]
staging: r8188eu: simplify if-else statement

Simplify a nested if-else statement to a single if-else statement in
rtw_set_threshold(). This improves readability and allows us to
remove the local variable threshold.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220329202141.7028-7-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: remove HW_VAR_RXDMA_AGG_PG_TH from SetHwReg8188EU()
Michael Straube [Tue, 29 Mar 2022 20:21:38 +0000 (22:21 +0200)]
staging: r8188eu: remove HW_VAR_RXDMA_AGG_PG_TH from SetHwReg8188EU()

The HW_VAR_RXDMA_AGG_PG_TH case in SetHwReg8188EU() just sets a
variable conditionally and then calls rtw_write8(). Set the variable
in the caller and call rtw_write8() directly. Move the functionality
into a new static function to make the code cleaner. Remove the
HW_VAR_RXDMA_AGG_PG_TH case from SetHwReg8188EU(). 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/20220329202141.7028-6-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: remove HW_VAR_ACM_CTRL from SetHwReg8188EU()
Michael Straube [Tue, 29 Mar 2022 20:21:37 +0000 (22:21 +0200)]
staging: r8188eu: remove HW_VAR_ACM_CTRL from SetHwReg8188EU()

SetHwReg8188EU() is called with HW_VAR_ACM_CTRL only from a function
in rtw_wlan_util.c. Move the functionality into a static function in
rtw_wlan_util.c and remove the HW_VAR_ACM_CTRL case from
SetHwReg8188EU(). 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/20220329202141.7028-5-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: rename some macros to upper case
Michael Straube [Tue, 29 Mar 2022 20:21:36 +0000 (22:21 +0200)]
staging: r8188eu: rename some macros to upper case

Rename some macros to upper case to avoid camel case and improve
readability. While at it, remove some unused macros.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220329202141.7028-4-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: remove HW_VAR_MLME_DISCONNECT from SetHwReg8188EU()
Michael Straube [Tue, 29 Mar 2022 20:21:35 +0000 (22:21 +0200)]
staging: r8188eu: remove HW_VAR_MLME_DISCONNECT from SetHwReg8188EU()

SetHwReg8188EU() is called with HW_VAR_MLME_DISCONNECT only from
functions in rtw_mlme_ext.c. Move the functionality into a static
function in rtw_mlme_ext.c and remove the HW_VAR_MLME_DISCONNECT case
from SetHwReg8188EU(). 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/20220329202141.7028-3-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: remove HW_VAR_RESP_SIFS from SetHwReg8188EU()
Michael Straube [Tue, 29 Mar 2022 20:21:34 +0000 (22:21 +0200)]
staging: r8188eu: remove HW_VAR_RESP_SIFS from SetHwReg8188EU()

SetHwReg8188EU() is called with HW_VAR_RESP_SIFS only in one place.
Remove the HW_VAR_RESP_SIFS case from SetHwReg8188EU() and call
rtw_write8() directly instead. 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/20220329202141.7028-2-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: Directly return _SUCCESS instead of using local ret variable
Haowen Bai [Wed, 30 Mar 2022 01:28:59 +0000 (09:28 +0800)]
staging: r8188eu: Directly return _SUCCESS instead of using local ret variable

As init_mlme_ext_priv function always returns SUCCESS , We can change
return type from int to void.

fixes coccinelle warning:
./drivers/staging/r8188eu/core/rtw_mlme_ext.c:357:5-8: Unneeded variable: "res".
 Return "_SUCCESS" on line 380

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Haowen Bai <baihaowen@meizu.com>
Link: https://lore.kernel.org/r/1648603740-14760-1-git-send-email-baihaowen@meizu.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: rts5208: Convert kmap() to kmap_local_page()
Fabio M. De Francesco [Wed, 30 Mar 2022 14:33:31 +0000 (16:33 +0200)]
staging: rts5208: Convert kmap() to kmap_local_page()

The use of kmap() is being deprecated in favor of kmap_local_page()
where it is feasible.

With kmap_local_page(), the mapping is per thread, CPU local and not
globally visible. Therefore rtsx_stor_access_xfer_buf() is a function
where the use of kmap_local_page() in place of kmap() is correctly
suited.

Convert to kmap_local_page() but, instead of open coding it, use the
helpers memcpy_to_page() and memcpy_from_page().

Make a minor change to a comment related to scatter-gather.

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
Link: https://lore.kernel.org/r/20220330143331.8306-1-fmdefrancesco@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: rtl8723bs: remove code suspect indent
Alaa Mohamed [Wed, 30 Mar 2022 17:59:49 +0000 (19:59 +0200)]
staging: rtl8723bs: remove code suspect indent

Fix "WARNING: suspect code indent for conditional
statements (16, 32)" for line 1240
founded by checkpatch.pl

Signed-off-by: Alaa Mohamed <eng.alaamohamedsoliman.am@gmail.com>
Link: https://lore.kernel.org/r/20220330175949.95564-1-eng.alaamohamedsoliman.am@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: remove unnecessary spaces
Rebecca Mckeever [Wed, 30 Mar 2022 13:07:36 +0000 (08:07 -0500)]
staging: r8188eu: remove unnecessary spaces

Conform to Linux kernel coding style. Issue found by checkpatch:

WARNING: Statements should start on a tabstop

Signed-off-by: Rebecca Mckeever <remckee0@gmail.com>
Link: https://lore.kernel.org/r/YkRWGCmMytlqgvkZ@bertie
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: wfx: remove space at the start of the line
Jaehee Park [Tue, 29 Mar 2022 22:25:34 +0000 (18:25 -0400)]
staging: wfx: remove space at the start of the line

Remove spaces at the start of the line to follow the linux kernel
coding style. Issue found by checkpatch:
WARNING: please, no spaces at the start of a line.

Signed-off-by: Jaehee Park <jhpark1013@gmail.com>
Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20220329222534.GA1002253@jaehee-ThinkPad-X1-Extreme
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: convert rtw_inc_and_chk_continual_urb_error() to bool
Michael Straube [Tue, 29 Mar 2022 10:37:56 +0000 (12:37 +0200)]
staging: r8188eu: convert rtw_inc_and_chk_continual_urb_error() to bool

Function rtw_inc_and_chk_continual_urb_error() returns boolean values.
Change its return type from int to bool.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220329103756.6740-5-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: convert rtw_usb_bulk_size_boundary() to bool
Michael Straube [Tue, 29 Mar 2022 10:37:55 +0000 (12:37 +0200)]
staging: r8188eu: convert rtw_usb_bulk_size_boundary() to bool

Function rtw_usb_bulk_size_boundary() returns boolean values.
Change its return type from u8 to bool.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220329103756.6740-4-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: refactor rtw_inc_and_chk_continual_urb_error()
Michael Straube [Tue, 29 Mar 2022 10:37:54 +0000 (12:37 +0200)]
staging: r8188eu: refactor rtw_inc_and_chk_continual_urb_error()

Refactor rtw_inc_and_chk_continual_urb_error(). Return directly
instead of using a return variable and initialize the variable 'value'
at declaration. This shortens the code and improves readability.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220329103756.6740-3-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: refactor rtw_usb_bulk_size_boundary()
Michael Straube [Tue, 29 Mar 2022 10:37:53 +0000 (12:37 +0200)]
staging: r8188eu: refactor rtw_usb_bulk_size_boundary()

Using ternary operator to set a variable to true or false is not
needed. Convert two such uses of ternary operator in
rtw_usb_bulk_size_boundary() to just use the condition and return the
value directly instead of using a return variable. This shortens the
code and improves readability. While at it, remove an unneeded line
break from the function head.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220329103756.6740-2-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: use ieee80211 define for fragment number
Martin Kaiser [Sun, 27 Mar 2022 18:09:44 +0000 (20:09 +0200)]
staging: r8188eu: use ieee80211 define for fragment number

Use the IEEE80211_SCTL_FRAG define to extract the fragment number from an
incoming frame.

pattrib->frag_num must be in host endianness, we have to convert
hdr->seq_ctrl, this field is little-endian.

Remove the local GetFragNum macro, it is not used any more.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220327180944.712545-10-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: use ieee80211 macro for sequence number
Martin Kaiser [Sun, 27 Mar 2022 18:09:43 +0000 (20:09 +0200)]
staging: r8188eu: use ieee80211 macro for sequence number

Use the IEEE80211_SEQ_TO_SN macro in function validate_recv_frame to get
the sequence number of an incoming frame.

Map the incoming rx bytes to a struct ieee80211_hdr. Replace the fc
variable with struct ieee80211_hdr's frame control component.

The IEEE80211_SEQ_TO_SN macro takes the sequence control field of an
ieee80211 header and extracts the sequence number. The macro's input
parameter must be in host endianness, the sequence number in the 80211
header is little-endian, we have to convert it to host endianness.

Remove the local GetSequence macro, it is not used any more.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220327180944.712545-9-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: remove unused control frame subtypes
Martin Kaiser [Sun, 27 Mar 2022 18:09:42 +0000 (20:09 +0200)]
staging: r8188eu: remove unused control frame subtypes

Remove unused defines for control frame subtypes.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220327180944.712545-8-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: remove unused data frame subtypes
Martin Kaiser [Sun, 27 Mar 2022 18:09:41 +0000 (20:09 +0200)]
staging: r8188eu: remove unused data frame subtypes

Remove unused defines for data frame subtypes.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220327180944.712545-7-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: use standard mechanisms for qos data frames
Martin Kaiser [Sun, 27 Mar 2022 18:09:40 +0000 (20:09 +0200)]
staging: r8188eu: use standard mechanisms for qos data frames

Use defines and macros from ieee80211.h to check for qos data frames and
to mark a frame as qos data.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220327180944.712545-6-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: use standard mechanisms for data frames
Martin Kaiser [Sun, 27 Mar 2022 18:09:39 +0000 (20:09 +0200)]
staging: r8188eu: use standard mechanisms for data frames

Use defines and macros from ieee80211.h to check for data frames and
to define data frame subtypes.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220327180944.712545-5-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: use standard mechanisms for control frames
Martin Kaiser [Sun, 27 Mar 2022 18:09:38 +0000 (20:09 +0200)]
staging: r8188eu: use standard mechanisms for control frames

Use defines and macros from ieee80211.h to check for control frames and
to define control frame subtypes.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220327180944.712545-4-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: use ieee80211 helper to read the pwr bit
Martin Kaiser [Sun, 27 Mar 2022 18:09:37 +0000 (20:09 +0200)]
staging: r8188eu: use ieee80211 helper to read the pwr bit

Use the ieee80211 helper to read the power management bit.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220327180944.712545-3-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: use ieee80211 define for version check
Martin Kaiser [Sun, 27 Mar 2022 18:09:36 +0000 (20:09 +0200)]
staging: r8188eu: use ieee80211 define for version check

Use the IEEE80211_FCTL_VERS define to check the version number
of a received frame.

Covert IEEE80211_FCTL_VERS to le16 before using it as a mask for fc,
which is also an le16 value. The ieee80211_... helper functions use
the same approach.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220327180944.712545-2-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: remove empty rtw_fwdbg_event_callback
Martin Kaiser [Tue, 22 Mar 2022 20:24:39 +0000 (21:24 +0100)]
staging: r8188eu: remove empty rtw_fwdbg_event_callback

Remove the empty function rtw_fwdbg_event_callback.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220322202439.157999-5-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: remove empty rtw_dummy_event_callback
Martin Kaiser [Tue, 22 Mar 2022 20:24:38 +0000 (21:24 +0100)]
staging: r8188eu: remove empty rtw_dummy_event_callback

Remove the empty function rtw_dummy_event_callback.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220322202439.157999-4-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: the MCS_rate_2R array is not used
Martin Kaiser [Tue, 22 Mar 2022 20:24:37 +0000 (21:24 +0100)]
staging: r8188eu: the MCS_rate_2R array is not used

The MCS_rate_2R array is not used in the r8188eu driver. Remove it.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220322202439.157999-3-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: make _rtw_init_mlme_priv static
Martin Kaiser [Tue, 22 Mar 2022 20:24:36 +0000 (21:24 +0100)]
staging: r8188eu: make _rtw_init_mlme_priv static

The _rtw_init_mlme_priv function is used only in rtw_mlme.c.
It can be declared as static.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220322202439.157999-2-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: vchiq: replace usage of found with dedicated list iterator variable
Jakob Koschel [Thu, 24 Mar 2022 07:30:24 +0000 (08:30 +0100)]
staging: vchiq: replace usage of found with dedicated list iterator variable

To move the list iterator variable into the list_for_each_entry_*()
macro in the future it should be avoided to use the list iterator
variable after the loop body.

To *never* use the list iterator variable after the loop it was
concluded to use a separate iterator variable instead of a
found boolean [1].

This removes the need to use a found variable and simply checking if
the variable was set, can determine if the break/goto was hit.

Link: https://lore.kernel.org/all/CAHk-=wgRr_D8CB-D9Kg-c=EHreAsk5SqXPwr9Y7k9sA6cWXJ6w@mail.gmail.com/
Signed-off-by: Jakob Koschel <jakobkoschel@gmail.com>
Link: https://lore.kernel.org/r/20220324073024.65943-1-jakobkoschel@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: refactor dm func set and clear
Martin Kaiser [Mon, 21 Mar 2022 20:30:31 +0000 (21:30 +0100)]
staging: r8188eu: refactor dm func set and clear

Refactor the code to set and clear "dm functions".

The only remaining callers of Switch_DM_Func use
Switch_DM_Func(padapter, DYNAMIC_ALL_FUNC_ENABLE, true) or
Switch_DM_Func(padapter, DYNAMIC_FUNC_DISABLE, false).

Remove Switch_DM_Func and call SetHwReg8188EU directly.

For HW_VAR_DM_FUNC_SET, the parameter is always DYNAMIC_ALL_FUNC_ENABLE.
This operation resets podmpriv->SupportAbility to the initial value.
Rename HW_VAR_DM_FUNC_SET to HW_VAR_DM_FUNC_RESET and drop the unused
else branch.

For HW_VAR_DM_FUNC_CLR, the parameter is always DYNAMIC_FUNC_DISABLE
(0x00). We can set podmpriv->SupportAbility to 0 directly.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220321203031.143486-7-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: DYNAMIC_RF_CALIBRATION is not used
Martin Kaiser [Mon, 21 Mar 2022 20:30:30 +0000 (21:30 +0100)]
staging: r8188eu: DYNAMIC_RF_CALIBRATION is not used

Remove the DYNAMIC_RF_CALIBRATION capability. It's cleared in one place
but never checked.

DYNAMIC_RF_CALIBRATION is part of podmpriv->SupportAbility, there are no
users that check SupportAbility as a whole and use DYNAMIC_RF_CALIBRATION
implicitly.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220321203031.143486-6-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: DYNAMIC_BB_ANT_DIV is not used
Martin Kaiser [Mon, 21 Mar 2022 20:30:29 +0000 (21:30 +0100)]
staging: r8188eu: DYNAMIC_BB_ANT_DIV is not used

Remove the DYNAMIC_BB_ANT_DIV capability. It's cleared in one place but
never checked.

DYNAMIC_BB_ANT_DIV is part of podmpriv->SupportAbility, there are no
users that check SupportAbility as a whole and use DYNAMIC_BB_ANT_DIV
implicitly.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220321203031.143486-5-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: DYNAMIC_BB_DYNAMIC_TXPWR is not used
Martin Kaiser [Mon, 21 Mar 2022 20:30:28 +0000 (21:30 +0100)]
staging: r8188eu: DYNAMIC_BB_DYNAMIC_TXPWR is not used

Remove the DYNAMIC_BB_DYNAMIC_TXPWR capability. It is cleared but not used.

DYNAMIC_BB_DYNAMIC_TXPWR defines a bit in podmpriv->SupportAbility that's
set or cleared. There's no code that checks this bit explicitly.

There's also no code that makes a copy of SupportAbility and checks the
DYNAMIC_BB_DYNAMIC_TXPWR in the copy. SupportAbility is copied to
podmpriv->BK_SupportAbility. The only use of BK_SupportAbility is to
restore a previously saved value. The other remaining reader of
SupportAbility is a private debug ioctl.

It's safe to assume that DYNAMIC_BB_DYNAMIC_TXPWR is not used, not even
indirectly.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220321203031.143486-4-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: remove unused defines for dynamic functions
Martin Kaiser [Mon, 21 Mar 2022 20:30:27 +0000 (21:30 +0100)]
staging: r8188eu: remove unused defines for dynamic functions

Remove a couple of DYNAMIC_BB_... defines which are not used
by this driver.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220321203031.143486-3-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: remove two limit defines
Martin Kaiser [Mon, 21 Mar 2022 20:30:26 +0000 (21:30 +0100)]
staging: r8188eu: remove two limit defines

Remove two unused defines related to limits.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220321203031.143486-2-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: remove local BIT macro
Martin Kaiser [Sat, 19 Mar 2022 18:03:42 +0000 (19:03 +0100)]
staging: r8188eu: remove local BIT macro

The r8188eu driver defines a local BIT(x) macro. Remove this local macro
and use the one from include/linux/bits.h.

The global BIT macro returns an unsigned long value, the removed local
BIT macro used a signed int.

DYNAMIC_BB_DYNAMIC_TXPWR is defined as BIT(2), ~DYNAMIC_BB_DYNAMIC_TXPWR
is passed to Switch_DM_Func as a u32 parameter. We need a cast in this
case as ~DYNAMIC_BB_DYNAMIC_TXPWR is a 64-bit value on x86_64 systems.

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220319180342.3143734-1-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: greybus: codecs: fix type confusion of list iterator variable
Jakob Koschel [Mon, 21 Mar 2022 12:36:26 +0000 (13:36 +0100)]
staging: greybus: codecs: fix type confusion of list iterator variable

If the list does not exit early then data == NULL and 'module' does not
point to a valid list element.
Using 'module' in such a case is not valid and was therefore removed.

Fixes: 6dd67645f22c ("greybus: audio: Use single codec driver registration")
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Vaibhav Agarwal <vaibhav.sr@gmail.com>
Reviewed-by: Mark Greer <mgreer@animalcreek.com>
Signed-off-by: Jakob Koschel <jakobkoschel@gmail.com>
Link: https://lore.kernel.org/r/20220321123626.3068639-1-jakobkoschel@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: greybus: codecs: use dedicated list iterator variable
Jakob Koschel [Mon, 21 Mar 2022 12:37:12 +0000 (13:37 +0100)]
staging: greybus: codecs: use dedicated list iterator variable

In preparation to limit the scope of the list iterator to the list
traversal loop, use a dedicated pointer to point to the found element [1].

Link: https://lore.kernel.org/all/YhdfEIwI4EdtHdym@kroah.com/
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Vaibhav Agarwal <vaibhav.sr@gmail.com>
Reviewed-by: Mark Greer <mgreer@animalcreek.com>
Signed-off-by: Jakob Koschel <jakobkoschel@gmail.com>
Link: https://lore.kernel.org/r/20220321123712.3068778-1-jakobkoschel@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: vt6656: Fix multiple blank lines warning
Sathish Kumar [Tue, 22 Mar 2022 08:43:34 +0000 (14:13 +0530)]
staging: vt6656: Fix multiple blank lines warning

This patch fixes the checkpatch.pl warnings like:
CHECK: Please don't use multiple blank lines
+
+

Signed-off-by: Sathish Kumar <skumark1902@gmail.com>
Link: https://lore.kernel.org/r/20220322084334.4077-1-skumark1902@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: rtl8712: Use completions for signaling
Sathish Kumar [Wed, 23 Mar 2022 04:55:15 +0000 (10:25 +0530)]
staging: rtl8712: Use completions for signaling

r8712_sitesurvey_cmd() uses a variable to notify r8712_SetFilter() that it
has completed operation. There is no sort of assurance that the variable will
actually change and it could cache the value the first time it is read and
then never update it for the whole loop logic.

Use completion variables because they are better suited for the purpose.

This patch fixes the checkpatch.pl warnings like:
CHECK: Avoid CamelCase: <blnEnableRxFF0Filter>
+   u8 blnEnableRxFF0Filter;

Reviewed-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
Signed-off-by: Sathish Kumar <skumark1902@gmail.com>
Link: https://lore.kernel.org/r/20220323045515.2513-1-skumark1902@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: rtl8723bs: Change rtw_ndev_notifier_call message to dbg
Chris Morgan [Wed, 23 Mar 2022 15:42:37 +0000 (10:42 -0500)]
staging: rtl8723bs: Change rtw_ndev_notifier_call message to dbg

The message received in the kernel log for the state of the notifier
call doesn't seem to be of much help to end users. Changing the message
type from info to dbg to hide the message unless you are debugging
the kernel or the network subsystem.

Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
Link: https://lore.kernel.org/r/20220323154237.21736-1-macroalpha82@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: rtl8723bs: Remove redundant else branches.
Sevinj Aghayeva [Tue, 29 Mar 2022 14:09:04 +0000 (07:09 -0700)]
staging: rtl8723bs: Remove redundant else branches.

This patch fixes the following checkpatch.pl warning:

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

Signed-off-by: Sevinj Aghayeva <sevinj.aghayeva@gmail.com>
Link: https://lore.kernel.org/r/20220329140904.GA3566@ubuntu
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: fix suspect code indent for conditional statements
Rebecca Mckeever [Tue, 29 Mar 2022 07:53:36 +0000 (02:53 -0500)]
staging: r8188eu: fix suspect code indent for conditional statements

Align the if and else if branches of the conditional statement
to improve readability. Prevent bugs that could be introduced
if developers misread the code. Issue found by checkpatch.

Signed-off-by: Rebecca Mckeever <remckee0@gmail.com>
Link: https://lore.kernel.org/r/YkK7ABTVt0TCbd18@bertie
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agoLinux 5.18-rc1
Linus Torvalds [Sun, 3 Apr 2022 21:08:21 +0000 (14:08 -0700)]
Linux 5.18-rc1

2 years agoMerge tag 'trace-v5.18-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt...
Linus Torvalds [Sun, 3 Apr 2022 19:26:01 +0000 (12:26 -0700)]
Merge tag 'trace-v5.18-2' of git://git./linux/kernel/git/rostedt/linux-trace

Pull more tracing updates from Steven Rostedt:

 - Rename the staging files to give them some meaning. Just
   stage1,stag2,etc, does not show what they are for

 - Check for NULL from allocation in bootconfig

 - Hold event mutex for dyn_event call in user events

 - Mark user events to broken (to work on the API)

 - Remove eBPF updates from user events

 - Remove user events from uapi header to keep it from being installed.

 - Move ftrace_graph_is_dead() into inline as it is called from hot
   paths and also convert it into a static branch.

* tag 'trace-v5.18-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
  tracing: Move user_events.h temporarily out of include/uapi
  ftrace: Make ftrace_graph_is_dead() a static branch
  tracing: Set user_events to BROKEN
  tracing/user_events: Remove eBPF interfaces
  tracing/user_events: Hold event_mutex during dyn_event_add
  proc: bootconfig: Add null pointer check
  tracing: Rename the staging files for trace_events

2 years agoMerge tag 'clk-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux
Linus Torvalds [Sun, 3 Apr 2022 19:21:14 +0000 (12:21 -0700)]
Merge tag 'clk-for-linus' of git://git./linux/kernel/git/clk/linux

Pull clk fix from Stephen Boyd:
 "A single revert to fix a boot regression seen when clk_put() started
  dropping rate range requests. It's best to keep various systems
  booting so we'll kick this out and try again next time"

* tag 'clk-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux:
  Revert "clk: Drop the rate range on clk_put()"

2 years agoMerge tag 'x86-urgent-2022-04-03' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Sun, 3 Apr 2022 19:15:47 +0000 (12:15 -0700)]
Merge tag 'x86-urgent-2022-04-03' of git://git./linux/kernel/git/tip/tip

Pull x86 fixes from Thomas Gleixner:
 "A set of x86 fixes and updates:

   - Make the prctl() for enabling dynamic XSTATE components correct so
     it adds the newly requested feature to the permission bitmap
     instead of overwriting it. Add a selftest which validates that.

   - Unroll string MMIO for encrypted SEV guests as the hypervisor
     cannot emulate it.

   - Handle supervisor states correctly in the FPU/XSTATE code so it
     takes the feature set of the fpstate buffer into account. The
     feature sets can differ between host and guest buffers. Guest
     buffers do not contain supervisor states. So far this was not an
     issue, but with enabling PASID it needs to be handled in the buffer
     offset calculation and in the permission bitmaps.

   - Avoid a gazillion of repeated CPUID invocations in by caching the
     values early in the FPU/XSTATE code.

   - Enable CONFIG_WERROR in x86 defconfig.

   - Make the X86 defconfigs more useful by adapting them to Y2022
     reality"

* tag 'x86-urgent-2022-04-03' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/fpu/xstate: Consolidate size calculations
  x86/fpu/xstate: Handle supervisor states in XSTATE permissions
  x86/fpu/xsave: Handle compacted offsets correctly with supervisor states
  x86/fpu: Cache xfeature flags from CPUID
  x86/fpu/xsave: Initialize offset/size cache early
  x86/fpu: Remove unused supervisor only offsets
  x86/fpu: Remove redundant XCOMP_BV initialization
  x86/sev: Unroll string mmio with CC_ATTR_GUEST_UNROLL_STRING_IO
  x86/config: Make the x86 defconfigs a bit more usable
  x86/defconfig: Enable WERROR
  selftests/x86/amx: Update the ARCH_REQ_XCOMP_PERM test
  x86/fpu/xstate: Fix the ARCH_REQ_XCOMP_PERM implementation

2 years agoMerge tag 'core-urgent-2022-04-03' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Sun, 3 Apr 2022 19:08:26 +0000 (12:08 -0700)]
Merge tag 'core-urgent-2022-04-03' of git://git./linux/kernel/git/tip/tip

Pull RT signal fix from Thomas Gleixner:
 "Revert the RT related signal changes. They need to be reworked and
  generalized"

* tag 'core-urgent-2022-04-03' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  Revert "signal, x86: Delay calling signals in atomic on RT enabled kernels"

2 years agoMerge tag 'dma-mapping-5.18-1' of git://git.infradead.org/users/hch/dma-mapping
Linus Torvalds [Sun, 3 Apr 2022 17:31:00 +0000 (10:31 -0700)]
Merge tag 'dma-mapping-5.18-1' of git://git.infradead.org/users/hch/dma-mapping

Pull more dma-mapping updates from Christoph Hellwig:

 - fix a regression in dma remap handling vs AMD memory encryption (me)

 - finally kill off the legacy PCI DMA API (Christophe JAILLET)

* tag 'dma-mapping-5.18-1' of git://git.infradead.org/users/hch/dma-mapping:
  dma-mapping: move pgprot_decrypted out of dma_pgprot
  PCI/doc: cleanup references to the legacy PCI DMA API
  PCI: Remove the deprecated "pci-dma-compat.h" API

2 years agoMerge tag 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm
Linus Torvalds [Sun, 3 Apr 2022 17:17:48 +0000 (10:17 -0700)]
Merge tag 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm

Pull ARM fixes from Russell King:

 - avoid unnecessary rebuilds for library objects

 - fix return value of __setup handlers

 - fix invalid input check for "crashkernel=" kernel option

 - silence KASAN warnings in unwind_frame

* tag 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm:
  ARM: 9191/1: arm/stacktrace, kasan: Silence KASAN warnings in unwind_frame()
  ARM: 9190/1: kdump: add invalid input check for 'crashkernel=0'
  ARM: 9187/1: JIVE: fix return value of __setup handler
  ARM: 9189/1: decompressor: fix unneeded rebuilds of library objects

2 years agoRevert "clk: Drop the rate range on clk_put()"
Stephen Boyd [Sun, 3 Apr 2022 02:28:18 +0000 (19:28 -0700)]
Revert "clk: Drop the rate range on clk_put()"

This reverts commit 7dabfa2bc4803eed83d6f22bd6f045495f40636b. There are
multiple reports that this breaks boot on various systems. The common
theme is that orphan clks are having rates set on them when that isn't
expected. Let's revert it out for now so that -rc1 boots.

Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reported-by: Tony Lindgren <tony@atomide.com>
Reported-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Reported-by: Naresh Kamboju <naresh.kamboju@linaro.org>
Link: https://lore.kernel.org/r/366a0232-bb4a-c357-6aa8-636e398e05eb@samsung.com
Cc: Maxime Ripard <maxime@cerno.tech>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Link: https://lore.kernel.org/r/20220403022818.39572-1-sboyd@kernel.org
2 years agoMerge tag 'perf-tools-for-v5.18-2022-04-02' of git://git.kernel.org/pub/scm/linux...
Linus Torvalds [Sat, 2 Apr 2022 19:57:17 +0000 (12:57 -0700)]
Merge tag 'perf-tools-for-v5.18-2022-04-02' of git://git./linux/kernel/git/acme/linux

Pull more perf tools updates from Arnaldo Carvalho de Melo:

 - Avoid SEGV if core.cpus isn't set in 'perf stat'.

 - Stop depending on .git files for building PERF-VERSION-FILE, used in
   'perf --version', fixing some perf tools build scenarios.

 - Convert tracepoint.py example to python3.

 - Update UAPI header copies from the kernel sources: socket,
   mman-common, msr-index, KVM, i915 and cpufeatures.

 - Update copy of libbpf's hashmap.c.

 - Directly return instead of using local ret variable in
   evlist__create_syswide_maps(), found by coccinelle.

* tag 'perf-tools-for-v5.18-2022-04-02' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux:
  perf python: Convert tracepoint.py example to python3
  perf evlist: Directly return instead of using local ret variable
  perf cpumap: More cpu map reuse by merge.
  perf cpumap: Add is_subset function
  perf evlist: Rename cpus to user_requested_cpus
  perf tools: Stop depending on .git files for building PERF-VERSION-FILE
  tools headers cpufeatures: Sync with the kernel sources
  tools headers UAPI: Sync drm/i915_drm.h with the kernel sources
  tools headers UAPI: Sync linux/kvm.h with the kernel sources
  tools kvm headers arm64: Update KVM headers from the kernel sources
  tools arch x86: Sync the msr-index.h copy with the kernel sources
  tools headers UAPI: Sync asm-generic/mman-common.h with the kernel
  perf beauty: Update copy of linux/socket.h with the kernel sources
  perf tools: Update copy of libbpf's hashmap.c
  perf stat: Avoid SEGV if core.cpus isn't set

2 years agoMerge tag 'kbuild-fixes-v5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/masah...
Linus Torvalds [Sat, 2 Apr 2022 19:33:31 +0000 (12:33 -0700)]
Merge tag 'kbuild-fixes-v5.18' of git://git./linux/kernel/git/masahiroy/linux-kbuild

Pull Kbuild fixes from Masahiro Yamada:

 - Fix empty $(PYTHON) expansion.

 - Fix UML, which got broken by the attempt to suppress Clang warnings.

 - Fix warning message in modpost.

* tag 'kbuild-fixes-v5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
  modpost: restore the warning message for missing symbol versions
  Revert "um: clang: Strip out -mno-global-merge from USER_CFLAGS"
  kbuild: Remove '-mno-global-merge'
  kbuild: fix empty ${PYTHON} in scripts/link-vmlinux.sh
  kconfig: remove stale comment about removed kconfig_print_symbol()

2 years agoMerge tag 'mips_5.18_1' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux
Linus Torvalds [Sat, 2 Apr 2022 19:14:38 +0000 (12:14 -0700)]
Merge tag 'mips_5.18_1' of git://git./linux/kernel/git/mips/linux

Pull MIPS fixes from Thomas Bogendoerfer:

 - build fix for gpio

 - fix crc32 build problems

 - check for failed memory allocations

* tag 'mips_5.18_1' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux:
  MIPS: crypto: Fix CRC32 code
  MIPS: rb532: move GPIOD definition into C-files
  MIPS: lantiq: check the return value of kzalloc()
  mips: sgi-ip22: add a check for the return of kzalloc()

2 years agoMerge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm
Linus Torvalds [Sat, 2 Apr 2022 19:09:02 +0000 (12:09 -0700)]
Merge tag 'for-linus' of git://git./virt/kvm/kvm

Pull kvm fixes from Paolo Bonzini:

 - Only do MSR filtering for MSRs accessed by rdmsr/wrmsr

 - Documentation improvements

 - Prevent module exit until all VMs are freed

 - PMU Virtualization fixes

 - Fix for kvm_irq_delivery_to_apic_fast() NULL-pointer dereferences

 - Other miscellaneous bugfixes

* tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm: (42 commits)
  KVM: x86: fix sending PV IPI
  KVM: x86/mmu: do compare-and-exchange of gPTE via the user address
  KVM: x86: Remove redundant vm_entry_controls_clearbit() call
  KVM: x86: cleanup enter_rmode()
  KVM: x86: SVM: fix tsc scaling when the host doesn't support it
  kvm: x86: SVM: remove unused defines
  KVM: x86: SVM: move tsc ratio definitions to svm.h
  KVM: x86: SVM: fix avic spec based definitions again
  KVM: MIPS: remove reference to trap&emulate virtualization
  KVM: x86: document limitations of MSR filtering
  KVM: x86: Only do MSR filtering when access MSR by rdmsr/wrmsr
  KVM: x86/emulator: Emulate RDPID only if it is enabled in guest
  KVM: x86/pmu: Fix and isolate TSX-specific performance event logic
  KVM: x86: mmu: trace kvm_mmu_set_spte after the new SPTE was set
  KVM: x86/svm: Clear reserved bits written to PerfEvtSeln MSRs
  KVM: x86: Trace all APICv inhibit changes and capture overall status
  KVM: x86: Add wrappers for setting/clearing APICv inhibits
  KVM: x86: Make APICv inhibit reasons an enum and cleanup naming
  KVM: X86: Handle implicit supervisor access with SMAP
  KVM: X86: Rename variable smap to not_smap in permission_fault()
  ...

2 years agomodpost: restore the warning message for missing symbol versions
Masahiro Yamada [Fri, 1 Apr 2022 15:56:10 +0000 (00:56 +0900)]
modpost: restore the warning message for missing symbol versions

This log message was accidentally chopped off.

I was wondering why this happened, but checking the ML log, Mark
precisely followed my suggestion [1].

I just used "..." because I was too lazy to type the sentence fully.
Sorry for the confusion.

[1]: https://lore.kernel.org/all/CAK7LNAR6bXXk9-ZzZYpTqzFqdYbQsZHmiWspu27rtsFxvfRuVA@mail.gmail.com/

Fixes: 4a6795933a89 ("kbuild: modpost: Explicitly warn about unprototyped symbols")
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Acked-by: Mark Brown <broonie@kernel.org>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
2 years agoMerge tag 'for-5.18/drivers-2022-04-02' of git://git.kernel.dk/linux-block
Linus Torvalds [Sat, 2 Apr 2022 18:03:03 +0000 (11:03 -0700)]
Merge tag 'for-5.18/drivers-2022-04-02' of git://git.kernel.dk/linux-block

Pull block driver fix from Jens Axboe:
 "Got two reports on nbd spewing warnings on load now, which is a
  regression from a commit that went into your tree yesterday.

  Revert the problematic change for now"

* tag 'for-5.18/drivers-2022-04-02' of git://git.kernel.dk/linux-block:
  Revert "nbd: fix possible overflow on 'first_minor' in nbd_dev_add()"

2 years agoMerge tag 'pci-v5.18-changes-2' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Sat, 2 Apr 2022 17:54:52 +0000 (10:54 -0700)]
Merge tag 'pci-v5.18-changes-2' of git://git./linux/kernel/git/helgaas/pci

Pull pci fix from Bjorn Helgaas:

 - Fix Hyper-V "defined but not used" build issue added during merge
   window (YueHaibing)

* tag 'pci-v5.18-changes-2' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci:
  PCI: hv: Remove unused hv_set_msi_entry_from_desc()

2 years agoMerge tag 'tag-chrome-platform-for-v5.18' of git://git.kernel.org/pub/scm/linux/kerne...
Linus Torvalds [Sat, 2 Apr 2022 17:44:18 +0000 (10:44 -0700)]
Merge tag 'tag-chrome-platform-for-v5.18' of git://git./linux/kernel/git/chrome-platform/linux

Pull chrome platform updates from Benson Leung:
 "cros_ec_typec:

   - Check for EC device - Fix a crash when using the cros_ec_typec
     driver on older hardware not capable of typec commands

   - Make try power role optional

   - Mux configuration reorganization series from Prashant

  cros_ec_debugfs:

   - Fix use after free. Thanks Tzung-bi

  sensorhub:

   - cros_ec_sensorhub fixup - Split trace include file

  misc:

   - Add new mailing list for chrome-platform development:

chrome-platform@lists.linux.dev

     Now with patchwork!"

* tag 'tag-chrome-platform-for-v5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux:
  platform/chrome: cros_ec_debugfs: detach log reader wq from devm
  platform: chrome: Split trace include file
  platform/chrome: cros_ec_typec: Update mux flags during partner removal
  platform/chrome: cros_ec_typec: Configure muxes at start of port update
  platform/chrome: cros_ec_typec: Get mux state inside configure_mux
  platform/chrome: cros_ec_typec: Move mux flag checks
  platform/chrome: cros_ec_typec: Check for EC device
  platform/chrome: cros_ec_typec: Make try power role optional
  MAINTAINERS: platform-chrome: Add new chrome-platform@lists.linux.dev list

2 years agoRevert "nbd: fix possible overflow on 'first_minor' in nbd_dev_add()"
Jens Axboe [Sat, 2 Apr 2022 17:40:23 +0000 (11:40 -0600)]
Revert "nbd: fix possible overflow on 'first_minor' in nbd_dev_add()"

This reverts commit 6d35d04a9e18990040e87d2bbf72689252669d54.

Both Gabriel and Borislav report that this commit casues a regression
with nbd:

sysfs: cannot create duplicate filename '/dev/block/43:0'

Revert it before 5.18-rc1 and we'll investigage this separately in
due time.

Link: https://lore.kernel.org/all/YkiJTnFOt9bTv6A2@zn.tnic/
Reported-by: Gabriel L. Somlo <somlo@cmu.edu>
Reported-by: Borislav Petkov <bp@alien8.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2 years agowatch_queue: Free the page array when watch_queue is dismantled
Eric Dumazet [Mon, 28 Mar 2022 17:07:04 +0000 (18:07 +0100)]
watch_queue: Free the page array when watch_queue is dismantled

Commit 7ea1a0124b6d ("watch_queue: Free the alloc bitmap when the
watch_queue is torn down") took care of the bitmap, but not the page
array.

  BUG: memory leak
  unreferenced object 0xffff88810d9bc140 (size 32):
  comm "syz-executor335", pid 3603, jiffies 4294946994 (age 12.840s)
  hex dump (first 32 bytes):
    40 a7 40 04 00 ea ff ff 00 00 00 00 00 00 00 00  @.@.............
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  backtrace:
     kmalloc_array include/linux/slab.h:621 [inline]
     kcalloc include/linux/slab.h:652 [inline]
     watch_queue_set_size+0x12f/0x2e0 kernel/watch_queue.c:251
     pipe_ioctl+0x82/0x140 fs/pipe.c:632
     vfs_ioctl fs/ioctl.c:51 [inline]
     __do_sys_ioctl fs/ioctl.c:874 [inline]
     __se_sys_ioctl fs/ioctl.c:860 [inline]
     __x64_sys_ioctl+0xfc/0x140 fs/ioctl.c:860
     do_syscall_x64 arch/x86/entry/common.c:50 [inline]

Reported-by: syzbot+25ea042ae28f3888727a@syzkaller.appspotmail.com
Fixes: c73be61cede5 ("pipe: Add general notification queue support")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Cc: Jann Horn <jannh@google.com>
Link: https://lore.kernel.org/r/20220322004654.618274-1-eric.dumazet@gmail.com/
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2 years agotracing: mark user_events as BROKEN
Steven Rostedt (Google) [Fri, 1 Apr 2022 18:39:03 +0000 (14:39 -0400)]
tracing: mark user_events as BROKEN

After being merged, user_events become more visible to a wider audience
that have concerns with the current API.

It is too late to fix this for this release, but instead of a full
revert, just mark it as BROKEN (which prevents it from being selected in
make config).  Then we can work finding a better API.  If that fails,
then it will need to be completely reverted.

To not have the code silently bitrot, still allow building it with
COMPILE_TEST.

And to prevent the uapi header from being installed, then later changed,
and then have an old distro user space see the old version, move the
header file out of the uapi directory.

Surround the include with CONFIG_COMPILE_TEST to the current location,
but when the BROKEN tag is taken off, it will use the uapi directory,
and fail to compile.  This is a good way to remind us to move the header
back.

Link: https://lore.kernel.org/all/20220330155835.5e1f6669@gandalf.local.home
Link: https://lkml.kernel.org/r/20220330201755.29319-1-mathieu.desnoyers@efficios.com
Suggested-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2 years agotracing: Move user_events.h temporarily out of include/uapi
Steven Rostedt (Google) [Fri, 1 Apr 2022 18:39:03 +0000 (14:39 -0400)]
tracing: Move user_events.h temporarily out of include/uapi

While user_events API is under development and has been marked for broken
to not let the API become fixed, move the header file out of the uapi
directory. This is to prevent it from being installed, then later changed,
and then have an old distro user space update with a new kernel, where
applications see the user_events being available, but the old header is in
place, and then they get compiled incorrectly.

Also, surround the include with CONFIG_COMPILE_TEST to the current
location, but when the BROKEN tag is taken off, it will use the uapi
directory, and fail to compile. This is a good way to remind us to move
the header back.

Link: https://lore.kernel.org/all/20220330155835.5e1f6669@gandalf.local.home
Link: https://lkml.kernel.org/r/20220330201755.29319-1-mathieu.desnoyers@efficios.com
Link: https://lkml.kernel.org/r/20220401143903.188384f3@gandalf.local.home
Suggested-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
2 years agoftrace: Make ftrace_graph_is_dead() a static branch
Christophe Leroy [Wed, 30 Mar 2022 07:00:19 +0000 (09:00 +0200)]
ftrace: Make ftrace_graph_is_dead() a static branch

ftrace_graph_is_dead() is used on hot paths, it just reads a variable
in memory and is not worth suffering function call constraints.

For instance, at entry of prepare_ftrace_return(), inlining it avoids
saving prepare_ftrace_return() parameters to stack and restoring them
after calling ftrace_graph_is_dead().

While at it using a static branch is even more performant and is
rather well adapted considering that the returned value will almost
never change.

Inline ftrace_graph_is_dead() and replace 'kill_ftrace_graph' bool
by a static branch.

The performance improvement is noticeable.

Link: https://lkml.kernel.org/r/e0411a6a0ed3eafff0ad2bc9cd4b0e202b4617df.1648623570.git.christophe.leroy@csgroup.eu
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
2 years agotracing: Set user_events to BROKEN
Steven Rostedt (Google) [Wed, 30 Mar 2022 19:58:35 +0000 (15:58 -0400)]
tracing: Set user_events to BROKEN

After being merged, user_events become more visible to a wider audience
that have concerns with the current API. It is too late to fix this for
this release, but instead of a full revert, just mark it as BROKEN (which
prevents it from being selected in make config). Then we can work finding
a better API. If that fails, then it will need to be completely reverted.

Link: https://lore.kernel.org/all/2059213643.196683.1648499088753.JavaMail.zimbra@efficios.com/
Link: https://lkml.kernel.org/r/20220330155835.5e1f6669@gandalf.local.home
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
2 years agotracing/user_events: Remove eBPF interfaces
Beau Belgrave [Tue, 29 Mar 2022 17:30:51 +0000 (10:30 -0700)]
tracing/user_events: Remove eBPF interfaces

Remove eBPF interfaces within user_events to ensure they are fully
reviewed.

Link: https://lore.kernel.org/all/20220329165718.GA10381@kbox/
Link: https://lkml.kernel.org/r/20220329173051.10087-1-beaub@linux.microsoft.com
Suggested-by: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Signed-off-by: Beau Belgrave <beaub@linux.microsoft.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>