From dd1f635fe0f14d8c03181f9f1f743b127694fc14 Mon Sep 17 00:00:00 2001 From: Holger Schurig Date: Wed, 19 Mar 2008 15:24:21 +0100 Subject: libertas: fix spinlock recursion bug This fixes a bug detected by CONFIG_DEBUG_SPINLOCK: if_cs_get_int_status() is only called from lbs_thread(), via priv->hw_get_int_status. However, lbs_thread() has already taken the priv->driver_lock. So it's a fault to take the same lock again here. Signed-off-by: Holger Schurig Acked-by: Dan Williams Signed-off-by: John W. Linville --- drivers/net/wireless/libertas/if_cs.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/net/wireless/libertas/if_cs.c b/drivers/net/wireless/libertas/if_cs.c index 5a9cadb9750..038c66a98f1 100644 --- a/drivers/net/wireless/libertas/if_cs.c +++ b/drivers/net/wireless/libertas/if_cs.c @@ -677,9 +677,7 @@ sbi_get_int_status_exit: /* Card has a command result for us */ if (*ireg & IF_CS_C_S_CMD_UPLD_RDY) { - spin_lock(&priv->driver_lock); ret = if_cs_receive_cmdres(priv, priv->upld_buf, &priv->upld_len); - spin_unlock(&priv->driver_lock); if (ret < 0) lbs_pr_err("could not receive cmd from card\n"); } -- cgit v1.2.3 From ebd9302842ecae39061b269531c0f5e278949cd3 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Tue, 4 Mar 2008 14:58:59 -0800 Subject: drivers/net/wireless/iwlwifi/iwl-4965.c: correct use of ! and & In commit e6bafba5b4765a5a252f1b8d31cbf6d2459da337, a bug was fixed that involved converting !x & y to !(x & y). The code below shows the same pattern, and thus should perhaps be fixed in the same way. This is not tested and clearly changes the semantics, so it is only something to consider. The semantic patch that makes this change is as follows: (http://www.emn.fr/x-info/coccinelle/) // @@ expression E1,E2; @@ ( !E1 & !E2 | - !E1 & E2 + !(E1 & E2) ) // Signed-off-by: Julia Lawall Cc: Tomas Winkler Cc: Guy Cohen Cc: Reinette Chatre Cc: Zhu Yi Signed-off-by: Andrew Morton Signed-off-by: John W. Linville --- drivers/net/wireless/iwlwifi/iwl-4965.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index d727de8b96f..65767570be6 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c @@ -4589,7 +4589,7 @@ static u8 iwl4965_is_fat_tx_allowed(struct iwl4965_priv *priv, if (sta_ht_inf) { if ((!sta_ht_inf->ht_supported) || - (!sta_ht_inf->cap & IEEE80211_HT_CAP_SUP_WIDTH)) + (!(sta_ht_inf->cap & IEEE80211_HT_CAP_SUP_WIDTH))) return 0; } -- cgit v1.2.3 From 9896322ae180e3520edec71e2480318e7196119c Mon Sep 17 00:00:00 2001 From: Ivo van Doorn Date: Thu, 27 Mar 2008 17:15:24 +0100 Subject: rt2x00: Ignore set_state(STATE_SLEEP) failure Some hardware never seem to accept the "goto sleep" command, since the legacy drivers don't have suspend and resume handlers the entire code for it was basically a educated guess (based on the "enable radio" code). This patch will only print a warning when the "goto sleep" command fails, and just continues as usual. Perhaps that means the device will not reach a sleep state and consumes more power then it should, but it is equally possible it simply needs some seconds longer to sleep. Anyway, by making the command non-fatal it will not block the rest of the suspend procedure. Signed-off-by: Ivo van Doorn Signed-off-by: John W. Linville --- drivers/net/wireless/rt2x00/rt2x00dev.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c index bd305f7f3ef..e873a39fcce 100644 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c @@ -1393,11 +1393,20 @@ int rt2x00lib_suspend(struct rt2x00_dev *rt2x00dev, pm_message_t state) exit: /* - * Set device mode to sleep for power management. + * Set device mode to sleep for power management, + * on some hardware this call seems to consistently fail. + * From the specifications it is hard to tell why it fails, + * and if this is a "bad thing". + * Overall it is safe to just ignore the failure and + * continue suspending. The only downside is that the + * device will not be in optimal power save mode, but with + * the radio and the other components already disabled the + * device is as good as disabled. */ retval = rt2x00dev->ops->lib->set_device_state(rt2x00dev, STATE_SLEEP); if (retval) - return retval; + WARNING(rt2x00dev, "Device failed to enter sleep state, " + "continue suspending.\n"); return 0; } -- cgit v1.2.3