Avoid triggering lockdep checker in ath_hw_reset()
authorproski <proski@0192ed92-7a03-0410-a25b-9323aeb14dbd>
Sun, 12 Apr 2009 05:53:23 +0000 (05:53 +0000)
committerproski <proski@0192ed92-7a03-0410-a25b-9323aeb14dbd>
Sun, 12 Apr 2009 05:53:23 +0000 (05:53 +0000)
Use spin_lock_irqsave_nested() instead of spin_lock_irqsave().  Use a
separate counter for the locking subclass, so that we don't exceed the
maximal value of 8.  We have 10 queues, but inactive queues don't get a
locking subclass number.

Provide a replacement for spin_lock_irqsave_nested() for kernels older
than 2.6.19.

git-svn-id: http://madwifi-project.org/svn/madwifi/trunk@3995 0192ed92-7a03-0410-a25b-9323aeb14dbd

ath/if_ath.c
include/compat.h

index 322f21bb94d4a6330ccd190da207efe4829b67d6..02be2169a04e9acee71d6a64a11b86425920673f 100644 (file)
@@ -1633,7 +1633,7 @@ static HAL_BOOL ath_hw_reset(struct ath_softc *sc, HAL_OPMODE opmode,
        HAL_BOOL ret;
        unsigned long __axq_lockflags[HAL_NUM_TX_QUEUES];
        struct ath_txq * txq;
-       int i;
+       int i, lclass = 0;
        u_int8_t old_privFlags = sc->sc_curchan.privFlags;
 
        /* ath_hal_reset() resets all TXDP pointers, so we need to
@@ -1643,7 +1643,8 @@ static HAL_BOOL ath_hw_reset(struct ath_softc *sc, HAL_OPMODE opmode,
        for (i = 0; i < HAL_NUM_TX_QUEUES; i++) {
                if (ATH_TXQ_SETUP(sc, i)) {
                        txq = &sc->sc_txq[i];
-                       spin_lock_irqsave(&txq->axq_lock, __axq_lockflags[i]);
+                       spin_lock_irqsave_nested(&txq->axq_lock,
+                                                __axq_lockflags[i], lclass++);
                }
        }
 
index 947cd5a90b3be62413653675bae8e644ae50e1cc..8f8da4691181b9b173379ef54336dc467af352fa 100644 (file)
@@ -210,6 +210,13 @@ typedef unsigned long resource_size_t;
 #define request_module(_fmt, _modname) request_module(_modname)
 #endif
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
+#ifndef spin_lock_irqsave_nested
+#define spin_lock_irqsave_nested(_lock, _flags, _subclass) \
+       spin_lock_irqsave(_lock, _flags)
+#endif
+#endif
+
 #endif /* __KERNEL__ */
 
 #endif /* _ATH_COMPAT_H_ */