All of lore.kernel.org
 help / color / mirror / Atom feed
* [ath9k-devel] [PATCH 0/5] ath10k: cleanups
@ 2013-04-17  6:04 Michal Kazior
  2013-04-17  6:04 ` [ath9k-devel] [PATCH 1/5] ath10k: replace debug_mtx with conf_mutex Michal Kazior
                   ` (5 more replies)
  0 siblings, 6 replies; 16+ messages in thread
From: Michal Kazior @ 2013-04-17  6:04 UTC (permalink / raw)
  To: ath9k-devel


Michal Kazior (5):
  ath10k: replace debug_mtx with conf_mutex
  ath10k: change wmi structure access
  ath10k: fix coding style
  ath10k: use ath10k_warn() instead of ath10k_info()
  ath10k: fix function prototype argument name

 drivers/net/wireless/ath/ath10k/core.h  |   19 ++++--
 drivers/net/wireless/ath/ath10k/debug.c |   10 +--
 drivers/net/wireless/ath/ath10k/debug.h |    4 +-
 drivers/net/wireless/ath/ath10k/htc.h   |    5 +-
 drivers/net/wireless/ath/ath10k/mac.c   |   10 +--
 drivers/net/wireless/ath/ath10k/txrx.c  |   16 ++---
 drivers/net/wireless/ath/ath10k/wmi.c   |  104 +++++++++++--------------------
 7 files changed, 76 insertions(+), 92 deletions(-)

-- 
1.7.9.5

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [ath9k-devel] [PATCH 1/5] ath10k: replace debug_mtx with conf_mutex
  2013-04-17  6:04 [ath9k-devel] [PATCH 0/5] ath10k: cleanups Michal Kazior
@ 2013-04-17  6:04 ` Michal Kazior
  2013-04-18  9:44   ` Kalle Valo
  2013-04-17  6:04 ` [ath9k-devel] [PATCH 2/5] ath10k: change wmi structure access Michal Kazior
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 16+ messages in thread
From: Michal Kazior @ 2013-04-17  6:04 UTC (permalink / raw)
  To: ath9k-devel

It's not a good to have too many mutexes. The
patch simplifies locking of debufs to use
conf_mutex.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
---
 drivers/net/wireless/ath/ath10k/core.h  |    1 -
 drivers/net/wireless/ath/ath10k/debug.c |   10 +++++-----
 drivers/net/wireless/ath/ath10k/debug.h |    4 ++--
 3 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h
index 193ac31..4577987 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -240,7 +240,6 @@ struct ath10k_debug {
 	u32 wmi_service_bitmap[WMI_SERVICE_BM_SIZE];
 
 	struct completion event_stats_compl;
-	struct mutex debug_mtx;
 };
 
 struct ath10k {
diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c
index 9b0096c..78bfbc9 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -113,7 +113,7 @@ static ssize_t ath10k_read_wmi_services(struct file *file,
 	if (!buf)
 		return -ENOMEM;
 
-	mutex_lock(&ar->debug.debug_mtx);
+	mutex_lock(&ar->conf_mutex);
 
 	if (len > buf_len)
 		len = buf_len;
@@ -134,7 +134,7 @@ static ssize_t ath10k_read_wmi_services(struct file *file,
 
 	ret_cnt = simple_read_from_buffer(user_buf, count, ppos, buf, len);
 
-	mutex_unlock(&ar->debug.debug_mtx);
+	mutex_unlock(&ar->conf_mutex);
 
 	kfree(buf);
 	return ret_cnt;
@@ -176,7 +176,7 @@ static ssize_t ath10k_read_fw_stats(struct file *file, char __user *user_buf,
 		return -ETIMEDOUT;
 	}
 
-	mutex_lock(&ar->debug.debug_mtx);
+	mutex_lock(&ar->conf_mutex);
 
 	len += scnprintf(buf + len, buf_len - len, "\n");
 	len += scnprintf(buf + len, buf_len - len, "%30s\n",
@@ -306,7 +306,7 @@ static ssize_t ath10k_read_fw_stats(struct file *file, char __user *user_buf,
 
 	ret_cnt = simple_read_from_buffer(user_buf, count, ppos, buf, len);
 
-	mutex_unlock(&ar->debug.debug_mtx);
+	mutex_unlock(&ar->conf_mutex);
 
 	kfree(buf);
 	return ret_cnt;
@@ -328,7 +328,7 @@ int ath10k_debug_create(struct ath10k *ar)
 		return -ENOMEM;
 
 	init_completion(&ar->debug.event_stats_compl);
-	mutex_init(&ar->debug.debug_mtx);
+	mutex_init(&ar->conf_mutex);
 
 	debugfs_create_file("fw_stats", S_IRUSR, ar->debug.debugfs_phy, ar,
 			    &fops_fw_stats);
diff --git a/drivers/net/wireless/ath/ath10k/debug.h b/drivers/net/wireless/ath/ath10k/debug.h
index dc4847b..b57a258 100644
--- a/drivers/net/wireless/ath/ath10k/debug.h
+++ b/drivers/net/wireless/ath/ath10k/debug.h
@@ -61,7 +61,7 @@ static inline void ath10k_debug_read_target_stats(struct ath10k *ar,
 	int num_pdev_stats, num_vdev_stats, num_peer_stats;
 	int i;
 
-	mutex_lock(&ar->debug.debug_mtx);
+	mutex_lock(&ar->conf_mutex);
 
 	fw_stats = &ar->debug.target_stats;
 
@@ -149,7 +149,7 @@ static inline void ath10k_debug_read_target_stats(struct ath10k *ar,
 		}
 	}
 
-	mutex_unlock(&ar->debug.debug_mtx);
+	mutex_unlock(&ar->conf_mutex);
 	complete(&ar->debug.event_stats_compl);
 
 }
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [ath9k-devel] [PATCH 2/5] ath10k: change wmi structure access
  2013-04-17  6:04 [ath9k-devel] [PATCH 0/5] ath10k: cleanups Michal Kazior
  2013-04-17  6:04 ` [ath9k-devel] [PATCH 1/5] ath10k: replace debug_mtx with conf_mutex Michal Kazior
@ 2013-04-17  6:04 ` Michal Kazior
  2013-04-17  6:04 ` [ath9k-devel] [PATCH 3/5] ath10k: fix coding style Michal Kazior
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 16+ messages in thread
From: Michal Kazior @ 2013-04-17  6:04 UTC (permalink / raw)
  To: ath9k-devel

WMI structure shouldn't be a magic void pointer.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
---
 drivers/net/wireless/ath/ath10k/core.h |   18 +++++-
 drivers/net/wireless/ath/ath10k/htc.h  |    3 +-
 drivers/net/wireless/ath/ath10k/wmi.c  |  104 +++++++++++---------------------
 3 files changed, 53 insertions(+), 72 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h
index 4577987..4781310 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -23,6 +23,7 @@
 #include <linux/types.h>
 #include <linux/pci.h>
 
+#include "htc.h"
 #include "hw.h"
 #include "targaddrs.h"
 #include "regtable.h"
@@ -114,6 +115,19 @@ struct ath10k_bmi {
 	bool done_sent;
 };
 
+struct ath10k_wmi {
+	struct ath10k *ar;
+
+	enum htc_endpoint_id eid;
+	struct completion service_ready;
+	struct completion unified_ready;
+	atomic_t pending_tx_count;
+	wait_queue_head_t wq;
+
+	struct sk_buff_head wmi_event_list;
+	struct work_struct wmi_event_work;
+};
+
 struct ath10k_peer_stat {
 	u8 peer_macaddr[ETH_ALEN];
 	u32 peer_rssi;
@@ -271,9 +285,7 @@ struct ath10k {
 		const struct ath10k_hif_ops *ops;
 	} hif;
 
-	struct {
-		void *wmi;
-	} modules;
+	struct ath10k_wmi wmi;
 
 #if defined(CONFIG_PM_SLEEP)
 	wait_queue_head_t event_queue;
diff --git a/drivers/net/wireless/ath/ath10k/htc.h b/drivers/net/wireless/ath/ath10k/htc.h
index 9bf3997..4ad8ca2 100644
--- a/drivers/net/wireless/ath/ath10k/htc.h
+++ b/drivers/net/wireless/ath/ath10k/htc.h
@@ -21,8 +21,9 @@
 #include <linux/kernel.h>
 #include <linux/list.h>
 #include <linux/bug.h>
-#include "core.h"
+#include <linux/skbuff.h>
 
+struct ath10k;
 
 #define MAKE_SERVICE_ID(group, index) \
 	(int)(((int)(group) << 8) | (int)(index))
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index 1cb55bb..4afc8cf 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -23,28 +23,14 @@
 #include "wmi.h"
 #include "mac.h"
 
-struct wmi_struct {
-	struct ath10k *ar;
-
-	enum htc_endpoint_id eid;
-	struct completion service_ready;
-	struct completion unified_ready;
-	atomic_t pending_tx_count;
-	wait_queue_head_t wq;
-
-	struct sk_buff_head wmi_event_list;
-	struct work_struct wmi_event_work;
-};
-
 void wmi_flush_tx(struct ath10k *ar)
 {
-	struct wmi_struct *wmi = ar->modules.wmi;
 	int ret;
 
-	ret = wait_event_timeout(wmi->wq,
-				 atomic_read(&wmi->pending_tx_count) == 0,
+	ret = wait_event_timeout(ar->wmi.wq,
+				 atomic_read(&ar->wmi.pending_tx_count) == 0,
 				 5*HZ);
-	if (atomic_read(&wmi->pending_tx_count) == 0)
+	if (atomic_read(&ar->wmi.pending_tx_count) == 0)
 		return;
 
 	if (ret == 0)
@@ -55,18 +41,16 @@ void wmi_flush_tx(struct ath10k *ar)
 
 int wmi_wait_for_service_ready(struct ath10k *ar)
 {
-	struct wmi_struct *wmi = ar->modules.wmi;
 	int ret;
-	ret = wait_for_completion_timeout(&wmi->service_ready,
+	ret = wait_for_completion_timeout(&ar->wmi.service_ready,
 					  WMI_SERVICE_READY_TIMEOUT_HZ);
 	return ret;
 }
 
 int wmi_wait_for_unified_ready(struct ath10k *ar)
 {
-	struct wmi_struct *wmi = ar->modules.wmi;
 	int ret;
-	ret = wait_for_completion_timeout(&wmi->unified_ready,
+	ret = wait_for_completion_timeout(&ar->wmi.unified_ready,
 					  WMI_UNIFIED_READY_TIMEOUT_HZ);
 	return ret;
 }
@@ -92,12 +76,12 @@ static struct sk_buff *wmi_alloc_skb(u32 len)
 static void wmi_htc_tx_complete(struct sk_buff *skb)
 {
 	struct ath10k_skb_cb *skb_cb = ATH10K_SKB_CB(skb);
-	struct wmi_struct *wmi = skb_cb->htc.priv;
+	struct ath10k *ar = skb_cb->htc.priv;
 
 	dev_kfree_skb(skb);
 
-	if (atomic_sub_return(1, &wmi->pending_tx_count) == 0)
-		wake_up(&wmi->wq);
+	if (atomic_sub_return(1, &ar->wmi.pending_tx_count) == 0)
+		wake_up(&ar->wmi.wq);
 }
 
 /* WMI command API */
@@ -105,7 +89,6 @@ static int wmi_cmd_send(struct ath10k *ar, struct sk_buff *skb,
 			enum wmi_cmd_id cmd_id)
 {
 	struct ath10k_skb_cb *skb_cb = ATH10K_SKB_CB(skb);
-	struct wmi_struct *wmi = ar->modules.wmi;
 	struct wmi_cmd_hdr *cmd_hdr;
 	int status;
 
@@ -117,25 +100,25 @@ static int wmi_cmd_send(struct ath10k *ar, struct sk_buff *skb,
 	cmd_hdr = (struct wmi_cmd_hdr *)skb->data;
 	cmd_hdr->cmd_id = __cpu_to_le16(cmd_id);
 
-	if (atomic_add_return(1, &wmi->pending_tx_count) >
+	if (atomic_add_return(1, &ar->wmi.pending_tx_count) >
 	    WMI_MAX_PENDING_TX_COUNT) {
 		/* avoid using up memory when FW hangs */
-		atomic_dec(&wmi->pending_tx_count);
+		atomic_dec(&ar->wmi.pending_tx_count);
 		ath10k_warn("%s: too many tx packets pending\n", __func__);
 		return -EBUSY;
 	}
 
 	memset(skb_cb, 0, sizeof(*skb_cb));
 	skb_cb->htc.complete = wmi_htc_tx_complete;
-	skb_cb->htc.priv = wmi;
+	skb_cb->htc.priv = ar;
 
 	trace_ath10k_wmi_cmd(cmd_id, skb->data, skb->len);
 
-	status = ath10k_htc_send(ar->htc_handle, wmi->eid, skb);
+	status = ath10k_htc_send(ar->htc_handle, ar->wmi.eid, skb);
 	if (status) {
 		dev_kfree_skb_any(skb);
-		atomic_dec(&wmi->pending_tx_count);
-		ath10k_warn("%s(): htc send failed (%d)\n", __func__, status);
+		atomic_dec(&ar->wmi.pending_tx_count);
+		ath10k_warn("%s(): htc_send failed (%d)\n", __func__, status);
 	}
 
 	return status;
@@ -754,7 +737,6 @@ static void wmi_event_vdev_install_key_complete(struct ath10k *ar,
 static void wmi_service_ready_event_rx(struct ath10k *ar, struct sk_buff *skb)
 {
 	struct ath_common *common = ath10k_common(ar);
-	struct wmi_struct *wmi = ar->modules.wmi;
 	struct wmi_service_ready_event *ev = (void *)skb->data;
 
 	if (skb->len < sizeof(*ev)) {
@@ -806,13 +788,12 @@ static void wmi_service_ready_event_rx(struct ath10k *ar, struct sk_buff *skb)
 		   __le32_to_cpu(ev->sys_cap_info),
 		   __le32_to_cpu(ev->num_mem_reqs));
 
-	complete(&wmi->service_ready);
+	complete(&ar->wmi.service_ready);
 }
 
 static int wmi_ready_event_rx(struct ath10k *ar, struct sk_buff *skb)
 {
 	struct wmi_ready_event *ev = (void *)skb->data;
-	struct wmi_struct *wmi = ar->modules.wmi;
 
 	if (WARN_ON(skb->len < sizeof(*ev)))
 		return -EINVAL;
@@ -834,13 +815,12 @@ static int wmi_ready_event_rx(struct ath10k *ar, struct sk_buff *skb)
 		   ev->mac_addr.addr,
 		   __le32_to_cpu(ev->status));
 
-	complete(&wmi->unified_ready);
+	complete(&ar->wmi.unified_ready);
 	return 0;
 }
 
-static void wmi_event_process(struct wmi_struct *wmi, struct sk_buff *skb)
+static void wmi_event_process(struct ath10k *ar, struct sk_buff *skb)
 {
-	struct ath10k *ar = wmi->ar;
 	struct wmi_cmd_hdr *cmd_hdr;
 	u16 id;
 	u8 *event;
@@ -968,22 +948,22 @@ static void wmi_event_process(struct wmi_struct *wmi, struct sk_buff *skb)
 
 static void wmi_event_work(struct work_struct *work)
 {
-	struct wmi_struct *wmi = container_of(work, struct wmi_struct,
-					      wmi_event_work);
+	struct ath10k *ar = container_of(work, struct ath10k,
+					 wmi.wmi_event_work);
 	struct sk_buff *skb;
 
 	for (;;) {
-		skb = skb_dequeue(&wmi->wmi_event_list);
+		skb = skb_dequeue(&ar->wmi.wmi_event_list);
 		if (!skb)
 			break;
 
-		wmi_event_process(wmi, skb);
+		wmi_event_process(ar, skb);
 	}
 }
 
 static void wmi_process_rx(void *ptr, struct sk_buff *skb)
 {
-	struct wmi_struct *wmi = ptr;
+	struct ath10k *ar = ptr;
 	struct wmi_cmd_hdr *cmd_hdr = (struct wmi_cmd_hdr *)skb->data;
 	enum wmi_event_id event_id = __le16_to_cpu(cmd_hdr->cmd_id);
 
@@ -996,57 +976,47 @@ static void wmi_process_rx(void *ptr, struct sk_buff *skb)
 	 * thus can't be defered to a worker thread */
 	switch (event_id) {
 	case WMI_HOST_SWBA_EVENTID:
-		wmi_event_process(wmi, skb);
+		wmi_event_process(ar, skb);
 		return;
 	default:
 		break;
 	}
 
-	skb_queue_tail(&wmi->wmi_event_list, skb);
-	queue_work(wmi->ar->workqueue, &wmi->wmi_event_work);
+	skb_queue_tail(&ar->wmi.wmi_event_list, skb);
+	queue_work(ar->workqueue, &ar->wmi.wmi_event_work);
 }
 
 /* WMI Initialization functions */
 int wmi_attach(struct ath10k *ar)
 {
-	struct wmi_struct *wmi;
-
-	wmi = kzalloc(sizeof(*wmi), GFP_KERNEL);
-	if (!wmi)
-		return -ENOMEM;
-
-	wmi->ar = ar;
-	init_completion(&wmi->service_ready);
-	init_completion(&wmi->unified_ready);
-	init_waitqueue_head(&wmi->wq);
+	ar->wmi.ar = ar;
+	init_completion(&ar->wmi.service_ready);
+	init_completion(&ar->wmi.unified_ready);
+	init_waitqueue_head(&ar->wmi.wq);
 
-	skb_queue_head_init(&wmi->wmi_event_list);
-	INIT_WORK(&wmi->wmi_event_work, wmi_event_work);
+	skb_queue_head_init(&ar->wmi.wmi_event_list);
+	INIT_WORK(&ar->wmi.wmi_event_work, wmi_event_work);
 
-	ar->modules.wmi = wmi;
 	return 0;
 }
 
 void wmi_detach(struct ath10k *ar)
 {
-	struct wmi_struct *wmi = ar->modules.wmi;
 	struct sk_buff *skb;
 
 	/* HTC should've drained the packets already */
-	if (WARN_ON(atomic_read(&wmi->pending_tx_count) > 0))
+	if (WARN_ON(atomic_read(&ar->wmi.pending_tx_count) > 0))
 		ath10k_warn("there are still pending packets\n");
 
-	cancel_work_sync(&wmi->wmi_event_work);
+	cancel_work_sync(&ar->wmi.wmi_event_work);
 
 	for (;;) {
-		skb = skb_dequeue(&wmi->wmi_event_list);
+		skb = skb_dequeue(&ar->wmi.wmi_event_list);
 		if (!skb)
 			break;
 
 		dev_kfree_skb_any(skb);
 	}
-
-	kfree(ar->modules.wmi);
 }
 
 int wmi_connect_htc_service(struct ath10k *ar)
@@ -1054,13 +1024,12 @@ int wmi_connect_htc_service(struct ath10k *ar)
 	int status;
 	struct htc_service_connect_req connect;
 	struct htc_service_connect_resp response;
-	struct wmi_struct *wmi = ar->modules.wmi;
 
 	memset(&connect, 0, sizeof(connect));
 	memset(&response, 0, sizeof(response));
 
 	/* these fields are the same for all service endpoints */
-	connect.ep_callbacks.context = wmi;
+	connect.ep_callbacks.context = ar;
 	connect.ep_callbacks.ep_rx_complete = wmi_process_rx;
 
 	/* connect to control service */
@@ -1073,8 +1042,7 @@ int wmi_connect_htc_service(struct ath10k *ar)
 		return status;
 	}
 
-	wmi->eid = response.ep_id;
-
+	ar->wmi.eid = response.ep_id;
 	return 0;
 }
 
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [ath9k-devel] [PATCH 3/5] ath10k: fix coding style
  2013-04-17  6:04 [ath9k-devel] [PATCH 0/5] ath10k: cleanups Michal Kazior
  2013-04-17  6:04 ` [ath9k-devel] [PATCH 1/5] ath10k: replace debug_mtx with conf_mutex Michal Kazior
  2013-04-17  6:04 ` [ath9k-devel] [PATCH 2/5] ath10k: change wmi structure access Michal Kazior
@ 2013-04-17  6:04 ` Michal Kazior
  2013-04-17  6:04 ` [ath9k-devel] [PATCH 4/5] ath10k: use ath10k_warn() instead of ath10k_info() Michal Kazior
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 16+ messages in thread
From: Michal Kazior @ 2013-04-17  6:04 UTC (permalink / raw)
  To: ath9k-devel

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
---
 drivers/net/wireless/ath/ath10k/mac.c  |    8 +++++---
 drivers/net/wireless/ath/ath10k/txrx.c |   16 +++++++++-------
 2 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 9fa8fc3..aa8c130 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -1232,10 +1232,12 @@ static void ath10k_tx_h_update_wep_key(struct sk_buff *skb)
 
 	ret = wmi_vdev_set_param(ar, arvif->vdev_id, WMI_VDEV_PARAM_DEF_KEYID,
 				 key->keyidx);
-	if (!ret)
-		arvif->def_wep_key_index = key->keyidx;
-	else
+	if (ret) {
 		ath10k_warn("could not update wep keyidx (%d)\n", ret);
+		return;
+	}
+
+	arvif->def_wep_key_index = key->keyidx;
 }
 
 static void ath10k_tx_h_add_p2p_noa_ie(struct ath10k *ar, struct sk_buff *skb)
diff --git a/drivers/net/wireless/ath/ath10k/txrx.c b/drivers/net/wireless/ath/ath10k/txrx.c
index a40d019..85d54bb 100644
--- a/drivers/net/wireless/ath/ath10k/txrx.c
+++ b/drivers/net/wireless/ath/ath10k/txrx.c
@@ -31,14 +31,16 @@ static void ath10k_report_offchan_tx(struct ath10k *ar, struct sk_buff *skb)
 	 * offchan_tx_completed for a different skb. Prevent this by using
 	 * offchan_tx_skb. */
 	spin_lock_bh(&ar->data_lock);
-	if (ar->offchan_tx_skb == skb) {
-		complete(&ar->offchan_tx_completed);
-		ar->offchan_tx_skb = NULL; /* just for sanity */
-
-		ath10k_dbg(ATH10K_DBG_HTT, "completed offchannel skb %p\n", skb);
+	if (ar->offchan_tx_skb != skb) {
+		ath10k_warn("completed old offchannel frame\n");
+		goto out;
 	}
-	else
-		ath10k_warn("completed late offchannel skb %p\n", skb);
+
+	complete(&ar->offchan_tx_completed);
+	ar->offchan_tx_skb = NULL; /* just for sanity */
+
+	ath10k_dbg(ATH10K_DBG_HTT, "completed offchannel skb %p\n", skb);
+out:
 	spin_unlock_bh(&ar->data_lock);
 }
 
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [ath9k-devel] [PATCH 4/5] ath10k: use ath10k_warn() instead of ath10k_info()
  2013-04-17  6:04 [ath9k-devel] [PATCH 0/5] ath10k: cleanups Michal Kazior
                   ` (2 preceding siblings ...)
  2013-04-17  6:04 ` [ath9k-devel] [PATCH 3/5] ath10k: fix coding style Michal Kazior
@ 2013-04-17  6:04 ` Michal Kazior
  2013-04-17  6:04 ` [ath9k-devel] [PATCH 5/5] ath10k: fix function prototype argument name Michal Kazior
  2013-04-18  9:50 ` [ath9k-devel] [PATCH 0/5] ath10k: cleanups Kalle Valo
  5 siblings, 0 replies; 16+ messages in thread
From: Michal Kazior @ 2013-04-17  6:04 UTC (permalink / raw)
  To: ath9k-devel

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
---
 drivers/net/wireless/ath/ath10k/mac.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index aa8c130..c0dc157 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -1327,7 +1327,7 @@ void ath10k_offchan_tx_work(struct work_struct *work)
 		spin_unlock_bh(&ar->data_lock);
 
 		if (peer)
-			ath10k_info("peer %pM on vdev %d already present\n",
+			ath10k_dbg(ATH10K_DBG_MAC, "peer %pM on vdev %d already present\n",
 				    peer_addr, vdev_id);
 
 		if (!peer) {
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [ath9k-devel] [PATCH 5/5] ath10k: fix function prototype argument name
  2013-04-17  6:04 [ath9k-devel] [PATCH 0/5] ath10k: cleanups Michal Kazior
                   ` (3 preceding siblings ...)
  2013-04-17  6:04 ` [ath9k-devel] [PATCH 4/5] ath10k: use ath10k_warn() instead of ath10k_info() Michal Kazior
@ 2013-04-17  6:04 ` Michal Kazior
  2013-04-18  9:50 ` [ath9k-devel] [PATCH 0/5] ath10k: cleanups Kalle Valo
  5 siblings, 0 replies; 16+ messages in thread
From: Michal Kazior @ 2013-04-17  6:04 UTC (permalink / raw)
  To: ath9k-devel

This argument is used to specify how much data we
want to pack up into a skbuff, no just headroom.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
---
 drivers/net/wireless/ath/ath10k/htc.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/htc.h b/drivers/net/wireless/ath/ath10k/htc.h
index 4ad8ca2..2c231db 100644
--- a/drivers/net/wireless/ath/ath10k/htc.h
+++ b/drivers/net/wireless/ath/ath10k/htc.h
@@ -112,6 +112,6 @@ int ath10k_htc_send(struct htc_target *target, enum htc_endpoint_id eid,
 		    struct sk_buff *packet);
 void ath10k_htc_stop(struct htc_target *target);
 void ath10k_htc_destroy(struct htc_target *target);
-struct sk_buff *ath10k_htc_alloc_skb(int extra_headroom);
+struct sk_buff *ath10k_htc_alloc_skb(int size);
 
 #endif
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [ath9k-devel] [PATCH 1/5] ath10k: replace debug_mtx with conf_mutex
  2013-04-17  6:04 ` [ath9k-devel] [PATCH 1/5] ath10k: replace debug_mtx with conf_mutex Michal Kazior
@ 2013-04-18  9:44   ` Kalle Valo
  2013-04-18  9:48     ` Michal Kazior
  0 siblings, 1 reply; 16+ messages in thread
From: Kalle Valo @ 2013-04-18  9:44 UTC (permalink / raw)
  To: ath9k-devel

Michal Kazior <michal.kazior@tieto.com> writes:

> It's not a good to have too many mutexes. The
> patch simplifies locking of debufs to use
> conf_mutex.
>
> Signed-off-by: Michal Kazior <michal.kazior@tieto.com>

[...]

> @@ -328,7 +328,7 @@ int ath10k_debug_create(struct ath10k *ar)
>  		return -ENOMEM;
>  
>  	init_completion(&ar->debug.event_stats_compl);
> -	mutex_init(&ar->debug.debug_mtx);
> +	mutex_init(&ar->conf_mutex);

Can this be right? We already initialise conf_mutex in core.c.

-- 
Kalle Valo

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [ath9k-devel] [PATCH 1/5] ath10k: replace debug_mtx with conf_mutex
  2013-04-18  9:44   ` Kalle Valo
@ 2013-04-18  9:48     ` Michal Kazior
  0 siblings, 0 replies; 16+ messages in thread
From: Michal Kazior @ 2013-04-18  9:48 UTC (permalink / raw)
  To: ath9k-devel

On 18/04/13 11:44, Kalle Valo wrote:
> Michal Kazior <michal.kazior@tieto.com> writes:
>
>> It's not a good to have too many mutexes. The
>> patch simplifies locking of debufs to use
>> conf_mutex.
>>
>> Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
>
> [...]
>
>> @@ -328,7 +328,7 @@ int ath10k_debug_create(struct ath10k *ar)
>>   		return -ENOMEM;
>>
>>   	init_completion(&ar->debug.event_stats_compl);
>> -	mutex_init(&ar->debug.debug_mtx);
>> +	mutex_init(&ar->conf_mutex);
>
> Can this be right? We already initialise conf_mutex in core.c.

Good catch, thanks! The mutex_init() is already initialized elsewhere. 
No need to re-initialize it here.


-- Pozdrawiam / Best regards, Michal Kazior.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [ath9k-devel] [PATCH 0/5] ath10k: cleanups
  2013-04-17  6:04 [ath9k-devel] [PATCH 0/5] ath10k: cleanups Michal Kazior
                   ` (4 preceding siblings ...)
  2013-04-17  6:04 ` [ath9k-devel] [PATCH 5/5] ath10k: fix function prototype argument name Michal Kazior
@ 2013-04-18  9:50 ` Kalle Valo
  2013-04-18 10:01   ` [ath9k-devel] [PATCH v2 " Michal Kazior
  5 siblings, 1 reply; 16+ messages in thread
From: Kalle Valo @ 2013-04-18  9:50 UTC (permalink / raw)
  To: ath9k-devel

Michal Kazior <michal.kazior@tieto.com> writes:

> Michal Kazior (5):
>   ath10k: replace debug_mtx with conf_mutex
>   ath10k: change wmi structure access
>   ath10k: fix coding style
>   ath10k: use ath10k_warn() instead of ath10k_info()
>   ath10k: fix function prototype argument name

When you resend can you also rebase the patches, please? Quite a lot of
conflicts in wmi.c

-- 
Kalle Valo

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [ath9k-devel] [PATCH v2 0/5] ath10k: cleanups
  2013-04-18  9:50 ` [ath9k-devel] [PATCH 0/5] ath10k: cleanups Kalle Valo
@ 2013-04-18 10:01   ` Michal Kazior
  2013-04-18 10:01     ` [ath9k-devel] [PATCH v2 1/5] ath10k: replace debug_mtx with conf_mutex Michal Kazior
                       ` (5 more replies)
  0 siblings, 6 replies; 16+ messages in thread
From: Michal Kazior @ 2013-04-18 10:01 UTC (permalink / raw)
  To: ath9k-devel

Rebased on top of latest master branch
 (https://github.com/kvalo/ath10k)

Patch #1 updated.


Michal Kazior (5):
  ath10k: replace debug_mtx with conf_mutex
  ath10k: change wmi structure access
  ath10k: fix coding style
  ath10k: use ath10k_warn() instead of ath10k_info()
  ath10k: fix function prototype argument name

 drivers/net/wireless/ath/ath10k/core.h  |   19 ++++--
 drivers/net/wireless/ath/ath10k/debug.c |    9 ++-
 drivers/net/wireless/ath/ath10k/debug.h |    4 +-
 drivers/net/wireless/ath/ath10k/htc.h   |    5 +-
 drivers/net/wireless/ath/ath10k/mac.c   |   10 +--
 drivers/net/wireless/ath/ath10k/txrx.c  |   16 ++---
 drivers/net/wireless/ath/ath10k/wmi.c   |  105 +++++++++++--------------------
 7 files changed, 75 insertions(+), 93 deletions(-)

-- 
1.7.9.5

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [ath9k-devel] [PATCH v2 1/5] ath10k: replace debug_mtx with conf_mutex
  2013-04-18 10:01   ` [ath9k-devel] [PATCH v2 " Michal Kazior
@ 2013-04-18 10:01     ` Michal Kazior
  2013-04-18 10:01     ` [ath9k-devel] [PATCH v2 2/5] ath10k: change wmi structure access Michal Kazior
                       ` (4 subsequent siblings)
  5 siblings, 0 replies; 16+ messages in thread
From: Michal Kazior @ 2013-04-18 10:01 UTC (permalink / raw)
  To: ath9k-devel

It's not a good to have too many mutexes. The
patch simplifies locking of debufs to use
conf_mutex.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
---
v2: removed unnecessary mutex_init()

 drivers/net/wireless/ath/ath10k/core.h  |    1 -
 drivers/net/wireless/ath/ath10k/debug.c |    9 ++++-----
 drivers/net/wireless/ath/ath10k/debug.h |    4 ++--
 3 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h
index 193ac31..4577987 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -240,7 +240,6 @@ struct ath10k_debug {
 	u32 wmi_service_bitmap[WMI_SERVICE_BM_SIZE];
 
 	struct completion event_stats_compl;
-	struct mutex debug_mtx;
 };
 
 struct ath10k {
diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c
index 8f5b506..7e6b7034 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -113,7 +113,7 @@ static ssize_t ath10k_read_wmi_services(struct file *file,
 	if (!buf)
 		return -ENOMEM;
 
-	mutex_lock(&ar->debug.debug_mtx);
+	mutex_lock(&ar->conf_mutex);
 
 	if (len > buf_len)
 		len = buf_len;
@@ -134,7 +134,7 @@ static ssize_t ath10k_read_wmi_services(struct file *file,
 
 	ret_cnt = simple_read_from_buffer(user_buf, count, ppos, buf, len);
 
-	mutex_unlock(&ar->debug.debug_mtx);
+	mutex_unlock(&ar->conf_mutex);
 
 	kfree(buf);
 	return ret_cnt;
@@ -176,7 +176,7 @@ static ssize_t ath10k_read_fw_stats(struct file *file, char __user *user_buf,
 		return -ETIMEDOUT;
 	}
 
-	mutex_lock(&ar->debug.debug_mtx);
+	mutex_lock(&ar->conf_mutex);
 
 	len += scnprintf(buf + len, buf_len - len, "\n");
 	len += scnprintf(buf + len, buf_len - len, "%30s\n",
@@ -306,7 +306,7 @@ static ssize_t ath10k_read_fw_stats(struct file *file, char __user *user_buf,
 
 	ret_cnt = simple_read_from_buffer(user_buf, count, ppos, buf, len);
 
-	mutex_unlock(&ar->debug.debug_mtx);
+	mutex_unlock(&ar->conf_mutex);
 
 	kfree(buf);
 	return ret_cnt;
@@ -328,7 +328,6 @@ int ath10k_debug_create(struct ath10k *ar)
 		return -ENOMEM;
 
 	init_completion(&ar->debug.event_stats_compl);
-	mutex_init(&ar->debug.debug_mtx);
 
 	debugfs_create_file("fw_stats", S_IRUSR, ar->debug.debugfs_phy, ar,
 			    &fops_fw_stats);
diff --git a/drivers/net/wireless/ath/ath10k/debug.h b/drivers/net/wireless/ath/ath10k/debug.h
index dc4847b..b57a258 100644
--- a/drivers/net/wireless/ath/ath10k/debug.h
+++ b/drivers/net/wireless/ath/ath10k/debug.h
@@ -61,7 +61,7 @@ static inline void ath10k_debug_read_target_stats(struct ath10k *ar,
 	int num_pdev_stats, num_vdev_stats, num_peer_stats;
 	int i;
 
-	mutex_lock(&ar->debug.debug_mtx);
+	mutex_lock(&ar->conf_mutex);
 
 	fw_stats = &ar->debug.target_stats;
 
@@ -149,7 +149,7 @@ static inline void ath10k_debug_read_target_stats(struct ath10k *ar,
 		}
 	}
 
-	mutex_unlock(&ar->debug.debug_mtx);
+	mutex_unlock(&ar->conf_mutex);
 	complete(&ar->debug.event_stats_compl);
 
 }
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [ath9k-devel] [PATCH v2 2/5] ath10k: change wmi structure access
  2013-04-18 10:01   ` [ath9k-devel] [PATCH v2 " Michal Kazior
  2013-04-18 10:01     ` [ath9k-devel] [PATCH v2 1/5] ath10k: replace debug_mtx with conf_mutex Michal Kazior
@ 2013-04-18 10:01     ` Michal Kazior
  2013-04-18 10:01     ` [ath9k-devel] [PATCH v2 3/5] ath10k: fix coding style Michal Kazior
                       ` (3 subsequent siblings)
  5 siblings, 0 replies; 16+ messages in thread
From: Michal Kazior @ 2013-04-18 10:01 UTC (permalink / raw)
  To: ath9k-devel

WMI structure shouldn't be a magic void pointer.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
---
 drivers/net/wireless/ath/ath10k/core.h |   18 +++++-
 drivers/net/wireless/ath/ath10k/htc.h  |    3 +-
 drivers/net/wireless/ath/ath10k/wmi.c  |  105 +++++++++++---------------------
 3 files changed, 53 insertions(+), 73 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h
index 4577987..4781310 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -23,6 +23,7 @@
 #include <linux/types.h>
 #include <linux/pci.h>
 
+#include "htc.h"
 #include "hw.h"
 #include "targaddrs.h"
 #include "regtable.h"
@@ -114,6 +115,19 @@ struct ath10k_bmi {
 	bool done_sent;
 };
 
+struct ath10k_wmi {
+	struct ath10k *ar;
+
+	enum htc_endpoint_id eid;
+	struct completion service_ready;
+	struct completion unified_ready;
+	atomic_t pending_tx_count;
+	wait_queue_head_t wq;
+
+	struct sk_buff_head wmi_event_list;
+	struct work_struct wmi_event_work;
+};
+
 struct ath10k_peer_stat {
 	u8 peer_macaddr[ETH_ALEN];
 	u32 peer_rssi;
@@ -271,9 +285,7 @@ struct ath10k {
 		const struct ath10k_hif_ops *ops;
 	} hif;
 
-	struct {
-		void *wmi;
-	} modules;
+	struct ath10k_wmi wmi;
 
 #if defined(CONFIG_PM_SLEEP)
 	wait_queue_head_t event_queue;
diff --git a/drivers/net/wireless/ath/ath10k/htc.h b/drivers/net/wireless/ath/ath10k/htc.h
index 9bf3997..4ad8ca2 100644
--- a/drivers/net/wireless/ath/ath10k/htc.h
+++ b/drivers/net/wireless/ath/ath10k/htc.h
@@ -21,8 +21,9 @@
 #include <linux/kernel.h>
 #include <linux/list.h>
 #include <linux/bug.h>
-#include "core.h"
+#include <linux/skbuff.h>
 
+struct ath10k;
 
 #define MAKE_SERVICE_ID(group, index) \
 	(int)(((int)(group) << 8) | (int)(index))
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index 4b44957..4fe22b2 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -23,28 +23,14 @@
 #include "wmi.h"
 #include "mac.h"
 
-struct wmi_struct {
-	struct ath10k *ar;
-
-	enum htc_endpoint_id eid;
-	struct completion service_ready;
-	struct completion unified_ready;
-	atomic_t pending_tx_count;
-	wait_queue_head_t wq;
-
-	struct sk_buff_head wmi_event_list;
-	struct work_struct wmi_event_work;
-};
-
 void ath10k_wmi_flush_tx(struct ath10k *ar)
 {
-	struct wmi_struct *wmi = ar->modules.wmi;
 	int ret;
 
-	ret = wait_event_timeout(wmi->wq,
-				 atomic_read(&wmi->pending_tx_count) == 0,
+	ret = wait_event_timeout(ar->wmi.wq,
+				 atomic_read(&ar->wmi.pending_tx_count) == 0,
 				 5*HZ);
-	if (atomic_read(&wmi->pending_tx_count) == 0)
+	if (atomic_read(&ar->wmi.pending_tx_count) == 0)
 		return;
 
 	if (ret == 0)
@@ -55,18 +41,16 @@ void ath10k_wmi_flush_tx(struct ath10k *ar)
 
 int ath10k_wmi_wait_for_service_ready(struct ath10k *ar)
 {
-	struct wmi_struct *wmi = ar->modules.wmi;
 	int ret;
-	ret = wait_for_completion_timeout(&wmi->service_ready,
+	ret = wait_for_completion_timeout(&ar->wmi.service_ready,
 					  WMI_SERVICE_READY_TIMEOUT_HZ);
 	return ret;
 }
 
 int ath10k_wmi_wait_for_unified_ready(struct ath10k *ar)
 {
-	struct wmi_struct *wmi = ar->modules.wmi;
 	int ret;
-	ret = wait_for_completion_timeout(&wmi->unified_ready,
+	ret = wait_for_completion_timeout(&ar->wmi.unified_ready,
 					  WMI_UNIFIED_READY_TIMEOUT_HZ);
 	return ret;
 }
@@ -92,12 +76,12 @@ static struct sk_buff *ath10k_wmi_alloc_skb(u32 len)
 static void ath10k_wmi_htc_tx_complete(struct sk_buff *skb)
 {
 	struct ath10k_skb_cb *skb_cb = ATH10K_SKB_CB(skb);
-	struct wmi_struct *wmi = skb_cb->htc.priv;
+	struct ath10k *ar = skb_cb->htc.priv;
 
 	dev_kfree_skb(skb);
 
-	if (atomic_sub_return(1, &wmi->pending_tx_count) == 0)
-		wake_up(&wmi->wq);
+	if (atomic_sub_return(1, &ar->wmi.pending_tx_count) == 0)
+		wake_up(&ar->wmi.wq);
 }
 
 /* WMI command API */
@@ -105,7 +89,6 @@ static int ath10k_wmi_cmd_send(struct ath10k *ar, struct sk_buff *skb,
 			       enum wmi_cmd_id cmd_id)
 {
 	struct ath10k_skb_cb *skb_cb = ATH10K_SKB_CB(skb);
-	struct wmi_struct *wmi = ar->modules.wmi;
 	struct wmi_cmd_hdr *cmd_hdr;
 	int status;
 
@@ -117,25 +100,25 @@ static int ath10k_wmi_cmd_send(struct ath10k *ar, struct sk_buff *skb,
 	cmd_hdr = (struct wmi_cmd_hdr *)skb->data;
 	cmd_hdr->cmd_id = __cpu_to_le16(cmd_id);
 
-	if (atomic_add_return(1, &wmi->pending_tx_count) >
+	if (atomic_add_return(1, &ar->wmi.pending_tx_count) >
 	    WMI_MAX_PENDING_TX_COUNT) {
 		/* avoid using up memory when FW hangs */
-		atomic_dec(&wmi->pending_tx_count);
+		atomic_dec(&ar->wmi.pending_tx_count);
 		ath10k_warn("%s: too many tx packets pending\n", __func__);
 		return -EBUSY;
 	}
 
 	memset(skb_cb, 0, sizeof(*skb_cb));
 	skb_cb->htc.complete = ath10k_wmi_htc_tx_complete;
-	skb_cb->htc.priv = wmi;
+	skb_cb->htc.priv = ar;
 
 	trace_ath10k_wmi_cmd(cmd_id, skb->data, skb->len);
 
-	status = ath10k_htc_send(ar->htc_handle, wmi->eid, skb);
+	status = ath10k_htc_send(ar->htc_handle, ar->wmi.eid, skb);
 	if (status) {
 		dev_kfree_skb_any(skb);
-		atomic_dec(&wmi->pending_tx_count);
-		ath10k_warn("%s(): htc send failed (%d)\n", __func__, status);
+		atomic_dec(&ar->wmi.pending_tx_count);
+		ath10k_warn("%s(): htc_send failed (%d)\n", __func__, status);
 	}
 
 	return status;
@@ -841,7 +824,6 @@ static void ath10k_wmi_event_vdev_install_key_complete(struct ath10k *ar,
 static void ath10k_wmi_service_ready_event_rx(struct ath10k *ar, struct sk_buff *skb)
 {
 	struct ath_common *common = ath10k_common(ar);
-	struct wmi_struct *wmi = ar->modules.wmi;
 	struct wmi_service_ready_event *ev = (void *)skb->data;
 
 	if (skb->len < sizeof(*ev)) {
@@ -893,13 +875,12 @@ static void ath10k_wmi_service_ready_event_rx(struct ath10k *ar, struct sk_buff
 		   __le32_to_cpu(ev->sys_cap_info),
 		   __le32_to_cpu(ev->num_mem_reqs));
 
-	complete(&wmi->service_ready);
+	complete(&ar->wmi.service_ready);
 }
 
 static int ath10k_wmi_ready_event_rx(struct ath10k *ar, struct sk_buff *skb)
 {
 	struct wmi_ready_event *ev = (void *)skb->data;
-	struct wmi_struct *wmi = ar->modules.wmi;
 
 	if (WARN_ON(skb->len < sizeof(*ev)))
 		return -EINVAL;
@@ -921,13 +902,12 @@ static int ath10k_wmi_ready_event_rx(struct ath10k *ar, struct sk_buff *skb)
 		   ev->mac_addr.addr,
 		   __le32_to_cpu(ev->status));
 
-	complete(&wmi->unified_ready);
+	complete(&ar->wmi.unified_ready);
 	return 0;
 }
 
-static void ath10k_wmi_event_process(struct wmi_struct *wmi, struct sk_buff *skb)
+static void ath10k_wmi_event_process(struct ath10k *ar, struct sk_buff *skb)
 {
-	struct ath10k *ar = wmi->ar;
 	struct wmi_cmd_hdr *cmd_hdr;
 	u16 id;
 	u8 *event;
@@ -1055,22 +1035,22 @@ static void ath10k_wmi_event_process(struct wmi_struct *wmi, struct sk_buff *skb
 
 static void ath10k_wmi_event_work(struct work_struct *work)
 {
-	struct wmi_struct *wmi = container_of(work, struct wmi_struct,
-					      wmi_event_work);
+	struct ath10k *ar = container_of(work, struct ath10k,
+					 wmi.wmi_event_work);
 	struct sk_buff *skb;
 
 	for (;;) {
-		skb = skb_dequeue(&wmi->wmi_event_list);
+		skb = skb_dequeue(&ar->wmi.wmi_event_list);
 		if (!skb)
 			break;
 
-		ath10k_wmi_event_process(wmi, skb);
+		ath10k_wmi_event_process(ar, skb);
 	}
 }
 
 static void ath10k_wmi_process_rx(void *ptr, struct sk_buff *skb)
 {
-	struct wmi_struct *wmi = ptr;
+	struct ath10k *ar = ptr;
 	struct wmi_cmd_hdr *cmd_hdr = (struct wmi_cmd_hdr *)skb->data;
 	enum wmi_event_id event_id = __le16_to_cpu(cmd_hdr->cmd_id);
 
@@ -1083,58 +1063,47 @@ static void ath10k_wmi_process_rx(void *ptr, struct sk_buff *skb)
 	 * thus can't be defered to a worker thread */
 	switch (event_id) {
 	case WMI_HOST_SWBA_EVENTID:
-	case WMI_MGMT_RX_EVENTID:
-		ath10k_wmi_event_process(wmi, skb);
+		ath10k_wmi_event_process(ar, skb);
 		return;
 	default:
 		break;
 	}
 
-	skb_queue_tail(&wmi->wmi_event_list, skb);
-	queue_work(wmi->ar->workqueue, &wmi->wmi_event_work);
+	skb_queue_tail(&ar->wmi.wmi_event_list, skb);
+	queue_work(ar->workqueue, &ar->wmi.wmi_event_work);
 }
 
 /* WMI Initialization functions */
 int ath10k_wmi_attach(struct ath10k *ar)
 {
-	struct wmi_struct *wmi;
+	ar->wmi.ar = ar;
+	init_completion(&ar->wmi.service_ready);
+	init_completion(&ar->wmi.unified_ready);
+	init_waitqueue_head(&ar->wmi.wq);
 
-	wmi = kzalloc(sizeof(*wmi), GFP_KERNEL);
-	if (!wmi)
-		return -ENOMEM;
+	skb_queue_head_init(&ar->wmi.wmi_event_list);
+	INIT_WORK(&ar->wmi.wmi_event_work, ath10k_wmi_event_work);
 
-	wmi->ar = ar;
-	init_completion(&wmi->service_ready);
-	init_completion(&wmi->unified_ready);
-	init_waitqueue_head(&wmi->wq);
-
-	skb_queue_head_init(&wmi->wmi_event_list);
-	INIT_WORK(&wmi->wmi_event_work, ath10k_wmi_event_work);
-
-	ar->modules.wmi = wmi;
 	return 0;
 }
 
 void ath10k_wmi_detach(struct ath10k *ar)
 {
-	struct wmi_struct *wmi = ar->modules.wmi;
 	struct sk_buff *skb;
 
 	/* HTC should've drained the packets already */
-	if (WARN_ON(atomic_read(&wmi->pending_tx_count) > 0))
+	if (WARN_ON(atomic_read(&ar->wmi.pending_tx_count) > 0))
 		ath10k_warn("there are still pending packets\n");
 
-	cancel_work_sync(&wmi->wmi_event_work);
+	cancel_work_sync(&ar->wmi.wmi_event_work);
 
 	for (;;) {
-		skb = skb_dequeue(&wmi->wmi_event_list);
+		skb = skb_dequeue(&ar->wmi.wmi_event_list);
 		if (!skb)
 			break;
 
 		dev_kfree_skb_any(skb);
 	}
-
-	kfree(ar->modules.wmi);
 }
 
 int ath10k_wmi_connect_htc_service(struct ath10k *ar)
@@ -1142,13 +1111,12 @@ int ath10k_wmi_connect_htc_service(struct ath10k *ar)
 	int status;
 	struct htc_service_connect_req connect;
 	struct htc_service_connect_resp response;
-	struct wmi_struct *wmi = ar->modules.wmi;
 
 	memset(&connect, 0, sizeof(connect));
 	memset(&response, 0, sizeof(response));
 
 	/* these fields are the same for all service endpoints */
-	connect.ep_callbacks.context = wmi;
+	connect.ep_callbacks.context = ar;
 	connect.ep_callbacks.ep_rx_complete = ath10k_wmi_process_rx;
 
 	/* connect to control service */
@@ -1161,8 +1129,7 @@ int ath10k_wmi_connect_htc_service(struct ath10k *ar)
 		return status;
 	}
 
-	wmi->eid = response.ep_id;
-
+	ar->wmi.eid = response.ep_id;
 	return 0;
 }
 
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [ath9k-devel] [PATCH v2 3/5] ath10k: fix coding style
  2013-04-18 10:01   ` [ath9k-devel] [PATCH v2 " Michal Kazior
  2013-04-18 10:01     ` [ath9k-devel] [PATCH v2 1/5] ath10k: replace debug_mtx with conf_mutex Michal Kazior
  2013-04-18 10:01     ` [ath9k-devel] [PATCH v2 2/5] ath10k: change wmi structure access Michal Kazior
@ 2013-04-18 10:01     ` Michal Kazior
  2013-04-18 10:01     ` [ath9k-devel] [PATCH v2 4/5] ath10k: use ath10k_warn() instead of ath10k_info() Michal Kazior
                       ` (2 subsequent siblings)
  5 siblings, 0 replies; 16+ messages in thread
From: Michal Kazior @ 2013-04-18 10:01 UTC (permalink / raw)
  To: ath9k-devel

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
---
 drivers/net/wireless/ath/ath10k/mac.c  |    8 +++++---
 drivers/net/wireless/ath/ath10k/txrx.c |   16 +++++++++-------
 2 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 94b5334..c6802b1 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -1235,10 +1235,12 @@ static void ath10k_tx_h_update_wep_key(struct sk_buff *skb)
 	ret = ath10k_wmi_vdev_set_param(ar, arvif->vdev_id,
 					WMI_VDEV_PARAM_DEF_KEYID,
 					key->keyidx);
-	if (!ret)
-		arvif->def_wep_key_index = key->keyidx;
-	else
+	if (ret) {
 		ath10k_warn("could not update wep keyidx (%d)\n", ret);
+		return;
+	}
+
+	arvif->def_wep_key_index = key->keyidx;
 }
 
 static void ath10k_tx_h_add_p2p_noa_ie(struct ath10k *ar, struct sk_buff *skb)
diff --git a/drivers/net/wireless/ath/ath10k/txrx.c b/drivers/net/wireless/ath/ath10k/txrx.c
index 205a9b8..6392f11 100644
--- a/drivers/net/wireless/ath/ath10k/txrx.c
+++ b/drivers/net/wireless/ath/ath10k/txrx.c
@@ -31,14 +31,16 @@ static void ath10k_report_offchan_tx(struct ath10k *ar, struct sk_buff *skb)
 	 * offchan_tx_completed for a different skb. Prevent this by using
 	 * offchan_tx_skb. */
 	spin_lock_bh(&ar->data_lock);
-	if (ar->offchan_tx_skb == skb) {
-		complete(&ar->offchan_tx_completed);
-		ar->offchan_tx_skb = NULL; /* just for sanity */
-
-		ath10k_dbg(ATH10K_DBG_HTT, "completed offchannel skb %p\n", skb);
+	if (ar->offchan_tx_skb != skb) {
+		ath10k_warn("completed old offchannel frame\n");
+		goto out;
 	}
-	else
-		ath10k_warn("completed late offchannel skb %p\n", skb);
+
+	complete(&ar->offchan_tx_completed);
+	ar->offchan_tx_skb = NULL; /* just for sanity */
+
+	ath10k_dbg(ATH10K_DBG_HTT, "completed offchannel skb %p\n", skb);
+out:
 	spin_unlock_bh(&ar->data_lock);
 }
 
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [ath9k-devel] [PATCH v2 4/5] ath10k: use ath10k_warn() instead of ath10k_info()
  2013-04-18 10:01   ` [ath9k-devel] [PATCH v2 " Michal Kazior
                       ` (2 preceding siblings ...)
  2013-04-18 10:01     ` [ath9k-devel] [PATCH v2 3/5] ath10k: fix coding style Michal Kazior
@ 2013-04-18 10:01     ` Michal Kazior
  2013-04-18 10:01     ` [ath9k-devel] [PATCH v2 5/5] ath10k: fix function prototype argument name Michal Kazior
  2013-04-22  8:10     ` [ath9k-devel] [PATCH v2 0/5] ath10k: cleanups Kalle Valo
  5 siblings, 0 replies; 16+ messages in thread
From: Michal Kazior @ 2013-04-18 10:01 UTC (permalink / raw)
  To: ath9k-devel

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
---
 drivers/net/wireless/ath/ath10k/mac.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index c6802b1..e5ef1d2 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -1330,7 +1330,7 @@ void ath10k_ath10k_offchan_tx_work(struct work_struct *work)
 		spin_unlock_bh(&ar->data_lock);
 
 		if (peer)
-			ath10k_info("peer %pM on vdev %d already present\n",
+			ath10k_dbg(ATH10K_DBG_MAC, "peer %pM on vdev %d already present\n",
 				    peer_addr, vdev_id);
 
 		if (!peer) {
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [ath9k-devel] [PATCH v2 5/5] ath10k: fix function prototype argument name
  2013-04-18 10:01   ` [ath9k-devel] [PATCH v2 " Michal Kazior
                       ` (3 preceding siblings ...)
  2013-04-18 10:01     ` [ath9k-devel] [PATCH v2 4/5] ath10k: use ath10k_warn() instead of ath10k_info() Michal Kazior
@ 2013-04-18 10:01     ` Michal Kazior
  2013-04-22  8:10     ` [ath9k-devel] [PATCH v2 0/5] ath10k: cleanups Kalle Valo
  5 siblings, 0 replies; 16+ messages in thread
From: Michal Kazior @ 2013-04-18 10:01 UTC (permalink / raw)
  To: ath9k-devel

This argument is used to specify how much data we
want to pack up into a skbuff, no just headroom.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
---
 drivers/net/wireless/ath/ath10k/htc.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/htc.h b/drivers/net/wireless/ath/ath10k/htc.h
index 4ad8ca2..2c231db 100644
--- a/drivers/net/wireless/ath/ath10k/htc.h
+++ b/drivers/net/wireless/ath/ath10k/htc.h
@@ -112,6 +112,6 @@ int ath10k_htc_send(struct htc_target *target, enum htc_endpoint_id eid,
 		    struct sk_buff *packet);
 void ath10k_htc_stop(struct htc_target *target);
 void ath10k_htc_destroy(struct htc_target *target);
-struct sk_buff *ath10k_htc_alloc_skb(int extra_headroom);
+struct sk_buff *ath10k_htc_alloc_skb(int size);
 
 #endif
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [ath9k-devel] [PATCH v2 0/5] ath10k: cleanups
  2013-04-18 10:01   ` [ath9k-devel] [PATCH v2 " Michal Kazior
                       ` (4 preceding siblings ...)
  2013-04-18 10:01     ` [ath9k-devel] [PATCH v2 5/5] ath10k: fix function prototype argument name Michal Kazior
@ 2013-04-22  8:10     ` Kalle Valo
  5 siblings, 0 replies; 16+ messages in thread
From: Kalle Valo @ 2013-04-22  8:10 UTC (permalink / raw)
  To: ath9k-devel

Michal Kazior <michal.kazior@tieto.com> writes:

> Rebased on top of latest master branch
>  (https://github.com/kvalo/ath10k)
>
> Patch #1 updated.
>
>
> Michal Kazior (5):
>   ath10k: replace debug_mtx with conf_mutex
>   ath10k: change wmi structure access
>   ath10k: fix coding style
>   ath10k: use ath10k_warn() instead of ath10k_info()
>   ath10k: fix function prototype argument name

Thanks, all five applied.

-- 
Kalle Valo

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2013-04-22  8:10 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-17  6:04 [ath9k-devel] [PATCH 0/5] ath10k: cleanups Michal Kazior
2013-04-17  6:04 ` [ath9k-devel] [PATCH 1/5] ath10k: replace debug_mtx with conf_mutex Michal Kazior
2013-04-18  9:44   ` Kalle Valo
2013-04-18  9:48     ` Michal Kazior
2013-04-17  6:04 ` [ath9k-devel] [PATCH 2/5] ath10k: change wmi structure access Michal Kazior
2013-04-17  6:04 ` [ath9k-devel] [PATCH 3/5] ath10k: fix coding style Michal Kazior
2013-04-17  6:04 ` [ath9k-devel] [PATCH 4/5] ath10k: use ath10k_warn() instead of ath10k_info() Michal Kazior
2013-04-17  6:04 ` [ath9k-devel] [PATCH 5/5] ath10k: fix function prototype argument name Michal Kazior
2013-04-18  9:50 ` [ath9k-devel] [PATCH 0/5] ath10k: cleanups Kalle Valo
2013-04-18 10:01   ` [ath9k-devel] [PATCH v2 " Michal Kazior
2013-04-18 10:01     ` [ath9k-devel] [PATCH v2 1/5] ath10k: replace debug_mtx with conf_mutex Michal Kazior
2013-04-18 10:01     ` [ath9k-devel] [PATCH v2 2/5] ath10k: change wmi structure access Michal Kazior
2013-04-18 10:01     ` [ath9k-devel] [PATCH v2 3/5] ath10k: fix coding style Michal Kazior
2013-04-18 10:01     ` [ath9k-devel] [PATCH v2 4/5] ath10k: use ath10k_warn() instead of ath10k_info() Michal Kazior
2013-04-18 10:01     ` [ath9k-devel] [PATCH v2 5/5] ath10k: fix function prototype argument name Michal Kazior
2013-04-22  8:10     ` [ath9k-devel] [PATCH v2 0/5] ath10k: cleanups Kalle Valo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.