X-Git-Url: http://git.ozo.com/?a=blobdiff_plain;f=ath%2Fif_ath_hal_macros.h;h=7d93314ce71cb80b2ced11155dac5ed44e8317bb;hb=752da93f475d63d6cac3a6e96a91947c1e3dffa0;hp=a28be19cb28e76a183e266ac3293fecb7f4caa9c;hpb=2c0d8db912df58c3a1b506e144e2b5d72edec617;p=madwifi%2F.git diff --git a/ath/if_ath_hal_macros.h b/ath/if_ath_hal_macros.h index a28be19..7d93314 100644 --- a/ath/if_ath_hal_macros.h +++ b/ath/if_ath_hal_macros.h @@ -53,12 +53,33 @@ #define ATH_HAL_LOCK_INIT(_sc) spin_lock_init(&(_sc)->sc_hal_lock) #define ATH_HAL_LOCK_DESTROY(_sc) #define ATH_HAL_LOCK_IRQ(_sc) do { \ - unsigned long __sc_halLockflags; \ + unsigned long __sc_halLockflags; \ + ATH_HAL_LOCK_CHECK(_sc); \ spin_lock_irqsave(&(_sc)->sc_hal_lock, __sc_halLockflags); #define ATH_HAL_UNLOCK_IRQ(_sc) \ + ATH_HAL_LOCK_ASSERT(_sc); \ spin_unlock_irqrestore(&(_sc)->sc_hal_lock, __sc_halLockflags); \ } while(0) #define ATH_HAL_UNLOCK_IRQ_EARLY(_sc) \ + ATH_HAL_LOCK_ASSERT(_sc); \ spin_unlock_irqrestore(&(_sc)->sc_hal_lock, __sc_halLockflags); +#if (defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)) && defined(spin_is_locked) +#define ATH_HAL_LOCK_ASSERT(_sc) \ + KASSERT(spin_is_locked(&(_sc)->sc_hal_lock), ("hal not locked!")) +#if (defined(ATH_DEBUG_SPINLOCKS)) +#define ATH_HAL_LOCK_CHECK(_sc) do { \ + if (spin_is_locked(&(_sc)->sc_hal_lock)) \ + printk("%s:%d - about to block on hal lock!\n", __func__, __LINE__); \ +} while(0) +#else /* #if (defined(ATH_DEBUG_SPINLOCKS)) */ +#define ATH_HAL_LOCK_CHECK(_sc) +#endif /* #if (defined(ATH_DEBUG_SPINLOCKS)) */ + +#else +#define ATH_HAL_LOCK_ASSERT(_sc) +#define ATH_HAL_LOCK_CHECK(_sc) +#endif + + #endif /* #ifndef _IF_ATH_HAL_MACROS_H_ */