summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/intersil
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2017-06-16 14:29:21 +0200
committerDavid S. Miller <davem@davemloft.net>2017-06-16 11:48:39 -0400
commit4df864c1d9afb46e2461a9f808d9f11a42d31bad (patch)
tree07e7b3d16b161e0d199c5b8116df277798566e4f /drivers/net/wireless/intersil
parent59ae1d127ac0ae404baf414c434ba2651b793f46 (diff)
downloadlinux-4df864c1d9afb46e2461a9f808d9f11a42d31bad.tar.gz
linux-4df864c1d9afb46e2461a9f808d9f11a42d31bad.tar.bz2
linux-4df864c1d9afb46e2461a9f808d9f11a42d31bad.zip
networking: make skb_put & friends return void pointers
It seems like a historic accident that these return unsigned char *, and in many places that means casts are required, more often than not. Make these functions (skb_put, __skb_put and pskb_put) return void * and remove all the casts across the tree, adding a (u8 *) cast only where the unsigned char pointer was used directly, all done with the following spatch: @@ expression SKB, LEN; typedef u8; identifier fn = { skb_put, __skb_put }; @@ - *(fn(SKB, LEN)) + *(u8 *)fn(SKB, LEN) @@ expression E, SKB, LEN; identifier fn = { skb_put, __skb_put }; type T; @@ - E = ((T *)(fn(SKB, LEN))) + E = fn(SKB, LEN) which actually doesn't cover pskb_put since there are only three users overall. A handful of stragglers were converted manually, notably a macro in drivers/isdn/i4l/isdn_bsdcomp.c and, oddly enough, one of the many instances in net/bluetooth/hci_sock.c. In the former file, I also had to fix one whitespace problem spatch introduced. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/wireless/intersil')
-rw-r--r--drivers/net/wireless/intersil/hostap/hostap_ap.c2
-rw-r--r--drivers/net/wireless/intersil/p54/fwio.c43
2 files changed, 22 insertions, 23 deletions
diff --git a/drivers/net/wireless/intersil/hostap/hostap_ap.c b/drivers/net/wireless/intersil/hostap/hostap_ap.c
index 91757defb9be..eb9cd6fa9c4d 100644
--- a/drivers/net/wireless/intersil/hostap/hostap_ap.c
+++ b/drivers/net/wireless/intersil/hostap/hostap_ap.c
@@ -2361,7 +2361,7 @@ static void schedule_packet_send(local_info_t *local, struct sta_info *sta)
return;
}
- hdr = (struct ieee80211_hdr *) skb_put(skb, 16);
+ hdr = skb_put(skb, 16);
/* Generate a fake pspoll frame to start packet delivery */
hdr->frame_control = cpu_to_le16(
diff --git a/drivers/net/wireless/intersil/p54/fwio.c b/drivers/net/wireless/intersil/p54/fwio.c
index 3076f646c829..52c095c7765f 100644
--- a/drivers/net/wireless/intersil/p54/fwio.c
+++ b/drivers/net/wireless/intersil/p54/fwio.c
@@ -206,7 +206,7 @@ static struct sk_buff *p54_alloc_skb(struct p54_common *priv, u16 hdr_flags,
return NULL;
skb_reserve(skb, priv->tx_hdr_len);
- hdr = (struct p54_hdr *) skb_put(skb, sizeof(*hdr));
+ hdr = skb_put(skb, sizeof(*hdr));
hdr->flags = cpu_to_le16(hdr_flags);
hdr->len = cpu_to_le16(payload_len);
hdr->type = cpu_to_le16(type);
@@ -236,8 +236,7 @@ int p54_download_eeprom(struct p54_common *priv, void *buf,
mutex_lock(&priv->eeprom_mutex);
priv->eeprom = buf;
- eeprom_hdr = (struct p54_eeprom_lm86 *) skb_put(skb,
- eeprom_hdr_size + len);
+ eeprom_hdr = skb_put(skb, eeprom_hdr_size + len);
if (priv->fw_var < 0x509) {
eeprom_hdr->v1.offset = cpu_to_le16(offset);
@@ -273,7 +272,7 @@ int p54_update_beacon_tim(struct p54_common *priv, u16 aid, bool set)
if (unlikely(!skb))
return -ENOMEM;
- tim = (struct p54_tim *) skb_put(skb, sizeof(*tim));
+ tim = skb_put(skb, sizeof(*tim));
tim->count = 1;
tim->entry[0] = cpu_to_le16(set ? (aid | 0x8000) : aid);
p54_tx(priv, skb);
@@ -290,7 +289,7 @@ int p54_sta_unlock(struct p54_common *priv, u8 *addr)
if (unlikely(!skb))
return -ENOMEM;
- sta = (struct p54_sta_unlock *)skb_put(skb, sizeof(*sta));
+ sta = skb_put(skb, sizeof(*sta));
memcpy(sta->addr, addr, ETH_ALEN);
p54_tx(priv, skb);
return 0;
@@ -310,7 +309,7 @@ int p54_tx_cancel(struct p54_common *priv, __le32 req_id)
if (unlikely(!skb))
return -ENOMEM;
- cancel = (struct p54_txcancel *)skb_put(skb, sizeof(*cancel));
+ cancel = skb_put(skb, sizeof(*cancel));
cancel->req_id = req_id;
p54_tx(priv, skb);
return 0;
@@ -327,7 +326,7 @@ int p54_setup_mac(struct p54_common *priv)
if (!skb)
return -ENOMEM;
- setup = (struct p54_setup_mac *) skb_put(skb, sizeof(*setup));
+ setup = skb_put(skb, sizeof(*setup));
if (!(priv->hw->conf.flags & IEEE80211_CONF_IDLE)) {
switch (priv->mode) {
case NL80211_IFTYPE_STATION:
@@ -413,18 +412,18 @@ int p54_scan(struct p54_common *priv, u16 mode, u16 dwell)
if (!skb)
return -ENOMEM;
- head = (struct p54_scan_head *) skb_put(skb, sizeof(*head));
+ head = skb_put(skb, sizeof(*head));
memset(head->scan_params, 0, sizeof(head->scan_params));
head->mode = cpu_to_le16(mode);
head->dwell = cpu_to_le16(dwell);
head->freq = freq;
if (priv->rxhw == PDR_SYNTH_FRONTEND_LONGBOW) {
- __le16 *pa_power_points = (__le16 *) skb_put(skb, 2);
+ __le16 *pa_power_points = skb_put(skb, 2);
*pa_power_points = cpu_to_le16(0x0c);
}
- iq_autocal = (void *) skb_put(skb, sizeof(*iq_autocal));
+ iq_autocal = skb_put(skb, sizeof(*iq_autocal));
for (i = 0; i < priv->iq_autocal_len; i++) {
if (priv->iq_autocal[i].freq != freq)
continue;
@@ -437,9 +436,9 @@ int p54_scan(struct p54_common *priv, u16 mode, u16 dwell)
goto err;
if (priv->rxhw == PDR_SYNTH_FRONTEND_LONGBOW)
- body = (void *) skb_put(skb, sizeof(body->longbow));
+ body = skb_put(skb, sizeof(body->longbow));
else
- body = (void *) skb_put(skb, sizeof(body->normal));
+ body = skb_put(skb, sizeof(body->normal));
for (i = 0; i < priv->output_limit->entries; i++) {
__le16 *entry_freq = (void *) (priv->output_limit->data +
@@ -500,25 +499,25 @@ int p54_scan(struct p54_common *priv, u16 mode, u16 dwell)
goto err;
if ((priv->fw_var >= 0x500) && (priv->fw_var < 0x509)) {
- rate = (void *) skb_put(skb, sizeof(*rate));
+ rate = skb_put(skb, sizeof(*rate));
rate->basic_rate_mask = cpu_to_le32(priv->basic_rate_mask);
for (i = 0; i < sizeof(rate->rts_rates); i++)
rate->rts_rates[i] = i;
}
- rssi = (struct pda_rssi_cal_entry *) skb_put(skb, sizeof(*rssi));
+ rssi = skb_put(skb, sizeof(*rssi));
rssi_data = p54_rssi_find(priv, le16_to_cpu(freq));
rssi->mul = cpu_to_le16(rssi_data->mul);
rssi->add = cpu_to_le16(rssi_data->add);
if (priv->rxhw == PDR_SYNTH_FRONTEND_LONGBOW) {
/* Longbow frontend needs ever more */
- rssi = (void *) skb_put(skb, sizeof(*rssi));
+ rssi = skb_put(skb, sizeof(*rssi));
rssi->mul = cpu_to_le16(rssi_data->longbow_unkn);
rssi->add = cpu_to_le16(rssi_data->longbow_unk2);
}
if (priv->fw_var >= 0x509) {
- rate = (void *) skb_put(skb, sizeof(*rate));
+ rate = skb_put(skb, sizeof(*rate));
rate->basic_rate_mask = cpu_to_le32(priv->basic_rate_mask);
for (i = 0; i < sizeof(rate->rts_rates); i++)
rate->rts_rates[i] = i;
@@ -550,7 +549,7 @@ int p54_set_leds(struct p54_common *priv)
if (unlikely(!skb))
return -ENOMEM;
- led = (struct p54_led *) skb_put(skb, sizeof(*led));
+ led = skb_put(skb, sizeof(*led));
led->flags = cpu_to_le16(0x0003);
led->mask[0] = led->mask[1] = cpu_to_le16(priv->softled_state);
led->delay[0] = cpu_to_le16(1);
@@ -570,7 +569,7 @@ int p54_set_edcf(struct p54_common *priv)
if (unlikely(!skb))
return -ENOMEM;
- edcf = (struct p54_edcf *)skb_put(skb, sizeof(*edcf));
+ edcf = skb_put(skb, sizeof(*edcf));
if (priv->use_short_slot) {
edcf->slottime = 9;
edcf->sifs = 0x10;
@@ -615,7 +614,7 @@ int p54_set_ps(struct p54_common *priv)
if (!skb)
return -ENOMEM;
- psm = (struct p54_psm *)skb_put(skb, sizeof(*psm));
+ psm = skb_put(skb, sizeof(*psm));
psm->mode = cpu_to_le16(mode);
psm->aid = cpu_to_le16(priv->aid);
for (i = 0; i < ARRAY_SIZE(psm->intervals); i++) {
@@ -644,7 +643,7 @@ int p54_init_xbow_synth(struct p54_common *priv)
if (unlikely(!skb))
return -ENOMEM;
- xbow = (struct p54_xbow_synth *)skb_put(skb, sizeof(*xbow));
+ xbow = skb_put(skb, sizeof(*xbow));
xbow->magic1 = cpu_to_le16(0x1);
xbow->magic2 = cpu_to_le16(0x2);
xbow->freq = cpu_to_le16(5390);
@@ -664,7 +663,7 @@ int p54_upload_key(struct p54_common *priv, u8 algo, int slot, u8 idx, u8 len,
if (unlikely(!skb))
return -ENOMEM;
- rxkey = (struct p54_keycache *)skb_put(skb, sizeof(*rxkey));
+ rxkey = skb_put(skb, sizeof(*rxkey));
rxkey->entry = slot;
rxkey->key_id = idx;
rxkey->key_type = algo;
@@ -744,7 +743,7 @@ int p54_set_groupfilter(struct p54_common *priv)
if (!skb)
return -ENOMEM;
- grp = (struct p54_group_address_table *)skb_put(skb, sizeof(*grp));
+ grp = skb_put(skb, sizeof(*grp));
on = !(priv->filter_flags & FIF_ALLMULTI) &&
(priv->mc_maclist_num > 0 &&