]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/net/wireless/ath5k/base.c
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/kaber/nf-next-2.6
[linux-2.6-omap-h63xx.git] / drivers / net / wireless / ath5k / base.c
index fa6a21646bf8ffcce3cbce78d84975b2df4dad05..cad3ccf61b00b378535122f880f635d28045419b 100644 (file)
@@ -79,7 +79,7 @@ MODULE_VERSION("0.6.0 (EXPERIMENTAL)");
 
 
 /* Known PCI ids */
-static struct pci_device_id ath5k_pci_id_table[] __devinitdata = {
+static const struct pci_device_id ath5k_pci_id_table[] = {
        { PCI_VDEVICE(ATHEROS, 0x0207), .driver_data = AR5K_AR5210 }, /* 5210 early */
        { PCI_VDEVICE(ATHEROS, 0x0007), .driver_data = AR5K_AR5210 }, /* 5210 */
        { PCI_VDEVICE(ATHEROS, 0x0011), .driver_data = AR5K_AR5211 }, /* 5311 - this is on AHB bus !*/
@@ -103,7 +103,7 @@ static struct pci_device_id ath5k_pci_id_table[] __devinitdata = {
 MODULE_DEVICE_TABLE(pci, ath5k_pci_id_table);
 
 /* Known SREVs */
-static struct ath5k_srev_name srev_names[] = {
+static const struct ath5k_srev_name srev_names[] = {
        { "5210",       AR5K_VERSION_MAC,       AR5K_SREV_AR5210 },
        { "5311",       AR5K_VERSION_MAC,       AR5K_SREV_AR5311 },
        { "5311A",      AR5K_VERSION_MAC,       AR5K_SREV_AR5311A },
@@ -142,7 +142,7 @@ static struct ath5k_srev_name srev_names[] = {
        { "xxxxx",      AR5K_VERSION_RAD,       AR5K_SREV_UNKNOWN },
 };
 
-static struct ieee80211_rate ath5k_rates[] = {
+static const struct ieee80211_rate ath5k_rates[] = {
        { .bitrate = 10,
          .hw_value = ATH5K_RATE_CODE_1M, },
        { .bitrate = 20,
@@ -248,7 +248,7 @@ static void ath5k_bss_info_changed(struct ieee80211_hw *hw,
                struct ieee80211_bss_conf *bss_conf,
                u32 changes);
 
-static struct ieee80211_ops ath5k_hw_ops = {
+static const struct ieee80211_ops ath5k_hw_ops = {
        .tx             = ath5k_tx,
        .start          = ath5k_start,
        .stop           = ath5k_stop,
@@ -370,11 +370,6 @@ static irqreturn_t ath5k_intr(int irq, void *dev_id);
 static void    ath5k_tasklet_reset(unsigned long data);
 
 static void    ath5k_calibrate(unsigned long data);
-/* LED functions */
-static int     ath5k_init_leds(struct ath5k_softc *sc);
-static void    ath5k_led_enable(struct ath5k_softc *sc);
-static void    ath5k_led_off(struct ath5k_softc *sc);
-static void    ath5k_unregister_leds(struct ath5k_softc *sc);
 
 /*
  * Module init/exit functions
@@ -1100,7 +1095,8 @@ ath5k_mode_setup(struct ath5k_softc *sc)
 static inline int
 ath5k_hw_to_driver_rix(struct ath5k_softc *sc, int hw_rix)
 {
-       WARN_ON(hw_rix < 0 || hw_rix > AR5K_MAX_RATES);
+       WARN(hw_rix < 0 || hw_rix >= AR5K_MAX_RATES,
+                       "hw_rix out of bounds: %x\n", hw_rix);
        return sc->rate_idx[sc->curband->band][hw_rix];
 }
 
@@ -1220,6 +1216,10 @@ ath5k_txbuf_setup(struct ath5k_softc *sc, struct ath5k_buf *bf)
 
        pktlen = skb->len;
 
+       if (info->control.hw_key) {
+               keyidx = info->control.hw_key->hw_key_idx;
+               pktlen += info->control.hw_key->icv_len;
+       }
        if (rc_flags & IEEE80211_TX_RC_USE_RTS_CTS) {
                flags |= AR5K_TXDESC_RTSENA;
                cts_rate = ieee80211_get_rts_cts_rate(sc->hw, info)->hw_value;
@@ -1232,11 +1232,6 @@ ath5k_txbuf_setup(struct ath5k_softc *sc, struct ath5k_buf *bf)
                duration = le16_to_cpu(ieee80211_ctstoself_duration(sc->hw,
                        sc->vif, pktlen, info));
        }
-
-       if (info->control.hw_key) {
-               keyidx = info->control.hw_key->hw_key_idx;
-               pktlen += info->control.hw_key->icv_len;
-       }
        ret = ah->ah_setup_tx_desc(ah, ds, pktlen,
                ieee80211_get_hdrlen_from_skb(skb), AR5K_PKT_TYPE_NORMAL,
                (sc->power_level * 2),
@@ -2530,141 +2525,6 @@ ath5k_calibrate(unsigned long data)
 }
 
 
-
-/***************\
-* LED functions *
-\***************/
-
-static void
-ath5k_led_enable(struct ath5k_softc *sc)
-{
-       if (test_bit(ATH_STAT_LEDSOFT, sc->status)) {
-               ath5k_hw_set_gpio_output(sc->ah, sc->led_pin);
-               ath5k_led_off(sc);
-       }
-}
-
-static void
-ath5k_led_on(struct ath5k_softc *sc)
-{
-       if (!test_bit(ATH_STAT_LEDSOFT, sc->status))
-               return;
-       ath5k_hw_set_gpio(sc->ah, sc->led_pin, sc->led_on);
-}
-
-static void
-ath5k_led_off(struct ath5k_softc *sc)
-{
-       if (!test_bit(ATH_STAT_LEDSOFT, sc->status))
-               return;
-       ath5k_hw_set_gpio(sc->ah, sc->led_pin, !sc->led_on);
-}
-
-static void
-ath5k_led_brightness_set(struct led_classdev *led_dev,
-       enum led_brightness brightness)
-{
-       struct ath5k_led *led = container_of(led_dev, struct ath5k_led,
-               led_dev);
-
-       if (brightness == LED_OFF)
-               ath5k_led_off(led->sc);
-       else
-               ath5k_led_on(led->sc);
-}
-
-static int
-ath5k_register_led(struct ath5k_softc *sc, struct ath5k_led *led,
-                  const char *name, char *trigger)
-{
-       int err;
-
-       led->sc = sc;
-       strncpy(led->name, name, sizeof(led->name));
-       led->led_dev.name = led->name;
-       led->led_dev.default_trigger = trigger;
-       led->led_dev.brightness_set = ath5k_led_brightness_set;
-
-       err = led_classdev_register(&sc->pdev->dev, &led->led_dev);
-       if (err) {
-               ATH5K_WARN(sc, "could not register LED %s\n", name);
-               led->sc = NULL;
-       }
-       return err;
-}
-
-static void
-ath5k_unregister_led(struct ath5k_led *led)
-{
-       if (!led->sc)
-               return;
-       led_classdev_unregister(&led->led_dev);
-       ath5k_led_off(led->sc);
-       led->sc = NULL;
-}
-
-static void
-ath5k_unregister_leds(struct ath5k_softc *sc)
-{
-       ath5k_unregister_led(&sc->rx_led);
-       ath5k_unregister_led(&sc->tx_led);
-}
-
-
-static int
-ath5k_init_leds(struct ath5k_softc *sc)
-{
-       int ret = 0;
-       struct ieee80211_hw *hw = sc->hw;
-       struct pci_dev *pdev = sc->pdev;
-       char name[ATH5K_LED_MAX_NAME_LEN + 1];
-
-       /*
-        * Auto-enable soft led processing for IBM cards and for
-        * 5211 minipci cards.
-        */
-       if (pdev->device == PCI_DEVICE_ID_ATHEROS_AR5212_IBM ||
-           pdev->device == PCI_DEVICE_ID_ATHEROS_AR5211) {
-               __set_bit(ATH_STAT_LEDSOFT, sc->status);
-               sc->led_pin = 0;
-               sc->led_on = 0;  /* active low */
-       }
-       /* Enable softled on PIN1 on HP Compaq nc6xx, nc4000 & nx5000 laptops */
-       if (pdev->subsystem_vendor == PCI_VENDOR_ID_COMPAQ) {
-               __set_bit(ATH_STAT_LEDSOFT, sc->status);
-               sc->led_pin = 1;
-               sc->led_on = 1;  /* active high */
-       }
-       /*
-        * Pin 3 on Foxconn chips used in Acer Aspire One (0x105b:e008) and
-        * in emachines notebooks with AMBIT subsystem.
-        */
-       if (pdev->subsystem_vendor == PCI_VENDOR_ID_FOXCONN ||
-           pdev->subsystem_vendor == PCI_VENDOR_ID_AMBIT) {
-               __set_bit(ATH_STAT_LEDSOFT, sc->status);
-               sc->led_pin = 3;
-               sc->led_on = 0;  /* active low */
-       }
-
-       if (!test_bit(ATH_STAT_LEDSOFT, sc->status))
-               goto out;
-
-       ath5k_led_enable(sc);
-
-       snprintf(name, sizeof(name), "ath5k-%s::rx", wiphy_name(hw->wiphy));
-       ret = ath5k_register_led(sc, &sc->rx_led, name,
-               ieee80211_get_rx_led_name(hw));
-       if (ret)
-               goto out;
-
-       snprintf(name, sizeof(name), "ath5k-%s::tx", wiphy_name(hw->wiphy));
-       ret = ath5k_register_led(sc, &sc->tx_led, name,
-               ieee80211_get_tx_led_name(hw));
-out:
-       return ret;
-}
-
-
 /********************\
 * Mac80211 functions *
 \********************/