Commit 055da4f9 authored by Tobin C. Harding's avatar Tobin C. Harding Committed by Greg Kroah-Hartman

staging: ks7010: fix complete_handler

complete_handler() takes void * types as parameters. void * parameters are then
cast to struct types. Call sites for this function either pass in NULL
or pointers to the struct types cast to void *. This casting is
unnecessary and can be removed.

Struct tx_device_buffer (which contains a pointer member to the
complete_handler() function) has as member 'ks_wlan_priv *priv' this is
unnecessary, we always have a pointer to this struct there is no need
to store it here.

The complete_handler can be more clearly defined by using struct
pointer types instead of void * types. The code is currently
unnecessarily complex, storing and passing extraneous pointer
parameters.

Remove unnecessary parameters, unnecessary casting to/from 'void
*'. Fix all call sites involving complete_handler().
Signed-off-by: default avatarTobin C. Harding <me@tobin.cc>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 68711ceb
...@@ -237,8 +237,9 @@ int ks_wlan_hw_power_save(struct ks_wlan_private *priv) ...@@ -237,8 +237,9 @@ int ks_wlan_hw_power_save(struct ks_wlan_private *priv)
static int enqueue_txdev(struct ks_wlan_private *priv, unsigned char *p, static int enqueue_txdev(struct ks_wlan_private *priv, unsigned char *p,
unsigned long size, unsigned long size,
void (*complete_handler)(void *arg1, void *arg2), void (*complete_handler)(struct ks_wlan_private *priv,
void *arg1, void *arg2) struct sk_buff *skb),
struct sk_buff *skb)
{ {
struct tx_device_buffer *sp; struct tx_device_buffer *sp;
int ret; int ret;
...@@ -259,8 +260,7 @@ static int enqueue_txdev(struct ks_wlan_private *priv, unsigned char *p, ...@@ -259,8 +260,7 @@ static int enqueue_txdev(struct ks_wlan_private *priv, unsigned char *p,
sp->sendp = p; sp->sendp = p;
sp->size = size; sp->size = size;
sp->complete_handler = complete_handler; sp->complete_handler = complete_handler;
sp->arg1 = arg1; sp->skb = skb;
sp->arg2 = arg2;
inc_txqtail(priv); inc_txqtail(priv);
return 0; return 0;
...@@ -268,7 +268,7 @@ static int enqueue_txdev(struct ks_wlan_private *priv, unsigned char *p, ...@@ -268,7 +268,7 @@ static int enqueue_txdev(struct ks_wlan_private *priv, unsigned char *p,
err_complete: err_complete:
kfree(p); kfree(p);
if (complete_handler) if (complete_handler)
(*complete_handler) (arg1, arg2); (*complete_handler)(priv, skb);
return ret; return ret;
} }
...@@ -327,7 +327,7 @@ static void tx_device_task(struct ks_wlan_private *priv) ...@@ -327,7 +327,7 @@ static void tx_device_task(struct ks_wlan_private *priv)
} }
kfree(sp->sendp); kfree(sp->sendp);
if (sp->complete_handler) /* TX Complete */ if (sp->complete_handler) /* TX Complete */
(*sp->complete_handler) (sp->arg1, sp->arg2); (*sp->complete_handler)(priv, sp->skb);
inc_txqhead(priv); inc_txqhead(priv);
if (cnt_txqbody(priv) > 0) { if (cnt_txqbody(priv) > 0) {
...@@ -337,8 +337,9 @@ static void tx_device_task(struct ks_wlan_private *priv) ...@@ -337,8 +337,9 @@ static void tx_device_task(struct ks_wlan_private *priv)
} }
int ks_wlan_hw_tx(struct ks_wlan_private *priv, void *p, unsigned long size, int ks_wlan_hw_tx(struct ks_wlan_private *priv, void *p, unsigned long size,
void (*complete_handler)(void *arg1, void *arg2), void (*complete_handler)(struct ks_wlan_private *priv,
void *arg1, void *arg2) struct sk_buff *skb),
struct sk_buff *skb)
{ {
int result = 0; int result = 0;
struct hostif_hdr *hdr; struct hostif_hdr *hdr;
...@@ -356,7 +357,7 @@ int ks_wlan_hw_tx(struct ks_wlan_private *priv, void *p, unsigned long size, ...@@ -356,7 +357,7 @@ int ks_wlan_hw_tx(struct ks_wlan_private *priv, void *p, unsigned long size,
DPRINTK(4, "event=%04X\n", hdr->event); DPRINTK(4, "event=%04X\n", hdr->event);
spin_lock(&priv->tx_dev.tx_dev_lock); spin_lock(&priv->tx_dev.tx_dev_lock);
result = enqueue_txdev(priv, p, size, complete_handler, arg1, arg2); result = enqueue_txdev(priv, p, size, complete_handler, skb);
spin_unlock(&priv->tx_dev.tx_dev_lock); spin_unlock(&priv->tx_dev.tx_dev_lock);
if (cnt_txqbody(priv) > 0) { if (cnt_txqbody(priv) > 0) {
...@@ -628,7 +629,7 @@ static void trx_device_exit(struct ks_wlan_private *priv) ...@@ -628,7 +629,7 @@ static void trx_device_exit(struct ks_wlan_private *priv)
sp = &priv->tx_dev.tx_dev_buff[priv->tx_dev.qhead]; sp = &priv->tx_dev.tx_dev_buff[priv->tx_dev.qhead];
kfree(sp->sendp); /* allocated memory free */ kfree(sp->sendp); /* allocated memory free */
if (sp->complete_handler) /* TX Complete */ if (sp->complete_handler) /* TX Complete */
(*sp->complete_handler) (sp->arg1, sp->arg2); (*sp->complete_handler)(priv, sp->skb);
inc_txqhead(priv); inc_txqhead(priv);
} }
......
...@@ -108,9 +108,9 @@ struct ks_sdio_card { ...@@ -108,9 +108,9 @@ struct ks_sdio_card {
struct tx_device_buffer { struct tx_device_buffer {
unsigned char *sendp; /* pointer of send req data */ unsigned char *sendp; /* pointer of send req data */
unsigned int size; unsigned int size;
void (*complete_handler)(void *arg1, void *arg2); void (*complete_handler)(struct ks_wlan_private *priv,
void *arg1; struct sk_buff *skb);
void *arg2; struct sk_buff *skb;
}; };
struct tx_device { struct tx_device {
......
...@@ -1254,10 +1254,8 @@ int hostif_data_request(struct ks_wlan_private *priv, struct sk_buff *skb) ...@@ -1254,10 +1254,8 @@ int hostif_data_request(struct ks_wlan_private *priv, struct sk_buff *skb)
pp->header.event = cpu_to_le16((uint16_t)HIF_DATA_REQ); pp->header.event = cpu_to_le16((uint16_t)HIF_DATA_REQ);
/* tx request */ /* tx request */
result = result = ks_wlan_hw_tx(priv, pp, hif_align_size(sizeof(*pp) + skb_len),
ks_wlan_hw_tx(priv, pp, hif_align_size(sizeof(*pp) + skb_len), send_packet_complete, skb);
(void *)send_packet_complete, (void *)priv,
(void *)skb);
/* MIC FAILURE REPORT check */ /* MIC FAILURE REPORT check */
if (eth_proto == ETHER_PROTOCOL_TYPE_EAP && if (eth_proto == ETHER_PROTOCOL_TYPE_EAP &&
...@@ -1308,7 +1306,7 @@ void hostif_mib_get_request(struct ks_wlan_private *priv, ...@@ -1308,7 +1306,7 @@ void hostif_mib_get_request(struct ks_wlan_private *priv,
/* send to device request */ /* send to device request */
ps_confirm_wait_inc(priv); ps_confirm_wait_inc(priv);
ks_wlan_hw_tx(priv, pp, hif_align_size(sizeof(*pp)), NULL, NULL, NULL); ks_wlan_hw_tx(priv, pp, hif_align_size(sizeof(*pp)), NULL, NULL);
} }
static static
...@@ -1343,8 +1341,7 @@ void hostif_mib_set_request(struct ks_wlan_private *priv, ...@@ -1343,8 +1341,7 @@ void hostif_mib_set_request(struct ks_wlan_private *priv,
/* send to device request */ /* send to device request */
ps_confirm_wait_inc(priv); ps_confirm_wait_inc(priv);
ks_wlan_hw_tx(priv, pp, hif_align_size(sizeof(*pp) + size), NULL, NULL, ks_wlan_hw_tx(priv, pp, hif_align_size(sizeof(*pp) + size), NULL, NULL);
NULL);
} }
static static
...@@ -1367,7 +1364,7 @@ void hostif_start_request(struct ks_wlan_private *priv, unsigned char mode) ...@@ -1367,7 +1364,7 @@ void hostif_start_request(struct ks_wlan_private *priv, unsigned char mode)
/* send to device request */ /* send to device request */
ps_confirm_wait_inc(priv); ps_confirm_wait_inc(priv);
ks_wlan_hw_tx(priv, pp, hif_align_size(sizeof(*pp)), NULL, NULL, NULL); ks_wlan_hw_tx(priv, pp, hif_align_size(sizeof(*pp)), NULL, NULL);
priv->aplist.size = 0; priv->aplist.size = 0;
priv->scan_ind_count = 0; priv->scan_ind_count = 0;
...@@ -1413,7 +1410,7 @@ void hostif_ps_adhoc_set_request(struct ks_wlan_private *priv) ...@@ -1413,7 +1410,7 @@ void hostif_ps_adhoc_set_request(struct ks_wlan_private *priv)
/* send to device request */ /* send to device request */
ps_confirm_wait_inc(priv); ps_confirm_wait_inc(priv);
ks_wlan_hw_tx(priv, pp, hif_align_size(sizeof(*pp)), NULL, NULL, NULL); ks_wlan_hw_tx(priv, pp, hif_align_size(sizeof(*pp)), NULL, NULL);
} }
static static
...@@ -1480,7 +1477,7 @@ void hostif_infrastructure_set_request(struct ks_wlan_private *priv) ...@@ -1480,7 +1477,7 @@ void hostif_infrastructure_set_request(struct ks_wlan_private *priv)
/* send to device request */ /* send to device request */
ps_confirm_wait_inc(priv); ps_confirm_wait_inc(priv);
ks_wlan_hw_tx(priv, pp, hif_align_size(sizeof(*pp)), NULL, NULL, NULL); ks_wlan_hw_tx(priv, pp, hif_align_size(sizeof(*pp)), NULL, NULL);
} }
static void hostif_infrastructure_set2_request(struct ks_wlan_private *priv) static void hostif_infrastructure_set2_request(struct ks_wlan_private *priv)
...@@ -1548,7 +1545,7 @@ static void hostif_infrastructure_set2_request(struct ks_wlan_private *priv) ...@@ -1548,7 +1545,7 @@ static void hostif_infrastructure_set2_request(struct ks_wlan_private *priv)
/* send to device request */ /* send to device request */
ps_confirm_wait_inc(priv); ps_confirm_wait_inc(priv);
ks_wlan_hw_tx(priv, pp, hif_align_size(sizeof(*pp)), NULL, NULL, NULL); ks_wlan_hw_tx(priv, pp, hif_align_size(sizeof(*pp)), NULL, NULL);
} }
static static
...@@ -1593,7 +1590,7 @@ void hostif_adhoc_set_request(struct ks_wlan_private *priv) ...@@ -1593,7 +1590,7 @@ void hostif_adhoc_set_request(struct ks_wlan_private *priv)
/* send to device request */ /* send to device request */
ps_confirm_wait_inc(priv); ps_confirm_wait_inc(priv);
ks_wlan_hw_tx(priv, pp, hif_align_size(sizeof(*pp)), NULL, NULL, NULL); ks_wlan_hw_tx(priv, pp, hif_align_size(sizeof(*pp)), NULL, NULL);
} }
static static
...@@ -1641,7 +1638,7 @@ void hostif_adhoc_set2_request(struct ks_wlan_private *priv) ...@@ -1641,7 +1638,7 @@ void hostif_adhoc_set2_request(struct ks_wlan_private *priv)
/* send to device request */ /* send to device request */
ps_confirm_wait_inc(priv); ps_confirm_wait_inc(priv);
ks_wlan_hw_tx(priv, pp, hif_align_size(sizeof(*pp)), NULL, NULL, NULL); ks_wlan_hw_tx(priv, pp, hif_align_size(sizeof(*pp)), NULL, NULL);
} }
static static
...@@ -1663,7 +1660,7 @@ void hostif_stop_request(struct ks_wlan_private *priv) ...@@ -1663,7 +1660,7 @@ void hostif_stop_request(struct ks_wlan_private *priv)
/* send to device request */ /* send to device request */
ps_confirm_wait_inc(priv); ps_confirm_wait_inc(priv);
ks_wlan_hw_tx(priv, pp, hif_align_size(sizeof(*pp)), NULL, NULL, NULL); ks_wlan_hw_tx(priv, pp, hif_align_size(sizeof(*pp)), NULL, NULL);
} }
static static
...@@ -1692,7 +1689,7 @@ void hostif_phy_information_request(struct ks_wlan_private *priv) ...@@ -1692,7 +1689,7 @@ void hostif_phy_information_request(struct ks_wlan_private *priv)
/* send to device request */ /* send to device request */
ps_confirm_wait_inc(priv); ps_confirm_wait_inc(priv);
ks_wlan_hw_tx(priv, pp, hif_align_size(sizeof(*pp)), NULL, NULL, NULL); ks_wlan_hw_tx(priv, pp, hif_align_size(sizeof(*pp)), NULL, NULL);
} }
static static
...@@ -1719,7 +1716,7 @@ void hostif_power_mngmt_request(struct ks_wlan_private *priv, ...@@ -1719,7 +1716,7 @@ void hostif_power_mngmt_request(struct ks_wlan_private *priv,
/* send to device request */ /* send to device request */
ps_confirm_wait_inc(priv); ps_confirm_wait_inc(priv);
ks_wlan_hw_tx(priv, pp, hif_align_size(sizeof(*pp)), NULL, NULL, NULL); ks_wlan_hw_tx(priv, pp, hif_align_size(sizeof(*pp)), NULL, NULL);
} }
static static
...@@ -1742,7 +1739,7 @@ void hostif_sleep_request(struct ks_wlan_private *priv, unsigned long mode) ...@@ -1742,7 +1739,7 @@ void hostif_sleep_request(struct ks_wlan_private *priv, unsigned long mode)
/* send to device request */ /* send to device request */
ps_confirm_wait_inc(priv); ps_confirm_wait_inc(priv);
ks_wlan_hw_tx(priv, pp, hif_align_size(sizeof(*pp)), NULL, NULL, ks_wlan_hw_tx(priv, pp, hif_align_size(sizeof(*pp)), NULL,
NULL); NULL);
} else if (mode == SLP_ACTIVE) { } else if (mode == SLP_ACTIVE) {
atomic_set(&priv->sleepstatus.wakeup_request, 1); atomic_set(&priv->sleepstatus.wakeup_request, 1);
...@@ -1804,7 +1801,7 @@ void hostif_bss_scan_request(struct ks_wlan_private *priv, ...@@ -1804,7 +1801,7 @@ void hostif_bss_scan_request(struct ks_wlan_private *priv,
/* send to device request */ /* send to device request */
ps_confirm_wait_inc(priv); ps_confirm_wait_inc(priv);
ks_wlan_hw_tx(priv, pp, hif_align_size(sizeof(*pp)), NULL, NULL, NULL); ks_wlan_hw_tx(priv, pp, hif_align_size(sizeof(*pp)), NULL, NULL);
priv->aplist.size = 0; priv->aplist.size = 0;
priv->scan_ind_count = 0; priv->scan_ind_count = 0;
...@@ -1832,7 +1829,7 @@ void hostif_mic_failure_request(struct ks_wlan_private *priv, ...@@ -1832,7 +1829,7 @@ void hostif_mic_failure_request(struct ks_wlan_private *priv,
/* send to device request */ /* send to device request */
ps_confirm_wait_inc(priv); ps_confirm_wait_inc(priv);
ks_wlan_hw_tx(priv, pp, hif_align_size(sizeof(*pp)), NULL, NULL, NULL); ks_wlan_hw_tx(priv, pp, hif_align_size(sizeof(*pp)), NULL, NULL);
} }
/* Device I/O Receive indicate */ /* Device I/O Receive indicate */
......
...@@ -656,9 +656,10 @@ void hostif_sme_enqueue(struct ks_wlan_private *priv, uint16_t event); ...@@ -656,9 +656,10 @@ void hostif_sme_enqueue(struct ks_wlan_private *priv, uint16_t event);
int hostif_init(struct ks_wlan_private *priv); int hostif_init(struct ks_wlan_private *priv);
void hostif_exit(struct ks_wlan_private *priv); void hostif_exit(struct ks_wlan_private *priv);
int ks_wlan_hw_tx(struct ks_wlan_private *priv, void *p, unsigned long size, int ks_wlan_hw_tx(struct ks_wlan_private *priv, void *p, unsigned long size,
void (*complete_handler)(void *arg1, void *arg2), void (*complete_handler)(struct ks_wlan_private *priv,
void *arg1, void *arg2); struct sk_buff *skb),
void send_packet_complete(void *arg1, void *arg2); struct sk_buff *skb);
void send_packet_complete(struct ks_wlan_private *priv, struct sk_buff *skb);
void ks_wlan_hw_wakeup_request(struct ks_wlan_private *priv); void ks_wlan_hw_wakeup_request(struct ks_wlan_private *priv);
int ks_wlan_hw_power_save(struct ks_wlan_private *priv); int ks_wlan_hw_power_save(struct ks_wlan_private *priv);
......
...@@ -2908,11 +2908,8 @@ int ks_wlan_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -2908,11 +2908,8 @@ int ks_wlan_start_xmit(struct sk_buff *skb, struct net_device *dev)
return 0; return 0;
} }
void send_packet_complete(void *arg1, void *arg2) void send_packet_complete(struct ks_wlan_private *priv, struct sk_buff *skb)
{ {
struct ks_wlan_private *priv = (struct ks_wlan_private *)arg1;
struct sk_buff *packet = (struct sk_buff *)arg2;
DPRINTK(3, "\n"); DPRINTK(3, "\n");
priv->nstats.tx_packets++; priv->nstats.tx_packets++;
...@@ -2920,10 +2917,9 @@ void send_packet_complete(void *arg1, void *arg2) ...@@ -2920,10 +2917,9 @@ void send_packet_complete(void *arg1, void *arg2)
if (netif_queue_stopped(priv->net_dev)) if (netif_queue_stopped(priv->net_dev))
netif_wake_queue(priv->net_dev); netif_wake_queue(priv->net_dev);
if (packet) { if (skb) {
priv->nstats.tx_bytes += packet->len; priv->nstats.tx_bytes += skb->len;
dev_kfree_skb(packet); dev_kfree_skb(skb);
packet = NULL;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment