mt7601u: make write with mask access atomic
authorLorenzo Bianconi <lorenzo.bianconi@redhat.com>
Fri, 16 Feb 2018 22:30:01 +0000 (23:30 +0100)
committerKalle Valo <kvalo@codeaurora.org>
Wed, 28 Feb 2018 14:58:42 +0000 (16:58 +0200)
commitfee05843801c37e527dbe2c5eeb3fb3b15bc9919
tree16643cc3a92281b5f66c307d4b45cc6efc00bec4
parent7972326a26b5bf8dc2adac575c4e03ee7e9d193a
mt7601u: make write with mask access atomic

Introduce __mt7601u_rr and __mt7601u_vendor_single_wr routines in order
to make mt7601u_rmw and mt7601u_rmc atomic. This patch does not fix a
reported issue but makes the usb access more robust to concurrent
operations on the same register since it is theoretically possible that
read and write accesses of mt7601u_rmw/mt7601u_rmc can be interleaved with
a different write operation on the same register.
Moreover using __mt7601u_rr and __mt7601u_vendor_single_wr in
mt7601u_rmw/mt7601u_rmc allows to grab vendor_req_mutex mutex once
instead of twice

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Acked-by: Jakub Kicinski <kubakici@wp.pl>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/mediatek/mt7601u/mt7601u.h
drivers/net/wireless/mediatek/mt7601u/usb.c