aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2x00.h
diff options
context:
space:
mode:
authorIvo van Doorn <ivdoorn@gmail.com>2008-11-09 17:40:46 -0500
committerJohn W. Linville <linville@tuxdriver.com>2008-11-21 11:08:16 -0500
commit8ff48a8bbe4a1ba29dea2836dfce74660f97c1be (patch)
tree611c0e996813c59c229694b52d329c24829b80e8 /drivers/net/wireless/rt2x00/rt2x00.h
parentbad13639a30e1557fbe9d440adc1906673c9de4e (diff)
rt2x00: Fix race condition when using inderect registers
Indirect registers require multiple calls to the CSR register in order to access the indirect registers. This must be protected under a lock to prevent race conditions which could cause invalid data to be returned when reading from the indirect register or silent failures when writing data to the indirect register. USB drivers where already protected under a mutex, so rename the mutex and make PCI drivers use the mutex as well. This now means that BBP and RF registers are no longer accessible in interrupt context. That is not a bad situation since the slow behavior of accessing those registers means we don't _want_ to access them in interrupt context either. Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2x00.h')
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00.h19
1 files changed, 9 insertions, 10 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
index baccea7184b5..fee61bee1e7e 100644
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -746,16 +746,15 @@ struct rt2x00_dev {
746 } csr; 746 } csr;
747 747
748 /* 748 /*
749 * Mutex to protect register accesses on USB devices. 749 * Mutex to protect register accesses.
750 * There are 2 reasons this is needed, one is to ensure 750 * For PCI and USB devices it protects against concurrent indirect
751 * use of the csr_cache (for USB devices) by one thread 751 * register access (BBP, RF, MCU) since accessing those
752 * isn't corrupted by another thread trying to access it. 752 * registers require multiple calls to the CSR registers.
753 * The other is that access to BBP and RF registers 753 * For USB devices it also protects the csr_cache since that
754 * require multiple BUS transactions and if another thread 754 * field is used for normal CSR access and it cannot support
755 * attempted to access one of those registers at the same 755 * multiple callers simultaneously.
756 * time one of the writes could silently fail. 756 */
757 */ 757 struct mutex csr_mutex;
758 struct mutex usb_cache_mutex;
759 758
760 /* 759 /*
761 * Current packet filter configuration for the device. 760 * Current packet filter configuration for the device.