ath: fix coding style/readability in ath/ar9170
[pandora-kernel.git] / drivers / net / wireless / ath / ar9170 / main.c
index 91797cb..fed6695 100644 (file)
@@ -235,7 +235,7 @@ static void __ar9170_dump_txqueue(struct ar9170 *ar,
               wiphy_name(ar->hw->wiphy), skb_queue_len(queue));
 
        skb_queue_walk(queue, skb) {
-               printk(KERN_DEBUG "index:%d => \n", i++);
+               printk(KERN_DEBUG "index:%d =>\n", i++);
                ar9170_print_txheader(ar, skb);
        }
        if (i != skb_queue_len(queue))
@@ -280,7 +280,7 @@ static void ar9170_dump_tx_status_ampdu(struct ar9170 *ar)
        unsigned long flags;
 
        spin_lock_irqsave(&ar->tx_status_ampdu.lock, flags);
-       printk(KERN_DEBUG "%s: A-MPDU tx_status queue => \n",
+       printk(KERN_DEBUG "%s: A-MPDU tx_status queue =>\n",
               wiphy_name(ar->hw->wiphy));
        __ar9170_dump_txqueue(ar, &ar->tx_status_ampdu);
        spin_unlock_irqrestore(&ar->tx_status_ampdu.lock, flags);
@@ -307,7 +307,7 @@ static void ar9170_recycle_expired(struct ar9170 *ar,
                if (time_is_before_jiffies(arinfo->timeout)) {
 #ifdef AR9170_QUEUE_DEBUG
                        printk(KERN_DEBUG "%s: [%ld > %ld] frame expired => "
-                              "recycle \n", wiphy_name(ar->hw->wiphy),
+                              "recycle\n", wiphy_name(ar->hw->wiphy),
                               jiffies, arinfo->timeout);
                        ar9170_print_txheader(ar, skb);
 #endif /* AR9170_QUEUE_DEBUG */
@@ -688,7 +688,8 @@ void ar9170_handle_command_response(struct ar9170 *ar, void *buf, u32 len)
 
        /* firmware debug */
        case 0xca:
-               printk(KERN_DEBUG "ar9170 FW: %.*s\n", len - 4, (char *)buf + 4);
+               printk(KERN_DEBUG "ar9170 FW: %.*s\n", len - 4,
+                               (char *)buf + 4);
                break;
        case 0xcb:
                len -= 4;
@@ -1727,7 +1728,7 @@ static void ar9170_tx(struct ar9170 *ar)
                        printk(KERN_DEBUG "%s: queue %d full\n",
                               wiphy_name(ar->hw->wiphy), i);
 
-                       printk(KERN_DEBUG "%s: stuck frames: ===> \n",
+                       printk(KERN_DEBUG "%s: stuck frames: ===>\n",
                               wiphy_name(ar->hw->wiphy));
                        ar9170_dump_txqueue(ar, &ar->tx_pending[i]);
                        ar9170_dump_txqueue(ar, &ar->tx_status[i]);
@@ -2329,54 +2330,55 @@ out:
        return err;
 }
 
-static void ar9170_sta_notify(struct ieee80211_hw *hw,
-                             struct ieee80211_vif *vif,
-                             enum sta_notify_cmd cmd,
-                             struct ieee80211_sta *sta)
+static int ar9170_sta_add(struct ieee80211_hw *hw,
+                         struct ieee80211_vif *vif,
+                         struct ieee80211_sta *sta)
 {
        struct ar9170 *ar = hw->priv;
        struct ar9170_sta_info *sta_info = (void *) sta->drv_priv;
        unsigned int i;
 
-       switch (cmd) {
-       case STA_NOTIFY_ADD:
-               memset(sta_info, 0, sizeof(*sta_info));
+       memset(sta_info, 0, sizeof(*sta_info));
 
-               if (!sta->ht_cap.ht_supported)
-                       break;
+       if (!sta->ht_cap.ht_supported)
+               return 0;
 
-               if (sta->ht_cap.ampdu_density > ar->global_ampdu_density)
-                       ar->global_ampdu_density = sta->ht_cap.ampdu_density;
+       if (sta->ht_cap.ampdu_density > ar->global_ampdu_density)
+               ar->global_ampdu_density = sta->ht_cap.ampdu_density;
 
-               if (sta->ht_cap.ampdu_factor < ar->global_ampdu_factor)
-                       ar->global_ampdu_factor = sta->ht_cap.ampdu_factor;
+       if (sta->ht_cap.ampdu_factor < ar->global_ampdu_factor)
+               ar->global_ampdu_factor = sta->ht_cap.ampdu_factor;
 
-               for (i = 0; i < AR9170_NUM_TID; i++) {
-                       sta_info->agg[i].state = AR9170_TID_STATE_SHUTDOWN;
-                       sta_info->agg[i].active = false;
-                       sta_info->agg[i].ssn = 0;
-                       sta_info->agg[i].tid = i;
-                       INIT_LIST_HEAD(&sta_info->agg[i].list);
-                       skb_queue_head_init(&sta_info->agg[i].queue);
-               }
+       for (i = 0; i < AR9170_NUM_TID; i++) {
+               sta_info->agg[i].state = AR9170_TID_STATE_SHUTDOWN;
+               sta_info->agg[i].active = false;
+               sta_info->agg[i].ssn = 0;
+               sta_info->agg[i].tid = i;
+               INIT_LIST_HEAD(&sta_info->agg[i].list);
+               skb_queue_head_init(&sta_info->agg[i].queue);
+       }
 
-               sta_info->ampdu_max_len = 1 << (3 + sta->ht_cap.ampdu_factor);
-               break;
+       sta_info->ampdu_max_len = 1 << (3 + sta->ht_cap.ampdu_factor);
 
-       case STA_NOTIFY_REMOVE:
-               if (!sta->ht_cap.ht_supported)
-                       break;
+       return 0;
+}
 
-               for (i = 0; i < AR9170_NUM_TID; i++) {
-                       sta_info->agg[i].state = AR9170_TID_STATE_INVALID;
-                       skb_queue_purge(&sta_info->agg[i].queue);
-               }
+static int ar9170_sta_remove(struct ieee80211_hw *hw,
+                            struct ieee80211_vif *vif,
+                            struct ieee80211_sta *sta)
+{
+       struct ar9170_sta_info *sta_info = (void *) sta->drv_priv;
+       unsigned int i;
 
-               break;
+       if (!sta->ht_cap.ht_supported)
+               return 0;
 
-       default:
-               break;
+       for (i = 0; i < AR9170_NUM_TID; i++) {
+               sta_info->agg[i].state = AR9170_TID_STATE_INVALID;
+               skb_queue_purge(&sta_info->agg[i].queue);
        }
+
+       return 0;
 }
 
 static int ar9170_get_stats(struct ieee80211_hw *hw,
@@ -2495,7 +2497,8 @@ static const struct ieee80211_ops ar9170_ops = {
        .bss_info_changed       = ar9170_op_bss_info_changed,
        .get_tsf                = ar9170_op_get_tsf,
        .set_key                = ar9170_set_key,
-       .sta_notify             = ar9170_sta_notify,
+       .sta_add                = ar9170_sta_add,
+       .sta_remove             = ar9170_sta_remove,
        .get_stats              = ar9170_get_stats,
        .ampdu_action           = ar9170_ampdu_action,
 };
@@ -2513,7 +2516,7 @@ void *ar9170_alloc(size_t priv_size)
         * tends to split the streams into seperate rx descriptors.
         */
 
-       skb = __dev_alloc_skb(AR9170_MAX_RX_BUFFER_SIZE, GFP_KERNEL);
+       skb = __dev_alloc_skb(AR9170_RX_STREAM_MAX_SIZE, GFP_KERNEL);
        if (!skb)
                goto err_nomem;
 
@@ -2699,7 +2702,8 @@ int ar9170_register(struct ar9170 *ar, struct device *pdev)
        dev_info(pdev, "Atheros AR9170 is registered as '%s'\n",
                 wiphy_name(ar->hw->wiphy));
 
-       return err;
+       ar->registered = true;
+       return 0;
 
 err_unreg:
        ieee80211_unregister_hw(ar->hw);
@@ -2710,11 +2714,14 @@ err_out:
 
 void ar9170_unregister(struct ar9170 *ar)
 {
+       if (ar->registered) {
 #ifdef CONFIG_AR9170_LEDS
-       ar9170_unregister_leds(ar);
+               ar9170_unregister_leds(ar);
 #endif /* CONFIG_AR9170_LEDS */
 
-       kfree_skb(ar->rx_failover);
        ieee80211_unregister_hw(ar->hw);
+       }
+
+       kfree_skb(ar->rx_failover);
        mutex_destroy(&ar->mutex);
 }