platform/kernel/linux-rpi.git
2 years agostaging: r8188eu: replace the GetFrameSubType call
Martin Kaiser [Sun, 17 Apr 2022 10:22:17 +0000 (12:22 +0200)]
staging: r8188eu: replace the GetFrameSubType call

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

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

Convert everything to host endianness before we use bit operations.

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

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

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

reported by checkpatch:

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

Fix these warnings.

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

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

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

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

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

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

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

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

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

Rename the fields of struct rt_firmware_hdr to avoid camel case.

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

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

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

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

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

The size of struct rt_firmware_hdr is 36 bytes.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Fix issue reported by checkpatch:

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

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

Fix issue reported by checkpatch:

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

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

Fix issue reported by checkpatch:

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

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

Fix issue reported by checkpatch:

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

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

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

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

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

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

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

Added tabs for indent to fix the checkpatch error.

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

Remove redundant parentheses reported by checkpatch.

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

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

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

pkg_newalloc in struct recv_buf is not used. Remove it.

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

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

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

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

Merge _mgt_dispatcher into mgt_dispatcher.

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

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

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

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

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

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

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

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

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

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

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

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

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

Remove the temporary variable ips_deffer_ms and use
RTW_PWR_STATE_CHK_INTERVAL directly.

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

Use time_before to check if ips_deny_time should be updated.

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

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

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

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

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

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

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

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

rtw_pwr_wakeup should return _SUCCESS or _FAIL.

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

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

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

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

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

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

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

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

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

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

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

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

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

buffSize -> size

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

Correct a macro spelling mistake in rtw_fw.c.

MAX_REG_BOLCK_SIZE -> MAX_REG_BLOCK_SIZE

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Adhere to linux coding style.

Reported by checkpatch:

spaces preferred around that '{operator}'.

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

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

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

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

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

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

Reported by checkpatch:

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

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

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

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

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

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

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

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

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

Signed-off-by: Davidlohr Bueso <dave@stgolabs.net>
Link: https://lore.kernel.org/r/20220411151620.129178-7-dave@stgolabs.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging/rtl8712: remove event_tasklet
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>
2 years agostaging/ks7010: replace SME taslet with work
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>
2 years agostaging/wlan-ng, prism2usb: replace completion_bh tasklet with work
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>
2 years agostaging/wlan-ng, prism2usb: replace reaper_bh tasklet with work
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>
2 years agostaging/most, dim2: convert dim2_tasklet to threaded irq
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>
2 years agostaging: vt6655: Remove macro PCAvDelayByIO
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>
2 years agostaging: rtl8712: efuse: code style - avoid macro argument precedence issues
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>
2 years agostaging: r8188eu: improve timeout handling in efuse_read_phymap_from_txpktbuf
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>
2 years agostaging: r8188eu: improve timeout handling in iol_execute
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>
2 years agostaging: r8188eu: improve timeout handling in LPS_RF_ON_check
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>
2 years agostaging: r8188eu: make LPS_RF_ON_check static
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>
2 years agostaging: r8188eu: improve timeout handling in rtw_check_join_candidate
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>
2 years agostaging: r8188eu: improve timeout handling in rtl8188e_firmware_download
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>
2 years agostaging: r8188eu: summarize two if statements
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>
2 years agostaging: r8188eu: remove unnecessary rtw_get_passing_time_ms call
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>
2 years agostaging: r8188eu: no need for an else after return
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>
2 years agostaging: greybus: pwm: Drop assignment to struct pwm_chip::base
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>
2 years agostaging: r8188eu: remove HW_VAR_H2C_FW_PWRMODE
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>
2 years agostaging: r8188eu: remove HW_VAR_FIFO_CLEARN_UP
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>
2 years agostaging: r8188eu: remove HW_VAR_MLME_JOIN
Michael Straube [Sat, 9 Apr 2022 12:06:25 +0000 (14:06 +0200)]
staging: r8188eu: remove HW_VAR_MLME_JOIN

Remove the HW_VAR_MLME_JOIN case from SetHwReg8188EU() and move its
functionality to a new static function in rtw_mlme_ext.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-3-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: remove HW_VAR_INITIAL_GAIN
Michael Straube [Sat, 9 Apr 2022 12:06:24 +0000 (14:06 +0200)]
staging: r8188eu: remove HW_VAR_INITIAL_GAIN

Remove the HW_VAR_INITIAL_GAIN case from SetHwReg8188EU() and move its
functionality to a new static function in rtw_mlme_ext.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-2-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: r8188eu: convert else if to else in rtw_led.c
Michael Straube [Fri, 8 Apr 2022 16:38:25 +0000 (18:38 +0200)]
staging: r8188eu: convert else if to else in rtw_led.c

The else if in this block is redundant, it can be a simple else.

if (x) {
  ...
} else if (!x) {
  ...
}

Convert two such else if statements to simple else in rw_led.c.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20220408163825.29069-1-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agostaging: rtl8723bs: tidy up error handling
Yihao Han [Fri, 8 Apr 2022 14:44:40 +0000 (07:44 -0700)]
staging: rtl8723bs: tidy up error handling

The check for if rtw_skb_alloc() fails is done twice and is written
in a confusing way.  Move the "if (!recvbuf->pskb)" right after
the allocation.  The "if (recvbuf->pskb)" check can now be deleted
and the code pulled in one tab.

Suggested-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Yihao Han <hanyihao@vivo.com>
Link: https://lore.kernel.org/r/20220408144442.17611-1-hanyihao@vivo.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agoMerge 5.18-rc2 into staging-next
Greg Kroah-Hartman [Mon, 11 Apr 2022 06:43:42 +0000 (08:43 +0200)]
Merge 5.18-rc2 into staging-next

We need the staging fix in here as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agoLinux 5.18-rc2
Linus Torvalds [Mon, 11 Apr 2022 00:21:36 +0000 (14:21 -1000)]
Linux 5.18-rc2

2 years agoMerge tag 'tty-5.18-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
Linus Torvalds [Sun, 10 Apr 2022 20:08:50 +0000 (10:08 -1000)]
Merge tag 'tty-5.18-rc2' of git://git./linux/kernel/git/gregkh/tty

Pull serial driver fix from Greg KH:
 "This is a single serial driver fix for a build issue that showed up
  due to changes that came in through the tty tree in 5.18-rc1 that were
  missed previously. It resolves a build error with the mpc52xx_uart
  driver.

  It has been in linux-next this week with no reported problems"

* tag 'tty-5.18-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty:
  tty: serial: mpc52xx_uart: make rx/tx hooks return unsigned, part II.

2 years agoMerge tag 'staging-5.18-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh...
Linus Torvalds [Sun, 10 Apr 2022 20:04:30 +0000 (10:04 -1000)]
Merge tag 'staging-5.18-rc2' of git://git./linux/kernel/git/gregkh/staging

Pull staging driver fix from Greg KH:
 "Here is a single staging driver fix for 5.18-rc2 that resolves an
  endian issue for the r8188eu driver. It has been in linux-next all
  this week with no reported problems"

* tag 'staging-5.18-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
  staging: r8188eu: Fix PPPoE tag insertion on little endian systems

2 years agoMerge tag 'driver-core-5.18-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Sun, 10 Apr 2022 19:55:09 +0000 (09:55 -1000)]
Merge tag 'driver-core-5.18-rc2' of git://git./linux/kernel/git/gregkh/driver-core

Pull driver core updates from Greg KH:
 "Here are two small driver core changes for 5.18-rc2.

  They are the final bits in the removal of the default_attrs field in
  struct kobj_type. I had to wait until after 5.18-rc1 for all of the
  changes to do this came in through different development trees, and
  then one new user snuck in. So this series has two changes:

   - removal of the default_attrs field in the powerpc/pseries/vas code.

     The change has been acked by the PPC maintainers to come through
     this tree

   - removal of default_attrs from struct kobj_type now that all
     in-kernel users are removed.

     This cleans up the kobject code a little bit and removes some
     duplicated functionality that confused people (now there is only
     one way to do default groups)

  Both of these have been in linux-next for all of this week with no
  reported problems"

* tag 'driver-core-5.18-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core:
  kobject: kobj_type: remove default_attrs
  powerpc/pseries/vas: use default_groups in kobj_type

2 years agoMerge tag 'char-misc-5.18-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregk...
Linus Torvalds [Sun, 10 Apr 2022 19:52:46 +0000 (09:52 -1000)]
Merge tag 'char-misc-5.18-rc2' of git://git./linux/kernel/git/gregkh/char-misc

Pull char/misc driver fix from Greg KH:
 "A single driver fix. It resolves the build warning issue on 32bit
  systems in the habannalabs driver that came in during the 5.18-rc1
  merge cycle.

  It has been in linux-next for all this week with no reported problems"

* tag 'char-misc-5.18-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc:
  habanalabs: Fix test build failures

2 years agoMerge tag 'powerpc-5.18-2' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc...
Linus Torvalds [Sun, 10 Apr 2022 17:36:18 +0000 (07:36 -1000)]
Merge tag 'powerpc-5.18-2' of git://git./linux/kernel/git/powerpc/linux

Pull powerpc fixes from Michael Ellerman:

 - Fix KVM "lost kick" race, where an attempt to pull a vcpu out of the
   guest could be lost (or delayed until the next guest exit).

 - Disable SCV (system call vectored) when PR KVM guests could be run.

 - Fix KVM PR guests using SCV, by disallowing AIL != 0 for KVM PR
   guests.

 - Add a new KVM CAP to indicate if AIL == 3 is supported.

 - Fix a regression when hotplugging a CPU to a memoryless/cpuless node.

 - Make virt_addr_valid() stricter for 64-bit Book3E & 32-bit, which
   fixes crashes seen due to hardened usercopy.

 - Revert a change to max_mapnr which broke HIGHMEM.

Thanks to Christophe Leroy, Fabiano Rosas, Kefeng Wang, Nicholas Piggin,
and Srikar Dronamraju.

* tag 'powerpc-5.18-2' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
  Revert "powerpc: Set max_mapnr correctly"
  powerpc: Fix virt_addr_valid() for 64-bit Book3E & 32-bit
  KVM: PPC: Move kvmhv_on_pseries() into kvm_ppc.h
  powerpc/numa: Handle partially initialized numa nodes
  powerpc/64: Fix build failure with allyesconfig in book3s_64_entry.S
  KVM: PPC: Use KVM_CAP_PPC_AIL_MODE_3
  KVM: PPC: Book3S PR: Disallow AIL != 0
  KVM: PPC: Book3S PR: Disable SCV when AIL could be disabled
  KVM: PPC: Book3S HV P9: Fix "lost kick" race

2 years agoMerge tag 'irq-urgent-2022-04-10' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Sun, 10 Apr 2022 17:25:49 +0000 (07:25 -1000)]
Merge tag 'irq-urgent-2022-04-10' of git://git./linux/kernel/git/tip/tip

Pull irq fixes from Thomas Gleixner:
 "A set of interrupt chip driver fixes:

   - A fix for a long standing bug in the ARM GICv3 redistributor
     polling which uses the wrong bit number to test.

   - Prevent translation of bogus ACPI table entries which map device
     interrupts into the IPI space on ARM GICs.

   - Don't write into the pending register of ARM GICV4 before the scan
     in hardware has completed.

   - A set of build and correctness fixes for the Qualcomm MPM driver"

* tag 'irq-urgent-2022-04-10' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  irqchip/gic, gic-v3: Prevent GSI to SGI translations
  irqchip/gic-v3: Fix GICR_CTLR.RWP polling
  irqchip/gic-v4: Wait for GICR_VPENDBASER.Dirty to clear before descheduling
  irqchip/irq-qcom-mpm: fix return value check in qcom_mpm_init()
  irq/qcom-mpm: Fix build error without MAILBOX

2 years agoMerge tag 'x86_urgent_for_v5.18_rc2' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 10 Apr 2022 17:12:27 +0000 (07:12 -1000)]
Merge tag 'x86_urgent_for_v5.18_rc2' of git://git./linux/kernel/git/tip/tip

Pull x86 fixes from Borislav Petkov:

 - Fix the MSI message data struct definition

 - Use local labels in the exception table macros to avoid symbol
   conflicts with clang LTO builds

 - A couple of fixes to objtool checking of the relatively newly added
   SLS and IBT code

 - Rename a local var in the WARN* macro machinery to prevent shadowing

* tag 'x86_urgent_for_v5.18_rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/msi: Fix msi message data shadow struct
  x86/extable: Prefer local labels in .set directives
  x86,bpf: Avoid IBT objtool warning
  objtool: Fix SLS validation for kcov tail-call replacement
  objtool: Fix IBT tail-call detection
  x86/bug: Prevent shadowing in __WARN_FLAGS
  x86/mm/tlb: Revert retpoline avoidance approach

2 years agoMerge tag 'perf_urgent_for_v5.18_rc2' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 10 Apr 2022 17:08:22 +0000 (07:08 -1000)]
Merge tag 'perf_urgent_for_v5.18_rc2' of git://git./linux/kernel/git/tip/tip

Pull perf fixes from Borislav Petkov:

 - A couple of fixes to cgroup-related handling of perf events

 - A couple of fixes to event encoding on Sapphire Rapids

 - Pass event caps of inherited events so that perf doesn't fail wrongly
   at fork()

 - Add support for a new Raptor Lake CPU

* tag 'perf_urgent_for_v5.18_rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  perf/core: Always set cpuctx cgrp when enable cgroup event
  perf/core: Fix perf_cgroup_switch()
  perf/core: Use perf_cgroup_info->active to check if cgroup is active
  perf/core: Don't pass task around when ctx sched in
  perf/x86/intel: Update the FRONTEND MSR mask on Sapphire Rapids
  perf/x86/intel: Don't extend the pseudo-encoding to GP counters
  perf/core: Inherit event_caps
  perf/x86/uncore: Add Raptor Lake uncore support
  perf/x86/msr: Add Raptor Lake CPU support
  perf/x86/cstate: Add Raptor Lake support
  perf/x86: Add Intel Raptor Lake support

2 years agoMerge tag 'locking_urgent_for_v5.18_rc2' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 10 Apr 2022 16:56:46 +0000 (06:56 -1000)]
Merge tag 'locking_urgent_for_v5.18_rc2' of git://git./linux/kernel/git/tip/tip

Pull locking fixes from Borislav Petkov:

 - Allow the compiler to optimize away unused percpu accesses and change
   the local_lock_* macros back to inline functions

 - A couple of fixes to static call insn patching

* tag 'locking_urgent_for_v5.18_rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  Revert "mm/page_alloc: mark pagesets as __maybe_unused"
  Revert "locking/local_lock: Make the empty local_lock_*() function a macro."
  x86/percpu: Remove volatile from arch_raw_cpu_ptr().
  static_call: Remove __DEFINE_STATIC_CALL macro
  static_call: Properly initialise DEFINE_STATIC_CALL_RET0()
  static_call: Don't make __static_call_return0 static
  x86,static_call: Fix __static_call_return0 for i386

2 years agoMerge tag 'sched_urgent_for_v5.18_rc2' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 10 Apr 2022 16:47:49 +0000 (06:47 -1000)]
Merge tag 'sched_urgent_for_v5.18_rc2' of git://git./linux/kernel/git/tip/tip

Pull scheduler fixes from Borislav Petkov:

 - Use the correct static key checking primitive on the IRQ exit path

 - Two fixes for the new forceidle balancer

* tag 'sched_urgent_for_v5.18_rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  entry: Fix compile error in dynamic_irqentry_exit_cond_resched()
  sched: Teach the forced-newidle balancer about CPU affinity limitation.
  sched/core: Fix forceidle balancing

2 years agoMerge tag 'perf-tools-fixes-for-v5.18-2022-04-09' of git://git.kernel.org/pub/scm...
Linus Torvalds [Sun, 10 Apr 2022 04:45:10 +0000 (18:45 -1000)]
Merge tag 'perf-tools-fixes-for-v5.18-2022-04-09' of git://git./linux/kernel/git/acme/linux

Pull perf tools fixes from Arnaldo Carvalho de Melo:

 - Fix the clang command line option probing and remove some options to
   filter out, fixing the build with the latest clang versions

 - Fix 'perf bench' futex and epoll benchmarks to deal with machines
   with more than 1K CPUs

 - Fix 'perf test tsc' error message when not supported

 - Remap perf ring buffer if there is no space for event, fixing perf
   usage in 32-bit ChromeOS

 - Drop objdump stderr to avoid getting stuck waiting for stdout output
   in 'perf annotate'

 - Fix up garbled output by now showing unwind error messages when
   augmenting frame in best effort mode

 - Fix perf's libperf_print callback, use the va_args eprintf() variant

 - Sync vhost and arm64 cputype headers with the kernel sources

 - Fix 'perf report --mem-mode' with ARM SPE

 - Add missing external commands ('iiostat', etc) to 'perf --list-cmds'

* tag 'perf-tools-fixes-for-v5.18-2022-04-09' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux:
  perf annotate: Drop objdump stderr to avoid getting stuck waiting for stdout output
  perf tools: Add external commands to list-cmds
  perf docs: Add perf-iostat link to manpages
  perf session: Remap buf if there is no space for event
  perf bench: Fix epoll bench to correct usage of affinity for machines with #CPUs > 1K
  perf bench: Fix futex bench to correct usage of affinity for machines with #CPUs > 1K
  perf tools: Fix perf's libperf_print callback
  perf: arm-spe: Fix perf report --mem-mode
  perf unwind: Don't show unwind error messages when augmenting frame pointer stack
  tools headers arm64: Sync arm64's cputype.h with the kernel sources
  perf test tsc: Fix error message when not supported
  perf build: Don't use -ffat-lto-objects in the python feature test when building with clang-13
  perf python: Fix probing for some clang command line options
  tools build: Filter out options and warnings not supported by clang
  tools build: Use $(shell ) instead of `` to get embedded libperl's ccopts
  tools include UAPI: Sync linux/vhost.h with the kernel sources

2 years agoMerge tag 'cxl+nvdimm-for-5.18-rc2' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 10 Apr 2022 04:31:59 +0000 (18:31 -1000)]
Merge tag 'cxl+nvdimm-for-5.18-rc2' of git://git./linux/kernel/git/nvdimm/nvdimm

Pull cxl and nvdimm fixes from Dan Williams:

 - Fix a compile error in the nvdimm unit tests

 - Fix a shadowed variable warning in the CXL PCI driver

* tag 'cxl+nvdimm-for-5.18-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm:
  cxl/pci: Drop shadowed variable
  tools/testing/nvdimm: Fix security_init() symbol collision

2 years agoMerge tag 'gpio-fixes-for-v5.18-rc2' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 10 Apr 2022 04:17:43 +0000 (18:17 -1000)]
Merge tag 'gpio-fixes-for-v5.18-rc2' of git://git./linux/kernel/git/brgl/linux

Pull gpio fix from Bartosz Golaszewski:

 - fix a race condition with consumers accessing the fields of GPIO IRQ
   chips before they're fully initialized

* tag 'gpio-fixes-for-v5.18-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux:
  gpio: Restrict usage of GPIO chip irq members before initialization

2 years agoMerge tag 'irqchip-fixes-5.18-1' of git://git.kernel.org/pub/scm/linux/kernel/git...
Thomas Gleixner [Sat, 9 Apr 2022 20:21:55 +0000 (22:21 +0200)]
Merge tag 'irqchip-fixes-5.18-1' of git://git./linux/kernel/git/maz/arm-platforms into irq/urgent

Pull irqchip fixes from Marc Zyngier:

 - Fix GICv3 polling for RWP in redistributors

 - Reject ACPI attempts to use SGIs on GIC/GICv3

 - Fix unpredictible behaviour when making a VPE non-resident
   with GICv4

 - A couple of fixes for the newly merged qcom-mpm driver

Link: https://lore.kernel.org/lkml/20220409094229.267649-1-maz@kernel.org
2 years agoperf annotate: Drop objdump stderr to avoid getting stuck waiting for stdout output
Ian Rogers [Thu, 7 Apr 2022 23:04:59 +0000 (16:04 -0700)]
perf annotate: Drop objdump stderr to avoid getting stuck waiting for stdout output

If objdump writes to stderr it can block waiting for it to be read. As
perf doesn't read stderr then progress stops with perf waiting for
stdout output.

Signed-off-by: Ian Rogers <irogers@google.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Alexandre Truong <alexandre.truong@arm.com>
Cc: Dave Marchevsky <davemarchevsky@fb.com>
Cc: Denis Nikitin <denik@chromium.org>
Cc: German Gomez <german.gomez@arm.com>
Cc: James Clark <james.clark@arm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: John Garry <john.garry@huawei.com>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Lexi Shao <shaolexi@huawei.com>
Cc: Li Huafei <lihuafei1@huawei.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Martin Liška <mliska@suse.cz>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ravi Bangoria <ravi.bangoria@amd.com>
Cc: Remi Bernon <rbernon@codeweavers.com>
Cc: Riccardo Mancini <rickyman7@gmail.com>
Cc: Song Liu <songliubraving@fb.com>
Cc: Stephane Eranian <eranian@google.com>
Cc: Thomas Richter <tmricht@linux.ibm.com>
Cc: Will Deacon <will@kernel.org>
Cc: William Cohen <wcohen@redhat.com>
Cc: linux-arm-kernel@lists.infradead.org
Link: http://lore.kernel.org/lkml/20220407230503.1265036-2-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2 years agoperf tools: Add external commands to list-cmds
Michael Petlan [Mon, 4 Apr 2022 22:15:41 +0000 (00:15 +0200)]
perf tools: Add external commands to list-cmds

The `perf --list-cmds` output prints only internal commands, although
there is no reason for that from users' perspective.

Adding the external commands to commands array with NULL function
pointer allows printing all perf commands while not changing the logic
of command handler selection.

Signed-off-by: Michael Petlan <mpetlan@redhat.com>
Acked-by: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Link: https://lore.kernel.org/r/20220404221541.30312-2-mpetlan@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2 years agoperf docs: Add perf-iostat link to manpages
Michael Petlan [Mon, 4 Apr 2022 22:15:40 +0000 (00:15 +0200)]
perf docs: Add perf-iostat link to manpages

Signed-off-by: Michael Petlan <mpetlan@redhat.com>
Acked-by: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Link: https://lore.kernel.org/r/20220404221541.30312-1-mpetlan@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2 years agoperf session: Remap buf if there is no space for event
Denis Nikitin [Wed, 30 Mar 2022 03:11:30 +0000 (20:11 -0700)]
perf session: Remap buf if there is no space for event

If a perf event doesn't fit into remaining buffer space return NULL to
remap buf and fetch the event again.

Keep the logic to error out on inadequate input from fuzzing.

This fixes perf failing on ChromeOS (with 32b userspace):

  $ perf report -v -i perf.data
  ...
  prefetch_event: head=0x1fffff8 event->header_size=0x30, mmap_size=0x2000000: fuzzed or compressed perf.data?
  Error:
  failed to process sample

Fixes: 57fc032ad643ffd0 ("perf session: Avoid infinite loop when seeing invalid header.size")
Reviewed-by: James Clark <james.clark@arm.com>
Signed-off-by: Denis Nikitin <denik@chromium.org>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Alexey Budankov <alexey.budankov@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/r/20220330031130.2152327-1-denik@chromium.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2 years agoMerge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Linus Torvalds [Sat, 9 Apr 2022 16:05:46 +0000 (06:05 -1000)]
Merge tag 'scsi-fixes' of git://git./linux/kernel/git/jejb/scsi

Pull SCSI fixes from James Bottomley:

 - add support for new devices (ufs, mvsas)

 - a major set of fixes in lpfc

 - get rid of a driver specific ioctl in pcmraid

 - a major rework of aha152x to get rid of the scsi_pointer.

 - minor fixes and obvious changes including several spelling updates.

* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (36 commits)
  scsi: megaraid_sas: Target with invalid LUN ID is deleted during scan
  scsi: ufs: ufshpb: Fix a NULL check on list iterator
  scsi: sd: Clean up gendisk if device_add_disk() failed
  scsi: message: fusion: Remove redundant variable dmp
  scsi: mvsas: Add PCI ID of RocketRaid 2640
  scsi: sd: sd_read_cpr() requires VPD pages
  scsi: mpt3sas: Fail reset operation if config request timed out
  scsi: sym53c500_cs: Stop using struct scsi_pointer
  scsi: ufs: ufs-pci: Add support for Intel MTL
  scsi: mpt3sas: Fix mpt3sas_check_same_4gb_region() kdoc comment
  scsi: scsi_debug: Fix sdebug_blk_mq_poll() in_use_bm bitmap use
  scsi: bnx2i: Fix spelling mistake "mis-match" -> "mismatch"
  scsi: bnx2fc: Fix spelling mistake "mis-match" -> "mismatch"
  scsi: zorro7xx: Fix a resource leak in zorro7xx_remove_one()
  scsi: aic7xxx: Use standard PCI subsystem, subdevice defines
  scsi: ufs: qcom: Drop custom Android boot parameters
  scsi: core: sysfs: Remove comments that conflict with the actual logic
  scsi: hisi_sas: Remove stray fallthrough annotation
  scsi: virtio-scsi: Eliminate anonymous module_init & module_exit
  scsi: isci: Fix spelling mistake "doesnt" -> "doesn't"
  ...

2 years agoperf bench: Fix epoll bench to correct usage of affinity for machines with #CPUs...
Athira Rajeev [Wed, 6 Apr 2022 17:51:11 +0000 (23:21 +0530)]
perf bench: Fix epoll bench to correct usage of affinity for machines with #CPUs > 1K

The 'perf bench epoll' testcase fails on systems with more than 1K CPUs.

Testcase: perf bench epoll all

Result snippet:
<<>>
Run summary [PID 106497]: 1399 threads monitoring on 64 file-descriptors for 8 secs.

perf: pthread_create: No such file or directory
<<>>

In epoll benchmarks (ctl, wait) pthread_create is invoked in do_threads
from respective bench_epoll_*  function. Though the logs shows direct
failure from pthread_create, the actual failure is from
"sched_setaffinity" returning EINVAL (invalid argument).

This happens because the default mask size in glibc is 1024. To overcome
this 1024 CPUs mask size limitation of cpu_set_t, change the mask size
using the CPU_*_S macros.

Patch addresses this by fixing all the epoll benchmarks to use CPU_ALLOC
to allocate cpumask, CPU_ALLOC_SIZE for size, and CPU_SET_S to set the
mask.

Reported-by: Disha Goel <disgoel@linux.vnet.ibm.com>
Signed-off-by: Athira Jajeev <atrajeev@linux.vnet.ibm.com>
Tested-by: Disha Goel <disgoel@linux.vnet.ibm.com>
Acked-by: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kajol Jain <kjain@linux.ibm.com>
Cc: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Nageswara R Sastry <rnsastry@linux.ibm.com>
Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Cc: linuxppc-dev@lists.ozlabs.org
Link: https://lore.kernel.org/r/20220406175113.87881-3-atrajeev@linux.vnet.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2 years agoperf bench: Fix futex bench to correct usage of affinity for machines with #CPUs...
Athira Rajeev [Wed, 6 Apr 2022 17:51:10 +0000 (23:21 +0530)]
perf bench: Fix futex bench to correct usage of affinity for machines with #CPUs > 1K

The 'perf bench futex' testcase fails on systems with more than 1K CPUs.

Testcase: perf bench futex all

Failure snippet:
<<>>Running futex/hash benchmark...

perf: pthread_create: No such file or directory
<<>>

All the futex benchmarks (ie hash, lock-api, requeue, wake,
wake-parallel), pthread_create is invoked in respective bench_futex_*
function. Though the logs shows direct failure from pthread_create,
strace logs showed that actual failure is from  "sched_setaffinity"
returning EINVAL (invalid argument).

This happens because the default mask size in glibc is 1024. To overcome
this 1024 CPUs mask size limitation of cpu_set_t, change the mask size
using the CPU_*_S macros.

Patch addresses this by fixing all the futex benchmarks to use CPU_ALLOC
to allocate cpumask, CPU_ALLOC_SIZE for size, and CPU_SET_S to set the
mask.

Reported-by: Disha Goel <disgoel@linux.vnet.ibm.com>
Reviewed-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Signed-off-by: Athira Jajeev <atrajeev@linux.vnet.ibm.com>
Tested-by: Disha Goel <disgoel@linux.vnet.ibm.com>
Acked-by: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kajol Jain <kjain@linux.ibm.com>
Cc: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Nageswara R Sastry <rnsastry@linux.ibm.com>
Cc: linuxppc-dev@lists.ozlabs.org
Link: https://lore.kernel.org/r/20220406175113.87881-2-atrajeev@linux.vnet.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2 years agoperf tools: Fix perf's libperf_print callback
Adrian Hunter [Fri, 8 Apr 2022 13:26:25 +0000 (16:26 +0300)]
perf tools: Fix perf's libperf_print callback

eprintf() does not expect va_list as the type of the 4th parameter.

Use veprintf() because it does.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Fixes: 428dab813a56ce94 ("libperf: Merge libperf_set_print() into libperf_init()")
Cc: Jiri Olsa <jolsa@kernel.org>
Link: https://lore.kernel.org/r/20220408132625.2451452-1-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2 years agoperf: arm-spe: Fix perf report --mem-mode
James Clark [Fri, 8 Apr 2022 14:40:56 +0000 (15:40 +0100)]
perf: arm-spe: Fix perf report --mem-mode

Since commit bb30acae4c4dacfa ("perf report: Bail out --mem-mode if mem
info is not available") "perf mem report" and "perf report --mem-mode"
don't allow opening the file unless one of the events has
PERF_SAMPLE_DATA_SRC set.

SPE doesn't have this set even though synthetic memory data is generated
after it is decoded. Fix this issue by setting DATA_SRC on SPE events.
This has no effect on the data collected because the SPE driver doesn't
do anything with that flag and doesn't generate samples.

Fixes: bb30acae4c4dacfa ("perf report: Bail out --mem-mode if mem info is not available")
Signed-off-by: James Clark <james.clark@arm.com>
Tested-by: Leo Yan <leo.yan@linaro.org>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: German Gomez <german.gomez@arm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: John Garry <john.garry@huawei.com>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: linux-arm-kernel@lists.infradead.org
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
Cc: Will Deacon <will@kernel.org>
Link: https://lore.kernel.org/r/20220408144056.1955535-1-james.clark@arm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2 years agoperf unwind: Don't show unwind error messages when augmenting frame pointer stack
James Clark [Wed, 6 Apr 2022 14:56:51 +0000 (15:56 +0100)]
perf unwind: Don't show unwind error messages when augmenting frame pointer stack

Commit Fixes: b9f6fbb3b2c29736 ("perf arm64: Inject missing frames when
using 'perf record --call-graph=fp'") intended to add a 'best effort'
DWARF unwind that improved the frame pointer stack in most scenarios.

It's expected that the unwind will fail sometimes, but this shouldn't be
reported as an error. It only works when the return address can be
determined from the contents of the link register alone.

Fix the error shown when the unwinder requires extra registers by adding
a new flag that suppresses error messages. This flag is not set in the
normal --call-graph=dwarf unwind mode so that behavior is not changed.

Fixes: b9f6fbb3b2c29736 ("perf arm64: Inject missing frames when using 'perf record --call-graph=fp'")
Reported-by: John Garry <john.garry@huawei.com>
Signed-off-by: James Clark <james.clark@arm.com>
Tested-by: John Garry <john.garry@huawei.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Alexandre Truong <alexandre.truong@arm.com>
Cc: German Gomez <german.gomez@arm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/r/20220406145651.1392529-1-james.clark@arm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2 years agotools headers arm64: Sync arm64's cputype.h with the kernel sources
Arnaldo Carvalho de Melo [Sat, 9 Apr 2022 14:48:15 +0000 (11:48 -0300)]
tools headers arm64: Sync arm64's cputype.h with the kernel sources

To get the changes in:

  83bea32ac7ed37bb ("arm64: Add part number for Arm Cortex-A78AE")

That addresses this perf build warning:

  Warning: Kernel ABI header at 'tools/arch/arm64/include/asm/cputype.h' differs from latest version at 'arch/arm64/include/asm/cputype.h'
  diff -u tools/arch/arm64/include/asm/cputype.h arch/arm64/include/asm/cputype.h

Cc: Ali Saidi <alisaidi@amazon.com>
Cc: Andrew Kilroy <andrew.kilroy@arm.com>
Cc: Chanho Park <chanho61.park@samsung.com>
Cc: German Gomez <german.gomez@arm.com>
Cc: James Clark <james.clark@arm.com>
Cc: John Garry <john.garry@huawei.com>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Will Deacon <will@kernel.org>
Link: http://lore.kernel.org/lkml/
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2 years agoperf test tsc: Fix error message when not supported
Chengdong Li [Fri, 8 Apr 2022 08:47:48 +0000 (16:47 +0800)]
perf test tsc: Fix error message when not supported

By default `perf test tsc` does not return the error message when the
child process detected kernel does not support it. Instead, the child
process prints an error message to stderr, unfortunately stderr is
redirected to /dev/null when verbose <= 0.

This patch does:

- return TEST_SKIP to the parent process instead of TEST_OK when
  perf_read_tsc_conversion() is not supported.

- Add a new subtest of testing if TSC is supported on current
  architecture by moving exist code to a separate function.
  It avoids two places in test__perf_time_to_tsc() that return
  TEST_SKIP by doing this.

- Extend the test suite definition to contain above two subtests.
  Current test_suite and test_case structs do not support printing skip
  reason when the number of subtest less than 1. To print skip reason, it
  is necessary to extend current test suite definition.

Reviewed-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Chengdong Li <chengdongli@tencent.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: likexu@tencent.com
Link: https://lore.kernel.org/r/20220408084748.43707-1-chengdongli@tencent.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2 years agoperf build: Don't use -ffat-lto-objects in the python feature test when building...
Arnaldo Carvalho de Melo [Thu, 7 Apr 2022 14:04:20 +0000 (11:04 -0300)]
perf build: Don't use -ffat-lto-objects in the python feature test when building with clang-13

Using -ffat-lto-objects in the python feature test when building with
clang-13 results in:

  clang-13: error: optimization flag '-ffat-lto-objects' is not supported [-Werror,-Wignored-optimization-argument]
  error: command '/usr/sbin/clang' failed with exit code 1
  cp: cannot stat '/tmp/build/perf/python_ext_build/lib/perf*.so': No such file or directory
  make[2]: *** [Makefile.perf:639: /tmp/build/perf/python/perf.so] Error 1

Noticed when building on a docker.io/library/archlinux:base container.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Fangrui Song <maskray@google.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: John Keeping <john@metanate.com>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Sedat Dilek <sedat.dilek@gmail.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2 years agoperf python: Fix probing for some clang command line options
Arnaldo Carvalho de Melo [Fri, 8 Apr 2022 13:08:07 +0000 (10:08 -0300)]
perf python: Fix probing for some clang command line options

The clang compiler complains about some options even without a source
file being available, while others require one, so use the simple
tools/build/feature/test-hello.c file.

Then check for the "is not supported" string in its output, in addition
to the "unknown argument" already being looked for.

This was noticed when building with clang-13 where -ffat-lto-objects
isn't supported and since we were looking just for "unknown argument"
and not providing a source code to clang, was mistakenly assumed as
being available and not being filtered to set of command line options
provided to clang, leading to a build failure.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Fangrui Song <maskray@google.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: John Keeping <john@metanate.com>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Sedat Dilek <sedat.dilek@gmail.com>
Link: http://lore.kernel.org/lkml/
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>