commit 1c1ef53f99c819920530e54a9bc91a1117e7bc97 Author: Jiri Slaby Date: Thu Aug 9 08:41:49 2007 +0200 get rid of bitfields diff --git a/ath5k_base.c b/ath5k_base.c index d8f4b8e..9002585 100644 --- a/ath5k_base.c +++ b/ath5k_base.c @@ -735,7 +735,8 @@ static u32 ath_calcrxfilter(struct ath_softc *sc) AR5K_RX_FILTER_PROBEREQ | AR5K_RX_FILTER_PROM; if (opmode != IEEE80211_IF_TYPE_STA) rfilt |= AR5K_RX_FILTER_PROBEREQ; - if (opmode != IEEE80211_IF_TYPE_AP && sc->promisc) + if (opmode != IEEE80211_IF_TYPE_AP && test_bit(ATH_STAT_PROMISC, + sc->status)) rfilt |= AR5K_RX_FILTER_PROM; if (opmode == IEEE80211_IF_TYPE_STA || opmode == IEEE80211_IF_TYPE_IBSS) rfilt |= AR5K_RX_FILTER_BEACON; @@ -936,7 +937,7 @@ static void ath_draintxq(struct ath_softc *sc) int i; /* XXX return value */ - if (likely(!sc->invalid)) { + if (likely(!test_bit(ATH_STAT_INVALID, sc->status))) { /* don't touch the hardware if marked invalid */ (void)ath5k_hw_stop_tx_dma(ah, sc->bhalq); DPRINTF(sc, ATH_DEBUG_RESET, "%s: beacon queue %x\n", __func__, @@ -963,7 +964,8 @@ static int ath_stop_locked(struct ath_softc *sc) { struct ath_hw *ah = sc->ah; - DPRINTF(sc, ATH_DEBUG_RESET, "%s: invalid %u\n", __func__, sc->invalid); + DPRINTF(sc, ATH_DEBUG_RESET, "%s: invalid %u\n", __func__, + test_bit(ATH_STAT_INVALID, sc->status)); /* * Shutdown the hardware and driver: @@ -982,16 +984,16 @@ static int ath_stop_locked(struct ath_softc *sc) */ ieee80211_stop_queues(sc->hw); - if (!sc->invalid) { - if (sc->led_soft) { + if (!test_bit(ATH_STAT_INVALID, sc->status)) { + if (test_bit(ATH_STAT_LEDSOFT, sc->status)) { del_timer_sync(&sc->led_tim); ath5k_hw_set_gpio(ah, sc->led_pin, !sc->led_on); - sc->led_blinking = 0; + __clear_bit(ATH_STAT_LEDBLINKING, sc->status); } ath5k_hw_set_intr(ah, 0); } ath_draintxq(sc); - if (!sc->invalid) { + if (!test_bit(ATH_STAT_INVALID, sc->status)) { ath_stoprecv(sc); ath5k_hw_phy_disable(ah); } else @@ -1012,7 +1014,7 @@ static int ath_stop_hw(struct ath_softc *sc) mutex_lock(&sc->lock); ret = ath_stop_locked(sc); - if (ret == 0 && !sc->invalid) { + if (ret == 0 && !test_bit(ATH_STAT_INVALID, sc->status)) { /* * Set the chip in full sleep mode. Note that we are * careful to do this only when bringing the interface @@ -1047,7 +1049,7 @@ static int ath_stop_hw(struct ath_softc *sc) static void ath_setcurmode(struct ath_softc *sc, unsigned int mode) { - if (unlikely(sc->led_soft)) { + if (unlikely(test_bit(ATH_STAT_LEDSOFT, sc->status))) { /* from Atheros NDIS driver, w/ permission */ static const struct { u16 rate; /* tx/rx 802.11 rate */ @@ -1414,8 +1416,11 @@ static void ath_set_multicast_list(struct ieee80211_hw *hw, unsigned int prom = !!(flags & IFF_PROMISC); u32 rfilt; - if (sc->promisc != prom) { - sc->promisc = prom; + if (test_bit(ATH_STAT_PROMISC, sc->status) != prom) { + if (prom) + __set_bit(ATH_STAT_PROMISC, sc->status); + else + __clear_bit(ATH_STAT_PROMISC, sc->status); rfilt = ath_calcrxfilter(sc); ath5k_hw_set_rx_filter(sc->ah, rfilt); } @@ -1443,19 +1448,19 @@ static int ath_set_key(struct ieee80211_hw *hw, set_key_cmd cmd, goto unlock; } - set_bit(key->keyidx, sc->keymap); + __set_bit(key->keyidx, sc->keymap); key->hw_key_idx = key->keyidx; key->flags &= ~IEEE80211_KEY_FORCE_SW_ENCRYPT; break; case DISABLE_KEY: ath5k_hw_reset_key(sc->ah, key->keyidx); - clear_bit(key->keyidx, sc->keymap); + __clear_bit(key->keyidx, sc->keymap); break; case REMOVE_ALL_KEYS: { unsigned int i; for (i = 0; i < AR5K_KEYCACHE_SIZE; i++) { ath5k_hw_reset_key(sc->ah, i); - clear_bit(i, sc->keymap); + __clear_bit(i, sc->keymap); } break; } @@ -1580,10 +1585,10 @@ static void ath_led_off(unsigned long data) { struct ath_softc *sc = (void *)data; - if (sc->led_endblink) - sc->led_blinking = 0; + if (test_bit(ATH_STAT_LEDENDBLINK, sc->status)) + __clear_bit(ATH_STAT_LEDBLINKING, sc->status); else { - sc->led_endblink = 1; + __set_bit(ATH_STAT_LEDENDBLINK, sc->status); ath5k_hw_set_gpio(sc->ah, sc->led_pin, !sc->led_on); mod_timer(&sc->led_tim, jiffies + sc->led_off); } @@ -1597,18 +1602,18 @@ static void ath_led_blink(struct ath_softc *sc, unsigned int on, { DPRINTF(sc, ATH_DEBUG_LED, "%s: on %u off %u\n", __func__, on, off); ath5k_hw_set_gpio(sc->ah, sc->led_pin, sc->led_on); - sc->led_blinking = 1; - sc->led_endblink = 0; + __set_bit(ATH_STAT_LEDBLINKING, sc->status); + __clear_bit(ATH_STAT_LEDENDBLINK, sc->status); sc->led_off = off; mod_timer(&sc->led_tim, jiffies + on); } static void ath_led_event(struct ath_softc *sc, int event) { - if (likely(!sc->led_soft)) - return; - if (unlikely(sc->led_blinking)) /* don't interrupt active blink */ + if (likely(!test_bit(ATH_STAT_LEDSOFT, sc->status))) return; + if (unlikely(test_bit(ATH_STAT_LEDBLINKING, sc->status))) + return; /* don't interrupt active blink */ switch (event) { case ATH_LED_TX: ath_led_blink(sc, sc->hwmap[sc->led_txrate].ledon, @@ -1628,7 +1633,8 @@ static irqreturn_t ath_intr(int irq, void *dev_id) enum ath5k_int status; unsigned int counter = 1000; - if (unlikely(sc->invalid || !ath5k_hw_is_intr_pending(ah))) + if (unlikely(test_bit(ATH_STAT_INVALID, sc->status) || + !ath5k_hw_is_intr_pending(ah))) return IRQ_NONE; do { @@ -2068,7 +2074,8 @@ static int ath_attach(struct pci_dev *pdev, struct ieee80211_hw *hw) * return false w/o doing anything. MAC's that do * support it will return true w/o doing anything. */ - sc->mrretry = ah->ah_setup_xtx_desc(ah, NULL, 0, 0, 0, 0, 0, 0); + if (ah->ah_setup_xtx_desc(ah, NULL, 0, 0, 0, 0, 0, 0)) + __set_bit(ATH_STAT_MRRETRY, sc->status); /* * Reset the key cache since some parts do not @@ -2130,7 +2137,6 @@ static int ath_attach(struct pci_dev *pdev, struct ieee80211_hw *hw) setup_timer(&sc->calib_tim, ath_calibrate, (unsigned long)sc); setup_timer(&sc->led_tim, ath_led_off, (unsigned long)sc); - sc->led_blinking = 0; sc->led_on = 0; /* low true */ /* * Auto-enable soft led processing for IBM cards and for @@ -2139,15 +2145,15 @@ static int ath_attach(struct pci_dev *pdev, struct ieee80211_hw *hw) */ if (pdev->device == PCI_DEVICE_ID_ATHEROS_AR5212_IBM || pdev->device == PCI_DEVICE_ID_ATHEROS_AR5211) { - sc->led_soft = 1; + __set_bit(ATH_STAT_LEDSOFT, sc->status); sc->led_pin = 0; } /* Enable softled on PIN1 on HP Compaq nc6xx, nc4000 & nx5000 laptops */ if (pdev->subsystem_vendor == PCI_VENDOR_ID_COMPAQ) { - sc->led_soft = 1; + __set_bit(ATH_STAT_LEDSOFT, sc->status); sc->led_pin = 0; } - if (sc->led_soft) { + if (test_bit(ATH_STAT_LEDSOFT, sc->status)) { ath5k_hw_set_gpio_output(ah, sc->led_pin); ath5k_hw_set_gpio(ah, sc->led_pin, !sc->led_on); } @@ -2306,7 +2312,7 @@ static int __devinit ath_pci_probe(struct pci_dev *pdev, #if AR_DEBUG sc->debug = ath_debug; #endif - sc->invalid = 1; + __set_bit(ATH_STAT_INVALID, sc->status); sc->iobase = mem; sc->cachelsz = csz * sizeof(u32); /* convert to bytes */ sc->opmode = IEEE80211_IF_TYPE_STA; @@ -2338,7 +2344,7 @@ static int __devinit ath_pci_probe(struct pci_dev *pdev, sc->ah->ah_phy_revision & 0xf); /* ready to process interrupts */ - sc->invalid = 0; + __clear_bit(ATH_STAT_INVALID, sc->status); return 0; err_ah: @@ -2377,7 +2383,7 @@ static int ath_pci_suspend(struct pci_dev *pdev, pm_message_t state) struct ieee80211_hw *hw = pci_get_drvdata(pdev); struct ath_softc *sc = hw->priv; - if (sc->led_soft) + if (test_bit(ATH_STAT_LEDSOFT, sc->status)) ath5k_hw_set_gpio(sc->ah, sc->led_pin, 1); ath_stop_hw(sc); @@ -2411,7 +2417,7 @@ static int ath_pci_resume(struct pci_dev *pdev) pci_write_config_byte(pdev, 0x41, 0); ath_init(sc); - if (sc->led_soft) { + if (test_bit(ATH_STAT_LEDSOFT, sc->status)) { ath5k_hw_set_gpio_output(sc->ah, sc->led_pin); ath5k_hw_set_gpio(sc->ah, sc->led_pin, 0); } diff --git a/ath5k_base.h b/ath5k_base.h index 39ad8f9..15560ad 100644 --- a/ath5k_base.h +++ b/ath5k_base.h @@ -138,9 +138,13 @@ struct ath_softc { size_t desc_len; /* size of TX/RX descriptors */ u16 cachelsz; /* cache line size */ - unsigned int invalid : 1, /* disable hardware accesses */ - mrretry : 1, /* multi-rate retry support */ - promisc : 1; + DECLARE_BITMAP(status, 6); +#define ATH_STAT_INVALID 0 /* disable hardware accesses */ +#define ATH_STAT_MRRETRY 1 /* multi-rate retry support */ +#define ATH_STAT_PROMISC 2 +#define ATH_STAT_LEDBLINKING 3 /* LED blink operation active */ +#define ATH_STAT_LEDENDBLINK 4 /* finish LED blink operation */ +#define ATH_STAT_LEDSOFT 5 /* enable LED gpio status */ unsigned int curmode; /* current phy mode */ struct ieee80211_channel *curchan; /* current h/w channel */ @@ -162,10 +166,7 @@ struct ath_softc { unsigned int led_pin, /* GPIO pin for driving LED */ led_on, /* pin setting for LED on */ - led_off, /* off time for current blink */ - led_blinking: 1,/* LED blink operation active */ - led_endblink: 1,/* finish LED blink operation */ - led_soft: 1; /* enable LED gpio status */ + led_off; /* off time for current blink */ struct timer_list led_tim; /* led off timer */ u8 led_rxrate; /* current rx rate for LED */ u8 led_txrate; /* current tx rate for LED */