]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
rtlwifi: Fix use of mutex in interrupt code
authorLarry Finger <Larry.Finger@lwfinger.net>
Sat, 18 Dec 2010 01:36:25 +0000 (19:36 -0600)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 20 Dec 2010 19:49:48 +0000 (14:49 -0500)
A previous conversion from semaphoreto mutexes missed the fact that one
of the semaphores was used in interrupt code. Fixed by changing to
a spinlock.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/rtlwifi/base.c
drivers/net/wireless/rtlwifi/ps.c
drivers/net/wireless/rtlwifi/wifi.h

index 87530eaa88bd0fa19f82514ab46076ad8be810e4..77fa59af63d8eb664c5570be89e75df0467e7f0a 100644 (file)
@@ -309,8 +309,8 @@ int rtl_init_core(struct ieee80211_hw *hw)
        }
 
        /* <4> locks */
-       mutex_init(&rtlpriv->locks.ips_mutex);
        mutex_init(&rtlpriv->locks.conf_mutex);
+       spin_lock_init(&rtlpriv->locks.ips_lock);
        spin_lock_init(&rtlpriv->locks.irq_th_lock);
        spin_lock_init(&rtlpriv->locks.h2c_lock);
        spin_lock_init(&rtlpriv->locks.rf_ps_lock);
index 22c293e5b88c858b018b5e3bff87793daaa3ba09..d2326c13449e08b67945bac5a9662218e313a08d 100644 (file)
@@ -286,8 +286,9 @@ void rtl_ips_nic_on(struct ieee80211_hw *hw)
        struct rtl_priv *rtlpriv = rtl_priv(hw);
        struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
        enum rf_pwrstate rtstate;
+       unsigned long flags;
 
-       mutex_lock(&rtlpriv->locks.ips_mutex);
+       spin_lock_irqsave(&rtlpriv->locks.ips_lock, flags);
 
        if (ppsc->b_inactiveps) {
                rtstate = ppsc->rfpwr_state;
@@ -303,7 +304,7 @@ void rtl_ips_nic_on(struct ieee80211_hw *hw)
                }
        }
 
-       mutex_unlock(&rtlpriv->locks.ips_mutex);
+       spin_unlock_irqrestore(&rtlpriv->locks.ips_lock, flags);
 }
 
 /*for FW LPS*/
index 77d5fa370bdc7835994cfff25aab763a944183fe..d44d79613d2da8183389a45748299d35b427a8af 100644 (file)
@@ -1192,11 +1192,11 @@ struct rtl_hal_cfg {
 };
 
 struct rtl_locks {
-       /*sem */
-       struct mutex ips_mutex;
+       /* mutex */
        struct mutex conf_mutex;
 
        /*spin lock */
+       spinlock_t ips_lock;
        spinlock_t irq_th_lock;
        spinlock_t h2c_lock;
        spinlock_t rf_ps_lock;