aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/bcm43xx/bcm43xx.h
diff options
context:
space:
mode:
authorMichael Buesch <mbuesch@freenet.de>2006-03-11 07:39:14 -0500
committerJohn W. Linville <linville@tuxdriver.com>2006-03-27 11:19:35 -0500
commitefccb647f486ff8174b4db0ab8145df8dd42ce6d (patch)
tree099f947a1a99f5699c99011175dd8d6bf27fc0d4 /drivers/net/wireless/bcm43xx/bcm43xx.h
parent4d5a9e0eeb7ec928c6bd55db410f09ed3779bc2a (diff)
[PATCH] bcm43xx: Abstract the locking mechanism.
This is the starting point to make the driver out-of-order-MMIO-stores safe. There are more mmiowb() needed. Signed-off-by: Michael Buesch <mbuesch@freenet.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/bcm43xx/bcm43xx.h')
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx.h20
1 files changed, 19 insertions, 1 deletions
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx.h b/drivers/net/wireless/bcm43xx/bcm43xx.h
index fd9754b52951..5f8c63fab836 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx.h
+++ b/drivers/net/wireless/bcm43xx/bcm43xx.h
@@ -619,7 +619,9 @@ struct bcm43xx_private {
619 void __iomem *mmio_addr; 619 void __iomem *mmio_addr;
620 unsigned int mmio_len; 620 unsigned int mmio_len;
621 621
622 spinlock_t lock; 622 /* Do not use the lock directly. Use the bcm43xx_lock* helper
623 * functions, to be MMIO-safe. */
624 spinlock_t _lock;
623 625
624 /* Driver status flags. */ 626 /* Driver status flags. */
625 u32 initialized:1, /* init_board() succeed */ 627 u32 initialized:1, /* init_board() succeed */
@@ -721,6 +723,22 @@ struct bcm43xx_private {
721#endif 723#endif
722}; 724};
723 725
726/* bcm43xx_(un)lock() protect struct bcm43xx_private.
727 * Note that _NO_ MMIO writes are allowed. If you want to
728 * write to the device through MMIO in the critical section, use
729 * the *_mmio lock functions.
730 * MMIO read-access is allowed, though.
731 */
732#define bcm43xx_lock(bcm, flags) spin_lock_irqsave(&(bcm)->_lock, flags)
733#define bcm43xx_unlock(bcm, flags) spin_unlock_irqrestore(&(bcm)->_lock, flags)
734/* bcm43xx_(un)lock_mmio() protect struct bcm43xx_private and MMIO.
735 * MMIO write-access to the device is allowed.
736 * All MMIO writes are flushed on unlock, so it is guaranteed to not
737 * interfere with other threads writing MMIO registers.
738 */
739#define bcm43xx_lock_mmio(bcm, flags) bcm43xx_lock(bcm, flags)
740#define bcm43xx_unlock_mmio(bcm, flags) do { mmiowb(); bcm43xx_unlock(bcm, flags); } while (0)
741
724static inline 742static inline
725struct bcm43xx_private * bcm43xx_priv(struct net_device *dev) 743struct bcm43xx_private * bcm43xx_priv(struct net_device *dev)
726{ 744{