linux/drivers/net/wireless/ath/carl9170
Daniel Wagner 78a9e17038 carl9170: Fix wrong completion usage
carl9170_usb_stop() is used from several places to flush and cleanup any
pending work. The normal pattern is to send a request and wait for the
irq handler to call complete(). The completion is not reinitialized
during normal operation and as the old comment indicates it is important
to keep calls to wait_for_completion_timeout() and complete() balanced.

Calling complete_all() brings this equilibirum out of balance and needs
to be fixed by a reinit_completion(). But that opens a small race
window. It is possible that the sequence of complete_all(),
reinit_completion() is faster than the wait_for_completion_timeout() can
do its work. The wake up is not lost but the done counter test is after
reinit_completion() has been executed. The only reason we don't see
carl9170_exec_cmd() hang forever is we use the timeout version of
wait_for_copletion().

Let's fix this by reinitializing the completion (that is just setting
done counter to 0) just before we send out an request. Now,
carl9170_usb_stop() can be sure a complete() call is enough to make
progess since there is only one waiter at max. This is a common pattern
also seen in various drivers which use completion.

Signed-off-by: Daniel Wagner <daniel.wagner@bmw-carit.de>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
2016-09-09 15:15:28 +03:00
..
carl9170.h carl9170: fix sending URBs with wrong type when using full-speed 2014-08-11 14:43:51 -04:00
cmd.c cfg80211: remove "channel" from survey names 2015-01-08 15:27:52 +01:00
cmd.h
debug.c wireless: use %*pb[l] to print bitmaps including cpumasks and nodemasks 2015-02-13 21:21:38 -08:00
debug.h
eeprom.h
fw.c mac80211: convert HW flags to unsigned long bitmap 2015-06-10 16:05:36 +02:00
fwcmd.h carl9170: import 1.9.9 firmware headers 2016-03-07 14:11:09 +02:00
fwdesc.h carl9170: import 1.9.9 firmware headers 2016-03-07 14:11:09 +02:00
hw.h carl9170: import 1.9.9 firmware headers 2016-03-07 14:11:09 +02:00
Kconfig carl9170: Clarify kconfig text 2016-06-04 17:58:14 +03:00
led.c mac80211: make LED trigger names const 2015-05-05 14:21:55 +02:00
mac.c cfg80211: remove enum ieee80211_band 2016-04-12 15:56:15 +02:00
main.c cfg80211: remove enum ieee80211_band 2016-04-12 15:56:15 +02:00
Makefile
phy.c cfg80211: remove enum ieee80211_band 2016-04-12 15:56:15 +02:00
phy.h
rx.c cfg80211: remove enum ieee80211_band 2016-04-12 15:56:15 +02:00
tx.c cfg80211: remove enum ieee80211_band 2016-04-12 15:56:15 +02:00
usb.c carl9170: Fix wrong completion usage 2016-09-09 15:15:28 +03:00
version.h carl9170: import 1.9.9 firmware headers 2016-03-07 14:11:09 +02:00
wlan.h