summaryrefslogtreecommitdiffstats
path: root/drivers/isdn
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/isdn
parent59ae1d127ac0ae404baf414c434ba2651b793f46 (diff)
downloadlinux-4df864c1d9afb46e2461a9f808d9f11a42d31bad.tar.bz2
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')
-rw-r--r--drivers/isdn/capi/capi.c4
-rw-r--r--drivers/isdn/gigaset/asyncdata.c26
-rw-r--r--drivers/isdn/gigaset/isocdata.c2
-rw-r--r--drivers/isdn/i4l/isdn_audio.c4
-rw-r--r--drivers/isdn/i4l/isdn_bsdcomp.c8
-rw-r--r--drivers/isdn/i4l/isdn_x25iface.c4
6 files changed, 24 insertions, 24 deletions
diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c
index 77be17590866..96f586d34d2d 100644
--- a/drivers/isdn/capi/capi.c
+++ b/drivers/isdn/capi/capi.c
@@ -1082,7 +1082,7 @@ static int capinc_tty_put_char(struct tty_struct *tty, unsigned char ch)
skb = mp->outskb;
if (skb) {
if (skb_tailroom(skb) > 0) {
- *(skb_put(skb, 1)) = ch;
+ *(u8 *)skb_put(skb, 1) = ch;
goto unlock_out;
}
mp->outskb = NULL;
@@ -1094,7 +1094,7 @@ static int capinc_tty_put_char(struct tty_struct *tty, unsigned char ch)
skb = alloc_skb(CAPI_DATA_B3_REQ_LEN + CAPI_MAX_BLKSIZE, GFP_ATOMIC);
if (skb) {
skb_reserve(skb, CAPI_DATA_B3_REQ_LEN);
- *(skb_put(skb, 1)) = ch;
+ *(u8 *)skb_put(skb, 1) = ch;
mp->outskb = skb;
} else {
printk(KERN_ERR "capinc_put_char: char %u lost\n", ch);
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
diff --git a/drivers/isdn/i4l/isdn_audio.c b/drivers/isdn/i4l/isdn_audio.c
index 78ce42214713..b6bcd1eca128 100644
--- a/drivers/isdn/i4l/isdn_audio.c
+++ b/drivers/isdn/i4l/isdn_audio.c
@@ -462,7 +462,7 @@ isdn_audio_goertzel(int *sample, modem_info *info)
info->line);
return;
}
- result = (int *) skb_put(skb, sizeof(int) * NCOEFF);
+ result = skb_put(skb, sizeof(int) * NCOEFF);
for (k = 0; k < NCOEFF; k++) {
sk = sk1 = sk2 = 0;
for (n = 0; n < DTMF_NPOINTS; n++) {
@@ -672,7 +672,7 @@ isdn_audio_put_dle_code(modem_info *info, u_char code)
info->line);
return;
}
- p = (char *) skb_put(skb, 2);
+ p = skb_put(skb, 2);
p[0] = 0x10;
p[1] = code;
ISDN_AUDIO_SKB_DLECOUNT(skb) = 0;
diff --git a/drivers/isdn/i4l/isdn_bsdcomp.c b/drivers/isdn/i4l/isdn_bsdcomp.c
index 8837ac5a492d..6ade0916da4e 100644
--- a/drivers/isdn/i4l/isdn_bsdcomp.c
+++ b/drivers/isdn/i4l/isdn_bsdcomp.c
@@ -472,7 +472,7 @@ static int bsd_compress(void *state, struct sk_buff *skb_in, struct sk_buff *skb
accm |= ((ent) << bitno); \
do { \
if (skb_out && skb_tailroom(skb_out) > 0) \
- *(skb_put(skb_out, 1)) = (unsigned char)(accm >> 24); \
+ *(u8 *)skb_put(skb_out, 1) = (u8)(accm >> 24); \
accm <<= 8; \
bitno += 8; \
} while (bitno <= 24); \
@@ -602,7 +602,7 @@ static int bsd_compress(void *state, struct sk_buff *skb_in, struct sk_buff *skb
* Do not emit a completely useless byte of ones.
*/
if (bitno < 32 && skb_out && skb_tailroom(skb_out) > 0)
- *(skb_put(skb_out, 1)) = (unsigned char)((accm | (0xff << (bitno - 8))) >> 24);
+ *(u8 *)skb_put(skb_out, 1) = (unsigned char)((accm | (0xff << (bitno - 8))) >> 24);
/*
* Increase code size if we would have without the packet
@@ -698,7 +698,7 @@ static int bsd_decompress(void *state, struct sk_buff *skb_in, struct sk_buff *s
db->bytes_out += ilen;
if (skb_tailroom(skb_out) > 0)
- *(skb_put(skb_out, 1)) = 0;
+ *(u8 *)skb_put(skb_out, 1) = 0;
else
return DECOMP_ERR_NOMEM;
@@ -816,7 +816,7 @@ static int bsd_decompress(void *state, struct sk_buff *skb_in, struct sk_buff *s
#endif
if (extra) /* the KwKwK case again */
- *(skb_put(skb_out, 1)) = finchar;
+ *(u8 *)skb_put(skb_out, 1) = finchar;
/*
* If not first code in a packet, and
diff --git a/drivers/isdn/i4l/isdn_x25iface.c b/drivers/isdn/i4l/isdn_x25iface.c
index ba60076e0b95..e33fa3073f74 100644
--- a/drivers/isdn/i4l/isdn_x25iface.c
+++ b/drivers/isdn/i4l/isdn_x25iface.c
@@ -224,7 +224,7 @@ static int isdn_x25iface_connect_ind(struct concap_proto *cprot)
skb = dev_alloc_skb(1);
if (skb) {
- *(skb_put(skb, 1)) = X25_IFACE_CONNECT;
+ *(u8 *)skb_put(skb, 1) = X25_IFACE_CONNECT;
skb->protocol = x25_type_trans(skb, cprot->net_dev);
netif_rx(skb);
return 0;
@@ -253,7 +253,7 @@ static int isdn_x25iface_disconn_ind(struct concap_proto *cprot)
*state_p = WAN_DISCONNECTED;
skb = dev_alloc_skb(1);
if (skb) {
- *(skb_put(skb, 1)) = X25_IFACE_DISCONNECT;
+ *(u8 *)skb_put(skb, 1) = X25_IFACE_DISCONNECT;
skb->protocol = x25_type_trans(skb, cprot->net_dev);
netif_rx(skb);
return 0;