History log of /linux-master/drivers/staging/rtl8723bs/core/rtw_recv.c
Revision Date Author Comments
# be6cded3 14-Aug-2023 Ruan Jinjie <ruanjinjie@huawei.com>

staging: rtl8723bs: Use helpers to check broadcast and multicast Ether addresses

Use is_multicast_ether_addr() and is_broadcast_ether_addr()
instead of custom macro IS_MCAST() and MacAddr_isBcst(), the buffer
is properly aligned.

Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
Link: https://lore.kernel.org/r/20230814105623.292541-1-ruanjinjie@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# af019910 04-Aug-2023 Yang Yingliang <yangyingliang@huawei.com>

staging: rtl8723bs: use is_zero_ether_addr() instead of memcmp()

Use is_zero_ether_addr() instead of memcmp to check
if the ethernet address is all zeros.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20230804083841.1321554-1-yangyingliang@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 6e006508 24-Oct-2022 Emily Peri <eperi1024@gmail.com>

staging: rtl8723bs: Fix indentation in conditional statements

Remove/add tabs in block statements in rtl8723bs/core to fix checkpatch
warnings for suspect code indent for conditionals.

Signed-off-by: Emily Peri <eperi1024@gmail.com>
Link: https://lore.kernel.org/r/Y1cH7br3mMcT4Dm5@marshmallow
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# ea1f5042 19-Sep-2022 Kang Minchul <tegongkang@gmail.com>

staging: rtl8723bs: Fix coding style issue in block comment

This patch removes the following warning generated by checkpatch.pl

WARNING: Block comments use * on subsequent lines
#206: FILE: rtw_recv.c:206:
+/*
+signed int rtw_enqueue_recvframe(union recv_frame *precvframe, struct __queue *queue)

WARNING: Block comments use * on subsequent lines
#216: FILE: rtw_recv.c:216:
+/*
+caller : defrag ; recvframe_chk_defrag in recv_thread (passive)

Signed-off-by: Kang Minchul <tegongkang@gmail.com>
Link: https://lore.kernel.org/r/20220919133408.3271462-1-tegongkang@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 47a54e93 17-Sep-2022 Kang Minchul <tegongkang@gmail.com>

staging: rtl8723bs: Insert blank line after declarations

This patch fixes checkpatch warning as follows:

WARNING: Missing a blank line after declarations

Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Kang Minchul <tegongkang@gmail.com>
Link: https://lore.kernel.org/r/20220917181620.3237192-1-tegongkang@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 56fb8f05 13-Sep-2022 Kang Minchul <tegongkang@gmail.com>

staging: rtl8723bs: remove braces in single statement blocks

This commit cleans up checkpatch warning as follows:
WARNING: braces {} are not necessary for single statement blocks

Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Kang Minchul <tegongkang@gmail.com>
Link: https://lore.kernel.org/r/20220913162510.3134430-1-tegongkang@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# c146ae45 18-Jan-2022 Kees Cook <keescook@chromium.org>

staging: rtl8723bs: Drop get_recvframe_data()

When building with -Warray-bounds, the following warning is emitted:

In file included from ./include/linux/string.h:253,
from ./arch/x86/include/asm/page_32.h:22,
from ./arch/x86/include/asm/page.h:14,
from ./arch/x86/include/asm/thread_info.h:12,
from ./include/linux/thread_info.h:60,
from ./arch/x86/include/asm/preempt.h:7,
from ./include/linux/preempt.h:78,
from ./include/linux/rcupdate.h:27,
from ./include/linux/rculist.h:11,
from ./include/linux/sched/signal.h:5,
from ./drivers/staging/rtl8723bs/include/drv_types.h:17,
from drivers/staging/rtl8723bs/core/rtw_recv.c:7:
In function 'memcpy',
inlined from 'wlanhdr_to_ethhdr' at drivers/staging/rtl8723bs/core/rtw_recv.c:1554:2:
./include/linux/fortify-string.h:41:33: warning: '__builtin_memcpy' offset [0, 5] is out of the bounds [0, 0] [-Warray-bounds]
41 | #define __underlying_memcpy __builtin_memcpy
| ^

This is because the compiler sees it is possible for "ptr" to be a NULL
value, and concludes that it has zero size and attempts to copy to it
would overflow. Instead, remove the get_recvframe_data() entirely, as
it's not possible for this to ever be NULL.

Additionally add missing NULL checks after recvframe_pull() (which are
present in the rtl8712 driver).

Cc: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Phillip Potter <phil@philpotter.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Michael Straube <straube.linux@gmail.com>
Cc: Fabio Aiuto <fabioaiuto83@gmail.com>
Cc: linux-staging@lists.linux.dev
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20220118193327.2822099-3-keescook@chromium.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 8f434708 02-Mar-2022 Hans de Goede <hdegoede@redhat.com>

staging: rtl8723bs: Fix access-point mode deadlock

Commit 54659ca026e5 ("staging: rtl8723bs: remove possible deadlock when
disconnect (v2)") split the locking of pxmitpriv->lock vs sleep_q/lock
into 2 locks in attempt to fix a lockdep reported issue with the locking
order of the sta_hash_lock vs pxmitpriv->lock.

But in the end this turned out to not fully solve the sta_hash_lock issue
so commit a7ac783c338b ("staging: rtl8723bs: remove a second possible
deadlock") was added to fix this in another way.

The original fix was kept as it was still seen as a good thing to have,
but now it turns out that it creates a deadlock in access-point mode:

[Feb20 23:47] ======================================================
[ +0.074085] WARNING: possible circular locking dependency detected
[ +0.074077] 5.16.0-1-amd64 #1 Tainted: G C E
[ +0.064710] ------------------------------------------------------
[ +0.074075] ksoftirqd/3/29 is trying to acquire lock:
[ +0.060542] ffffb8b30062ab00 (&pxmitpriv->lock){+.-.}-{2:2}, at: rtw_xmit_classifier+0x8a/0x140 [r8723bs]
[ +0.114921]
but task is already holding lock:
[ +0.069908] ffffb8b3007ab704 (&psta->sleep_q.lock){+.-.}-{2:2}, at: wakeup_sta_to_xmit+0x3b/0x300 [r8723bs]
[ +0.116976]
which lock already depends on the new lock.

[ +0.098037]
the existing dependency chain (in reverse order) is:
[ +0.089704]
-> #1 (&psta->sleep_q.lock){+.-.}-{2:2}:
[ +0.077232] _raw_spin_lock_bh+0x34/0x40
[ +0.053261] xmitframe_enqueue_for_sleeping_sta+0xc1/0x2f0 [r8723bs]
[ +0.082572] rtw_xmit+0x58b/0x940 [r8723bs]
[ +0.056528] _rtw_xmit_entry+0xba/0x350 [r8723bs]
[ +0.062755] dev_hard_start_xmit+0xf1/0x320
[ +0.056381] sch_direct_xmit+0x9e/0x360
[ +0.052212] __dev_queue_xmit+0xce4/0x1080
[ +0.055334] ip6_finish_output2+0x18f/0x6e0
[ +0.056378] ndisc_send_skb+0x2c8/0x870
[ +0.052209] ndisc_send_ns+0xd3/0x210
[ +0.050130] addrconf_dad_work+0x3df/0x5a0
[ +0.055338] process_one_work+0x274/0x5a0
[ +0.054296] worker_thread+0x52/0x3b0
[ +0.050124] kthread+0x16c/0x1a0
[ +0.044925] ret_from_fork+0x1f/0x30
[ +0.049092]
-> #0 (&pxmitpriv->lock){+.-.}-{2:2}:
[ +0.074101] __lock_acquire+0x10f5/0x1d80
[ +0.054298] lock_acquire+0xd7/0x300
[ +0.049088] _raw_spin_lock_bh+0x34/0x40
[ +0.053248] rtw_xmit_classifier+0x8a/0x140 [r8723bs]
[ +0.066949] rtw_xmitframe_enqueue+0xa/0x20 [r8723bs]
[ +0.066946] rtl8723bs_hal_xmitframe_enqueue+0x14/0x50 [r8723bs]
[ +0.078386] wakeup_sta_to_xmit+0xa6/0x300 [r8723bs]
[ +0.065903] rtw_recv_entry+0xe36/0x1160 [r8723bs]
[ +0.063809] rtl8723bs_recv_tasklet+0x349/0x6c0 [r8723bs]
[ +0.071093] tasklet_action_common.constprop.0+0xe5/0x110
[ +0.070966] __do_softirq+0x16f/0x50a
[ +0.050134] __irq_exit_rcu+0xeb/0x140
[ +0.051172] irq_exit_rcu+0xa/0x20
[ +0.047006] common_interrupt+0xb8/0xd0
[ +0.052214] asm_common_interrupt+0x1e/0x40
[ +0.056381] finish_task_switch.isra.0+0x100/0x3a0
[ +0.063670] __schedule+0x3ad/0xd20
[ +0.048047] schedule+0x4e/0xc0
[ +0.043880] smpboot_thread_fn+0xc4/0x220
[ +0.054298] kthread+0x16c/0x1a0
[ +0.044922] ret_from_fork+0x1f/0x30
[ +0.049088]
other info that might help us debug this:

[ +0.095950] Possible unsafe locking scenario:

[ +0.070952] CPU0 CPU1
[ +0.054282] ---- ----
[ +0.054285] lock(&psta->sleep_q.lock);
[ +0.047004] lock(&pxmitpriv->lock);
[ +0.074082] lock(&psta->sleep_q.lock);
[ +0.077209] lock(&pxmitpriv->lock);
[ +0.043873]
*** DEADLOCK ***

[ +0.070950] 1 lock held by ksoftirqd/3/29:
[ +0.049082] #0: ffffb8b3007ab704 (&psta->sleep_q.lock){+.-.}-{2:2}, at: wakeup_sta_to_xmit+0x3b/0x300 [r8723bs]

Analysis shows that in hindsight the splitting of the lock was not
a good idea, so revert this to fix the access-point mode deadlock.

Note this is a straight-forward revert done with git revert, the commented
out "/* spin_lock_bh(&psta_bmc->sleep_q.lock); */" lines were part of the
code before the reverted changes.

Fixes: 54659ca026e5 ("staging: rtl8723bs: remove possible deadlock when disconnect (v2)")
Cc: stable <stable@vger.kernel.org>
Cc: Fabio Aiuto <fabioaiuto83@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=215542
Link: https://lore.kernel.org/r/20220302101637.26542-1-hdegoede@redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 54659ca0 20-Sep-2021 Fabio Aiuto <fabioaiuto83@gmail.com>

staging: rtl8723bs: remove possible deadlock when disconnect (v2)

when turning off a connection, lockdep complains with the
following warning (a modprobe has been done but the same
happens with a disconnection from NetworkManager,
it's enough to trigger a cfg80211_disconnect call):

[ 682.855867] ======================================================
[ 682.855877] WARNING: possible circular locking dependency detected
[ 682.855887] 5.14.0-rc6+ #16 Tainted: G C OE
[ 682.855898] ------------------------------------------------------
[ 682.855906] modprobe/1770 is trying to acquire lock:
[ 682.855916] ffffb6d000332b00 (&pxmitpriv->lock){+.-.}-{2:2},
at: rtw_free_stainfo+0x52/0x4a0 [r8723bs]
[ 682.856073]
but task is already holding lock:
[ 682.856081] ffffb6d0003336a8 (&pstapriv->sta_hash_lock){+.-.}-{2:2},
at: rtw_free_assoc_resources+0x48/0x110 [r8723bs]
[ 682.856207]
which lock already depends on the new lock.

[ 682.856215]
the existing dependency chain (in reverse order) is:
[ 682.856223]
-> #1 (&pstapriv->sta_hash_lock){+.-.}-{2:2}:
[ 682.856247] _raw_spin_lock_bh+0x34/0x40
[ 682.856265] rtw_get_stainfo+0x9a/0x110 [r8723bs]
[ 682.856389] rtw_xmit_classifier+0x27/0x130 [r8723bs]
[ 682.856515] rtw_xmitframe_enqueue+0xa/0x20 [r8723bs]
[ 682.856642] rtl8723bs_hal_xmit+0x3b/0xb0 [r8723bs]
[ 682.856752] rtw_xmit+0x4ef/0x890 [r8723bs]
[ 682.856879] _rtw_xmit_entry+0xba/0x350 [r8723bs]
[ 682.856981] dev_hard_start_xmit+0xee/0x320
[ 682.856999] sch_direct_xmit+0x8c/0x330
[ 682.857014] __dev_queue_xmit+0xba5/0xf00
[ 682.857030] packet_sendmsg+0x981/0x1b80
[ 682.857047] sock_sendmsg+0x5b/0x60
[ 682.857060] __sys_sendto+0xf1/0x160
[ 682.857073] __x64_sys_sendto+0x24/0x30
[ 682.857087] do_syscall_64+0x3a/0x80
[ 682.857102] entry_SYSCALL_64_after_hwframe+0x44/0xae
[ 682.857117]
-> #0 (&pxmitpriv->lock){+.-.}-{2:2}:
[ 682.857142] __lock_acquire+0xfd9/0x1b50
[ 682.857158] lock_acquire+0xb4/0x2c0
[ 682.857172] _raw_spin_lock_bh+0x34/0x40
[ 682.857185] rtw_free_stainfo+0x52/0x4a0 [r8723bs]
[ 682.857308] rtw_free_assoc_resources+0x53/0x110 [r8723bs]
[ 682.857415] cfg80211_rtw_disconnect+0x4b/0x70 [r8723bs]
[ 682.857522] cfg80211_disconnect+0x12e/0x2f0 [cfg80211]
[ 682.857759] cfg80211_leave+0x2b/0x40 [cfg80211]
[ 682.857961] cfg80211_netdev_notifier_call+0xa9/0x560 [cfg80211]
[ 682.858163] raw_notifier_call_chain+0x41/0x50
[ 682.858180] __dev_close_many+0x62/0x100
[ 682.858195] dev_close_many+0x7d/0x120
[ 682.858209] unregister_netdevice_many+0x416/0x680
[ 682.858225] unregister_netdevice_queue+0xab/0xf0
[ 682.858240] unregister_netdev+0x18/0x20
[ 682.858255] rtw_unregister_netdevs+0x28/0x40 [r8723bs]
[ 682.858360] rtw_dev_remove+0x24/0xd0 [r8723bs]
[ 682.858463] sdio_bus_remove+0x31/0xd0 [mmc_core]
[ 682.858532] device_release_driver_internal+0xf7/0x1d0
[ 682.858550] driver_detach+0x47/0x90
[ 682.858564] bus_remove_driver+0x77/0xd0
[ 682.858579] rtw_drv_halt+0xc/0x678 [r8723bs]
[ 682.858685] __x64_sys_delete_module+0x13f/0x250
[ 682.858699] do_syscall_64+0x3a/0x80
[ 682.858715] entry_SYSCALL_64_after_hwframe+0x44/0xae
[ 682.858729]
other info that might help us debug this:

[ 682.858737] Possible unsafe locking scenario:

[ 682.858744] CPU0 CPU1
[ 682.858751] ---- ----
[ 682.858758] lock(&pstapriv->sta_hash_lock);
[ 682.858772] lock(&pxmitpriv->lock);
[ 682.858786] lock(&pstapriv->sta_hash_lock);
[ 682.858799] lock(&pxmitpriv->lock);
[ 682.858812]
*** DEADLOCK ***

[ 682.858820] 5 locks held by modprobe/1770:
[ 682.858831] #0: ffff8d870697d980 (&dev->mutex){....}-{3:3},
at: device_release_driver_internal+0x1a/0x1d0
[ 682.858869] #1: ffffffffbdbbf1c8 (rtnl_mutex){+.+.}-{3:3},
at: unregister_netdev+0xe/0x20
[ 682.858906] #2: ffff8d87054ee5e8 (&rdev->wiphy.mtx){+.+.}-{3:3},
at: cfg80211_netdev_notifier_call+0x9e/0x560 [cfg80211]
[ 682.859131] #3: ffff8d870f2bc8f0 (&wdev->mtx){+.+.}-{3:3},
at: cfg80211_leave+0x20/0x40 [cfg80211]
[ 682.859354] #4: ffffb6d0003336a8 (&pstapriv->sta_hash_lock){+.-.}-{2:2},
at: rtw_free_assoc_resources+0x48/0x110 [r8723bs]
[ 682.859482]
stack backtrace:
[ 682.859491] CPU: 1 PID: 1770 Comm: modprobe Tainted: G
C OE 5.14.0-rc6+ #16
[ 682.859507] Hardware name: LENOVO 80NR/Madrid, BIOS DACN25WW 08/20/2015
[ 682.859517] Call Trace:
[ 682.859531] dump_stack_lvl+0x56/0x6f
[ 682.859551] check_noncircular+0xdb/0xf0
[ 682.859579] __lock_acquire+0xfd9/0x1b50
[ 682.859606] lock_acquire+0xb4/0x2c0
[ 682.859623] ? rtw_free_stainfo+0x52/0x4a0 [r8723bs]
[ 682.859752] ? mark_held_locks+0x48/0x70
[ 682.859769] ? rtw_free_stainfo+0x4a/0x4a0 [r8723bs]
[ 682.859898] _raw_spin_lock_bh+0x34/0x40
[ 682.859914] ? rtw_free_stainfo+0x52/0x4a0 [r8723bs]
[ 682.860039] rtw_free_stainfo+0x52/0x4a0 [r8723bs]
[ 682.860171] rtw_free_assoc_resources+0x53/0x110 [r8723bs]
[ 682.860286] cfg80211_rtw_disconnect+0x4b/0x70 [r8723bs]
[ 682.860397] cfg80211_disconnect+0x12e/0x2f0 [cfg80211]
[ 682.860629] cfg80211_leave+0x2b/0x40 [cfg80211]
[ 682.860836] cfg80211_netdev_notifier_call+0xa9/0x560 [cfg80211]
[ 682.861048] ? __lock_acquire+0x4dc/0x1b50
[ 682.861070] ? lock_is_held_type+0xa8/0x110
[ 682.861089] ? lock_is_held_type+0xa8/0x110
[ 682.861104] ? find_held_lock+0x2d/0x90
[ 682.861120] ? packet_notifier+0x173/0x300
[ 682.861141] ? lock_release+0xb3/0x250
[ 682.861160] ? packet_notifier+0x192/0x300
[ 682.861184] raw_notifier_call_chain+0x41/0x50
[ 682.861205] __dev_close_many+0x62/0x100
[ 682.861224] dev_close_many+0x7d/0x120
[ 682.861245] unregister_netdevice_many+0x416/0x680
[ 682.861264] ? find_held_lock+0x2d/0x90
[ 682.861284] unregister_netdevice_queue+0xab/0xf0
[ 682.861306] unregister_netdev+0x18/0x20
[ 682.861325] rtw_unregister_netdevs+0x28/0x40 [r8723bs]
[ 682.861434] rtw_dev_remove+0x24/0xd0 [r8723bs]
[ 682.861542] sdio_bus_remove+0x31/0xd0 [mmc_core]
[ 682.861615] device_release_driver_internal+0xf7/0x1d0
[ 682.861637] driver_detach+0x47/0x90
[ 682.861656] bus_remove_driver+0x77/0xd0
[ 682.861674] rtw_drv_halt+0xc/0x678 [r8723bs]
[ 682.861782] __x64_sys_delete_module+0x13f/0x250
[ 682.861801] ? lockdep_hardirqs_on_prepare+0xf3/0x170
[ 682.861817] ? syscall_enter_from_user_mode+0x20/0x70
[ 682.861836] do_syscall_64+0x3a/0x80
[ 682.861855] entry_SYSCALL_64_after_hwframe+0x44/0xae
[ 682.861873] RIP: 0033:0x7f6dbe85400b
[ 682.861890] Code: 73 01 c3 48 8b 0d 6d 1e 0c 00 f7 d8 64 89
01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa
b8 b0 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 3d
1e 0c 00 f7 d8 64 89 01 48
[ 682.861906] RSP: 002b:00007ffe7a82f538 EFLAGS: 00000206 ORIG_RAX: 00000000000000b0
[ 682.861923] RAX: ffffffffffffffda RBX: 000055a64693bd20 RCX: 00007f6dbe85400b
[ 682.861935] RDX: 0000000000000000 RSI: 0000000000000800 RDI: 000055a64693bd88
[ 682.861946] RBP: 000055a64693bd20 R08: 0000000000000000 R09: 0000000000000000
[ 682.861957] R10: 00007f6dbe8c7ac0 R11: 0000000000000206 R12: 000055a64693bd88
[ 682.861967] R13: 0000000000000000 R14: 000055a64693bd88 R15: 00007ffe7a831848

This happens because when we enqueue a frame for
transmission we do it under xmit_priv lock, then calling
rtw_get_stainfo (needed for enqueuing) takes sta_hash_lock
and this leads to the following lock dependency:

xmit_priv->lock -> sta_hash_lock

Turning off a connection will bring to call
rtw_free_assoc_resources which will set up
the inverse dependency:

sta_hash_lock -> xmit_priv_lock

This could lead to a deadlock as lockdep complains.

Fix it by removing the xmit_priv->lock around
rtw_xmitframe_enqueue call inside rtl8723bs_hal_xmit
and put it in a smaller critical section inside
rtw_xmit_classifier, the only place where
xmit_priv data are actually accessed.

Replace spin_{lock,unlock}_bh(pxmitpriv->lock)
in other tx paths leading to rtw_xmitframe_enqueue
call with spin_{lock,unlock}_bh(psta->sleep_q.lock)
- it's not clear why accessing a sleep_q was protected
by a spinlock on xmitpriv->lock.

This way is avoided the same faulty lock nesting
order.

Extra changes in v2 by Hans de Goede:
-Lift the taking of the struct __queue.lock spinlock out of
rtw_free_xmitframe_queue() into the callers this allows also
protecting a bunch of related state in rtw_free_stainfo():
-Protect psta->sleepq_len on rtw_free_xmitframe_queue(&psta->sleep_q);
-Protect struct tx_servq.tx_pending and tx_servq.qcnt when
calling rtw_free_xmitframe_queue(&tx_servq.sta_pending)
-This also allows moving the spin_lock_bh(&pxmitpriv->lock); to below
the sleep_q free-ing code, avoiding another ABBA locking issue

CC: Larry Finger <Larry.Finger@lwfinger.net>
Co-developed-by: Hans de Goede <hdegoede@redhat.com>
Tested-on: Lenovo Ideapad MiiX 300-10IBY
Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20210920145502.155454-1-hdegoede@redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# ea2054ba 17-Sep-2021 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Revert "staging: rtl8723bs: remove possible deadlock when disconnect"

This reverts commit 78a1614a81f06032055a25b7acd9965a81196433.

There's been attempts to fix this, but it's not quite right yet, so just
remove the original commit.

Link: https://lore.kernel.org/r/20210913130346.2390-1-fabioaiuto83@gmail.com
Cc: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Fabio Aiuto <fabioaiuto83@gmail.com>
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 78a1614a 02-Sep-2021 Fabio Aiuto <fabioaiuto83@gmail.com>

staging: rtl8723bs: remove possible deadlock when disconnect

when turning off a connection, lockdep complains with the
following warning (a modprobe has been done but the same
happens with a disconnection from NetworkManager,
it's enough to trigger a cfg80211_disconnect call):

[ 682.855867] ======================================================
[ 682.855877] WARNING: possible circular locking dependency detected
[ 682.855887] 5.14.0-rc6+ #16 Tainted: G C OE
[ 682.855898] ------------------------------------------------------
[ 682.855906] modprobe/1770 is trying to acquire lock:
[ 682.855916] ffffb6d000332b00 (&pxmitpriv->lock){+.-.}-{2:2},
at: rtw_free_stainfo+0x52/0x4a0 [r8723bs]
[ 682.856073]
but task is already holding lock:
[ 682.856081] ffffb6d0003336a8 (&pstapriv->sta_hash_lock){+.-.}-{2:2},
at: rtw_free_assoc_resources+0x48/0x110 [r8723bs]
[ 682.856207]
which lock already depends on the new lock.

[ 682.856215]
the existing dependency chain (in reverse order) is:
[ 682.856223]
-> #1 (&pstapriv->sta_hash_lock){+.-.}-{2:2}:
[ 682.856247] _raw_spin_lock_bh+0x34/0x40
[ 682.856265] rtw_get_stainfo+0x9a/0x110 [r8723bs]
[ 682.856389] rtw_xmit_classifier+0x27/0x130 [r8723bs]
[ 682.856515] rtw_xmitframe_enqueue+0xa/0x20 [r8723bs]
[ 682.856642] rtl8723bs_hal_xmit+0x3b/0xb0 [r8723bs]
[ 682.856752] rtw_xmit+0x4ef/0x890 [r8723bs]
[ 682.856879] _rtw_xmit_entry+0xba/0x350 [r8723bs]
[ 682.856981] dev_hard_start_xmit+0xee/0x320
[ 682.856999] sch_direct_xmit+0x8c/0x330
[ 682.857014] __dev_queue_xmit+0xba5/0xf00
[ 682.857030] packet_sendmsg+0x981/0x1b80
[ 682.857047] sock_sendmsg+0x5b/0x60
[ 682.857060] __sys_sendto+0xf1/0x160
[ 682.857073] __x64_sys_sendto+0x24/0x30
[ 682.857087] do_syscall_64+0x3a/0x80
[ 682.857102] entry_SYSCALL_64_after_hwframe+0x44/0xae
[ 682.857117]
-> #0 (&pxmitpriv->lock){+.-.}-{2:2}:
[ 682.857142] __lock_acquire+0xfd9/0x1b50
[ 682.857158] lock_acquire+0xb4/0x2c0
[ 682.857172] _raw_spin_lock_bh+0x34/0x40
[ 682.857185] rtw_free_stainfo+0x52/0x4a0 [r8723bs]
[ 682.857308] rtw_free_assoc_resources+0x53/0x110 [r8723bs]
[ 682.857415] cfg80211_rtw_disconnect+0x4b/0x70 [r8723bs]
[ 682.857522] cfg80211_disconnect+0x12e/0x2f0 [cfg80211]
[ 682.857759] cfg80211_leave+0x2b/0x40 [cfg80211]
[ 682.857961] cfg80211_netdev_notifier_call+0xa9/0x560 [cfg80211]
[ 682.858163] raw_notifier_call_chain+0x41/0x50
[ 682.858180] __dev_close_many+0x62/0x100
[ 682.858195] dev_close_many+0x7d/0x120
[ 682.858209] unregister_netdevice_many+0x416/0x680
[ 682.858225] unregister_netdevice_queue+0xab/0xf0
[ 682.858240] unregister_netdev+0x18/0x20
[ 682.858255] rtw_unregister_netdevs+0x28/0x40 [r8723bs]
[ 682.858360] rtw_dev_remove+0x24/0xd0 [r8723bs]
[ 682.858463] sdio_bus_remove+0x31/0xd0 [mmc_core]
[ 682.858532] device_release_driver_internal+0xf7/0x1d0
[ 682.858550] driver_detach+0x47/0x90
[ 682.858564] bus_remove_driver+0x77/0xd0
[ 682.858579] rtw_drv_halt+0xc/0x678 [r8723bs]
[ 682.858685] __x64_sys_delete_module+0x13f/0x250
[ 682.858699] do_syscall_64+0x3a/0x80
[ 682.858715] entry_SYSCALL_64_after_hwframe+0x44/0xae
[ 682.858729]
other info that might help us debug this:

[ 682.858737] Possible unsafe locking scenario:

[ 682.858744] CPU0 CPU1
[ 682.858751] ---- ----
[ 682.858758] lock(&pstapriv->sta_hash_lock);
[ 682.858772] lock(&pxmitpriv->lock);
[ 682.858786] lock(&pstapriv->sta_hash_lock);
[ 682.858799] lock(&pxmitpriv->lock);
[ 682.858812]
*** DEADLOCK ***

[ 682.858820] 5 locks held by modprobe/1770:
[ 682.858831] #0: ffff8d870697d980 (&dev->mutex){....}-{3:3},
at: device_release_driver_internal+0x1a/0x1d0
[ 682.858869] #1: ffffffffbdbbf1c8 (rtnl_mutex){+.+.}-{3:3},
at: unregister_netdev+0xe/0x20
[ 682.858906] #2: ffff8d87054ee5e8 (&rdev->wiphy.mtx){+.+.}-{3:3},
at: cfg80211_netdev_notifier_call+0x9e/0x560 [cfg80211]
[ 682.859131] #3: ffff8d870f2bc8f0 (&wdev->mtx){+.+.}-{3:3},
at: cfg80211_leave+0x20/0x40 [cfg80211]
[ 682.859354] #4: ffffb6d0003336a8 (&pstapriv->sta_hash_lock){+.-.}-{2:2},
at: rtw_free_assoc_resources+0x48/0x110 [r8723bs]
[ 682.859482]
stack backtrace:
[ 682.859491] CPU: 1 PID: 1770 Comm: modprobe Tainted: G
C OE 5.14.0-rc6+ #16
[ 682.859507] Hardware name: LENOVO 80NR/Madrid, BIOS DACN25WW 08/20/2015
[ 682.859517] Call Trace:
[ 682.859531] dump_stack_lvl+0x56/0x6f
[ 682.859551] check_noncircular+0xdb/0xf0
[ 682.859579] __lock_acquire+0xfd9/0x1b50
[ 682.859606] lock_acquire+0xb4/0x2c0
[ 682.859623] ? rtw_free_stainfo+0x52/0x4a0 [r8723bs]
[ 682.859752] ? mark_held_locks+0x48/0x70
[ 682.859769] ? rtw_free_stainfo+0x4a/0x4a0 [r8723bs]
[ 682.859898] _raw_spin_lock_bh+0x34/0x40
[ 682.859914] ? rtw_free_stainfo+0x52/0x4a0 [r8723bs]
[ 682.860039] rtw_free_stainfo+0x52/0x4a0 [r8723bs]
[ 682.860171] rtw_free_assoc_resources+0x53/0x110 [r8723bs]
[ 682.860286] cfg80211_rtw_disconnect+0x4b/0x70 [r8723bs]
[ 682.860397] cfg80211_disconnect+0x12e/0x2f0 [cfg80211]
[ 682.860629] cfg80211_leave+0x2b/0x40 [cfg80211]
[ 682.860836] cfg80211_netdev_notifier_call+0xa9/0x560 [cfg80211]
[ 682.861048] ? __lock_acquire+0x4dc/0x1b50
[ 682.861070] ? lock_is_held_type+0xa8/0x110
[ 682.861089] ? lock_is_held_type+0xa8/0x110
[ 682.861104] ? find_held_lock+0x2d/0x90
[ 682.861120] ? packet_notifier+0x173/0x300
[ 682.861141] ? lock_release+0xb3/0x250
[ 682.861160] ? packet_notifier+0x192/0x300
[ 682.861184] raw_notifier_call_chain+0x41/0x50
[ 682.861205] __dev_close_many+0x62/0x100
[ 682.861224] dev_close_many+0x7d/0x120
[ 682.861245] unregister_netdevice_many+0x416/0x680
[ 682.861264] ? find_held_lock+0x2d/0x90
[ 682.861284] unregister_netdevice_queue+0xab/0xf0
[ 682.861306] unregister_netdev+0x18/0x20
[ 682.861325] rtw_unregister_netdevs+0x28/0x40 [r8723bs]
[ 682.861434] rtw_dev_remove+0x24/0xd0 [r8723bs]
[ 682.861542] sdio_bus_remove+0x31/0xd0 [mmc_core]
[ 682.861615] device_release_driver_internal+0xf7/0x1d0
[ 682.861637] driver_detach+0x47/0x90
[ 682.861656] bus_remove_driver+0x77/0xd0
[ 682.861674] rtw_drv_halt+0xc/0x678 [r8723bs]
[ 682.861782] __x64_sys_delete_module+0x13f/0x250
[ 682.861801] ? lockdep_hardirqs_on_prepare+0xf3/0x170
[ 682.861817] ? syscall_enter_from_user_mode+0x20/0x70
[ 682.861836] do_syscall_64+0x3a/0x80
[ 682.861855] entry_SYSCALL_64_after_hwframe+0x44/0xae
[ 682.861873] RIP: 0033:0x7f6dbe85400b
[ 682.861890] Code: 73 01 c3 48 8b 0d 6d 1e 0c 00 f7 d8 64 89
01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa
b8 b0 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 3d
1e 0c 00 f7 d8 64 89 01 48
[ 682.861906] RSP: 002b:00007ffe7a82f538 EFLAGS: 00000206 ORIG_RAX: 00000000000000b0
[ 682.861923] RAX: ffffffffffffffda RBX: 000055a64693bd20 RCX: 00007f6dbe85400b
[ 682.861935] RDX: 0000000000000000 RSI: 0000000000000800 RDI: 000055a64693bd88
[ 682.861946] RBP: 000055a64693bd20 R08: 0000000000000000 R09: 0000000000000000
[ 682.861957] R10: 00007f6dbe8c7ac0 R11: 0000000000000206 R12: 000055a64693bd88
[ 682.861967] R13: 0000000000000000 R14: 000055a64693bd88 R15: 00007ffe7a831848

This happens because when we enqueue a frame for
transmission we do it under xmit_priv lock, then calling
rtw_get_stainfo (needed for enqueuing) takes sta_hash_lock
and this leads to the following lock dependency:

xmit_priv->lock -> sta_hash_lock

Turning off a connection will bring to call
rtw_free_assoc_resources which will set up
the inverse dependency:

sta_hash_lock -> xmit_priv_lock

This could lead to a deadlock as lockdep complains.

Fix it by removing the xmit_priv->lock around
rtw_xmitframe_enqueue call inside rtl8723bs_hal_xmit
and put it in a smaller critical section inside
rtw_xmit_classifier, the only place where
xmit_priv data are actually accessed.

Replace spin_{lock,unlock}_bh(pxmitpriv->lock)
in other tx paths leading to rtw_xmitframe_enqueue
call with spin_{lock,unlock}_bh(psta->sleep_q.lock)
- it's not clear why accessing a sleep_q was protected
by a spinlock on xmitpriv->lock.

This way is avoided the same faulty lock nesting
order.

CC: Larry Finger <Larry.Finger@lwfinger.net>
Tested-on: Lenovo Ideapad MiiX 300-10IBY
Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
Link: https://lore.kernel.org/r/20210902093559.9779-1-fabioaiuto83@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# d1cfdcad 30-Aug-2021 Fabio Aiuto <fabioaiuto83@gmail.com>

staging: rtl8723bs: unwrap initialization of queues

unwrap initialization of queues to avoid false positive
lockdep warning:

[ 27.350258] ============================================
[ 27.350267] WARNING: possible recursive locking detected
[ 27.350276] 5.14.0-rc6+ #16 Tainted: G C OE
[ 27.350288] --------------------------------------------
[ 27.350295] RTW_CMD_THREAD/679 is trying to acquire lock:
[ 27.350306] ffffa846c03290c8 (&(pqueue->lock)){+.-.}-{2:2},
at: rtw_alloc_network+0x1b/0xa0 [r8723bs]
[ 27.350441]
but task is already holding lock:
[ 27.350448] ffffa846c0329118 (&(pqueue->lock)){+.-.}-{2:2},
at: rtw_update_scanned_network+0x33/0x1d0 [r8723bs]
[ 27.350573]
other info that might help us debug this:
[ 27.350581] Possible unsafe locking scenario:

[ 27.350588] CPU0
[ 27.350594] ----
[ 27.350600] lock(&(pqueue->lock));
[ 27.350614] lock(&(pqueue->lock));
[ 27.350627]
*** DEADLOCK ***

[ 27.350634] May be due to missing lock nesting notation

[ 27.350641] 2 locks held by RTW_CMD_THREAD/679:
[ 27.350652] #0: ffffa846c0329038 (&pmlmepriv->lock){+...}-{2:2},
at: rtw_survey_event_callback+0x2d/0xe0 [r8723bs]
[ 27.350780] #1: ffffa846c0329118 (&(pqueue->lock)){+.-.}-{2:2},
at: rtw_update_scanned_network+0x33/0x1d0 [r8723bs]
[ 27.350907]
stack backtrace:
[ 27.350916] CPU: 3 PID: 679 Comm: RTW_CMD_THREAD Tainted: G
C OE 5.14.0-rc6+ #16
[ 27.350933] Hardware name: LENOVO 80NR/Madrid, BIOS DACN25WW
08/20/2015
[ 27.350943] Call Trace:
[ 27.350959] dump_stack_lvl+0x56/0x6f
[ 27.350982] __lock_acquire.cold.79+0x137/0x298
[ 27.351012] lock_acquire+0xb4/0x2c0
[ 27.351031] ? rtw_alloc_network+0x1b/0xa0 [r8723bs]
[ 27.351140] ? rtw_update_scanned_network+0x33/0x1d0 [r8723bs]
[ 27.351254] _raw_spin_lock_bh+0x34/0x40
[ 27.351271] ? rtw_alloc_network+0x1b/0xa0 [r8723bs]
[ 27.351378] rtw_alloc_network+0x1b/0xa0 [r8723bs]
[ 27.351488] rtw_update_scanned_network+0xa5/0x1d0 [r8723bs]
[ 27.351605] rtw_survey_event_callback+0x54/0xe0 [r8723bs]
[ 27.351719] mlme_evt_hdl+0x4e/0x70 [r8723bs]
[ 27.351839] rtw_cmd_thread+0x16c/0x3d0 [r8723bs]
[ 27.351945] ? rtw_stop_cmd_thread+0x50/0x50 [r8723bs]
[ 27.352045] kthread+0x136/0x160
[ 27.352064] ? set_kthread_struct+0x40/0x40
[ 27.352083] ret_from_fork+0x22/0x30

This happens because the wrapping function _rtw_init_queues()
bring lockdep considering all queues as a single one. But
all queues are different with their own lock.

Applied the following semantic patch:

@@
expression a;
@@

- _rtw_init_queue(&a);
+ INIT_LIST_HEAD(&a.queue);
+ spin_lock_init(&a.lock);

Reported-by: Hans De Goede <hdegoede@redhat.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
Link: https://lore.kernel.org/r/c2c3a18cc2b883feab74f150ccbaa4f2cc11995c.1630307025.git.fabioaiuto83@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 9bfb54a8 24-Aug-2021 Michael Straube <straube.linux@gmail.com>

staging: rtl8723bs: remove header file ethernet.h

The header file ehternet.h defines only two constants.

#define ETHERNET_HEADER_SIZE 14 /* Ethernet Header Length */
#define LLC_HEADER_SIZE 6 /* LLC Header Length */

Both are only used in the file core/rtw_recv.c and ETHERNET_HEADER_SIZE
just duplicates the in-kernel constant ETH_HLEN. Replace the usage of
ETHERNET_HEADER_SIZE with ETH_HLEN, move the definition of LLC_HEADER_SIZE
into rtw_rev.h (renamed to LLC_HEADER_LENGTH) and remove the now unused
header file ethernet.h.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
Link: https://lore.kernel.org/r/20210825100842.13217-1-straube.linux@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 2ce75c4f 30-Apr-2021 Fabio Aiuto <fabioaiuto83@gmail.com>

staging: rtl8723bs: remove commented out DbgPrint logs

remove commented out DbgPrint logs.

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
Link: https://lore.kernel.org/r/63eb0244a9e25d5633d78b67fd5a0c61cb48d83e.1619794331.git.fabioaiuto83@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 2172a657 30-Apr-2021 Fabio Aiuto <fabioaiuto83@gmail.com>

staging: rtl8723bs: remove commented out RT_ASSERT occurrences

remove commented out obsoete RT_ASSERT macro occurences.

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
Link: https://lore.kernel.org/r/3ee98d7bf1685af627e625f413de355fce58d52d.1619794331.git.fabioaiuto83@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# a596ef19 24-Apr-2021 Fabio Aiuto <fabioaiuto83@gmail.com>

staging: rtl8723bs: remove debug macros related to core/rtw_recv.c tracing

remove debug macros definitions related to core/rtw_recv.c
obsolete tracing.

Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
Link: https://lore.kernel.org/r/5af86d4dea96caf9c84f9ac302ec060edbc2fb65.1619254603.git.fabioaiuto83@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# daa2627c 14-Apr-2021 Lee Jones <lee.jones@linaro.org>

staging: rtl8723bs: core: rtw_recv: Mark debug variable as __maybe_unused

Fixes the following W=1 kernel build warning(s):

from drivers/staging/rtl8188eu/core/rtw_recv.c:12:
drivers/staging/rtl8723bs/core/rtw_recv.c: In function ‘rtw_signal_stat_timer_hdl’:
drivers/staging/rtl8723bs/core/rtw_recv.c:2341:6: warning: variable ‘num_signal_qual’ set but not used [-Wunused-but-set-variable]

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-staging@lists.linux.dev
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20210414181129.1628598-14-lee.jones@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# dd782523 07-Apr-2021 Fabio Aiuto <fabioaiuto83@gmail.com>

staging: rtl8723bs: remove unnecessary parentheses

fix following post-commit checkpatch issue:

CHECK: Unnecessary parentheses around 'prxattrib->bdecrypted'
125: FILE: drivers/staging/rtl8723bs/core/rtw_recv.c:365:
+ if ((prxattrib->bdecrypted) && (brpt_micerror))

Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
Link: https://lore.kernel.org/r/1453eec49833fc940e134fc14bc65d218ace0663.1617802415.git.fabioaiuto83@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# e427bdd8 07-Apr-2021 Fabio Aiuto <fabioaiuto83@gmail.com>

staging: rtl8723bs: rewrite comparison to null

fi following post-commit checkpatch issues:

CHECK: Comparison to NULL could be written "!p"
290: FILE: drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:978:
+ if (p == NULL)
--
CHECK: Comparison to NULL could be written "!pmgntframe"
328: FILE: drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:2016:
+ if (pmgntframe == NULL)
--
CHECK: Comparison to NULL could be written "!pmgntframe"
361: FILE: drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:2378:
+ if (pmgntframe == NULL)
--
CHECK: Comparison to NULL could be written "!pmgntframe"
391: FILE: drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:3478:
+ if (pmgntframe == NULL)
--
CHECK: Comparison to NULL could be written "!p"
427: FILE: drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:4071:
+ if (p == NULL)
--
CHECK: Comparison to NULL could be written "!BIP_AAD"
781: FILE: drivers/staging/rtl8723bs/core/rtw_security.c:1690:
+ if (BIP_AAD == NULL)
--
CHECK: Comparison to NULL could be written "!pwep"
1773: FILE: drivers/staging/rtl8723bs/os_dep/ioctl_linux.c:3062:
+ if (pwep == NULL)
--
CHECK: Comparison to NULL could be written "!pmlmepriv->wps_beacon_ie"
1784: FILE: drivers/staging/rtl8723bs/os_dep/ioctl_linux.c:3510:
+ if (pmlmepriv->wps_beacon_ie == NULL)
--
CHECK: Comparison to NULL could be written "!pmlmepriv->wps_probe_resp_ie"
1795: FILE: drivers/staging/rtl8723bs/os_dep/ioctl_linux.c:3544:
+ if (pmlmepriv->wps_probe_resp_ie == NULL)
--
CHECK: Comparison to NULL could be written "!pmlmepriv->wps_assoc_resp_ie"
1807: FILE: drivers/staging/rtl8723bs/os_dep/ioctl_linux.c:3574:
+ if (pmlmepriv->wps_assoc_resp_ie == NULL)
--
CHECK: Comparison to NULL could be written "!pbuf"
1818: FILE: drivers/staging/rtl8723bs/os_dep/ioctl_linux.c:3928:
+ if (pbuf == NULL)
--
CHECK: Comparison to NULL could be written "!if1"
1944: FILE: drivers/staging/rtl8723bs/os_dep/sdio_intf.c:392:
+ if (if1 == NULL)

CHECK: Using comparison to false is error prone
402: FILE: drivers/staging/rtl8723bs/core/rtw_mlme_ext.c:3890:
+ if (false == bxmitok)
--
CHECK: Using comparison to true is error prone
671: FILE: drivers/staging/rtl8723bs/core/rtw_recv.c:365:
+ if ((prxattrib->bdecrypted == true) && (brpt_micerror == true))
--
CHECK: Using comparison to true is error prone
1051: FILE: drivers/staging/rtl8723bs/core/rtw_xmit.c:1174:
+ if (padapter->securitypriv.binstallBIPkey != true)
--
CHECK: Using comparison to false is error prone
1632: FILE: drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c:2194:
+ if (false == bMatched)

Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
Link: https://lore.kernel.org/r/572f96dcb6217fd3e6ea23c37b55b0ebb3231f14.1617802415.git.fabioaiuto83@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 709c8e49 07-Apr-2021 Fabio Aiuto <fabioaiuto83@gmail.com>

staging: rtl8723bs: remove unnecessary bracks on DBG_871X removal sites

remove unnecessary bracks on DBG_871X removal sites

Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
Link: https://lore.kernel.org/r/35f5edf0f39b717b3de3ad7861cbaa5f4ba60576.1617802415.git.fabioaiuto83@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# b4f27a06 07-Apr-2021 Fabio Aiuto <fabioaiuto83@gmail.com>

staging: rtl8723bs: remove empty #ifdef blocks after DBG_871X removal

remove #ifdef and blocks #if defined() blocks left empty
after DBG_871X removal.

Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
Link: https://lore.kernel.org/r/4e19eb1c71bc1d43d30c1b0a04851ab7ce528f36.1617802415.git.fabioaiuto83@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# ae31f4ed 07-Apr-2021 Fabio Aiuto <fabioaiuto83@gmail.com>

staging: rtl8723bs: remove empty tracing function dump_rx_packet

remove tracing function dump_rx_packet after DBG_871X removal.

Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
Link: https://lore.kernel.org/r/281afbaecdb9614c91e648b3a6fc2738a176e57a.1617802415.git.fabioaiuto83@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 3f85c670 07-Apr-2021 Fabio Aiuto <fabioaiuto83@gmail.com>

staging: rtl8723bs: remove empty for cycles left by DBG_871X removal

remove empty for cycles and unused counter variables to suppress
compiler warnings.

Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
Link: https://lore.kernel.org/r/fe758f88ef6d6eaad9762d16d78dcfa876fcf654.1617802415.git.fabioaiuto83@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 21e161c3 07-Apr-2021 Fabio Aiuto <fabioaiuto83@gmail.com>

staging: rtl8723bs: remove all if-else empty blocks left by DBG_871X removal

remove all if-else empty {} blocks left by spatch application.

removed unused variables and an unused static function definition
after if-else blocks removal, to suppress compiler warnings.

Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
Link: https://lore.kernel.org/r/56055b20bc064d7ac1e8f14bd1ed42aba6b02c36.1617802415.git.fabioaiuto83@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 68e79909 07-Apr-2021 Fabio Aiuto <fabioaiuto83@gmail.com>

staging: rtl8723bs: remove commented out DBG_871X logs

remove all commented out DBG_871X logs unmatched by
semantic patch.

Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
Link: https://lore.kernel.org/r/125e216e3bb5bc938e06b15dadfbbf51d9517dde.1617802415.git.fabioaiuto83@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 968b15ad 07-Apr-2021 Fabio Aiuto <fabioaiuto83@gmail.com>

staging: rtl8723bs: remove all DBG_871X logs

Remove all of the DBG_871X logs as they
currently do nothing as they require the code to be modified by
hand in order to be turned on. This obviously has not happened
since the code was merged, so just remove them as they are unused.

applied the following semantic patch script:

@@
expression a, b, c, d, e, f, g, h, i, j, k;
constant B, C, D, E;
@@

(
- DBG_871X(a);
|
- DBG_871X(a, b);
|
- DBG_871X(a, B);
|
- DBG_871X(a, b, c);
|
- DBG_871X(a, B, c);
|
- DBG_871X(a, b, C);
|
- DBG_871X(a, B, C);
|
- DBG_871X(a, b, c, d);
|
- DBG_871X(a, B, c, d);
|
- DBG_871X(a, b, C, d);
|
- DBG_871X(a, b, c, D);
|
- DBG_871X(a, B, C, d);
|
- DBG_871X(a, B, c, D);
|
- DBG_871X(a, b, C, D);
|
- DBG_871X(a, B, C, D);
|
- DBG_871X(a, b, c, d, e);
|
- DBG_871X(a, B, c, d, e);
|
- DBG_871X(a, b, C, d, e);
|
- DBG_871X(a, b, c, D, e);
|
- DBG_871X(a, b, c, d, E);
|
- DBG_871X(a, B, C, d, e);
|
- DBG_871X(a, B, c, D, e);
|
- DBG_871X(a, B, c, d, E);
|
- DBG_871X(a, b, C, D, e);
|
- DBG_871X(a, b, C, d, E);
|
- DBG_871X(a, b, c, D, E);
|
- DBG_871X(a, B, C, D, e);
|
- DBG_871X(a, B, C, d, E);
|
- DBG_871X(a, B, c, D, E);
|
- DBG_871X(a, b, C, D, E);
|
- DBG_871X(a, B, C, D, E);
|
- DBG_871X(a, b, c, d, e, f);
|
- DBG_871X(a, b, c, d, e, f, g);
|
- DBG_871X(a, b, c, d, e, f, g, h);
|
- DBG_871X(a, b, c, d, e, f, g, h, i);
|
- DBG_871X(a, b, c, d, e, f, g, h, i, j);
|
- DBG_871X(a, b, c, d, e, f, g, h, i, j, k);
)

Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
Link: https://lore.kernel.org/r/89a39f551107ba73b44dd2422765cf8ce371501a.1617802415.git.fabioaiuto83@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 42c3243f 07-Apr-2021 Fabio Aiuto <fabioaiuto83@gmail.com>

staging: rtl8723bs: remove DBG_871X log argument

This patch prepares the application of the semantic
patch aimed to remove all DBG_871X logs.

One occurrence of the DBG_871X macro has one
repeated argument, that's not even comma separated
value with the previous one nor a format string
parameter associated.

In normal conditions this worked, for the macro
is usually not expanded (the do nothing behaviour),
but if I try to apply the sempantic patch to remove
all macro occurrences, all macros call after that
abnormal declaration are left untouched (not removed).

Remove all of the DBG_871X logs as they currently
do nothing as they require the code to be modified by
hand in order to be turned on. This obviously has not happened
since the code was merged, so just remove them as they are unused.

Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
Link: https://lore.kernel.org/r/3473925ae9ee5a3bcd0ab86613dbce80b6d3f33f.1617802415.git.fabioaiuto83@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 0dfb2de7 04-Apr-2021 Fabio Aiuto <fabioaiuto83@gmail.com>

staging: rtl8723bs: fix comparison in if condition in core/rtw_recv.c

fix post-commit checkpatch issue:

CHECK: Using comparison to false is error prone
27: FILE: drivers/staging/rtl8723bs/core/rtw_recv.c:381:
+ if (psecuritypriv->
bcheck_grpkey == false &&

and fix the same issue in second comparison to true
inside the same if condition
IS_MCAST(prxattrib->ra) == true
^^^^^^^

Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
Link: https://lore.kernel.org/r/4b363edbc2da36cb3c63edbcd43e3285754768c9.1617545239.git.fabioaiuto83@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 4e715773 04-Apr-2021 Fabio Aiuto <fabioaiuto83@gmail.com>

staging: rtl8723bs: remove unnecessary parentheses in core/rtw_recv.c

fix post-commit checkpatch issue:

CHECK: Unnecessary parentheses around
'psecuritypriv->bcheck_grpkey == false'
24: FILE: drivers/staging/rtl8723bs/core/rtw_recv.c:381:
+ if ((psecuritypriv->
bcheck_grpkey == false) &&
+ (IS_MCAST(prxattrib->ra)
== true))

and fix same issue on second comparison
(IS_MCAST(prxattrib->ra) == true)
^ ^

Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
Link: https://lore.kernel.org/r/eab39c58913d799dc90efb8b234c2a7fdb61ba57.1617545239.git.fabioaiuto83@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 1f96ef45 04-Apr-2021 Fabio Aiuto <fabioaiuto83@gmail.com>

staging: rtl8723bs: split long line in core/rtw_recv.c

fix post-commit hook checkpatch issue:

WARNING: line length of 113 exceeds 100 columns
110: FILE: drivers/staging/rtl8723bs/core/rtw_recv.c:381:
+ if ((psecuritypriv->bcheck_grpkey
== false) && (IS_MCAST(prxattrib->ra) == true))

Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
Link: https://lore.kernel.org/r/ac256752eddba7678e8305cb5e560969dec482de.1617545239.git.fabioaiuto83@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 052b7b90 04-Apr-2021 Fabio Aiuto <fabioaiuto83@gmail.com>

staging: rtl8723bs: added spaces around operator in core/rtw_recv.c

fix post-commit hook checkpatch issue:

CHECK: spaces preferred around that '+' (ctx:VxV)
60: FILE: drivers/staging/rtl8723bs/core/rtw_recv.c:359:
+ if (miccode[i] != *(pframemic+i))
^

Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
Link: https://lore.kernel.org/r/6202df1b5383aa0a66810358495c2b1c9dd6c189.1617545239.git.fabioaiuto83@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 760a6677 04-Apr-2021 Fabio Aiuto <fabioaiuto83@gmail.com>

staging: rtl8723bs: remove RT_TRACE logs in core/rtw_recv.c

Remove all of the RT_TRACE logs in the core/rtw_recv.c file as they
currently do nothing as they require the code to be modified by
hand in order to be turned on. This obviously has not happened
since the code was merged. Moreover it relies on an unneeded
private log level tracing which overrides the in-kernel public one,
so just remove them as they are unused.

Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
Link: https://lore.kernel.org/r/c4a5d7cc3a1e7c5a13622b277ee34042c34981bd.1617545239.git.fabioaiuto83@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# dfe138c9 04-Apr-2021 Fabio Aiuto <fabioaiuto83@gmail.com>

staging: rtl8723bs: remove commented RT_TRACE calls in core/rtw_recv.c

Remove commented RT_TRACE calls

Remove all of the RT_TRACE logs in the core/rtw_recv.c file as they
currently do nothing as they require the code to be modified by
hand in order to be turned on. This obviously has not happened
since the code was merged. Moreover it relies on an unneeded
private log level tracing which overrides the in-kernel public one,
so just remove them as they are unused.

Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
Link: https://lore.kernel.org/r/6986ce9c7bb0e9560d9463281973e1858347a966.1617545239.git.fabioaiuto83@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 7a246f17 23-Mar-2021 Fabio Aiuto <fabioaiuto83@gmail.com>

staging: rtl8723bs: removed function prototypes and made statics in core/rtw_recv.c

fix the following checkpatch issue:

WARNING: externs should be avoided in .c files
1190: FILE: drivers/staging/rtl8723bs/core/rtw_recv.c:1190:
+signed int validate_recv_mgnt_frame(struct adapter *padapter, union recv_frame *precv_frame);

removed function prototypes and made statics

moved two static function definitions before their usage
to make code compile

Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
Link: https://lore.kernel.org/r/e40951ad0d3ba103b1551e8f2e54c7bc45563346.1616503354.git.fabioaiuto83@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 5306e022 15-Mar-2021 Fabio Aiuto <fabioaiuto83@gmail.com>

staging: rtl8723bs: remove unused code blocks conditioned by never set CONFIG_AUTO_AP_MODE

remove conditional code blocks checked by unused CONFIG_AUTO_AP_MODE

cleaning required in TODO file:

find and remove code blocks guarded by never set CONFIG_FOO defines

Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
Link: https://lore.kernel.org/r/342607e2b4ba2a19b367705a0b47cac95d601d44.1615801721.git.fabioaiuto83@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 00d5865c 12-Mar-2021 Marco Cesati <marcocesati@gmail.com>

staging: rtl8723bs: remove typedefs in osdep_service_linux.h

This commit fixes the following checkpatch.pl warnings:

WARNING: do not add new typedefs
#43: FILE: include/osdep_service_linux.h:43:
+ typedef spinlock_t _lock;

WARNING: do not add new typedefs
#44: FILE: include/osdep_service_linux.h:44:
+ typedef struct mutex _mutex;

WARNING: do not add new typedefs
#45: FILE: include/osdep_service_linux.h:45:
+ typedef struct timer_list _timer;

WARNING: do not add new typedefs
#52: FILE: include/osdep_service_linux.h:52:
+ typedef struct sk_buff _pkt;

WARNING: do not add new typedefs
#53: FILE: include/osdep_service_linux.h:53:
+ typedef unsigned char _buffer;

WARNING: do not add new typedefs
#55: FILE: include/osdep_service_linux.h:55:
+ typedef int _OS_STATUS;

WARNING: do not add new typedefs
#57: FILE: include/osdep_service_linux.h:57:
+ typedef unsigned long _irqL;

WARNING: do not add new typedefs
#58: FILE: include/osdep_service_linux.h:58:
+ typedef struct net_device * _nic_hdl;

WARNING: do not add new typedefs
#62: FILE: include/osdep_service_linux.h:62:
+ typedef void timer_hdl_return;

WARNING: do not add new typedefs
#63: FILE: include/osdep_service_linux.h:63:
+ typedef void* timer_hdl_context;

WARNING: do not add new typedefs
#65: FILE: include/osdep_service_linux.h:65:
+ typedef struct work_struct _workitem;

Signed-off-by: Marco Cesati <marco.cesati@gmail.com>
Link: https://lore.kernel.org/r/20210312082638.25512-29-marco.cesati@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# d495c5503 12-Mar-2021 Marco Cesati <marcocesati@gmail.com>

staging: rtl8723bs: remove typedefs in basic_types.h

This commit fixes the following checkpatch.pl warning:

WARNING: do not add new typedefs
#16: FILE: include/basic_types.h:16:
+typedef signed int sint;

Signed-off-by: Marco Cesati <marco.cesati@gmail.com>
Link: https://lore.kernel.org/r/20210312082638.25512-28-marco.cesati@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 8b7b8784 15-Feb-2021 Phillip Potter <phil@philpotter.co.uk>

staging: rtl8723bs: remove DBG_COUNTER calls from core/rtw_recv.c

Remove all DBG_COUNTER macro calls from core/rtw_recv.c, as the
corresponding variables are only ever written to and not used. This
makes the code cleaner, and is necessary prior to removing the
DBG_COUNTER definition itself.

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
Link: https://lore.kernel.org/r/20210215233440.80617-5-phil@philpotter.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# aaa0bc19 07-Dec-2020 Ross Schmidt <ross.schm.dev@gmail.com>

staging: rtl8723bs: replace _TIM_IE_

Replace unique _TIM_IE_ macro with kernel provided WLAN_EID_DS_PARAMS
from linux/ieee80211.h.

Signed-off-by: Ross Schmidt <ross.schm.dev@gmail.com>
Link: https://lore.kernel.org/r/20201208040733.379197-10-ross.schm.dev@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 19cf9d7a 05-Dec-2020 Ross Schmidt <ross.schm.dev@gmail.com>

staging: rtl8723bs: remove LIST_CONTAINOR

Remove unnecessary macro for container_of and call it directly.

Signed-off-by: Ross Schmidt <ross.schm.dev@gmail.com>
Link: https://lore.kernel.org/r/20201206034517.4276-9-ross.schm.dev@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 954c647a 05-Dec-2020 Brother Matthew De Angelis <matthew.v.deangelis@gmail.com>

Staging: rtl8723bs/core: fix brace coding style issue

Remove unnecessary braces identified by checkpatch.pl at lines 740,
1039,1602,1922,1939.

Signed-off-by: Brother Matthew De Angelis <matthew.v.deangelis@gmail.com>
Link: https://lore.kernel.org/r/8ddd195a246696e9315dacfcce06b7ba7f9d7d1a.1607209336.git.matthew.v.deangelis@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# be25cfd8 05-Dec-2020 Brother Matthew De Angelis <matthew.v.deangelis@gmail.com>

Staging: rtl8723bs/core: delete empty if statement

Delete an if statement that was not executing anything when true.
This has the side effect of removing one checkpatch warning about braces
not being necessary.

Signed-off-by: Brother Matthew De Angelis <matthew.v.deangelis@gmail.com>
Link: https://lore.kernel.org/r/1895dc8a7b44bfdcb6a46273703fabad80cbdf99.1607209336.git.matthew.v.deangelis@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 8ec06b9f 09-Nov-2020 Ross Schmidt <ross.schm.dev@gmail.com>

staging: rtl8723bs: clean up logical continuations

Move operators to fix coding style issues and clear checkpatch checks.

CHECK: Logical continuations should be on the previous line

Signed-off-by: Ross Schmidt <ross.schm.dev@gmail.com>
Link: https://lore.kernel.org/r/20201110041008.15847-8-ross.schm.dev@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 5641eeec 09-Nov-2020 Ross Schmidt <ross.schm.dev@gmail.com>

staging: rtl8723bs: clean up open ended lines

Move declarations to fix coding style issues and clear checkpatch
checks.

CHECK: Lines should not end with a '('

Signed-off-by: Ross Schmidt <ross.schm.dev@gmail.com>
Link: https://lore.kernel.org/r/20201110041008.15847-4-ross.schm.dev@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 79008395 09-Nov-2020 Ross Schmidt <ross.schm.dev@gmail.com>

staging: rtl8723bs: clean up space before tabs

Remove spaces before tabs to fix coding style issues and clear
checkpatch warnings.

WARNING: please, no space before tabs

Signed-off-by: Ross Schmidt <ross.schm.dev@gmail.com>
Link: https://lore.kernel.org/r/20201110041008.15847-3-ross.schm.dev@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# bbda3ac4 04-Nov-2020 Ross Schmidt <ross.schm.dev@gmail.com>

staging: rtl8723bs: remove MAC_FMT macro

Remove unnecessary macro for %pM and call it directly.

Signed-off-by: Ross Schmidt <ross.schm.dev@gmail.com>
Link: https://lore.kernel.org/r/20201105034754.12383-1-ross.schm.dev@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 90855921 26-Oct-2020 Amarjargal Gundjalam <amarjargal16@gmail.com>

staging: rtl8723bs: cleanup NULL check before vfree

Remove redundant NULL pointer check before vfree() since vfree() does
its own NULL check. Reported by coccinelle.

Signed-off-by: Amarjargal Gundjalam <amarjargal16@gmail.com>
Link: https://lore.kernel.org/r/20201026141510.GA21791@AJ-T14
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# d2e8f201 03-Oct-2020 Ross Schmidt <ross.schm.dev@gmail.com>

staging: rtl8723bs: replace RTW_GET_BE16 with get_unaligned_be16

Replace RTW_GET_BE16 macro with get_unlaligned_be16.

Signed-off-by: Ross Schmidt <ross.schm.dev@gmail.com>
Link: https://lore.kernel.org/r/20201004011743.10750-7-ross.schm.dev@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 77f55d13 27-May-2020 Pascal Terjan <pterjan@google.com>

staging: rtl8723bs: Use common packet header constants

This driver contains a local version of the rfc1042 header and bridge
tunnel header constants which are available from cfg80211.h, switch to
those.

Signed-off-by: Pascal Terjan <pterjan@google.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20200527205100.35794-1-pterjan@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 858ea450 26-Mar-2020 R Veera Kumar <vkor@vkten.in>

staging: rtl8723bs: core: Correct typos in comments

Correct typos in comments.
Misspellings found using checkpatch.pl.

Signed-off-by: R Veera Kumar <vkor@vkten.in>
Link: https://lore.kernel.org/r/20200326123540.12401-1-vkor@vkten.in
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 0fd1dc1e 06-Oct-2019 zhengbin <zhengbin13@huawei.com>

staging: rtl8723bs: Remove set but not used variables 'ppp', 'type', 'data'

Fixes gcc '-Wunused-but-set-variable' warning:

drivers/staging/rtl8723bs/core/rtw_recv.c: In function validate_80211w_mgmt:
drivers/staging/rtl8723bs/core/rtw_recv.c:1415:8: warning: variable ppp set but not used [-Wunused-but-set-variable]
drivers/staging/rtl8723bs/core/rtw_recv.c: In function validate_80211w_mgmt:
drivers/staging/rtl8723bs/core/rtw_recv.c:1403:5: warning: variable type set but not used [-Wunused-but-set-variable]
drivers/staging/rtl8723bs/core/rtw_recv.c: In function recvframe_defrag:
drivers/staging/rtl8723bs/core/rtw_recv.c:1713:6: warning: variable data set but not used [-Wunused-but-set-variable]

They are not used since commit 554c0a3abf21 ("staging:
Add rtl8723bs sdio wifi driver")

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: zhengbin <zhengbin13@huawei.com>
Link: https://lore.kernel.org/r/1570352999-45790-5-git-send-email-zhengbin13@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# d05b5320 10-Jun-2019 Nishka Dasgupta <nishkadg.linux@gmail.com>

staging: rtl8723bs: Change type of rtw_os_recv_resource_alloc()

Remove assignment of the return value of rtw_os_recv_resource_alloc as
this assignment at the call site is never used.
Remove return statement from rtw_os_recv_resource_alloc() as its return
variable is never used.
Change the type of the function to void.

Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# ce3b32a2 22-May-2019 Hariprasad Kelam <hariprasad.kelam@gmail.com>

staging: rtl8723bs: core: rtw_recv: fix warning Comparison to NULL

fix below warning reported by checkpatch

CHECK: Comparison to NULL could be written
"!precvpriv->pallocated_frame_buf"
CHECK: Comparison to NULL could be written "padapter"

Signed-off-by: Hariprasad Kelam <hariprasad.kelam@gmail.com>
-----
changes in v2:
Corected few erorrs like (!*psta == NULL) pointed in
review

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# f3dbf6ea 15-May-2019 Hariprasad Kelam <hariprasad.kelam@gmail.com>

staging: rtl8723bs: core: rtw_recv: fix warning Unneeded variable ret

fix below warning reported by coccicheck

drivers/staging/rtl8723bs/core/rtw_recv.c:1903:5-8: Unneeded variable:
"ret". Return "_SUCCESS" on line 1972
drivers/staging/rtl8723bs/core/rtw_recv.c:1618:6-9: Unneeded variable:
"ret". Return "_SUCCESS" on line 1705

Signed-off-by: Hariprasad Kelam <hariprasad.kelam@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# cb9a242c 12-Dec-2018 Hardik Singh Rathore <hardiksingh.k@gmail.com>

Staging: rtl8723bs: Fix code style issue in rtl8723bs driver

Add space between 'else' and '{' to solve code style issue
in all the files for rtl8723bs driver.

Signed-off-by: Hardik Singh Rathore <hardiksingh.k@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 58391efd 08-May-2018 Nathan Chancellor <nathan@kernel.org>

staging: rtl8723bs: Replace license boilerplate with SPDX identifiers

This satisfies a checkpatch.pl warning and is the preferred method for
notating the license due to its lack of ambiguity.

Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# c3ecca4b 03-Mar-2018 Arushi Singhal <arushisinghal19971997@gmail.com>

staging: rtl8723bs: Remove unnecessary semicolon.

Remove unnecessary semicolon using semicolon.cocci Coccinelle script.

Signed-off-by: Arushi Singhal <arushisinghal19971997@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# e8b1844a 24-Oct-2017 Kees Cook <keescook@chromium.org>

staging: rtl8723bs: Convert timers to use timer_setup()

In preparation for unconditionally passing the struct timer_list pointer to
all timer callbacks, switch to using the new timer_setup() and from_timer()
to pass the timer pointer explicitly. This performs some refactoring to
remove needless wrapper functions, and adds a pointer back to the desired
adapter.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Shreeya Patel <shreeya.patel23498@gmail.com>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Himanshu Jha <himanshujha199640@gmail.com>
Cc: Joe Perches <joe@perches.com>
Cc: Derek Robson <robsonde@gmail.com>
Cc: Harsha Sharma <harshasharmaiitr@gmail.com>
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Stephen Hemminger <stephen@networkplumber.org>
Cc: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>
Cc: Johannes Berg <johannes.berg@intel.com>
Cc: devel@driverdev.osuosl.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 8eb1f34c 01-Oct-2017 Shreeya Patel <shreeya.patel23498@gmail.com>

Staging: rtl8723bs: Remove unnecessary comments

Remove unnecessary comments which are there
to explain why call to memset is in comments. Both of the
comments are not needed as they are not very useful.

Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 67af9094 09-Sep-2017 Joe Perches <joe@perches.com>

staging: rtl8723bs: Convert LIST_CONTAINOR to use kernel container_of

These are similar macros so use the normal kernel one.

As well, there are odd games being played with casting a plist to
a union recv_frame by using LIST_CONTAINOR. Just use a direct cast
to union recv_frame instead.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 529d87b4 28-Aug-2017 Himanshu Jha <himanshujha199640@gmail.com>

staging: rtl8723bs: core: remove cast to void pointer

casting to void pointer from any pointer type and vice-versa is done
implicitly and therefore casting is not needed in such a case.

Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 40d4aa0f 29-Jul-2017 Shreeya Patel <shreeya.patel23498@gmail.com>

Staging: rtl8723bs: Do not initialise static to 0.

Do not initialise static to 0.
Static variables by default initialise to 0.

This patch fixes the errors found by checkpatch.

Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 7ecb3644 23-Apr-2017 Kenneth Hsu <kennethhsu@gmail.com>

staging: rtl8723bs: declare private function as static

This fixes a sparse warning regarding an undeclared symbol. Since the
function is private to rtw_recv.c, it should be declared as static.

Signed-off-by: Kenneth Hsu <kennethhsu@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 3498d684 08-Apr-2017 Larry Finger <Larry.Finger@lwfinger.net>

staging: rtl8723bs: Fix white-space errors in core/rtw_recv.c

Smart reports the following:

CHECK drivers/staging/rtl8723bs/core/rtw_recv.c
drivers/staging/rtl8723bs/core/rtw_recv.c:598 portctrl() warn: inconsistent indenting
drivers/staging/rtl8723bs/core/rtw_recv.c:838 sta2sta_data_frame() warn: inconsistent indenting
drivers/staging/rtl8723bs/core/rtw_recv.c:1547 validate_recv_frame() warn: inconsistent indenting

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 554c0a3a 29-Mar-2017 Hans de Goede <hdegoede@redhat.com>

staging: Add rtl8723bs sdio wifi driver

The rtl8723bs is found on quite a few systems used by Linux users,
such as on Atom systems (Intel Computestick and various other
Atom based devices) and on many (budget) ARM boards such as
the CHIP.

The plan moving forward with this is for the new clean,
written from scratch, rtl8xxxu driver to eventually gain
support for sdio devices. But there is no clear timeline
for that, so lets add this driver included in staging for now.

Cc: Bastien Nocera <hadess@hadess.net>
Cc: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Jes Sorensen <jes.sorensen@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>