diff options
author | Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com> | 2011-10-25 10:04:00 -0400 |
---|---|---|
committer | Kalle Valo <kvalo@qca.qualcomm.com> | 2011-11-11 05:58:46 -0500 |
commit | 108438bc6ad16b3962aa5009123cd810d1c1f643 (patch) | |
tree | 0b28fbbe9c354c3969f10fad4067a02b77b2c2b4 /drivers/net/wireless/ath | |
parent | dd3751f7b1036c24e0d44167482bbf4d60935d24 (diff) |
ath6kl: Define an initial vif structure and use it
vif specific information need to be moved from struct ath6kl.
Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Diffstat (limited to 'drivers/net/wireless/ath')
-rw-r--r-- | drivers/net/wireless/ath/ath6kl/cfg80211.c | 41 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath6kl/core.h | 11 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath6kl/init.c | 4 |
3 files changed, 35 insertions, 21 deletions
diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.c b/drivers/net/wireless/ath/ath6kl/cfg80211.c index c827ced7755f..b6b3112e57ef 100644 --- a/drivers/net/wireless/ath/ath6kl/cfg80211.c +++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c | |||
@@ -2015,51 +2015,58 @@ int ath6kl_register_ieee80211_hw(struct ath6kl *ar) | |||
2015 | return 0; | 2015 | return 0; |
2016 | } | 2016 | } |
2017 | 2017 | ||
2018 | static int ath6kl_init_if_data(struct ath6kl *ar, struct net_device *ndev) | 2018 | static int ath6kl_init_if_data(struct ath6kl_vif *vif) |
2019 | { | 2019 | { |
2020 | ar->aggr_cntxt = aggr_init(ndev); | 2020 | struct ath6kl *ar = vif->ar; |
2021 | |||
2022 | ar->aggr_cntxt = aggr_init(vif->ndev); | ||
2021 | if (!ar->aggr_cntxt) { | 2023 | if (!ar->aggr_cntxt) { |
2022 | ath6kl_err("failed to initialize aggr\n"); | 2024 | ath6kl_err("failed to initialize aggr\n"); |
2023 | return -ENOMEM; | 2025 | return -ENOMEM; |
2024 | } | 2026 | } |
2025 | 2027 | ||
2026 | setup_timer(&ar->disconnect_timer, disconnect_timer_handler, | 2028 | setup_timer(&ar->disconnect_timer, disconnect_timer_handler, |
2027 | (unsigned long) ndev); | 2029 | (unsigned long) vif->ndev); |
2028 | 2030 | ||
2029 | return 0; | 2031 | return 0; |
2030 | } | 2032 | } |
2031 | 2033 | ||
2032 | void ath6kl_deinit_if_data(struct ath6kl *ar, struct net_device *ndev) | 2034 | void ath6kl_deinit_if_data(struct ath6kl_vif *vif) |
2033 | { | 2035 | { |
2036 | struct ath6kl *ar = vif->ar; | ||
2037 | |||
2034 | aggr_module_destroy(ar->aggr_cntxt); | 2038 | aggr_module_destroy(ar->aggr_cntxt); |
2035 | 2039 | ||
2036 | ar->aggr_cntxt = NULL; | 2040 | ar->aggr_cntxt = NULL; |
2037 | 2041 | ||
2038 | if (test_bit(NETDEV_REGISTERED, &ar->flag)) { | 2042 | if (test_bit(NETDEV_REGISTERED, &ar->flag)) { |
2039 | unregister_netdev(ndev); | 2043 | unregister_netdev(vif->ndev); |
2040 | clear_bit(NETDEV_REGISTERED, &ar->flag); | 2044 | clear_bit(NETDEV_REGISTERED, &ar->flag); |
2041 | } | 2045 | } |
2042 | 2046 | ||
2043 | free_netdev(ndev); | 2047 | free_netdev(vif->ndev); |
2044 | } | 2048 | } |
2045 | 2049 | ||
2046 | struct net_device *ath6kl_interface_add(struct ath6kl *ar, char *name, | 2050 | struct net_device *ath6kl_interface_add(struct ath6kl *ar, char *name, |
2047 | enum nl80211_iftype type) | 2051 | enum nl80211_iftype type) |
2048 | { | 2052 | { |
2049 | struct net_device *ndev; | 2053 | struct net_device *ndev; |
2050 | struct wireless_dev *wdev; | 2054 | struct ath6kl_vif *vif; |
2051 | 2055 | ||
2052 | ndev = alloc_netdev(sizeof(*wdev), "wlan%d", ether_setup); | 2056 | ndev = alloc_netdev(sizeof(*vif), "wlan%d", ether_setup); |
2053 | if (!ndev) | 2057 | if (!ndev) |
2054 | return NULL; | 2058 | return NULL; |
2055 | 2059 | ||
2056 | wdev = netdev_priv(ndev); | 2060 | vif = netdev_priv(ndev); |
2057 | ndev->ieee80211_ptr = wdev; | 2061 | ndev->ieee80211_ptr = &vif->wdev; |
2058 | wdev->wiphy = ar->wiphy; | 2062 | vif->wdev.wiphy = ar->wiphy; |
2059 | SET_NETDEV_DEV(ndev, wiphy_dev(wdev->wiphy)); | 2063 | vif->ar = ar; |
2060 | wdev->netdev = ndev; | 2064 | ar->vif = vif; |
2061 | wdev->iftype = type; | 2065 | vif->ndev = ndev; |
2062 | ar->wdev = wdev; | 2066 | SET_NETDEV_DEV(ndev, wiphy_dev(vif->wdev.wiphy)); |
2067 | vif->wdev.netdev = ndev; | ||
2068 | vif->wdev.iftype = type; | ||
2069 | ar->wdev = &vif->wdev; | ||
2063 | ar->net_dev = ndev; | 2070 | ar->net_dev = ndev; |
2064 | 2071 | ||
2065 | init_netdev(ndev); | 2072 | init_netdev(ndev); |
@@ -2067,7 +2074,7 @@ struct net_device *ath6kl_interface_add(struct ath6kl *ar, char *name, | |||
2067 | ath6kl_init_control_info(ar); | 2074 | ath6kl_init_control_info(ar); |
2068 | 2075 | ||
2069 | /* TODO: Pass interface specific pointer instead of ar */ | 2076 | /* TODO: Pass interface specific pointer instead of ar */ |
2070 | if (ath6kl_init_if_data(ar, ndev)) | 2077 | if (ath6kl_init_if_data(vif)) |
2071 | goto err; | 2078 | goto err; |
2072 | 2079 | ||
2073 | if (register_netdev(ndev)) | 2080 | if (register_netdev(ndev)) |
@@ -2081,7 +2088,7 @@ struct net_device *ath6kl_interface_add(struct ath6kl *ar, char *name, | |||
2081 | return ndev; | 2088 | return ndev; |
2082 | 2089 | ||
2083 | err: | 2090 | err: |
2084 | ath6kl_deinit_if_data(ar, ndev); | 2091 | ath6kl_deinit_if_data(vif); |
2085 | 2092 | ||
2086 | return NULL; | 2093 | return NULL; |
2087 | } | 2094 | } |
diff --git a/drivers/net/wireless/ath/ath6kl/core.h b/drivers/net/wireless/ath/ath6kl/core.h index f1b3c47f2c7e..0c1dee07653d 100644 --- a/drivers/net/wireless/ath/ath6kl/core.h +++ b/drivers/net/wireless/ath/ath6kl/core.h | |||
@@ -380,6 +380,12 @@ struct ath6kl_req_key { | |||
380 | u8 key_len; | 380 | u8 key_len; |
381 | }; | 381 | }; |
382 | 382 | ||
383 | struct ath6kl_vif { | ||
384 | struct wireless_dev wdev; | ||
385 | struct net_device *ndev; | ||
386 | struct ath6kl *ar; | ||
387 | }; | ||
388 | |||
383 | /* Flag info */ | 389 | /* Flag info */ |
384 | #define WMI_ENABLED 0 | 390 | #define WMI_ENABLED 0 |
385 | #define WMI_READY 1 | 391 | #define WMI_READY 1 |
@@ -410,6 +416,7 @@ struct ath6kl { | |||
410 | int total_tx_data_pend; | 416 | int total_tx_data_pend; |
411 | struct htc_target *htc_target; | 417 | struct htc_target *htc_target; |
412 | void *hif_priv; | 418 | void *hif_priv; |
419 | struct ath6kl_vif *vif; | ||
413 | spinlock_t lock; | 420 | spinlock_t lock; |
414 | struct semaphore sem; | 421 | struct semaphore sem; |
415 | int ssid_len; | 422 | int ssid_len; |
@@ -543,7 +550,7 @@ struct ath6kl { | |||
543 | 550 | ||
544 | static inline void *ath6kl_priv(struct net_device *dev) | 551 | static inline void *ath6kl_priv(struct net_device *dev) |
545 | { | 552 | { |
546 | return wdev_priv(dev->ieee80211_ptr); | 553 | return ((struct ath6kl_vif *) netdev_priv(dev))->ar; |
547 | } | 554 | } |
548 | 555 | ||
549 | static inline void ath6kl_deposit_credit_to_ep(struct htc_credit_state_info | 556 | static inline void ath6kl_deposit_credit_to_ep(struct htc_credit_state_info |
@@ -643,6 +650,6 @@ void ath6kl_wakeup_event(void *dev); | |||
643 | void ath6kl_target_failure(struct ath6kl *ar); | 650 | void ath6kl_target_failure(struct ath6kl *ar); |
644 | 651 | ||
645 | void ath6kl_init_control_info(struct ath6kl *ar); | 652 | void ath6kl_init_control_info(struct ath6kl *ar); |
646 | void ath6kl_deinit_if_data(struct ath6kl *ar, struct net_device *ndev); | 653 | void ath6kl_deinit_if_data(struct ath6kl_vif *vif); |
647 | void ath6kl_core_free(struct ath6kl *ar); | 654 | void ath6kl_core_free(struct ath6kl *ar); |
648 | #endif /* CORE_H */ | 655 | #endif /* CORE_H */ |
diff --git a/drivers/net/wireless/ath/ath6kl/init.c b/drivers/net/wireless/ath/ath6kl/init.c index 8adfc4259f38..f21224c2807f 100644 --- a/drivers/net/wireless/ath/ath6kl/init.c +++ b/drivers/net/wireless/ath/ath6kl/init.c | |||
@@ -1499,7 +1499,7 @@ err_rxbuf_cleanup: | |||
1499 | err_cleanup_scatter: | 1499 | err_cleanup_scatter: |
1500 | ath6kl_hif_cleanup_scatter(ar); | 1500 | ath6kl_hif_cleanup_scatter(ar); |
1501 | err_if_deinit: | 1501 | err_if_deinit: |
1502 | ath6kl_deinit_if_data(ar, ndev); | 1502 | ath6kl_deinit_if_data(netdev_priv(ndev)); |
1503 | wiphy_unregister(ar->wiphy); | 1503 | wiphy_unregister(ar->wiphy); |
1504 | err_debug_init: | 1504 | err_debug_init: |
1505 | ath6kl_debug_cleanup(ar); | 1505 | ath6kl_debug_cleanup(ar); |
@@ -1632,7 +1632,7 @@ void ath6kl_destroy(struct net_device *dev, unsigned int unregister) | |||
1632 | 1632 | ||
1633 | ath6kl_debug_cleanup(ar); | 1633 | ath6kl_debug_cleanup(ar); |
1634 | 1634 | ||
1635 | ath6kl_deinit_if_data(ar, dev); | 1635 | ath6kl_deinit_if_data(netdev_priv(dev)); |
1636 | 1636 | ||
1637 | kfree(ar->fw_board); | 1637 | kfree(ar->fw_board); |
1638 | kfree(ar->fw_otp); | 1638 | kfree(ar->fw_otp); |