From patchwork Sat Dec 18 08:17:37 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajkumar Manoharan X-Patchwork-Id: 417901 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 oBI8I6ZR025692 for ; Sat, 18 Dec 2010 08:18:06 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753557Ab0LRISD (ORCPT ); Sat, 18 Dec 2010 03:18:03 -0500 Received: from mail.atheros.com ([12.19.149.2]:47813 "EHLO mail.atheros.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753464Ab0LRISC (ORCPT ); Sat, 18 Dec 2010 03:18:02 -0500 Received: from mail.atheros.com ([10.10.20.105]) by sidewinder.atheros.com for ; Sat, 18 Dec 2010 00:17:47 -0800 Received: from CHEXHC-01.global.atheros.com (10.12.0.100) by SC1EXHC-01.global.atheros.com (10.10.20.105) with Microsoft SMTP Server (TLS) id 8.2.213.0; Sat, 18 Dec 2010 00:18:01 -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 13:47:57 +0530 Received: by mail.atheros.com (sSMTP sendmail emulation); Sat, 18 Dec 2010 13:47:39 +0530 From: Rajkumar Manoharan To: CC: , Rajkumar Manoharan Subject: [PATCH 1/2] ath9k: Fix warnings on card removal Date: Sat, 18 Dec 2010 13:47:37 +0530 Message-ID: <1292660258-4063-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 08:18:06 +0000 (UTC) diff --git a/drivers/net/wireless/ath/ath9k/eeprom.h b/drivers/net/wireless/ath/ath9k/eeprom.h index f6f09d1..c0942f7 100644 --- a/drivers/net/wireless/ath/ath9k/eeprom.h +++ b/drivers/net/wireless/ath/ath9k/eeprom.h @@ -23,7 +23,8 @@ #include #include "ar9003_eeprom.h" -#define AH_USE_EEPROM 0x1 +#define AH_USE_EEPROM 0x00000001 +#define AH_UNPLUGGED 0x00000002 #ifdef __BIG_ENDIAN #define AR5416_EEPROM_MAGIC 0x5aa5 diff --git a/drivers/net/wireless/ath/ath9k/gpio.c b/drivers/net/wireless/ath/ath9k/gpio.c index 1337640..978a223 100644 --- a/drivers/net/wireless/ath/ath9k/gpio.c +++ b/drivers/net/wireless/ath/ath9k/gpio.c @@ -125,7 +125,8 @@ void ath_deinit_leds(struct ath_softc *sc) ath_unregister_led(&sc->tx_led); ath_unregister_led(&sc->rx_led); ath_unregister_led(&sc->radio_led); - ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, 1); + if (!(sc->sc_ah->ah_flags & AH_UNPLUGGED)) + ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, 1); } void ath_init_leds(struct ath_softc *sc) diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c index 1238795..8cf2414 100644 --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c @@ -542,6 +542,7 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid, if (!sc->dev->platform_data) ah->ah_flags |= AH_USE_EEPROM; + sc->sc_ah->ah_flags &= ~AH_UNPLUGGED; common = ath9k_hw_common(ah); common->ops = &ath9k_common_ops; common->bus_ops = bus_ops; @@ -818,8 +819,8 @@ void ath9k_deinit_device(struct ath_softc *sc) struct ieee80211_hw *hw = sc->hw; int i = 0; - ath9k_ps_wakeup(sc); - + if (!(sc->sc_ah->ah_flags & AH_UNPLUGGED)) + ath9k_ps_wakeup(sc); wiphy_rfkill_stop_polling(sc->hw->wiphy); ath_deinit_leds(sc); diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index cb53fbb..e06a44e 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c @@ -1220,6 +1220,12 @@ static int ath9k_tx(struct ieee80211_hw *hw, struct ath_tx_control txctl; struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; + if (sc->sc_ah->ah_flags & AH_UNPLUGGED) { + ath_dbg(common, ATH_DBG_ANY, + "Device not present, can not xmit\n"); + goto exit; + } + if (aphy->state != ATH_WIPHY_ACTIVE && aphy->state != ATH_WIPHY_SCAN) { ath_dbg(common, ATH_DBG_XMIT, "ath9k: %s: TX in unexpected wiphy state %d\n", @@ -1318,6 +1324,12 @@ static void ath9k_stop(struct ieee80211_hw *hw) return; } + if (ah->ah_flags & AH_UNPLUGGED) { + ath_dbg(common, ATH_DBG_ANY, "Device not present\n"); + mutex_unlock(&sc->mutex); + return; + } + if (ath9k_wiphy_started(sc)) { mutex_unlock(&sc->mutex); return; /* another wiphy still in use */ @@ -1585,6 +1597,11 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed) mutex_lock(&sc->mutex); + if (ah->ah_flags & AH_UNPLUGGED) { + mutex_unlock(&sc->mutex); + return 0; + } + /* * Leave this as the first check because we need to turn on the * radio if it was disabled before prior to processing the rest @@ -1765,6 +1782,9 @@ static void ath9k_configure_filter(struct ieee80211_hw *hw, changed_flags &= SUPPORTED_FILTERS; *total_flags &= SUPPORTED_FILTERS; + if (sc->sc_ah->ah_flags & AH_UNPLUGGED) + return; + sc->rx.rxfilter = *total_flags; ath9k_ps_wakeup(sc); rfilt = ath_calcrxfilter(sc); diff --git a/drivers/net/wireless/ath/ath9k/pci.c b/drivers/net/wireless/ath/ath9k/pci.c index 7ca8499..96c6005 100644 --- a/drivers/net/wireless/ath/ath9k/pci.c +++ b/drivers/net/wireless/ath/ath9k/pci.c @@ -264,6 +264,7 @@ static void ath_pci_remove(struct pci_dev *pdev) struct ath_softc *sc = aphy->sc; void __iomem *mem = sc->mem; + sc->sc_ah->ah_flags |= AH_UNPLUGGED; ath9k_deinit_device(sc); free_irq(sc->irq, sc); ieee80211_free_hw(sc->hw);