Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wirel...
[pandora-kernel.git] / drivers / net / wireless / ath9k / main.c
index a9715f5..8db75f6 100644 (file)
@@ -1084,12 +1084,6 @@ fail:
        ath_deinit_leds(sc);
 }
 
-#if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE)
-
-/*******************/
-/*     Rfkill     */
-/*******************/
-
 void ath_radio_enable(struct ath_softc *sc)
 {
        struct ath_hw *ah = sc->sc_ah;
@@ -1166,6 +1160,12 @@ void ath_radio_disable(struct ath_softc *sc)
        ath9k_ps_restore(sc);
 }
 
+#if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE)
+
+/*******************/
+/*     Rfkill     */
+/*******************/
+
 static bool ath_is_rfkill_set(struct ath_softc *sc)
 {
        struct ath_hw *ah = sc->sc_ah;
@@ -1583,7 +1583,8 @@ void ath_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw)
                IEEE80211_HW_SIGNAL_DBM |
                IEEE80211_HW_AMPDU_AGGREGATION |
                IEEE80211_HW_SUPPORTS_PS |
-               IEEE80211_HW_PS_NULLFUNC_STACK;
+               IEEE80211_HW_PS_NULLFUNC_STACK |
+               IEEE80211_HW_SPECTRUM_MGMT;
 
        if (AR_SREV_9160_10_OR_LATER(sc->sc_ah) || modparam_nohwcrypt)
                hw->flags |= IEEE80211_HW_MFP_CAPABLE;
@@ -1671,7 +1672,7 @@ int ath_attach(u16 devid, struct ath_softc *sc)
        }
        wiphy_apply_custom_regulatory(hw->wiphy, regd);
        ath9k_reg_apply_radar_flags(hw->wiphy);
-       ath9k_reg_apply_world_flags(hw->wiphy, REGDOM_SET_BY_INIT);
+       ath9k_reg_apply_world_flags(hw->wiphy, NL80211_REGDOM_SET_BY_DRIVER);
 
        INIT_WORK(&sc->chan_work, ath9k_wiphy_chan_work);
        INIT_DELAYED_WORK(&sc->wiphy_work, ath9k_wiphy_work);
@@ -1774,6 +1775,7 @@ int ath_descdma_setup(struct ath_softc *sc, struct ath_descdma *dd,
        DPRINTF(sc, ATH_DBG_CONFIG, "%s DMA: %u buffers %u desc/buf\n",
                name, nbuf, ndesc);
 
+       INIT_LIST_HEAD(head);
        /* ath_desc must be a multiple of DWORDs */
        if ((sizeof(struct ath_desc) % 4) != 0) {
                DPRINTF(sc, ATH_DBG_FATAL, "ath_desc not DWORD aligned\n");
@@ -1805,7 +1807,7 @@ int ath_descdma_setup(struct ath_softc *sc, struct ath_descdma *dd,
 
        /* allocate descriptors */
        dd->dd_desc = dma_alloc_coherent(sc->dev, dd->dd_desc_len,
-                                        &dd->dd_desc_paddr, GFP_ATOMIC);
+                                        &dd->dd_desc_paddr, GFP_KERNEL);
        if (dd->dd_desc == NULL) {
                error = -ENOMEM;
                goto fail;
@@ -1817,15 +1819,13 @@ int ath_descdma_setup(struct ath_softc *sc, struct ath_descdma *dd,
 
        /* allocate buffers */
        bsize = sizeof(struct ath_buf) * nbuf;
-       bf = kmalloc(bsize, GFP_KERNEL);
+       bf = kzalloc(bsize, GFP_KERNEL);
        if (bf == NULL) {
                error = -ENOMEM;
                goto fail2;
        }
-       memset(bf, 0, bsize);
        dd->dd_bufptr = bf;
 
-       INIT_LIST_HEAD(head);
        for (i = 0; i < nbuf; i++, bf++, ds += ndesc) {
                bf->bf_desc = ds;
                bf->bf_daddr = DS2PHYS(dd, ds);
@@ -2859,12 +2859,20 @@ static int __init ath9k_init(void)
                goto err_out;
        }
 
+       error = ath9k_debug_create_root();
+       if (error) {
+               printk(KERN_ERR
+                       "ath9k: Unable to create debugfs root: %d\n",
+                       error);
+               goto err_rate_unregister;
+       }
+
        error = ath_pci_init();
        if (error < 0) {
                printk(KERN_ERR
                        "ath9k: No PCI devices found, driver not installed.\n");
                error = -ENODEV;
-               goto err_rate_unregister;
+               goto err_remove_root;
        }
 
        error = ath_ahb_init();
@@ -2878,6 +2886,8 @@ static int __init ath9k_init(void)
  err_pci_exit:
        ath_pci_exit();
 
+ err_remove_root:
+       ath9k_debug_remove_root();
  err_rate_unregister:
        ath_rate_control_unregister();
  err_out:
@@ -2889,6 +2899,7 @@ static void __exit ath9k_exit(void)
 {
        ath_ahb_exit();
        ath_pci_exit();
+       ath9k_debug_remove_root();
        ath_rate_control_unregister();
        printk(KERN_INFO "%s: Driver unloaded\n", dev_info);
 }