mwifiex: factor out mwifiex_cancel_pending_scan_cmd
authorAndreas Fenkart <afenkart@gmail.com>
Thu, 10 Mar 2016 08:44:10 +0000 (09:44 +0100)
committerKalle Valo <kvalo@codeaurora.org>
Fri, 15 Apr 2016 18:34:50 +0000 (21:34 +0300)
commitc70ca8cb9a7c6722d5bb6d428b6571921998c48d
tree38e7bb3736f1d6e4bd1c2a2a716c7c520a23db16
parent948ad6b34943a1247653392d59bcfc9896da8fe7
mwifiex: factor out mwifiex_cancel_pending_scan_cmd

Releasing the scan_pending lock in mwifiex_check_next_scan_command
introduces a short window where pending scan commands can be removed
or added before removing them all in mwifiex_cancel_pending_scan_cmd.
I think this is safe, since the worst thing to happen is that a
pending scan cmd is removed by the command handler. Adding new scan
commands is not possible while one is pending, see scan_processing flag.
Since all commands are removed from the queue anyway, we don't care if
some commands are removed by a different code path earlier, the final
state remains the same.
I assume, that the critical section needed for the check has been
extended over clearing the pending scan queue out of convenience. The
lock was already held and releasing it and grab it again was just
more work. It doesn't seem to be necessary because of concurrency.

Signed-off-by: Andreas Fenkart <afenkart@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/marvell/mwifiex/cmdevt.c
drivers/net/wireless/marvell/mwifiex/main.h
drivers/net/wireless/marvell/mwifiex/scan.c
drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c