summaryrefslogtreecommitdiffstats
path: root/net/irda
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 17:48:39 +0200
commit4df864c1d9afb46e2461a9f808d9f11a42d31bad (patch)
tree07e7b3d16b161e0d199c5b8116df277798566e4f /net/irda
parentnetworking: introduce and use skb_put_data() (diff)
downloadlinux-4df864c1d9afb46e2461a9f808d9f11a42d31bad.tar.xz
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 'net/irda')
-rw-r--r--net/irda/irlap_frame.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/net/irda/irlap_frame.c b/net/irda/irlap_frame.c
index bf56ac7dba96..82e71e5622c2 100644
--- a/net/irda/irlap_frame.c
+++ b/net/irda/irlap_frame.c
@@ -133,7 +133,7 @@ void irlap_send_snrm_frame(struct irlap_cb *self, struct qos_info *qos)
if (!tx_skb)
return;
- frame = (struct snrm_frame *) skb_put(tx_skb, 2);
+ frame = skb_put(tx_skb, 2);
/* Insert connection address field */
if (qos)
@@ -228,7 +228,7 @@ void irlap_send_ua_response_frame(struct irlap_cb *self, struct qos_info *qos)
if (!tx_skb)
return;
- frame = (struct ua_frame *) skb_put(tx_skb, 10);
+ frame = skb_put(tx_skb, 10);
/* Build UA response */
frame->caddr = self->caddr;
@@ -268,7 +268,7 @@ void irlap_send_dm_frame( struct irlap_cb *self)
if (!tx_skb)
return;
- frame = (struct dm_frame *)skb_put(tx_skb, 2);
+ frame = skb_put(tx_skb, 2);
if (self->state == LAP_NDM)
frame->caddr = CBROADCAST;
@@ -298,7 +298,7 @@ void irlap_send_disc_frame(struct irlap_cb *self)
if (!tx_skb)
return;
- frame = (struct disc_frame *)skb_put(tx_skb, 2);
+ frame = skb_put(tx_skb, 2);
frame->caddr = self->caddr | CMD_FRAME;
frame->control = DISC_CMD | PF_BIT;
@@ -587,7 +587,7 @@ void irlap_send_rr_frame(struct irlap_cb *self, int command)
if (!tx_skb)
return;
- frame = (struct rr_frame *)skb_put(tx_skb, 2);
+ frame = skb_put(tx_skb, 2);
frame->caddr = self->caddr;
frame->caddr |= (command) ? CMD_FRAME : 0;
@@ -612,7 +612,7 @@ void irlap_send_rd_frame(struct irlap_cb *self)
if (!tx_skb)
return;
- frame = (struct rd_frame *)skb_put(tx_skb, 2);
+ frame = skb_put(tx_skb, 2);
frame->caddr = self->caddr;
frame->control = RD_RSP | PF_BIT;
@@ -1202,14 +1202,13 @@ void irlap_send_test_frame(struct irlap_cb *self, __u8 caddr, __u32 daddr,
/* Broadcast frames must include saddr and daddr fields */
if (caddr == CBROADCAST) {
- frame = (struct test_frame *)
- skb_put(tx_skb, sizeof(struct test_frame));
+ frame = skb_put(tx_skb, sizeof(struct test_frame));
/* Insert the swapped addresses */
frame->saddr = cpu_to_le32(self->saddr);
frame->daddr = cpu_to_le32(daddr);
} else
- frame = (struct test_frame *) skb_put(tx_skb, LAP_ADDR_HEADER + LAP_CTRL_HEADER);
+ frame = skb_put(tx_skb, LAP_ADDR_HEADER + LAP_CTRL_HEADER);
frame->caddr = caddr;
frame->control = TEST_RSP | PF_BIT;