diff options
author | Johannes Berg <johannes.berg@intel.com> | 2017-06-16 14:29:21 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-06-16 11:48:39 -0400 |
commit | 4df864c1d9afb46e2461a9f808d9f11a42d31bad (patch) | |
tree | 07e7b3d16b161e0d199c5b8116df277798566e4f /drivers/isdn/gigaset | |
parent | 59ae1d127ac0ae404baf414c434ba2651b793f46 (diff) | |
download | blackbird-op-linux-4df864c1d9afb46e2461a9f808d9f11a42d31bad.tar.gz blackbird-op-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/isdn/gigaset')
-rw-r--r-- | drivers/isdn/gigaset/asyncdata.c | 26 | ||||
-rw-r--r-- | drivers/isdn/gigaset/isocdata.c | 2 |
2 files changed, 14 insertions, 14 deletions
diff --git a/drivers/isdn/gigaset/asyncdata.c b/drivers/isdn/gigaset/asyncdata.c index c90dca5abeac..03ac9fbfe318 100644 --- a/drivers/isdn/gigaset/asyncdata.c +++ b/drivers/isdn/gigaset/asyncdata.c @@ -264,7 +264,7 @@ byte_stuff: /* skip remainder of packet */ bcs->rx_skb = skb = NULL; } else { - *__skb_put(skb, 1) = c; + *(u8 *)__skb_put(skb, 1) = c; fcs = crc_ccitt_byte(fcs, c); } } @@ -315,7 +315,7 @@ static unsigned iraw_loop(unsigned numbytes, struct inbuf_t *inbuf) /* regular data byte: append to current skb */ inputstate |= INS_have_data; - *__skb_put(skb, 1) = bitrev8(c); + *(u8 *)__skb_put(skb, 1) = bitrev8(c); } /* pass data up */ @@ -492,33 +492,33 @@ static struct sk_buff *HDLC_Encode(struct sk_buff *skb) hdlc_skb->mac_len = skb->mac_len; /* Add flag sequence in front of everything.. */ - *(skb_put(hdlc_skb, 1)) = PPP_FLAG; + *(u8 *)skb_put(hdlc_skb, 1) = PPP_FLAG; /* Perform byte stuffing while copying data. */ while (skb->len--) { if (muststuff(*skb->data)) { - *(skb_put(hdlc_skb, 1)) = PPP_ESCAPE; - *(skb_put(hdlc_skb, 1)) = (*skb->data++) ^ PPP_TRANS; + *(u8 *)skb_put(hdlc_skb, 1) = PPP_ESCAPE; + *(u8 *)skb_put(hdlc_skb, 1) = (*skb->data++) ^ PPP_TRANS; } else - *(skb_put(hdlc_skb, 1)) = *skb->data++; + *(u8 *)skb_put(hdlc_skb, 1) = *skb->data++; } /* Finally add FCS (byte stuffed) and flag sequence */ c = (fcs & 0x00ff); /* least significant byte first */ if (muststuff(c)) { - *(skb_put(hdlc_skb, 1)) = PPP_ESCAPE; + *(u8 *)skb_put(hdlc_skb, 1) = PPP_ESCAPE; c ^= PPP_TRANS; } - *(skb_put(hdlc_skb, 1)) = c; + *(u8 *)skb_put(hdlc_skb, 1) = c; c = ((fcs >> 8) & 0x00ff); if (muststuff(c)) { - *(skb_put(hdlc_skb, 1)) = PPP_ESCAPE; + *(u8 *)skb_put(hdlc_skb, 1) = PPP_ESCAPE; c ^= PPP_TRANS; } - *(skb_put(hdlc_skb, 1)) = c; + *(u8 *)skb_put(hdlc_skb, 1) = c; - *(skb_put(hdlc_skb, 1)) = PPP_FLAG; + *(u8 *)skb_put(hdlc_skb, 1) = PPP_FLAG; dev_kfree_skb_any(skb); return hdlc_skb; @@ -561,8 +561,8 @@ static struct sk_buff *iraw_encode(struct sk_buff *skb) while (len--) { c = bitrev8(*cp++); if (c == DLE_FLAG) - *(skb_put(iraw_skb, 1)) = c; - *(skb_put(iraw_skb, 1)) = c; + *(u8 *)skb_put(iraw_skb, 1) = c; + *(u8 *)skb_put(iraw_skb, 1) = c; } dev_kfree_skb_any(skb); return iraw_skb; diff --git a/drivers/isdn/gigaset/isocdata.c b/drivers/isdn/gigaset/isocdata.c index bc29f1d52a2f..74e250664ce9 100644 --- a/drivers/isdn/gigaset/isocdata.c +++ b/drivers/isdn/gigaset/isocdata.c @@ -511,7 +511,7 @@ static inline void hdlc_putbyte(unsigned char c, struct bc_state *bcs) bcs->rx_skb = NULL; return; } - *__skb_put(bcs->rx_skb, 1) = c; + *(u8 *)__skb_put(bcs->rx_skb, 1) = c; } /* hdlc_flush |