* [PATCH 0/6] ath6kl: create ath6kl_core.ko
@ 2012-01-04 23:07 Kalle Valo
2012-01-04 23:07 ` [PATCH 1/6] ath6kl: rename vif init and cleanup functions Kalle Valo
` (5 more replies)
0 siblings, 6 replies; 13+ messages in thread
From: Kalle Valo @ 2012-01-04 23:07 UTC (permalink / raw)
To: linville-2XuSBdqkA4R54TAoqtyWWQ
Cc: sfr-3FnU+UHB4dNDw9hX6IcOSA, netdev-u79uwXL29TY76Z2rM5mHXA,
linux-wireless-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-next-u79uwXL29TY76Z2rM5mHXA,
ath6kl-devel-zC7DfRvBq/JWk0Htik3J/w, davem-fT/PcQaiUtIeIZ0/mPfg9Q
Here's the patchset to fix the allyesconfig build breakage. My fix is to
create a separate module ath6kl_core.ko which both ath6kl_sdio.ko and
ath6kl_usb.ko use. I have tested various combinations to make sure that
there are no compile errors anymore. Also allyesconfig build is running
right now.
Dave, please take a look and let me know if you prefer to fix this somehow
differently.
John, these patches are based your wireless-next tree, they do not even
apply to ath6kl.git. If the patches are ok, please take them directly to
get them faster to Dave.
Sorry again for this mess and taking so long to fix it.
---
Kalle Valo (6):
ath6kl: rename vif init and cleanup functions
ath6kl: unify cfg80211 init/cleanup functions
ath6kl: create core.c
ath6kl: get rid of AR_DBG_LVL_CHECK()
ath6kl: convert ath6kl_dbg() and ath6kl_dbg_dump() into functions
ath6kl: create ath6kl_core.ko
drivers/net/wireless/ath/ath6kl/Makefile | 35 +--
drivers/net/wireless/ath/ath6kl/cfg80211.c | 207 ++++++++------------
drivers/net/wireless/ath/ath6kl/cfg80211.h | 12 +
drivers/net/wireless/ath/ath6kl/common.h | 3
drivers/net/wireless/ath/ath6kl/core.c | 297 ++++++++++++++++++++++++++++
drivers/net/wireless/ath/ath6kl/core.h | 10 +
drivers/net/wireless/ath/ath6kl/debug.c | 62 ++++--
drivers/net/wireless/ath/ath6kl/debug.h | 27 ---
drivers/net/wireless/ath/ath6kl/hif.c | 10 +
drivers/net/wireless/ath/ath6kl/init.c | 211 +-------------------
drivers/net/wireless/ath/ath6kl/sdio.c | 4
drivers/net/wireless/ath/ath6kl/usb.c | 8 -
drivers/net/wireless/ath/ath6kl/wmi.c | 3
13 files changed, 478 insertions(+), 411 deletions(-)
create mode 100644 drivers/net/wireless/ath/ath6kl/core.c
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 1/6] ath6kl: rename vif init and cleanup functions
2012-01-04 23:07 [PATCH 0/6] ath6kl: create ath6kl_core.ko Kalle Valo
@ 2012-01-04 23:07 ` Kalle Valo
2012-01-04 23:08 ` [PATCH 2/6] ath6kl: unify cfg80211 init/cleanup functions Kalle Valo
` (4 subsequent siblings)
5 siblings, 0 replies; 13+ messages in thread
From: Kalle Valo @ 2012-01-04 23:07 UTC (permalink / raw)
To: linville-2XuSBdqkA4R54TAoqtyWWQ
Cc: sfr-3FnU+UHB4dNDw9hX6IcOSA, netdev-u79uwXL29TY76Z2rM5mHXA,
linux-wireless-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-next-u79uwXL29TY76Z2rM5mHXA,
ath6kl-devel-zC7DfRvBq/JWk0Htik3J/w, davem-fT/PcQaiUtIeIZ0/mPfg9Q
ath6kl_cfg80211_vif_init/cleanup() follow more closely the style used
elsewhere in ath6kl.
Signed-off-by: Kalle Valo <kvalo-A+ZNKFmMK5xy9aJCnZT0Uw@public.gmane.org>
---
drivers/net/wireless/ath/ath6kl/cfg80211.c | 9 ++++-----
drivers/net/wireless/ath/ath6kl/cfg80211.h | 2 ++
drivers/net/wireless/ath/ath6kl/core.h | 1 -
drivers/net/wireless/ath/ath6kl/init.c | 5 +++--
4 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.c b/drivers/net/wireless/ath/ath6kl/cfg80211.c
index 6c59a21..cd67cb6 100644
--- a/drivers/net/wireless/ath/ath6kl/cfg80211.c
+++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c
@@ -1403,7 +1403,7 @@ static int ath6kl_cfg80211_del_iface(struct wiphy *wiphy,
ath6kl_cleanup_vif(vif, test_bit(WMI_READY, &ar->flag));
- ath6kl_deinit_if_data(vif);
+ ath6kl_cfg80211_vif_cleanup(vif);
return 0;
}
@@ -2742,7 +2742,7 @@ int ath6kl_register_ieee80211_hw(struct ath6kl *ar)
return 0;
}
-static int ath6kl_init_if_data(struct ath6kl_vif *vif)
+static int ath6kl_cfg80211_vif_init(struct ath6kl_vif *vif)
{
vif->aggr_cntxt = aggr_init(vif->ndev);
if (!vif->aggr_cntxt) {
@@ -2761,7 +2761,7 @@ static int ath6kl_init_if_data(struct ath6kl_vif *vif)
return 0;
}
-void ath6kl_deinit_if_data(struct ath6kl_vif *vif)
+void ath6kl_cfg80211_vif_cleanup(struct ath6kl_vif *vif)
{
struct ath6kl *ar = vif->ar;
@@ -2808,8 +2808,7 @@ struct net_device *ath6kl_interface_add(struct ath6kl *ar, char *name,
ath6kl_init_control_info(vif);
- /* TODO: Pass interface specific pointer instead of ar */
- if (ath6kl_init_if_data(vif))
+ if (ath6kl_cfg80211_vif_init(vif))
goto err;
if (register_netdevice(ndev))
diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.h b/drivers/net/wireless/ath/ath6kl/cfg80211.h
index 81f20a5..aa96169 100644
--- a/drivers/net/wireless/ath/ath6kl/cfg80211.h
+++ b/drivers/net/wireless/ath/ath6kl/cfg80211.h
@@ -53,6 +53,8 @@ int ath6kl_cfg80211_suspend(struct ath6kl *ar,
int ath6kl_cfg80211_resume(struct ath6kl *ar);
+void ath6kl_cfg80211_vif_cleanup(struct ath6kl_vif *vif);
+
void ath6kl_cfg80211_stop(struct ath6kl_vif *vif);
void ath6kl_cfg80211_stop_all(struct ath6kl *ar);
diff --git a/drivers/net/wireless/ath/ath6kl/core.h b/drivers/net/wireless/ath/ath6kl/core.h
index c863a28..93d05c0 100644
--- a/drivers/net/wireless/ath/ath6kl/core.h
+++ b/drivers/net/wireless/ath/ath6kl/core.h
@@ -723,7 +723,6 @@ void ath6kl_wakeup_event(void *dev);
void ath6kl_reset_device(struct ath6kl *ar, u32 target_type,
bool wait_fot_compltn, bool cold_reset);
void ath6kl_init_control_info(struct ath6kl_vif *vif);
-void ath6kl_deinit_if_data(struct ath6kl_vif *vif);
void ath6kl_core_free(struct ath6kl *ar);
struct ath6kl_vif *ath6kl_vif_first(struct ath6kl *ar);
void ath6kl_cleanup_vif(struct ath6kl_vif *vif, bool wmi_ready);
diff --git a/drivers/net/wireless/ath/ath6kl/init.c b/drivers/net/wireless/ath/ath6kl/init.c
index 368ecbd..ffe6254 100644
--- a/drivers/net/wireless/ath/ath6kl/init.c
+++ b/drivers/net/wireless/ath/ath6kl/init.c
@@ -1695,7 +1695,7 @@ err_rxbuf_cleanup:
ath6kl_htc_flush_rx_buf(ar->htc_target);
ath6kl_cleanup_amsdu_rxbufs(ar);
rtnl_lock();
- ath6kl_deinit_if_data(netdev_priv(ndev));
+ ath6kl_cfg80211_vif_cleanup(netdev_priv(ndev));
rtnl_unlock();
wiphy_unregister(ar->wiphy);
err_debug_init:
@@ -1716,6 +1716,7 @@ err_wq:
return ret;
}
+/* FIXME: move this to cfg80211.c and rename to ath6kl_cfg80211_vif_stop() */
void ath6kl_cleanup_vif(struct ath6kl_vif *vif, bool wmi_ready)
{
static u8 bcast_mac[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
@@ -1761,7 +1762,7 @@ void ath6kl_stop_txrx(struct ath6kl *ar)
spin_unlock_bh(&ar->list_lock);
ath6kl_cleanup_vif(vif, test_bit(WMI_READY, &ar->flag));
rtnl_lock();
- ath6kl_deinit_if_data(vif);
+ ath6kl_cfg80211_vif_cleanup(vif);
rtnl_unlock();
spin_lock_bh(&ar->list_lock);
}
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 2/6] ath6kl: unify cfg80211 init/cleanup functions
2012-01-04 23:07 [PATCH 0/6] ath6kl: create ath6kl_core.ko Kalle Valo
2012-01-04 23:07 ` [PATCH 1/6] ath6kl: rename vif init and cleanup functions Kalle Valo
@ 2012-01-04 23:08 ` Kalle Valo
2012-01-04 23:08 ` [PATCH 3/6] ath6kl: create core.c Kalle Valo
` (3 subsequent siblings)
5 siblings, 0 replies; 13+ messages in thread
From: Kalle Valo @ 2012-01-04 23:08 UTC (permalink / raw)
To: linville-2XuSBdqkA4R54TAoqtyWWQ
Cc: sfr-3FnU+UHB4dNDw9hX6IcOSA, netdev-u79uwXL29TY76Z2rM5mHXA,
linux-wireless-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-next-u79uwXL29TY76Z2rM5mHXA,
ath6kl-devel-zC7DfRvBq/JWk0Htik3J/w, davem-fT/PcQaiUtIeIZ0/mPfg9Q
Group them together and change the naming to follow the common style in
ath6kl. No functional changes.
Signed-off-by: Kalle Valo <kvalo-A+ZNKFmMK5xy9aJCnZT0Uw@public.gmane.org>
---
drivers/net/wireless/ath/ath6kl/cfg80211.c | 109 +++++++++++++++-------------
drivers/net/wireless/ath/ath6kl/cfg80211.h | 6 +-
drivers/net/wireless/ath/ath6kl/init.c | 4 +
3 files changed, 62 insertions(+), 57 deletions(-)
diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.c b/drivers/net/wireless/ath/ath6kl/cfg80211.c
index cd67cb6..5f2c137 100644
--- a/drivers/net/wireless/ath/ath6kl/cfg80211.c
+++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c
@@ -2691,57 +2691,6 @@ struct ath6kl *ath6kl_core_alloc(struct device *dev)
return ar;
}
-int ath6kl_register_ieee80211_hw(struct ath6kl *ar)
-{
- struct wiphy *wiphy = ar->wiphy;
- int ret;
-
- wiphy->mgmt_stypes = ath6kl_mgmt_stypes;
-
- wiphy->max_remain_on_channel_duration = 5000;
-
- /* set device pointer for wiphy */
- set_wiphy_dev(wiphy, ar->dev);
-
- wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
- BIT(NL80211_IFTYPE_ADHOC) |
- BIT(NL80211_IFTYPE_AP);
- if (ar->p2p) {
- wiphy->interface_modes |= BIT(NL80211_IFTYPE_P2P_GO) |
- BIT(NL80211_IFTYPE_P2P_CLIENT);
- }
-
- /* max num of ssids that can be probed during scanning */
- wiphy->max_scan_ssids = MAX_PROBED_SSID_INDEX;
- wiphy->max_scan_ie_len = 1000; /* FIX: what is correct limit? */
- wiphy->bands[IEEE80211_BAND_2GHZ] = &ath6kl_band_2ghz;
- wiphy->bands[IEEE80211_BAND_5GHZ] = &ath6kl_band_5ghz;
- wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
-
- wiphy->cipher_suites = cipher_suites;
- wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
-
- wiphy->wowlan.flags = WIPHY_WOWLAN_MAGIC_PKT |
- WIPHY_WOWLAN_DISCONNECT |
- WIPHY_WOWLAN_GTK_REKEY_FAILURE |
- WIPHY_WOWLAN_SUPPORTS_GTK_REKEY |
- WIPHY_WOWLAN_EAP_IDENTITY_REQ |
- WIPHY_WOWLAN_4WAY_HANDSHAKE;
- wiphy->wowlan.n_patterns = WOW_MAX_FILTERS_PER_LIST;
- wiphy->wowlan.pattern_min_len = 1;
- wiphy->wowlan.pattern_max_len = WOW_PATTERN_SIZE;
-
- wiphy->max_sched_scan_ssids = 10;
-
- ret = wiphy_register(wiphy);
- if (ret < 0) {
- ath6kl_err("couldn't register wiphy device\n");
- return ret;
- }
-
- return 0;
-}
-
static int ath6kl_cfg80211_vif_init(struct ath6kl_vif *vif)
{
vif->aggr_cntxt = aggr_init(vif->ndev);
@@ -2835,8 +2784,64 @@ err:
return NULL;
}
-void ath6kl_deinit_ieee80211_hw(struct ath6kl *ar)
+int ath6kl_cfg80211_init(struct ath6kl *ar)
+{
+ struct wiphy *wiphy = ar->wiphy;
+ int ret;
+
+ wiphy->mgmt_stypes = ath6kl_mgmt_stypes;
+
+ wiphy->max_remain_on_channel_duration = 5000;
+
+ /* set device pointer for wiphy */
+ set_wiphy_dev(wiphy, ar->dev);
+
+ wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
+ BIT(NL80211_IFTYPE_ADHOC) |
+ BIT(NL80211_IFTYPE_AP);
+ if (ar->p2p) {
+ wiphy->interface_modes |= BIT(NL80211_IFTYPE_P2P_GO) |
+ BIT(NL80211_IFTYPE_P2P_CLIENT);
+ }
+
+ /* max num of ssids that can be probed during scanning */
+ wiphy->max_scan_ssids = MAX_PROBED_SSID_INDEX;
+ wiphy->max_scan_ie_len = 1000; /* FIX: what is correct limit? */
+ wiphy->bands[IEEE80211_BAND_2GHZ] = &ath6kl_band_2ghz;
+ wiphy->bands[IEEE80211_BAND_5GHZ] = &ath6kl_band_5ghz;
+ wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
+
+ wiphy->cipher_suites = cipher_suites;
+ wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
+
+ wiphy->wowlan.flags = WIPHY_WOWLAN_MAGIC_PKT |
+ WIPHY_WOWLAN_DISCONNECT |
+ WIPHY_WOWLAN_GTK_REKEY_FAILURE |
+ WIPHY_WOWLAN_SUPPORTS_GTK_REKEY |
+ WIPHY_WOWLAN_EAP_IDENTITY_REQ |
+ WIPHY_WOWLAN_4WAY_HANDSHAKE;
+ wiphy->wowlan.n_patterns = WOW_MAX_FILTERS_PER_LIST;
+ wiphy->wowlan.pattern_min_len = 1;
+ wiphy->wowlan.pattern_max_len = WOW_PATTERN_SIZE;
+
+ wiphy->max_sched_scan_ssids = 10;
+
+ ret = wiphy_register(wiphy);
+ if (ret < 0) {
+ ath6kl_err("couldn't register wiphy device\n");
+ return ret;
+ }
+
+ return 0;
+}
+
+void ath6kl_cfg80211_cleanup(struct ath6kl *ar)
{
wiphy_unregister(ar->wiphy);
+
+ /*
+ * FIXME: should be removed as we remove wiphy in
+ * ath6kl_core_free(). Most likely this causes a use after free.
+ */
wiphy_free(ar->wiphy);
}
diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.h b/drivers/net/wireless/ath/ath6kl/cfg80211.h
index aa96169..08d9769 100644
--- a/drivers/net/wireless/ath/ath6kl/cfg80211.h
+++ b/drivers/net/wireless/ath/ath6kl/cfg80211.h
@@ -27,10 +27,7 @@ enum ath6kl_cfg_suspend_mode {
struct net_device *ath6kl_interface_add(struct ath6kl *ar, char *name,
enum nl80211_iftype type,
u8 fw_vif_idx, u8 nw_type);
-int ath6kl_register_ieee80211_hw(struct ath6kl *ar);
struct ath6kl *ath6kl_core_alloc(struct device *dev);
-void ath6kl_deinit_ieee80211_hw(struct ath6kl *ar);
-
void ath6kl_cfg80211_scan_complete_event(struct ath6kl_vif *vif, bool aborted);
void ath6kl_cfg80211_connect_event(struct ath6kl_vif *vif, u16 channel,
@@ -58,4 +55,7 @@ void ath6kl_cfg80211_vif_cleanup(struct ath6kl_vif *vif);
void ath6kl_cfg80211_stop(struct ath6kl_vif *vif);
void ath6kl_cfg80211_stop_all(struct ath6kl *ar);
+int ath6kl_cfg80211_init(struct ath6kl *ar);
+void ath6kl_cfg80211_cleanup(struct ath6kl *ar);
+
#endif /* ATH6KL_CFG80211_H */
diff --git a/drivers/net/wireless/ath/ath6kl/init.c b/drivers/net/wireless/ath/ath6kl/init.c
index ffe6254..32bd111 100644
--- a/drivers/net/wireless/ath/ath6kl/init.c
+++ b/drivers/net/wireless/ath/ath6kl/init.c
@@ -600,7 +600,7 @@ void ath6kl_core_cleanup(struct ath6kl *ar)
kfree(ar->fw);
kfree(ar->fw_patch);
- ath6kl_deinit_ieee80211_hw(ar);
+ ath6kl_cfg80211_cleanup(ar);
}
/* firmware upload */
@@ -1608,7 +1608,7 @@ int ath6kl_core_init(struct ath6kl *ar)
ath6kl_dbg(ATH6KL_DBG_TRC, "%s: got wmi @ 0x%p.\n", __func__, ar->wmi);
- ret = ath6kl_register_ieee80211_hw(ar);
+ ret = ath6kl_cfg80211_init(ar);
if (ret)
goto err_node_cleanup;
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 3/6] ath6kl: create core.c
2012-01-04 23:07 [PATCH 0/6] ath6kl: create ath6kl_core.ko Kalle Valo
2012-01-04 23:07 ` [PATCH 1/6] ath6kl: rename vif init and cleanup functions Kalle Valo
2012-01-04 23:08 ` [PATCH 2/6] ath6kl: unify cfg80211 init/cleanup functions Kalle Valo
@ 2012-01-04 23:08 ` Kalle Valo
2012-01-04 23:09 ` [PATCH 4/6] ath6kl: get rid of AR_DBG_LVL_CHECK() Kalle Valo
` (2 subsequent siblings)
5 siblings, 0 replies; 13+ messages in thread
From: Kalle Valo @ 2012-01-04 23:08 UTC (permalink / raw)
To: linville-2XuSBdqkA4R54TAoqtyWWQ
Cc: sfr-3FnU+UHB4dNDw9hX6IcOSA, netdev-u79uwXL29TY76Z2rM5mHXA,
linux-wireless-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-next-u79uwXL29TY76Z2rM5mHXA,
ath6kl-devel-zC7DfRvBq/JWk0Htik3J/w, davem-fT/PcQaiUtIeIZ0/mPfg9Q
Currently core functions are spread between various files, group all
the functions into file and rename the functions to follow the style
used elsewhere in the driver. This will make it easier to a separate core
module.
Also fix a bug where wiphy is freed too early.
Signed-off-by: Kalle Valo <kvalo-A+ZNKFmMK5xy9aJCnZT0Uw@public.gmane.org>
---
drivers/net/wireless/ath/ath6kl/Makefile | 2
drivers/net/wireless/ath/ath6kl/cfg80211.c | 94 ++-------
drivers/net/wireless/ath/ath6kl/cfg80211.h | 4
drivers/net/wireless/ath/ath6kl/common.h | 3
drivers/net/wireless/ath/ath6kl/core.c | 288 ++++++++++++++++++++++++++++
drivers/net/wireless/ath/ath6kl/core.h | 9 +
drivers/net/wireless/ath/ath6kl/init.c | 205 --------------------
drivers/net/wireless/ath/ath6kl/sdio.c | 4
drivers/net/wireless/ath/ath6kl/usb.c | 8 -
9 files changed, 333 insertions(+), 284 deletions(-)
create mode 100644 drivers/net/wireless/ath/ath6kl/core.c
diff --git a/drivers/net/wireless/ath/ath6kl/Makefile b/drivers/net/wireless/ath/ath6kl/Makefile
index e14cef9..9bb69a8 100644
--- a/drivers/net/wireless/ath/ath6kl/Makefile
+++ b/drivers/net/wireless/ath/ath6kl/Makefile
@@ -31,6 +31,7 @@ ath6kl_sdio-y += init.o
ath6kl_sdio-y += main.o
ath6kl_sdio-y += txrx.o
ath6kl_sdio-y += wmi.o
+ath6kl_sdio-y += core.o
ath6kl_sdio-y += sdio.o
ath6kl_sdio-$(CONFIG_NL80211_TESTMODE) += testmode.o
@@ -44,6 +45,7 @@ ath6kl_usb-y += init.o
ath6kl_usb-y += main.o
ath6kl_usb-y += txrx.o
ath6kl_usb-y += wmi.o
+ath6kl_usb-y += core.o
ath6kl_usb-y += usb.o
ath6kl_usb-$(CONFIG_NL80211_TESTMODE) += testmode.o
diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.c b/drivers/net/wireless/ath/ath6kl/cfg80211.c
index 5f2c137..64043f8 100644
--- a/drivers/net/wireless/ath/ath6kl/cfg80211.c
+++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c
@@ -22,10 +22,6 @@
#include "hif-ops.h"
#include "testmode.h"
-static unsigned int ath6kl_p2p;
-
-module_param(ath6kl_p2p, uint, 0644);
-
#define RATETAB_ENT(_rate, _rateid, _flags) { \
.bitrate = (_rate), \
.flags = (_flags), \
@@ -2629,68 +2625,6 @@ void ath6kl_cfg80211_stop_all(struct ath6kl *ar)
ath6kl_cfg80211_stop(vif);
}
-struct ath6kl *ath6kl_core_alloc(struct device *dev)
-{
- struct ath6kl *ar;
- struct wiphy *wiphy;
- u8 ctr;
-
- /* create a new wiphy for use with cfg80211 */
- wiphy = wiphy_new(&ath6kl_cfg80211_ops, sizeof(struct ath6kl));
-
- if (!wiphy) {
- ath6kl_err("couldn't allocate wiphy device\n");
- return NULL;
- }
-
- ar = wiphy_priv(wiphy);
- ar->p2p = !!ath6kl_p2p;
- ar->wiphy = wiphy;
- ar->dev = dev;
-
- ar->vif_max = 1;
-
- ar->max_norm_iface = 1;
-
- spin_lock_init(&ar->lock);
- spin_lock_init(&ar->mcastpsq_lock);
- spin_lock_init(&ar->list_lock);
-
- init_waitqueue_head(&ar->event_wq);
- sema_init(&ar->sem, 1);
-
- INIT_LIST_HEAD(&ar->amsdu_rx_buffer_queue);
- INIT_LIST_HEAD(&ar->vif_list);
-
- clear_bit(WMI_ENABLED, &ar->flag);
- clear_bit(SKIP_SCAN, &ar->flag);
- clear_bit(DESTROY_IN_PROGRESS, &ar->flag);
-
- ar->listen_intvl_t = A_DEFAULT_LISTEN_INTERVAL;
- ar->listen_intvl_b = 0;
- ar->tx_pwr = 0;
-
- ar->intra_bss = 1;
- ar->lrssi_roam_threshold = DEF_LRSSI_ROAM_THRESHOLD;
-
- ar->state = ATH6KL_STATE_OFF;
-
- memset((u8 *)ar->sta_list, 0,
- AP_MAX_NUM_STA * sizeof(struct ath6kl_sta));
-
- /* Init the PS queues */
- for (ctr = 0; ctr < AP_MAX_NUM_STA; ctr++) {
- spin_lock_init(&ar->sta_list[ctr].psq_lock);
- skb_queue_head_init(&ar->sta_list[ctr].psq);
- }
-
- skb_queue_head_init(&ar->mcastpsq);
-
- memcpy(ar->ap_country_code, DEF_AP_COUNTRY_CODE, 3);
-
- return ar;
-}
-
static int ath6kl_cfg80211_vif_init(struct ath6kl_vif *vif)
{
vif->aggr_cntxt = aggr_init(vif->ndev);
@@ -2838,10 +2772,30 @@ int ath6kl_cfg80211_init(struct ath6kl *ar)
void ath6kl_cfg80211_cleanup(struct ath6kl *ar)
{
wiphy_unregister(ar->wiphy);
+}
- /*
- * FIXME: should be removed as we remove wiphy in
- * ath6kl_core_free(). Most likely this causes a use after free.
- */
+struct ath6kl *ath6kl_cfg80211_create(void)
+{
+ struct ath6kl *ar;
+ struct wiphy *wiphy;
+
+ /* create a new wiphy for use with cfg80211 */
+ wiphy = wiphy_new(&ath6kl_cfg80211_ops, sizeof(struct ath6kl));
+
+ if (!wiphy) {
+ ath6kl_err("couldn't allocate wiphy device\n");
+ return NULL;
+ }
+
+ ar = wiphy_priv(wiphy);
+ ar->wiphy = wiphy;
+
+ return ar;
+}
+
+/* Note: ar variable must not be accessed after calling this! */
+void ath6kl_cfg80211_destroy(struct ath6kl *ar)
+{
wiphy_free(ar->wiphy);
}
+
diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.h b/drivers/net/wireless/ath/ath6kl/cfg80211.h
index 08d9769..3c693b7 100644
--- a/drivers/net/wireless/ath/ath6kl/cfg80211.h
+++ b/drivers/net/wireless/ath/ath6kl/cfg80211.h
@@ -27,7 +27,6 @@ enum ath6kl_cfg_suspend_mode {
struct net_device *ath6kl_interface_add(struct ath6kl *ar, char *name,
enum nl80211_iftype type,
u8 fw_vif_idx, u8 nw_type);
-struct ath6kl *ath6kl_core_alloc(struct device *dev);
void ath6kl_cfg80211_scan_complete_event(struct ath6kl_vif *vif, bool aborted);
void ath6kl_cfg80211_connect_event(struct ath6kl_vif *vif, u16 channel,
@@ -58,4 +57,7 @@ void ath6kl_cfg80211_stop_all(struct ath6kl *ar);
int ath6kl_cfg80211_init(struct ath6kl *ar);
void ath6kl_cfg80211_cleanup(struct ath6kl *ar);
+struct ath6kl *ath6kl_cfg80211_create(void);
+void ath6kl_cfg80211_destroy(struct ath6kl *ar);
+
#endif /* ATH6KL_CFG80211_H */
diff --git a/drivers/net/wireless/ath/ath6kl/common.h b/drivers/net/wireless/ath/ath6kl/common.h
index bfd6597..f89f1e1 100644
--- a/drivers/net/wireless/ath/ath6kl/common.h
+++ b/drivers/net/wireless/ath/ath6kl/common.h
@@ -79,8 +79,5 @@ struct ath6kl;
enum htc_credit_dist_reason;
struct ath6kl_htc_credit_info;
-struct ath6kl *ath6kl_core_alloc(struct device *sdev);
-int ath6kl_core_init(struct ath6kl *ar);
-void ath6kl_core_cleanup(struct ath6kl *ar);
struct sk_buff *ath6kl_buf_alloc(int size);
#endif /* COMMON_H */
diff --git a/drivers/net/wireless/ath/ath6kl/core.c b/drivers/net/wireless/ath/ath6kl/core.c
new file mode 100644
index 0000000..7e3574e
--- /dev/null
+++ b/drivers/net/wireless/ath/ath6kl/core.c
@@ -0,0 +1,288 @@
+/*
+ * Copyright (c) 2004-2011 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include "core.h"
+
+#include <linux/moduleparam.h>
+
+#include "debug.h"
+#include "hif-ops.h"
+#include "cfg80211.h"
+
+unsigned int debug_mask;
+static bool suspend_cutpower;
+static unsigned int uart_debug;
+static unsigned int ath6kl_p2p;
+
+module_param(debug_mask, uint, 0644);
+module_param(suspend_cutpower, bool, 0444);
+module_param(uart_debug, uint, 0644);
+module_param(ath6kl_p2p, uint, 0644);
+
+int ath6kl_core_init(struct ath6kl *ar)
+{
+ struct ath6kl_bmi_target_info targ_info;
+ struct net_device *ndev;
+ int ret = 0, i;
+
+ ar->ath6kl_wq = create_singlethread_workqueue("ath6kl");
+ if (!ar->ath6kl_wq)
+ return -ENOMEM;
+
+ ret = ath6kl_bmi_init(ar);
+ if (ret)
+ goto err_wq;
+
+ /*
+ * Turn on power to get hardware (target) version and leave power
+ * on delibrately as we will boot the hardware anyway within few
+ * seconds.
+ */
+ ret = ath6kl_hif_power_on(ar);
+ if (ret)
+ goto err_bmi_cleanup;
+
+ ret = ath6kl_bmi_get_target_info(ar, &targ_info);
+ if (ret)
+ goto err_power_off;
+
+ ar->version.target_ver = le32_to_cpu(targ_info.version);
+ ar->target_type = le32_to_cpu(targ_info.type);
+ ar->wiphy->hw_version = le32_to_cpu(targ_info.version);
+
+ ret = ath6kl_init_hw_params(ar);
+ if (ret)
+ goto err_power_off;
+
+ ar->htc_target = ath6kl_htc_create(ar);
+
+ if (!ar->htc_target) {
+ ret = -ENOMEM;
+ goto err_power_off;
+ }
+
+ ret = ath6kl_init_fetch_firmwares(ar);
+ if (ret)
+ goto err_htc_cleanup;
+
+ /* FIXME: we should free all firmwares in the error cases below */
+
+ /* Indicate that WMI is enabled (although not ready yet) */
+ set_bit(WMI_ENABLED, &ar->flag);
+ ar->wmi = ath6kl_wmi_init(ar);
+ if (!ar->wmi) {
+ ath6kl_err("failed to initialize wmi\n");
+ ret = -EIO;
+ goto err_htc_cleanup;
+ }
+
+ ath6kl_dbg(ATH6KL_DBG_TRC, "%s: got wmi @ 0x%p.\n", __func__, ar->wmi);
+
+ ret = ath6kl_cfg80211_init(ar);
+ if (ret)
+ goto err_node_cleanup;
+
+ ret = ath6kl_debug_init(ar);
+ if (ret) {
+ wiphy_unregister(ar->wiphy);
+ goto err_node_cleanup;
+ }
+
+ for (i = 0; i < ar->vif_max; i++)
+ ar->avail_idx_map |= BIT(i);
+
+ rtnl_lock();
+
+ /* Add an initial station interface */
+ ndev = ath6kl_interface_add(ar, "wlan%d", NL80211_IFTYPE_STATION, 0,
+ INFRA_NETWORK);
+
+ rtnl_unlock();
+
+ if (!ndev) {
+ ath6kl_err("Failed to instantiate a network device\n");
+ ret = -ENOMEM;
+ wiphy_unregister(ar->wiphy);
+ goto err_debug_init;
+ }
+
+
+ ath6kl_dbg(ATH6KL_DBG_TRC, "%s: name=%s dev=0x%p, ar=0x%p\n",
+ __func__, ndev->name, ndev, ar);
+
+ /* setup access class priority mappings */
+ ar->ac_stream_pri_map[WMM_AC_BK] = 0; /* lowest */
+ ar->ac_stream_pri_map[WMM_AC_BE] = 1;
+ ar->ac_stream_pri_map[WMM_AC_VI] = 2;
+ ar->ac_stream_pri_map[WMM_AC_VO] = 3; /* highest */
+
+ /* give our connected endpoints some buffers */
+ ath6kl_rx_refill(ar->htc_target, ar->ctrl_ep);
+ ath6kl_rx_refill(ar->htc_target, ar->ac2ep_map[WMM_AC_BE]);
+
+ /* allocate some buffers that handle larger AMSDU frames */
+ ath6kl_refill_amsdu_rxbufs(ar, ATH6KL_MAX_AMSDU_RX_BUFFERS);
+
+ ath6kl_cookie_init(ar);
+
+ ar->conf_flags = ATH6KL_CONF_IGNORE_ERP_BARKER |
+ ATH6KL_CONF_ENABLE_11N | ATH6KL_CONF_ENABLE_TX_BURST;
+
+ if (suspend_cutpower)
+ ar->conf_flags |= ATH6KL_CONF_SUSPEND_CUTPOWER;
+
+ ar->wiphy->flags |= WIPHY_FLAG_SUPPORTS_FW_ROAM |
+ WIPHY_FLAG_HAVE_AP_SME |
+ WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL |
+ WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD;
+
+ if (test_bit(ATH6KL_FW_CAPABILITY_SCHED_SCAN, ar->fw_capabilities))
+ ar->wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN;
+
+ ar->wiphy->probe_resp_offload =
+ NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS |
+ NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS2 |
+ NL80211_PROBE_RESP_OFFLOAD_SUPPORT_P2P |
+ NL80211_PROBE_RESP_OFFLOAD_SUPPORT_80211U;
+
+ set_bit(FIRST_BOOT, &ar->flag);
+
+ ret = ath6kl_init_hw_start(ar);
+ if (ret) {
+ ath6kl_err("Failed to start hardware: %d\n", ret);
+ goto err_rxbuf_cleanup;
+ }
+
+ /*
+ * Set mac address which is received in ready event
+ * FIXME: Move to ath6kl_interface_add()
+ */
+ memcpy(ndev->dev_addr, ar->mac_addr, ETH_ALEN);
+
+ return ret;
+
+err_rxbuf_cleanup:
+ ath6kl_htc_flush_rx_buf(ar->htc_target);
+ ath6kl_cleanup_amsdu_rxbufs(ar);
+ rtnl_lock();
+ ath6kl_cfg80211_vif_cleanup(netdev_priv(ndev));
+ rtnl_unlock();
+ wiphy_unregister(ar->wiphy);
+err_debug_init:
+ ath6kl_debug_cleanup(ar);
+err_node_cleanup:
+ ath6kl_wmi_shutdown(ar->wmi);
+ clear_bit(WMI_ENABLED, &ar->flag);
+ ar->wmi = NULL;
+err_htc_cleanup:
+ ath6kl_htc_cleanup(ar->htc_target);
+err_power_off:
+ ath6kl_hif_power_off(ar);
+err_bmi_cleanup:
+ ath6kl_bmi_cleanup(ar);
+err_wq:
+ destroy_workqueue(ar->ath6kl_wq);
+
+ return ret;
+}
+
+struct ath6kl *ath6kl_core_create(struct device *dev)
+{
+ struct ath6kl *ar;
+ u8 ctr;
+
+ ar = ath6kl_cfg80211_create();
+
+ if (!ar)
+ return NULL;
+
+ ar->p2p = !!ath6kl_p2p;
+ ar->dev = dev;
+
+ ar->vif_max = 1;
+
+ ar->max_norm_iface = 1;
+
+ spin_lock_init(&ar->lock);
+ spin_lock_init(&ar->mcastpsq_lock);
+ spin_lock_init(&ar->list_lock);
+
+ init_waitqueue_head(&ar->event_wq);
+ sema_init(&ar->sem, 1);
+
+ INIT_LIST_HEAD(&ar->amsdu_rx_buffer_queue);
+ INIT_LIST_HEAD(&ar->vif_list);
+
+ clear_bit(WMI_ENABLED, &ar->flag);
+ clear_bit(SKIP_SCAN, &ar->flag);
+ clear_bit(DESTROY_IN_PROGRESS, &ar->flag);
+
+ ar->listen_intvl_t = A_DEFAULT_LISTEN_INTERVAL;
+ ar->listen_intvl_b = 0;
+ ar->tx_pwr = 0;
+
+ ar->intra_bss = 1;
+ ar->lrssi_roam_threshold = DEF_LRSSI_ROAM_THRESHOLD;
+
+ ar->state = ATH6KL_STATE_OFF;
+
+ memset((u8 *)ar->sta_list, 0,
+ AP_MAX_NUM_STA * sizeof(struct ath6kl_sta));
+
+ /* Init the PS queues */
+ for (ctr = 0; ctr < AP_MAX_NUM_STA; ctr++) {
+ spin_lock_init(&ar->sta_list[ctr].psq_lock);
+ skb_queue_head_init(&ar->sta_list[ctr].psq);
+ }
+
+ skb_queue_head_init(&ar->mcastpsq);
+
+ memcpy(ar->ap_country_code, DEF_AP_COUNTRY_CODE, 3);
+
+ return ar;
+}
+
+void ath6kl_core_cleanup(struct ath6kl *ar)
+{
+ ath6kl_hif_power_off(ar);
+
+ destroy_workqueue(ar->ath6kl_wq);
+
+ if (ar->htc_target)
+ ath6kl_htc_cleanup(ar->htc_target);
+
+ ath6kl_cookie_cleanup(ar);
+
+ ath6kl_cleanup_amsdu_rxbufs(ar);
+
+ ath6kl_bmi_cleanup(ar);
+
+ ath6kl_debug_cleanup(ar);
+
+ kfree(ar->fw_board);
+ kfree(ar->fw_otp);
+ kfree(ar->fw);
+ kfree(ar->fw_patch);
+
+ ath6kl_cfg80211_cleanup(ar);
+ ath6kl_cfg80211_destroy(ar);
+}
+
+void ath6kl_core_destroy(struct ath6kl *ar)
+{
+ ath6kl_cfg80211_destroy(ar);
+}
+
diff --git a/drivers/net/wireless/ath/ath6kl/core.h b/drivers/net/wireless/ath/ath6kl/core.h
index 93d05c0..5415358 100644
--- a/drivers/net/wireless/ath/ath6kl/core.h
+++ b/drivers/net/wireless/ath/ath6kl/core.h
@@ -723,11 +723,18 @@ void ath6kl_wakeup_event(void *dev);
void ath6kl_reset_device(struct ath6kl *ar, u32 target_type,
bool wait_fot_compltn, bool cold_reset);
void ath6kl_init_control_info(struct ath6kl_vif *vif);
-void ath6kl_core_free(struct ath6kl *ar);
struct ath6kl_vif *ath6kl_vif_first(struct ath6kl *ar);
void ath6kl_cleanup_vif(struct ath6kl_vif *vif, bool wmi_ready);
int ath6kl_init_hw_start(struct ath6kl *ar);
int ath6kl_init_hw_stop(struct ath6kl *ar);
+int ath6kl_init_fetch_firmwares(struct ath6kl *ar);
+int ath6kl_init_hw_params(struct ath6kl *ar);
+
void ath6kl_check_wow_status(struct ath6kl *ar);
+struct ath6kl *ath6kl_core_create(struct device *dev);
+int ath6kl_core_init(struct ath6kl *ar);
+void ath6kl_core_cleanup(struct ath6kl *ar);
+void ath6kl_core_destroy(struct ath6kl *ar);
+
#endif /* CORE_H */
diff --git a/drivers/net/wireless/ath/ath6kl/init.c b/drivers/net/wireless/ath/ath6kl/init.c
index 32bd111..5a92307 100644
--- a/drivers/net/wireless/ath/ath6kl/init.c
+++ b/drivers/net/wireless/ath/ath6kl/init.c
@@ -25,13 +25,9 @@
#include "debug.h"
#include "hif-ops.h"
-unsigned int debug_mask;
static unsigned int testmode;
-static bool suspend_cutpower;
-module_param(debug_mask, uint, 0644);
module_param(testmode, uint, 0644);
-module_param(suspend_cutpower, bool, 0444);
static const struct ath6kl_hw hw_list[] = {
{
@@ -573,36 +569,6 @@ int ath6kl_configure_target(struct ath6kl *ar)
return 0;
}
-void ath6kl_core_free(struct ath6kl *ar)
-{
- wiphy_free(ar->wiphy);
-}
-
-void ath6kl_core_cleanup(struct ath6kl *ar)
-{
- ath6kl_hif_power_off(ar);
-
- destroy_workqueue(ar->ath6kl_wq);
-
- if (ar->htc_target)
- ath6kl_htc_cleanup(ar->htc_target);
-
- ath6kl_cookie_cleanup(ar);
-
- ath6kl_cleanup_amsdu_rxbufs(ar);
-
- ath6kl_bmi_cleanup(ar);
-
- ath6kl_debug_cleanup(ar);
-
- kfree(ar->fw_board);
- kfree(ar->fw_otp);
- kfree(ar->fw);
- kfree(ar->fw_patch);
-
- ath6kl_cfg80211_cleanup(ar);
-}
-
/* firmware upload */
static int ath6kl_get_fw(struct ath6kl *ar, const char *filename,
u8 **fw, size_t *fw_len)
@@ -1010,7 +976,7 @@ out:
return ret;
}
-static int ath6kl_fetch_firmwares(struct ath6kl *ar)
+int ath6kl_init_fetch_firmwares(struct ath6kl *ar)
{
int ret;
@@ -1372,7 +1338,7 @@ static int ath6kl_init_upload(struct ath6kl *ar)
return status;
}
-static int ath6kl_init_hw_params(struct ath6kl *ar)
+int ath6kl_init_hw_params(struct ath6kl *ar)
{
const struct ath6kl_hw *hw;
int i;
@@ -1549,173 +1515,6 @@ int ath6kl_init_hw_stop(struct ath6kl *ar)
return 0;
}
-int ath6kl_core_init(struct ath6kl *ar)
-{
- struct ath6kl_bmi_target_info targ_info;
- struct net_device *ndev;
- int ret = 0, i;
-
- ar->ath6kl_wq = create_singlethread_workqueue("ath6kl");
- if (!ar->ath6kl_wq)
- return -ENOMEM;
-
- ret = ath6kl_bmi_init(ar);
- if (ret)
- goto err_wq;
-
- /*
- * Turn on power to get hardware (target) version and leave power
- * on delibrately as we will boot the hardware anyway within few
- * seconds.
- */
- ret = ath6kl_hif_power_on(ar);
- if (ret)
- goto err_bmi_cleanup;
-
- ret = ath6kl_bmi_get_target_info(ar, &targ_info);
- if (ret)
- goto err_power_off;
-
- ar->version.target_ver = le32_to_cpu(targ_info.version);
- ar->target_type = le32_to_cpu(targ_info.type);
- ar->wiphy->hw_version = le32_to_cpu(targ_info.version);
-
- ret = ath6kl_init_hw_params(ar);
- if (ret)
- goto err_power_off;
-
- ar->htc_target = ath6kl_htc_create(ar);
-
- if (!ar->htc_target) {
- ret = -ENOMEM;
- goto err_power_off;
- }
-
- ret = ath6kl_fetch_firmwares(ar);
- if (ret)
- goto err_htc_cleanup;
-
- /* FIXME: we should free all firmwares in the error cases below */
-
- /* Indicate that WMI is enabled (although not ready yet) */
- set_bit(WMI_ENABLED, &ar->flag);
- ar->wmi = ath6kl_wmi_init(ar);
- if (!ar->wmi) {
- ath6kl_err("failed to initialize wmi\n");
- ret = -EIO;
- goto err_htc_cleanup;
- }
-
- ath6kl_dbg(ATH6KL_DBG_TRC, "%s: got wmi @ 0x%p.\n", __func__, ar->wmi);
-
- ret = ath6kl_cfg80211_init(ar);
- if (ret)
- goto err_node_cleanup;
-
- ret = ath6kl_debug_init(ar);
- if (ret) {
- wiphy_unregister(ar->wiphy);
- goto err_node_cleanup;
- }
-
- for (i = 0; i < ar->vif_max; i++)
- ar->avail_idx_map |= BIT(i);
-
- rtnl_lock();
-
- /* Add an initial station interface */
- ndev = ath6kl_interface_add(ar, "wlan%d", NL80211_IFTYPE_STATION, 0,
- INFRA_NETWORK);
-
- rtnl_unlock();
-
- if (!ndev) {
- ath6kl_err("Failed to instantiate a network device\n");
- ret = -ENOMEM;
- wiphy_unregister(ar->wiphy);
- goto err_debug_init;
- }
-
-
- ath6kl_dbg(ATH6KL_DBG_TRC, "%s: name=%s dev=0x%p, ar=0x%p\n",
- __func__, ndev->name, ndev, ar);
-
- /* setup access class priority mappings */
- ar->ac_stream_pri_map[WMM_AC_BK] = 0; /* lowest */
- ar->ac_stream_pri_map[WMM_AC_BE] = 1;
- ar->ac_stream_pri_map[WMM_AC_VI] = 2;
- ar->ac_stream_pri_map[WMM_AC_VO] = 3; /* highest */
-
- /* give our connected endpoints some buffers */
- ath6kl_rx_refill(ar->htc_target, ar->ctrl_ep);
- ath6kl_rx_refill(ar->htc_target, ar->ac2ep_map[WMM_AC_BE]);
-
- /* allocate some buffers that handle larger AMSDU frames */
- ath6kl_refill_amsdu_rxbufs(ar, ATH6KL_MAX_AMSDU_RX_BUFFERS);
-
- ath6kl_cookie_init(ar);
-
- ar->conf_flags = ATH6KL_CONF_IGNORE_ERP_BARKER |
- ATH6KL_CONF_ENABLE_11N | ATH6KL_CONF_ENABLE_TX_BURST;
-
- if (suspend_cutpower)
- ar->conf_flags |= ATH6KL_CONF_SUSPEND_CUTPOWER;
-
- ar->wiphy->flags |= WIPHY_FLAG_SUPPORTS_FW_ROAM |
- WIPHY_FLAG_HAVE_AP_SME |
- WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL |
- WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD;
-
- if (test_bit(ATH6KL_FW_CAPABILITY_SCHED_SCAN, ar->fw_capabilities))
- ar->wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN;
-
- ar->wiphy->probe_resp_offload =
- NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS |
- NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS2 |
- NL80211_PROBE_RESP_OFFLOAD_SUPPORT_P2P |
- NL80211_PROBE_RESP_OFFLOAD_SUPPORT_80211U;
-
- set_bit(FIRST_BOOT, &ar->flag);
-
- ret = ath6kl_init_hw_start(ar);
- if (ret) {
- ath6kl_err("Failed to start hardware: %d\n", ret);
- goto err_rxbuf_cleanup;
- }
-
- /*
- * Set mac address which is received in ready event
- * FIXME: Move to ath6kl_interface_add()
- */
- memcpy(ndev->dev_addr, ar->mac_addr, ETH_ALEN);
-
- return ret;
-
-err_rxbuf_cleanup:
- ath6kl_htc_flush_rx_buf(ar->htc_target);
- ath6kl_cleanup_amsdu_rxbufs(ar);
- rtnl_lock();
- ath6kl_cfg80211_vif_cleanup(netdev_priv(ndev));
- rtnl_unlock();
- wiphy_unregister(ar->wiphy);
-err_debug_init:
- ath6kl_debug_cleanup(ar);
-err_node_cleanup:
- ath6kl_wmi_shutdown(ar->wmi);
- clear_bit(WMI_ENABLED, &ar->flag);
- ar->wmi = NULL;
-err_htc_cleanup:
- ath6kl_htc_cleanup(ar->htc_target);
-err_power_off:
- ath6kl_hif_power_off(ar);
-err_bmi_cleanup:
- ath6kl_bmi_cleanup(ar);
-err_wq:
- destroy_workqueue(ar->ath6kl_wq);
-
- return ret;
-}
-
/* FIXME: move this to cfg80211.c and rename to ath6kl_cfg80211_vif_stop() */
void ath6kl_cleanup_vif(struct ath6kl_vif *vif, bool wmi_ready)
{
diff --git a/drivers/net/wireless/ath/ath6kl/sdio.c b/drivers/net/wireless/ath/ath6kl/sdio.c
index 15c3f56..08d2db4 100644
--- a/drivers/net/wireless/ath/ath6kl/sdio.c
+++ b/drivers/net/wireless/ath/ath6kl/sdio.c
@@ -1263,7 +1263,7 @@ static int ath6kl_sdio_probe(struct sdio_func *func,
for (count = 0; count < BUS_REQUEST_MAX_NUM; count++)
ath6kl_sdio_free_bus_req(ar_sdio, &ar_sdio->bus_req[count]);
- ar = ath6kl_core_alloc(&ar_sdio->func->dev);
+ ar = ath6kl_core_create(&ar_sdio->func->dev);
if (!ar) {
ath6kl_err("Failed to alloc ath6kl core\n");
ret = -ENOMEM;
@@ -1293,7 +1293,7 @@ static int ath6kl_sdio_probe(struct sdio_func *func,
return ret;
err_core_alloc:
- ath6kl_core_free(ar_sdio->ar);
+ ath6kl_core_destroy(ar_sdio->ar);
err_dma:
kfree(ar_sdio->dma_buffer);
err_hif:
diff --git a/drivers/net/wireless/ath/ath6kl/usb.c b/drivers/net/wireless/ath/ath6kl/usb.c
index e3cf397..38ac253 100644
--- a/drivers/net/wireless/ath/ath6kl/usb.c
+++ b/drivers/net/wireless/ath/ath6kl/usb.c
@@ -352,7 +352,7 @@ static int ath6kl_usb_probe(struct usb_interface *interface,
goto err_usb_put;
}
- ar = ath6kl_core_alloc(&ar_usb->udev->dev);
+ ar = ath6kl_core_create(&ar_usb->udev->dev);
if (ar == NULL) {
ath6kl_err("Failed to alloc ath6kl core\n");
ret = -ENOMEM;
@@ -370,13 +370,13 @@ static int ath6kl_usb_probe(struct usb_interface *interface,
ret = ath6kl_core_init(ar);
if (ret) {
ath6kl_err("Failed to init ath6kl core: %d\n", ret);
- goto err_core_free;
+ goto err_core_destroy;
}
return ret;
-err_core_free:
- ath6kl_core_free(ar);
+err_core_destroy:
+ ath6kl_core_destroy(ar);
err_usb_destroy:
ath6kl_usb_destroy(ar_usb);
err_usb_put:
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 4/6] ath6kl: get rid of AR_DBG_LVL_CHECK()
2012-01-04 23:07 [PATCH 0/6] ath6kl: create ath6kl_core.ko Kalle Valo
` (2 preceding siblings ...)
2012-01-04 23:08 ` [PATCH 3/6] ath6kl: create core.c Kalle Valo
@ 2012-01-04 23:09 ` Kalle Valo
2012-01-04 23:58 ` Joe Perches
2012-01-04 23:09 ` [PATCH 5/6] ath6kl: convert ath6kl_dbg() and ath6kl_dbg_dump() into functions Kalle Valo
2012-01-04 23:10 ` [PATCH 6/6] ath6kl: create ath6kl_core.ko Kalle Valo
5 siblings, 1 reply; 13+ messages in thread
From: Kalle Valo @ 2012-01-04 23:09 UTC (permalink / raw)
To: linville-2XuSBdqkA4R54TAoqtyWWQ
Cc: sfr-3FnU+UHB4dNDw9hX6IcOSA, netdev-u79uwXL29TY76Z2rM5mHXA,
linux-wireless-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-next-u79uwXL29TY76Z2rM5mHXA,
ath6kl-devel-zC7DfRvBq/JWk0Htik3J/w, davem-fT/PcQaiUtIeIZ0/mPfg9Q
We don't need it as debug calls already have a log level and compiler
should be smart enough to optimise away the code when ath6kl debug code
is not enabled. Also it makes it easier to abstract core code to
ath6kl_core.ko.
Signed-off-by: Kalle Valo <kvalo-A+ZNKFmMK5xy9aJCnZT0Uw@public.gmane.org>
---
drivers/net/wireless/ath/ath6kl/debug.c | 35 ++++++++++++++-----------------
drivers/net/wireless/ath/ath6kl/debug.h | 2 --
drivers/net/wireless/ath/ath6kl/hif.c | 5 ++--
drivers/net/wireless/ath/ath6kl/wmi.c | 3 ---
4 files changed, 18 insertions(+), 27 deletions(-)
diff --git a/drivers/net/wireless/ath/ath6kl/debug.c b/drivers/net/wireless/ath/ath6kl/debug.c
index eb808b4..0d77129 100644
--- a/drivers/net/wireless/ath/ath6kl/debug.c
+++ b/drivers/net/wireless/ath/ath6kl/debug.c
@@ -82,31 +82,31 @@ void ath6kl_dump_registers(struct ath6kl_device *dev,
struct ath6kl_irq_enable_reg *irq_enable_reg)
{
- ath6kl_dbg(ATH6KL_DBG_ANY, ("<------- Register Table -------->\n"));
+ ath6kl_dbg(ATH6KL_DBG_IRQ, ("<------- Register Table -------->\n"));
if (irq_proc_reg != NULL) {
- ath6kl_dbg(ATH6KL_DBG_ANY,
+ ath6kl_dbg(ATH6KL_DBG_IRQ,
"Host Int status: 0x%x\n",
irq_proc_reg->host_int_status);
- ath6kl_dbg(ATH6KL_DBG_ANY,
+ ath6kl_dbg(ATH6KL_DBG_IRQ,
"CPU Int status: 0x%x\n",
irq_proc_reg->cpu_int_status);
- ath6kl_dbg(ATH6KL_DBG_ANY,
+ ath6kl_dbg(ATH6KL_DBG_IRQ,
"Error Int status: 0x%x\n",
irq_proc_reg->error_int_status);
- ath6kl_dbg(ATH6KL_DBG_ANY,
+ ath6kl_dbg(ATH6KL_DBG_IRQ,
"Counter Int status: 0x%x\n",
irq_proc_reg->counter_int_status);
- ath6kl_dbg(ATH6KL_DBG_ANY,
+ ath6kl_dbg(ATH6KL_DBG_IRQ,
"Mbox Frame: 0x%x\n",
irq_proc_reg->mbox_frame);
- ath6kl_dbg(ATH6KL_DBG_ANY,
+ ath6kl_dbg(ATH6KL_DBG_IRQ,
"Rx Lookahead Valid: 0x%x\n",
irq_proc_reg->rx_lkahd_valid);
- ath6kl_dbg(ATH6KL_DBG_ANY,
+ ath6kl_dbg(ATH6KL_DBG_IRQ,
"Rx Lookahead 0: 0x%x\n",
irq_proc_reg->rx_lkahd[0]);
- ath6kl_dbg(ATH6KL_DBG_ANY,
+ ath6kl_dbg(ATH6KL_DBG_IRQ,
"Rx Lookahead 1: 0x%x\n",
irq_proc_reg->rx_lkahd[1]);
@@ -115,16 +115,16 @@ void ath6kl_dump_registers(struct ath6kl_device *dev,
* If the target supports GMBOX hardware, dump some
* additional state.
*/
- ath6kl_dbg(ATH6KL_DBG_ANY,
+ ath6kl_dbg(ATH6KL_DBG_IRQ,
"GMBOX Host Int status 2: 0x%x\n",
irq_proc_reg->host_int_status2);
- ath6kl_dbg(ATH6KL_DBG_ANY,
+ ath6kl_dbg(ATH6KL_DBG_IRQ,
"GMBOX RX Avail: 0x%x\n",
irq_proc_reg->gmbox_rx_avail);
- ath6kl_dbg(ATH6KL_DBG_ANY,
+ ath6kl_dbg(ATH6KL_DBG_IRQ,
"GMBOX lookahead alias 0: 0x%x\n",
irq_proc_reg->rx_gmbox_lkahd_alias[0]);
- ath6kl_dbg(ATH6KL_DBG_ANY,
+ ath6kl_dbg(ATH6KL_DBG_IRQ,
"GMBOX lookahead alias 1: 0x%x\n",
irq_proc_reg->rx_gmbox_lkahd_alias[1]);
}
@@ -132,13 +132,13 @@ void ath6kl_dump_registers(struct ath6kl_device *dev,
}
if (irq_enable_reg != NULL) {
- ath6kl_dbg(ATH6KL_DBG_ANY,
+ ath6kl_dbg(ATH6KL_DBG_IRQ,
"Int status Enable: 0x%x\n",
irq_enable_reg->int_status_en);
- ath6kl_dbg(ATH6KL_DBG_ANY, "Counter Int status Enable: 0x%x\n",
+ ath6kl_dbg(ATH6KL_DBG_IRQ, "Counter Int status Enable: 0x%x\n",
irq_enable_reg->cntr_int_status_en);
}
- ath6kl_dbg(ATH6KL_DBG_ANY, "<------------------------------->\n");
+ ath6kl_dbg(ATH6KL_DBG_IRQ, "<------------------------------->\n");
}
static void dump_cred_dist(struct htc_endpoint_credit_dist *ep_dist)
@@ -175,9 +175,6 @@ void dump_cred_dist_stats(struct htc_target *target)
{
struct htc_endpoint_credit_dist *ep_list;
- if (!AR_DBG_LVL_CHECK(ATH6KL_DBG_CREDIT))
- return;
-
list_for_each_entry(ep_list, &target->cred_dist_list, list)
dump_cred_dist(ep_list);
diff --git a/drivers/net/wireless/ath/ath6kl/debug.h b/drivers/net/wireless/ath/ath6kl/debug.h
index e569c65..cb21d91 100644
--- a/drivers/net/wireless/ath/ath6kl/debug.h
+++ b/drivers/net/wireless/ath/ath6kl/debug.h
@@ -56,8 +56,6 @@ int ath6kl_printk(const char *level, const char *fmt, ...);
#define ath6kl_warn(fmt, ...) \
ath6kl_printk(KERN_WARNING, fmt, ##__VA_ARGS__)
-#define AR_DBG_LVL_CHECK(mask) (debug_mask & mask)
-
enum ath6kl_war {
ATH6KL_WAR_INVALID_RATE,
};
diff --git a/drivers/net/wireless/ath/ath6kl/hif.c b/drivers/net/wireless/ath/ath6kl/hif.c
index 0772ef6..3d26c14 100644
--- a/drivers/net/wireless/ath/ath6kl/hif.c
+++ b/drivers/net/wireless/ath/ath6kl/hif.c
@@ -429,9 +429,8 @@ static int proc_pending_irqs(struct ath6kl_device *dev, bool *done)
if (status)
goto out;
- if (AR_DBG_LVL_CHECK(ATH6KL_DBG_IRQ))
- ath6kl_dump_registers(dev, &dev->irq_proc_reg,
- &dev->irq_en_reg);
+ ath6kl_dump_registers(dev, &dev->irq_proc_reg,
+ &dev->irq_en_reg);
/* Update only those registers that are enabled */
host_int_status = dev->irq_proc_reg.host_int_status &
diff --git a/drivers/net/wireless/ath/ath6kl/wmi.c b/drivers/net/wireless/ath/ath6kl/wmi.c
index f6f2aa2..fbd886a 100644
--- a/drivers/net/wireless/ath/ath6kl/wmi.c
+++ b/drivers/net/wireless/ath/ath6kl/wmi.c
@@ -419,9 +419,6 @@ static int ath6kl_wmi_tx_complete_event_rx(u8 *datap, int len)
ath6kl_dbg(ATH6KL_DBG_WMI, "comp: %d %d %d\n",
evt->num_msg, evt->msg_len, evt->msg_type);
- if (!AR_DBG_LVL_CHECK(ATH6KL_DBG_WMI))
- return 0;
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 5/6] ath6kl: convert ath6kl_dbg() and ath6kl_dbg_dump() into functions
2012-01-04 23:07 [PATCH 0/6] ath6kl: create ath6kl_core.ko Kalle Valo
` (3 preceding siblings ...)
2012-01-04 23:09 ` [PATCH 4/6] ath6kl: get rid of AR_DBG_LVL_CHECK() Kalle Valo
@ 2012-01-04 23:09 ` Kalle Valo
2012-01-04 23:41 ` Joe Perches
2012-01-04 23:10 ` [PATCH 6/6] ath6kl: create ath6kl_core.ko Kalle Valo
5 siblings, 1 reply; 13+ messages in thread
From: Kalle Valo @ 2012-01-04 23:09 UTC (permalink / raw)
To: linville-2XuSBdqkA4R54TAoqtyWWQ
Cc: sfr-3FnU+UHB4dNDw9hX6IcOSA, netdev-u79uwXL29TY76Z2rM5mHXA,
linux-wireless-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-next-u79uwXL29TY76Z2rM5mHXA,
ath6kl-devel-zC7DfRvBq/JWk0Htik3J/w, davem-fT/PcQaiUtIeIZ0/mPfg9Q
That way it's possible to not export debug_mask outside the upcoming
ath6kl_core.ko and that makes it easier to ath6kl_core.ko in the
following patch.
Signed-off-by: Kalle Valo <kvalo-A+ZNKFmMK5xy9aJCnZT0Uw@public.gmane.org>
---
drivers/net/wireless/ath/ath6kl/debug.c | 24 ++++++++++++++++++++++++
drivers/net/wireless/ath/ath6kl/debug.h | 25 ++++---------------------
2 files changed, 28 insertions(+), 21 deletions(-)
diff --git a/drivers/net/wireless/ath/ath6kl/debug.c b/drivers/net/wireless/ath/ath6kl/debug.c
index 0d77129..1d216e9 100644
--- a/drivers/net/wireless/ath/ath6kl/debug.c
+++ b/drivers/net/wireless/ath/ath6kl/debug.c
@@ -57,6 +57,30 @@ int ath6kl_printk(const char *level, const char *fmt, ...)
#ifdef CONFIG_ATH6KL_DEBUG
+void ath6kl_dbg(enum ATH6K_DEBUG_MASK mask, const char *fmt, ...)
+{
+ va_list args;
+
+ if (!(debug_mask & mask))
+ return;
+
+ va_start(args, fmt);
+ ath6kl_printk(KERN_DEBUG, fmt, &args);
+ va_end(args);
+}
+
+void ath6kl_dbg_dump(enum ATH6K_DEBUG_MASK mask,
+ const char *msg, const char *prefix,
+ const void *buf, size_t len)
+{
+ if (debug_mask & mask) {
+ if (msg)
+ ath6kl_dbg(mask, "%s\n", msg);
+
+ print_hex_dump_bytes(prefix, DUMP_PREFIX_OFFSET, buf, len);
+ }
+}
+
#define REG_OUTPUT_LEN_PER_LINE 25
#define REGTYPE_STR_LEN 100
diff --git a/drivers/net/wireless/ath/ath6kl/debug.h b/drivers/net/wireless/ath/ath6kl/debug.h
index cb21d91..c4be6e5 100644
--- a/drivers/net/wireless/ath/ath6kl/debug.h
+++ b/drivers/net/wireless/ath/ath6kl/debug.h
@@ -61,28 +61,11 @@ enum ath6kl_war {
};
#ifdef CONFIG_ATH6KL_DEBUG
-#define ath6kl_dbg(mask, fmt, ...) \
- ({ \
- int rtn; \
- if (debug_mask & mask) \
- rtn = ath6kl_printk(KERN_DEBUG, fmt, ##__VA_ARGS__); \
- else \
- rtn = 0; \
- \
- rtn; \
- })
-static inline void ath6kl_dbg_dump(enum ATH6K_DEBUG_MASK mask,
- const char *msg, const char *prefix,
- const void *buf, size_t len)
-{
- if (debug_mask & mask) {
- if (msg)
- ath6kl_dbg(mask, "%s\n", msg);
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 6/6] ath6kl: create ath6kl_core.ko
2012-01-04 23:07 [PATCH 0/6] ath6kl: create ath6kl_core.ko Kalle Valo
` (4 preceding siblings ...)
2012-01-04 23:09 ` [PATCH 5/6] ath6kl: convert ath6kl_dbg() and ath6kl_dbg_dump() into functions Kalle Valo
@ 2012-01-04 23:10 ` Kalle Valo
5 siblings, 0 replies; 13+ messages in thread
From: Kalle Valo @ 2012-01-04 23:10 UTC (permalink / raw)
To: linville-2XuSBdqkA4R54TAoqtyWWQ
Cc: sfr-3FnU+UHB4dNDw9hX6IcOSA, netdev-u79uwXL29TY76Z2rM5mHXA,
linux-wireless-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-next-u79uwXL29TY76Z2rM5mHXA,
ath6kl-devel-zC7DfRvBq/JWk0Htik3J/w, davem-fT/PcQaiUtIeIZ0/mPfg9Q
Now ath6kl is ready for splitting core code to ath6kl_core.ko module.
This also makes it possible to link both sdio and usb code to kernel
at the same time, which earlier failed miserably.
Reported-by: Stephen Rothwell <sfr-3FnU+UHB4dNDw9hX6IcOSA@public.gmane.org>
Signed-off-by: Kalle Valo <kvalo-A+ZNKFmMK5xy9aJCnZT0Uw@public.gmane.org>
---
drivers/net/wireless/ath/ath6kl/Makefile | 37 +++++++++++-----------------
drivers/net/wireless/ath/ath6kl/cfg80211.c | 3 ++
drivers/net/wireless/ath/ath6kl/core.c | 9 +++++++
drivers/net/wireless/ath/ath6kl/debug.c | 3 ++
drivers/net/wireless/ath/ath6kl/hif.c | 5 ++++
drivers/net/wireless/ath/ath6kl/init.c | 3 ++
6 files changed, 37 insertions(+), 23 deletions(-)
diff --git a/drivers/net/wireless/ath/ath6kl/Makefile b/drivers/net/wireless/ath/ath6kl/Makefile
index 9bb69a8..863b9f6 100644
--- a/drivers/net/wireless/ath/ath6kl/Makefile
+++ b/drivers/net/wireless/ath/ath6kl/Makefile
@@ -21,32 +21,23 @@
# Author(s): ="Atheros"
#------------------------------------------------------------------------------
-obj-$(CONFIG_ATH6KL_SDIO) := ath6kl_sdio.o
-ath6kl_sdio-y += debug.o
-ath6kl_sdio-y += hif.o
-ath6kl_sdio-y += htc.o
-ath6kl_sdio-y += bmi.o
-ath6kl_sdio-y += cfg80211.o
-ath6kl_sdio-y += init.o
-ath6kl_sdio-y += main.o
-ath6kl_sdio-y += txrx.o
-ath6kl_sdio-y += wmi.o
-ath6kl_sdio-y += core.o
+obj-$(CONFIG_ATH6KL) += ath6kl_core.o
+ath6kl_core-y += debug.o
+ath6kl_core-y += hif.o
+ath6kl_core-y += htc.o
+ath6kl_core-y += bmi.o
+ath6kl_core-y += cfg80211.o
+ath6kl_core-y += init.o
+ath6kl_core-y += main.o
+ath6kl_core-y += txrx.o
+ath6kl_core-y += wmi.o
+ath6kl_core-y += core.o
+ath6kl_core-$(CONFIG_NL80211_TESTMODE) += testmode.o
+
+obj-$(CONFIG_ATH6KL_SDIO) += ath6kl_sdio.o
ath6kl_sdio-y += sdio.o
-ath6kl_sdio-$(CONFIG_NL80211_TESTMODE) += testmode.o
obj-$(CONFIG_ATH6KL_USB) += ath6kl_usb.o
-ath6kl_usb-y += debug.o
-ath6kl_usb-y += hif.o
-ath6kl_usb-y += htc.o
-ath6kl_usb-y += bmi.o
-ath6kl_usb-y += cfg80211.o
-ath6kl_usb-y += init.o
-ath6kl_usb-y += main.o
-ath6kl_usb-y += txrx.o
-ath6kl_usb-y += wmi.o
-ath6kl_usb-y += core.o
ath6kl_usb-y += usb.o
-ath6kl_usb-$(CONFIG_NL80211_TESTMODE) += testmode.o
ccflags-y += -D__CHECK_ENDIAN__
diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.c b/drivers/net/wireless/ath/ath6kl/cfg80211.c
index 64043f8..d4ed6d1 100644
--- a/drivers/net/wireless/ath/ath6kl/cfg80211.c
+++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c
@@ -15,6 +15,7 @@
*/
#include <linux/moduleparam.h>
+#include <linux/export.h>
#include "core.h"
#include "cfg80211.h"
@@ -1907,6 +1908,7 @@ int ath6kl_cfg80211_suspend(struct ath6kl *ar,
return 0;
}
+EXPORT_SYMBOL(ath6kl_cfg80211_suspend);
int ath6kl_cfg80211_resume(struct ath6kl *ar)
{
@@ -1958,6 +1960,7 @@ int ath6kl_cfg80211_resume(struct ath6kl *ar)
return 0;
}
+EXPORT_SYMBOL(ath6kl_cfg80211_resume);
#ifdef CONFIG_PM
diff --git a/drivers/net/wireless/ath/ath6kl/core.c b/drivers/net/wireless/ath/ath6kl/core.c
index 7e3574e..0d00475 100644
--- a/drivers/net/wireless/ath/ath6kl/core.c
+++ b/drivers/net/wireless/ath/ath6kl/core.c
@@ -16,7 +16,9 @@
#include "core.h"
+#include <linux/module.h>
#include <linux/moduleparam.h>
+#include <linux/export.h>
#include "debug.h"
#include "hif-ops.h"
@@ -198,6 +200,7 @@ err_wq:
return ret;
}
+EXPORT_SYMBOL(ath6kl_core_init);
struct ath6kl *ath6kl_core_create(struct device *dev)
{
@@ -254,6 +257,7 @@ struct ath6kl *ath6kl_core_create(struct device *dev)
return ar;
}
+EXPORT_SYMBOL(ath6kl_core_create);
void ath6kl_core_cleanup(struct ath6kl *ar)
{
@@ -280,9 +284,14 @@ void ath6kl_core_cleanup(struct ath6kl *ar)
ath6kl_cfg80211_cleanup(ar);
ath6kl_cfg80211_destroy(ar);
}
+EXPORT_SYMBOL(ath6kl_core_cleanup);
void ath6kl_core_destroy(struct ath6kl *ar)
{
ath6kl_cfg80211_destroy(ar);
}
+EXPORT_SYMBOL(ath6kl_core_destroy);
+MODULE_AUTHOR("Qualcomm Atheros");
+MODULE_DESCRIPTION("Core module for AR600x SDIO and USB devices.");
+MODULE_LICENSE("Dual BSD/GPL");
diff --git a/drivers/net/wireless/ath/ath6kl/debug.c b/drivers/net/wireless/ath/ath6kl/debug.c
index 1d216e9..19795a6 100644
--- a/drivers/net/wireless/ath/ath6kl/debug.c
+++ b/drivers/net/wireless/ath/ath6kl/debug.c
@@ -54,6 +54,7 @@ int ath6kl_printk(const char *level, const char *fmt, ...)
return rtn;
}
+EXPORT_SYMBOL(ath6kl_printk);
#ifdef CONFIG_ATH6KL_DEBUG
@@ -68,6 +69,7 @@ void ath6kl_dbg(enum ATH6K_DEBUG_MASK mask, const char *fmt, ...)
ath6kl_printk(KERN_DEBUG, fmt, &args);
va_end(args);
}
+EXPORT_SYMBOL(ath6kl_dbg);
void ath6kl_dbg_dump(enum ATH6K_DEBUG_MASK mask,
const char *msg, const char *prefix,
@@ -80,6 +82,7 @@ void ath6kl_dbg_dump(enum ATH6K_DEBUG_MASK mask,
print_hex_dump_bytes(prefix, DUMP_PREFIX_OFFSET, buf, len);
}
}
+EXPORT_SYMBOL(ath6kl_dbg_dump);
#define REG_OUTPUT_LEN_PER_LINE 25
#define REGTYPE_STR_LEN 100
diff --git a/drivers/net/wireless/ath/ath6kl/hif.c b/drivers/net/wireless/ath/ath6kl/hif.c
index 3d26c14..e911737 100644
--- a/drivers/net/wireless/ath/ath6kl/hif.c
+++ b/drivers/net/wireless/ath/ath6kl/hif.c
@@ -15,6 +15,8 @@
*/
#include "hif.h"
+#include <linux/export.h>
+
#include "core.h"
#include "target.h"
#include "hif-ops.h"
@@ -59,6 +61,8 @@ int ath6kl_hif_rw_comp_handler(void *context, int status)
return 0;
}
+EXPORT_SYMBOL(ath6kl_hif_rw_comp_handler);
+
#define REG_DUMP_COUNT_AR6003 60
#define REGISTER_DUMP_LEN_MAX 60
@@ -560,6 +564,7 @@ int ath6kl_hif_intr_bh_handler(struct ath6kl *ar)
return status;
}
+EXPORT_SYMBOL(ath6kl_hif_intr_bh_handler);
static int ath6kl_hif_enable_intrs(struct ath6kl_device *dev)
{
diff --git a/drivers/net/wireless/ath/ath6kl/init.c b/drivers/net/wireless/ath/ath6kl/init.c
index 5a92307..6183c42 100644
--- a/drivers/net/wireless/ath/ath6kl/init.c
+++ b/drivers/net/wireless/ath/ath6kl/init.c
@@ -17,8 +17,10 @@
#include <linux/moduleparam.h>
#include <linux/errno.h>
+#include <linux/export.h>
#include <linux/of.h>
#include <linux/mmc/sdio_func.h>
+
#include "core.h"
#include "cfg80211.h"
#include "target.h"
@@ -1596,3 +1598,4 @@ void ath6kl_stop_txrx(struct ath6kl *ar)
clear_bit(WLAN_ENABLED, &ar->flag);
}
+EXPORT_SYMBOL(ath6kl_stop_txrx);
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH 5/6] ath6kl: convert ath6kl_dbg() and ath6kl_dbg_dump() into functions
2012-01-04 23:09 ` [PATCH 5/6] ath6kl: convert ath6kl_dbg() and ath6kl_dbg_dump() into functions Kalle Valo
@ 2012-01-04 23:41 ` Joe Perches
2012-01-05 8:22 ` Kalle Valo
2012-01-05 10:41 ` David Laight
0 siblings, 2 replies; 13+ messages in thread
From: Joe Perches @ 2012-01-04 23:41 UTC (permalink / raw)
To: Kalle Valo
Cc: linville, sfr, netdev, linux-wireless, linux-kernel, linux-next,
ath6kl-devel, davem
On Thu, 2012-01-05 at 01:09 +0200, Kalle Valo wrote:
> That way it's possible to not export debug_mask outside the upcoming
> ath6kl_core.ko and that makes it easier to ath6kl_core.ko in the
> following patch.
[]
> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
[]
> diff --git a/drivers/net/wireless/ath/ath6kl/debug.c b/drivers/net/wireless/ath/ath6kl/debug.c
[]
> +void ath6kl_dbg(enum ATH6K_DEBUG_MASK mask, const char *fmt, ...)
> +{
> + va_list args;
> +
> + if (!(debug_mask & mask))
> + return;
> +
> + va_start(args, fmt);
> + ath6kl_printk(KERN_DEBUG, fmt, &args);
Passing a va_list as an argument?
I believe this doesn't work.
I think you'll need to add and use:
struct va_format vaf;
vaf.fmt = fmt;
vaf.va = &args;
ath6kl_printk(KERN_DEBUG, "%pV", &vaf);
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 4/6] ath6kl: get rid of AR_DBG_LVL_CHECK()
2012-01-04 23:09 ` [PATCH 4/6] ath6kl: get rid of AR_DBG_LVL_CHECK() Kalle Valo
@ 2012-01-04 23:58 ` Joe Perches
2012-01-05 8:57 ` Kalle Valo
0 siblings, 1 reply; 13+ messages in thread
From: Joe Perches @ 2012-01-04 23:58 UTC (permalink / raw)
To: Kalle Valo
Cc: linville, sfr, netdev, linux-wireless, linux-kernel, linux-next,
ath6kl-devel, davem
On Thu, 2012-01-05 at 01:09 +0200, Kalle Valo wrote:
> We don't need it as debug calls already have a log level and compiler
> should be smart enough to optimise away the code when ath6kl debug code
> is not enabled. Also it makes it easier to abstract core code to
> ath6kl_core.ko.
Changelog isn't representative of code changes.
ATH6KL_DBG_ANY -> ATH6KL_DBG_IRQ.
> diff --git a/drivers/net/wireless/ath/ath6kl/debug.c b/drivers/net/wireless/ath/ath6kl/debug.c
[]
> @@ -82,31 +82,31 @@ void ath6kl_dump_registers(struct ath6kl_device *dev,
> struct ath6kl_irq_enable_reg *irq_enable_reg)
> {
>
> - ath6kl_dbg(ATH6KL_DBG_ANY, ("<------- Register Table -------->\n"));
> + ath6kl_dbg(ATH6KL_DBG_IRQ, ("<------- Register Table -------->\n"));
etc...
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 5/6] ath6kl: convert ath6kl_dbg() and ath6kl_dbg_dump() into functions
2012-01-04 23:41 ` Joe Perches
@ 2012-01-05 8:22 ` Kalle Valo
2012-01-05 10:41 ` David Laight
1 sibling, 0 replies; 13+ messages in thread
From: Kalle Valo @ 2012-01-05 8:22 UTC (permalink / raw)
To: Joe Perches
Cc: linville-2XuSBdqkA4R54TAoqtyWWQ, sfr-3FnU+UHB4dNDw9hX6IcOSA,
netdev-u79uwXL29TY76Z2rM5mHXA,
linux-wireless-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-next-u79uwXL29TY76Z2rM5mHXA,
ath6kl-devel-zC7DfRvBq/JWk0Htik3J/w, davem-fT/PcQaiUtIeIZ0/mPfg9Q
On 01/05/2012 01:41 AM, Joe Perches wrote:
> On Thu, 2012-01-05 at 01:09 +0200, Kalle Valo wrote:
>> That way it's possible to not export debug_mask outside the upcoming
>> ath6kl_core.ko and that makes it easier to ath6kl_core.ko in the
>> following patch.
> []
>> Signed-off-by: Kalle Valo <kvalo-A+ZNKFmMK5xy9aJCnZT0Uw@public.gmane.org>
> []
>> diff --git a/drivers/net/wireless/ath/ath6kl/debug.c b/drivers/net/wireless/ath/ath6kl/debug.c
> []
>> +void ath6kl_dbg(enum ATH6K_DEBUG_MASK mask, const char *fmt, ...)
>> +{
>> + va_list args;
>> +
>> + if (!(debug_mask & mask))
>> + return;
>> +
>> + va_start(args, fmt);
>> + ath6kl_printk(KERN_DEBUG, fmt, &args);
>
> Passing a va_list as an argument?
> I believe this doesn't work.
Doh, I was supposed to test this but then I forgot in the hurry. Thanks
for pointing this out. I will send v2 which will fix this.
Kalle
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 4/6] ath6kl: get rid of AR_DBG_LVL_CHECK()
2012-01-04 23:58 ` Joe Perches
@ 2012-01-05 8:57 ` Kalle Valo
0 siblings, 0 replies; 13+ messages in thread
From: Kalle Valo @ 2012-01-05 8:57 UTC (permalink / raw)
To: Joe Perches
Cc: linville, sfr, netdev, linux-wireless, linux-kernel, linux-next,
ath6kl-devel, davem
On 01/05/2012 01:58 AM, Joe Perches wrote:
> On Thu, 2012-01-05 at 01:09 +0200, Kalle Valo wrote:
>> We don't need it as debug calls already have a log level and compiler
>> should be smart enough to optimise away the code when ath6kl debug code
>> is not enabled. Also it makes it easier to abstract core code to
>> ath6kl_core.ko.
>
> Changelog isn't representative of code changes.
> ATH6KL_DBG_ANY -> ATH6KL_DBG_IRQ.
>
>> diff --git a/drivers/net/wireless/ath/ath6kl/debug.c b/drivers/net/wireless/ath/ath6kl/debug.c
> []
>> @@ -82,31 +82,31 @@ void ath6kl_dump_registers(struct ath6kl_device *dev,
>> struct ath6kl_irq_enable_reg *irq_enable_reg)
>> {
>>
>> - ath6kl_dbg(ATH6KL_DBG_ANY, ("<------- Register Table -------->\n"));
>> + ath6kl_dbg(ATH6KL_DBG_IRQ, ("<------- Register Table -------->\n"));
It's related to this change:
- if (AR_DBG_LVL_CHECK(ATH6KL_DBG_IRQ))
- ath6kl_dump_registers(dev, &dev->irq_proc_reg,
- &dev->irq_en_reg);
+ ath6kl_dump_registers(dev, &dev->irq_proc_reg,
+ &dev->irq_en_reg);
So instead of checking ATH6KL_DBG_IRQ before calling the function the
debug messages in function instead use ATH6KL_DBG_IRQ. I'll mention this
in the commit log.
I should get rid of that ATH6KL_DBG_ANY level completely, it's just
confusing. But I'll do that later.
Thank you for the review.
Kalle
^ permalink raw reply [flat|nested] 13+ messages in thread
* RE: [PATCH 5/6] ath6kl: convert ath6kl_dbg() and ath6kl_dbg_dump() into functions
2012-01-04 23:41 ` Joe Perches
2012-01-05 8:22 ` Kalle Valo
@ 2012-01-05 10:41 ` David Laight
2012-01-05 16:30 ` Joe Perches
1 sibling, 1 reply; 13+ messages in thread
From: David Laight @ 2012-01-05 10:41 UTC (permalink / raw)
To: Joe Perches, Kalle Valo
Cc: linville, sfr, netdev, linux-wireless, linux-kernel, linux-next,
ath6kl-devel, davem
> > + va_start(args, fmt);
> > + ath6kl_printk(KERN_DEBUG, fmt, &args);
>
> Passing a va_list as an argument?
> I believe this doesn't work.
> I think you'll need to add and use:
Passing a va_list certainly does work - vprintf() etc.
What is problematical is taking the address of a va_list.
The likely problem is a 'levels of indirection' one
because, when va_list needs to be a struct (very
likely when arguments are passed in registers),
it is often declared as as array type.
David
^ permalink raw reply [flat|nested] 13+ messages in thread
* RE: [PATCH 5/6] ath6kl: convert ath6kl_dbg() and ath6kl_dbg_dump() into functions
2012-01-05 10:41 ` David Laight
@ 2012-01-05 16:30 ` Joe Perches
0 siblings, 0 replies; 13+ messages in thread
From: Joe Perches @ 2012-01-05 16:30 UTC (permalink / raw)
To: David Laight
Cc: Kalle Valo, linville, sfr, netdev, linux-wireless, linux-kernel,
linux-next, ath6kl-devel, davem
On Thu, 2012-01-05 at 10:41 +0000, David Laight wrote:
> > > + va_start(args, fmt);
> > > + ath6kl_printk(KERN_DEBUG, fmt, &args);
> > Passing a va_list as an argument?
> > I believe this doesn't work.
> > I think you'll need to add and use:
> Passing a va_list certainly does work - vprintf() etc.
> What is problematical is taking the address of a va_list.
Nope. This referred to this specific instance.
Taking the address of a va_list works fine.
Look at the provide example.
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2012-01-05 16:30 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-04 23:07 [PATCH 0/6] ath6kl: create ath6kl_core.ko Kalle Valo
2012-01-04 23:07 ` [PATCH 1/6] ath6kl: rename vif init and cleanup functions Kalle Valo
2012-01-04 23:08 ` [PATCH 2/6] ath6kl: unify cfg80211 init/cleanup functions Kalle Valo
2012-01-04 23:08 ` [PATCH 3/6] ath6kl: create core.c Kalle Valo
2012-01-04 23:09 ` [PATCH 4/6] ath6kl: get rid of AR_DBG_LVL_CHECK() Kalle Valo
2012-01-04 23:58 ` Joe Perches
2012-01-05 8:57 ` Kalle Valo
2012-01-04 23:09 ` [PATCH 5/6] ath6kl: convert ath6kl_dbg() and ath6kl_dbg_dump() into functions Kalle Valo
2012-01-04 23:41 ` Joe Perches
2012-01-05 8:22 ` Kalle Valo
2012-01-05 10:41 ` David Laight
2012-01-05 16:30 ` Joe Perches
2012-01-04 23:10 ` [PATCH 6/6] ath6kl: create ath6kl_core.ko Kalle Valo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).