From: Sujith Manoharan Date: Sun, 28 Apr 2013 21:01:25 +0530 Subject: [ath9k-devel] [PATCH 07/20] ath10k: Remove void pointers in HTC endpoints In-Reply-To: <1367163098-22787-1-git-send-email-sujith@msujith.org> References: <1367163098-22787-1-git-send-email-sujith@msujith.org> Message-ID: <1367163098-22787-7-git-send-email-sujith@msujith.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: ath9k-devel@lists.ath9k.org From: Sujith Manoharan Signed-off-by: Sujith Manoharan --- drivers/net/wireless/ath/ath10k/htc.c | 13 ++++++------- drivers/net/wireless/ath/ath10k/htc.h | 9 ++++----- drivers/net/wireless/ath/ath10k/htt.c | 11 ++++------- drivers/net/wireless/ath/ath10k/htt.h | 4 ++-- drivers/net/wireless/ath/ath10k/htt_rx.c | 4 ++-- drivers/net/wireless/ath/ath10k/htt_tx.c | 4 ++-- drivers/net/wireless/ath/ath10k/wmi.c | 8 ++------ 7 files changed, 22 insertions(+), 31 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/htc.c b/drivers/net/wireless/ath/ath10k/htc.c index 647bd69..b303c35 100644 --- a/drivers/net/wireless/ath/ath10k/htc.c +++ b/drivers/net/wireless/ath/ath10k/htc.c @@ -29,7 +29,7 @@ static inline void ath10k_htc_stop_queue(struct ath10k_htc_ep *ep) return; if (ep->ep_ops.stop_queue) - ep->ep_ops.stop_queue(ep->ep_ops.context); + ep->ep_ops.stop_queue(ep->htc->ar); ath10k_dbg(ATH10K_DBG_HTC, "ep %d stop\n", ep->eid); ep->tx_queue_stopped = true; @@ -41,7 +41,7 @@ static inline void ath10k_htc_wake_queue(struct ath10k_htc_ep *ep) return; if (ep->ep_ops.wake_queue) - ep->ep_ops.wake_queue(ep->ep_ops.context); + ep->ep_ops.wake_queue(ep->htc->ar); ath10k_dbg(ATH10K_DBG_HTC, "ep %d wake\n", ep->eid); ep->tx_queue_stopped = false; @@ -74,7 +74,7 @@ static inline void ath10k_htc_send_complete_check(struct ath10k_htc_ep *ep, ath10k_hif_send_complete_check(ep->htc->ar, ep->ul_pipe_id, force); } -static void ath10k_htc_control_tx_complete(void *context, struct sk_buff *skb) +static void ath10k_htc_control_tx_complete(struct ath10k *ar, struct sk_buff *skb) { kfree_skb(skb); } @@ -121,7 +121,7 @@ static void ath10k_htc_notify_tx_completion(struct ath10k_htc_ep *ep, return; } - ep->ep_ops.ep_tx_complete(ep->ep_ops.context, skb); + ep->ep_ops.ep_tx_complete(ep->htc->ar, skb); } /* assumes tx_lock is held */ @@ -606,7 +606,7 @@ static int ath10k_htc_rx_completion_handler(struct ath10k *ar, ath10k_dbg(ATH10K_DBG_HTC, "htc rx completion ep %d skb %p\n", eid, skb); - ep->ep_ops.ep_rx_complete(ep->ep_ops.context, skb); + ep->ep_ops.ep_rx_complete(ar, skb); /* skb is now owned by the rx completion handler */ skb = NULL; @@ -616,7 +616,7 @@ out: return status; } -static void ath10k_htc_control_rx_complete(void *context, struct sk_buff *skb) +static void ath10k_htc_control_rx_complete(struct ath10k *ar, struct sk_buff *skb) { /* TODO, can't receive HTC control messages yet */ ath10k_dbg(ATH10K_DBG_HTC, "Invalid call to %s\n", __func__); @@ -740,7 +740,6 @@ int ath10k_htc_wait_target(struct ath10k_htc *htc) /* setup our pseudo HTC control endpoint connection */ memset(&conn_req, 0, sizeof(conn_req)); memset(&conn_resp, 0, sizeof(conn_resp)); - conn_req.ep_ops.context = htc; conn_req.ep_ops.ep_tx_complete = ath10k_htc_control_tx_complete; conn_req.ep_ops.ep_rx_complete = ath10k_htc_control_rx_complete; conn_req.max_send_queue_depth = ATH10K_NUM_CONTROL_TX_BUFFERS; diff --git a/drivers/net/wireless/ath/ath10k/htc.h b/drivers/net/wireless/ath/ath10k/htc.h index 3d03019..cf97bde 100644 --- a/drivers/net/wireless/ath/ath10k/htc.h +++ b/drivers/net/wireless/ath/ath10k/htc.h @@ -274,11 +274,10 @@ struct ath10k_htc_ops { }; struct ath10k_htc_ep_ops { - void *context; - void (*ep_tx_complete)(void *context, struct sk_buff *); - void (*ep_rx_complete)(void *context, struct sk_buff *); - void (*stop_queue)(void *context); - void (*wake_queue)(void *context); + void (*ep_tx_complete)(struct ath10k *, struct sk_buff *); + void (*ep_rx_complete)(struct ath10k *, struct sk_buff *); + void (*stop_queue)(struct ath10k *); + void (*wake_queue)(struct ath10k *); }; /* service connection information */ diff --git a/drivers/net/wireless/ath/ath10k/htt.c b/drivers/net/wireless/ath/ath10k/htt.c index c253db8..5ad552d 100644 --- a/drivers/net/wireless/ath/ath10k/htt.c +++ b/drivers/net/wireless/ath/ath10k/htt.c @@ -21,16 +21,14 @@ #include "core.h" #include "debug.h" -static void ath10k_htt_stop_queue(void *context) +static void ath10k_htt_stop_queue(struct ath10k *ar) { - struct ath10k_htt *htt = context; - ieee80211_stop_queues(htt->ar->hw); + ieee80211_stop_queues(ar->hw); } -static void ath10k_htt_wake_queue(void *context) +static void ath10k_htt_wake_queue(struct ath10k *ar) { - struct ath10k_htt *htt = context; - ieee80211_wake_queues(htt->ar->hw); + ieee80211_wake_queues(ar->hw); } static int ath10k_htt_htc_attach(struct ath10k_htt *htt) @@ -42,7 +40,6 @@ static int ath10k_htt_htc_attach(struct ath10k_htt *htt) memset(&conn_req, 0, sizeof(conn_req)); memset(&conn_resp, 0, sizeof(conn_resp)); - conn_req.ep_ops.context = htt; conn_req.ep_ops.ep_tx_complete = ath10k_htt_htc_tx_complete; conn_req.ep_ops.ep_rx_complete = ath10k_htt_t2h_msg_handler; conn_req.ep_ops.stop_queue = ath10k_htt_stop_queue; diff --git a/drivers/net/wireless/ath/ath10k/htt.h b/drivers/net/wireless/ath/ath10k/htt.h index 58f0d03..2853a53 100644 --- a/drivers/net/wireless/ath/ath10k/htt.h +++ b/drivers/net/wireless/ath/ath10k/htt.h @@ -1265,8 +1265,8 @@ void ath10k_htt_tx_attach(struct ath10k_htt *htt); void ath10k_htt_tx_detach(struct ath10k_htt *htt); int ath10k_htt_rx_attach(struct ath10k_htt *htt); void ath10k_htt_rx_detach(struct ath10k_htt *htt); -void ath10k_htt_htc_tx_complete(void *context, struct sk_buff *skb); -void ath10k_htt_t2h_msg_handler(void *context, struct sk_buff *skb); +void ath10k_htt_htc_tx_complete(struct ath10k *ar, struct sk_buff *skb); +void ath10k_htt_t2h_msg_handler(struct ath10k *ar, struct sk_buff *skb); int ath10k_htt_h2t_ver_req_msg(struct ath10k_htt *htt); int ath10k_htt_send_rx_ring_cfg_ll(struct ath10k_htt *htt); diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c index 0b20879..ac4dc4a 100644 --- a/drivers/net/wireless/ath/ath10k/htt_rx.c +++ b/drivers/net/wireless/ath/ath10k/htt_rx.c @@ -981,9 +981,9 @@ end: } } -void ath10k_htt_t2h_msg_handler(void *context, struct sk_buff *skb) +void ath10k_htt_t2h_msg_handler(struct ath10k *ar, struct sk_buff *skb) { - struct ath10k_htt *htt = (struct ath10k_htt *)context; + struct ath10k_htt *htt = ar->htt; struct htt_resp *resp = (struct htt_resp *)skb->data; /* confirm alignment */ diff --git a/drivers/net/wireless/ath/ath10k/htt_tx.c b/drivers/net/wireless/ath/ath10k/htt_tx.c index 62575b7..2e6e0d9 100644 --- a/drivers/net/wireless/ath/ath10k/htt_tx.c +++ b/drivers/net/wireless/ath/ath10k/htt_tx.c @@ -86,10 +86,10 @@ void ath10k_htt_tx_detach(struct ath10k_htt *htt) return; } -void ath10k_htt_htc_tx_complete(void *context, struct sk_buff *skb) +void ath10k_htt_htc_tx_complete(struct ath10k *ar, struct sk_buff *skb) { struct ath10k_skb_cb *skb_cb = ATH10K_SKB_CB(skb); - struct ath10k_htt *htt = (struct ath10k_htt *)context; + struct ath10k_htt *htt = ar->htt; if (skb_cb->htt.is_conf) { dev_kfree_skb_any(skb); diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c index a837b3f..577a63e 100644 --- a/drivers/net/wireless/ath/ath10k/wmi.c +++ b/drivers/net/wireless/ath/ath10k/wmi.c @@ -73,10 +73,8 @@ static struct sk_buff *ath10k_wmi_alloc_skb(u32 len) return skb; } -static void ath10k_wmi_htc_tx_complete(void *context, struct sk_buff *skb) +static void ath10k_wmi_htc_tx_complete(struct ath10k *ar, struct sk_buff *skb) { - struct ath10k *ar = context; - dev_kfree_skb(skb); if (atomic_sub_return(1, &ar->wmi.pending_tx_count) == 0) @@ -1048,9 +1046,8 @@ static void ath10k_wmi_event_work(struct work_struct *work) } } -static void ath10k_wmi_process_rx(void *ptr, struct sk_buff *skb) +static void ath10k_wmi_process_rx(struct ath10k *ar, struct sk_buff *skb) { - struct ath10k *ar = ptr; struct wmi_cmd_hdr *cmd_hdr = (struct wmi_cmd_hdr *)skb->data; enum wmi_event_id event_id; @@ -1109,7 +1106,6 @@ int ath10k_wmi_connect_htc_service(struct ath10k *ar) memset(&conn_resp, 0, sizeof(conn_resp)); /* these fields are the same for all service endpoints */ - conn_req.ep_ops.context = ar; conn_req.ep_ops.ep_tx_complete = ath10k_wmi_htc_tx_complete; conn_req.ep_ops.ep_rx_complete = ath10k_wmi_process_rx; -- 1.8.2.2