From patchwork Sat Dec 18 09:29:07 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajkumar Manoharan X-Patchwork-Id: 417921 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oBI9Tfhi029235 for ; Sat, 18 Dec 2010 09:29:42 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754151Ab0LRJ3e (ORCPT ); Sat, 18 Dec 2010 04:29:34 -0500 Received: from mail.atheros.com ([12.19.149.2]:48318 "EHLO mail.atheros.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754108Ab0LRJ3b (ORCPT ); Sat, 18 Dec 2010 04:29:31 -0500 Received: from mail.atheros.com ([10.10.20.108]) by sidewinder.atheros.com for ; Sat, 18 Dec 2010 01:29:15 -0800 Received: from CHEXHC-01.global.atheros.com (10.12.0.100) by SC1EXHC-02.global.atheros.com (10.10.20.108) with Microsoft SMTP Server (TLS) id 8.2.213.0; Sat, 18 Dec 2010 01:29:30 -0800 Received: from mail.atheros.com (10.12.4.12) by CHEXHC-01.global.atheros.com (10.12.0.100) with Microsoft SMTP Server (TLS) id 8.2.176.0; Sat, 18 Dec 2010 14:59:26 +0530 Received: by mail.atheros.com (sSMTP sendmail emulation); Sat, 18 Dec 2010 14:59:08 +0530 From: Rajkumar Manoharan To: CC: , Rajkumar Manoharan Subject: [PATCH 2/2] ath9k_htc: Fix unnecessary warnings on card removal Date: Sat, 18 Dec 2010 14:59:07 +0530 Message-ID: <1292664547-5474-1-git-send-email-rmanoharan@atheros.com> X-Mailer: git-send-email 1.7.3.3 MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Sat, 18 Dec 2010 09:29:42 +0000 (UTC) diff --git a/drivers/net/wireless/ath/ath9k/htc.h b/drivers/net/wireless/ath/ath9k/htc.h index fdf9d5f..d90838a 100644 --- a/drivers/net/wireless/ath/ath9k/htc.h +++ b/drivers/net/wireless/ath/ath9k/htc.h @@ -339,7 +339,6 @@ void ath_htc_cancel_btcoex_work(struct ath9k_htc_priv *priv); #define OP_ASSOCIATED BIT(7) #define OP_ENABLE_BEACON BIT(8) #define OP_LED_DEINIT BIT(9) -#define OP_UNPLUGGED BIT(10) #define OP_BT_PRIORITY_DETECTED BIT(11) #define OP_BT_SCAN BIT(12) diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c b/drivers/net/wireless/ath/ath9k/htc_drv_init.c index 0f6be35..8a73dc2 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c @@ -632,6 +632,7 @@ static int ath9k_init_priv(struct ath9k_htc_priv *priv, ah->hw_version.subsysid = 0; /* FIXME */ ah->hw_version.usbdev = drv_info; ah->ah_flags |= AH_USE_EEPROM; + ah->ah_flags &= ~AH_UNPLUGGED; priv->ah = ah; common = ath9k_hw_common(ah); @@ -851,9 +852,6 @@ int ath9k_htc_probe_device(struct htc_target *htc_handle, struct device *dev, if (ret) goto err_init; - /* The device may have been unplugged earlier. */ - priv->op_flags &= ~OP_UNPLUGGED; - ret = ath9k_init_device(priv, devid, product, drv_info); if (ret) goto err_init; @@ -873,7 +871,7 @@ void ath9k_htc_disconnect_device(struct htc_target *htc_handle, bool hotunplug) /* Check if the device has been yanked out. */ if (hotunplug) - htc_handle->drv_priv->op_flags |= OP_UNPLUGGED; + htc_handle->drv_priv->ah->ah_flags |= AH_UNPLUGGED; ath9k_deinit_device(htc_handle->drv_priv); ath9k_deinit_wmi(htc_handle->drv_priv); diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c index dd17909..f6e64c9 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c @@ -1110,6 +1110,11 @@ static int ath9k_htc_tx(struct ieee80211_hw *hw, struct sk_buff *skb) struct ath9k_htc_priv *priv = hw->priv; int padpos, padsize, ret; + if (priv->ah->ah_flags & AH_UNPLUGGED) { + ath_dbg(ath9k_hw_common(priv->ah), ATH_DBG_ANY, + "Device no present, can not xmit\n"); + goto fail_tx; + } hdr = (struct ieee80211_hdr *) skb->data; /* Add the padding after the header if this is not already done */ @@ -1231,6 +1236,12 @@ static void ath9k_htc_stop(struct ieee80211_hw *hw) cancel_delayed_work_sync(&priv->ath9k_led_blink_work); ath9k_led_stop_brightness(priv); + if (ah->ah_flags & AH_UNPLUGGED) { + ath_dbg(common, ATH_DBG_ANY, "Device not present\n"); + mutex_unlock(&priv->mutex); + return; + } + ath9k_htc_ps_wakeup(priv); htc_stop(priv->htc); WMI_CMD(WMI_DISABLE_INTR_CMDID); @@ -1348,6 +1359,11 @@ static void ath9k_htc_remove_interface(struct ieee80211_hw *hw, ath_dbg(common, ATH_DBG_CONFIG, "Detach Interface\n"); mutex_lock(&priv->mutex); + if (priv->ah->ah_flags & AH_UNPLUGGED) { + ath_dbg(common, ATH_DBG_ANY, "Device not present\n"); + mutex_unlock(&priv->mutex); + return; + } ath9k_htc_ps_wakeup(priv); memset(&hvif, 0, sizeof(struct ath9k_htc_target_vif)); @@ -1471,11 +1487,17 @@ static void ath9k_htc_configure_filter(struct ieee80211_hw *hw, u32 rfilt; mutex_lock(&priv->mutex); - ath9k_htc_ps_wakeup(priv); changed_flags &= SUPPORTED_FILTERS; *total_flags &= SUPPORTED_FILTERS; + if (priv->ah->ah_flags & AH_UNPLUGGED) { + ath_dbg(ath9k_hw_common(priv->ah), ATH_DBG_ANY, + "Device not present\n"); + mutex_unlock(&priv->mutex); + return; + } + ath9k_htc_ps_wakeup(priv); priv->rxfilter = *total_flags; rfilt = ath9k_htc_calcrxfilter(priv); ath9k_hw_setrxfilter(priv->ah, rfilt); diff --git a/drivers/net/wireless/ath/ath9k/wmi.c b/drivers/net/wireless/ath/ath9k/wmi.c index 8f42ea7..8f42d42 100644 --- a/drivers/net/wireless/ath/ath9k/wmi.c +++ b/drivers/net/wireless/ath/ath9k/wmi.c @@ -250,7 +250,7 @@ int ath9k_wmi_cmd(struct wmi *wmi, enum wmi_cmd_id cmd_id, int time_left, ret = 0; unsigned long flags; - if (wmi->drv_priv->op_flags & OP_UNPLUGGED) + if (wmi->drv_priv->ah->ah_flags & AH_UNPLUGGED) return 0; skb = alloc_skb(headroom + cmd_len, GFP_ATOMIC);