diff options
| author | Johannes Berg <johannes.berg@intel.com> | 2017-06-16 08:29:23 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2017-06-16 11:48:40 -0400 |
| commit | d58ff35122847a83ba55394e2ae3a1527b6febf5 (patch) | |
| tree | e1ecf758e86519922c403f1aa88f19ef25a554ad /drivers/net/arcnet | |
| parent | af72868b9070d1b843c829f0d0d0b22c04a20815 (diff) | |
networking: make skb_push & __skb_push 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 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_push, __skb_push, skb_push_rcsum };
@@
- *(fn(SKB, LEN))
+ *(u8 *)fn(SKB, LEN)
@@
expression E, SKB, LEN;
identifier fn = { skb_push, __skb_push, skb_push_rcsum };
type T;
@@
- E = ((T *)(fn(SKB, LEN)))
+ E = fn(SKB, LEN)
@@
expression SKB, LEN;
identifier fn = { skb_push, __skb_push, skb_push_rcsum };
@@
- fn(SKB, LEN)[0]
+ *(u8 *)fn(SKB, LEN)
Note that the last part there converts from push(...)[0] to the
more idiomatic *(u8 *)push(...).
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/arcnet')
| -rw-r--r-- | drivers/net/arcnet/arc-rawmode.c | 2 | ||||
| -rw-r--r-- | drivers/net/arcnet/capmode.c | 2 | ||||
| -rw-r--r-- | drivers/net/arcnet/rfc1051.c | 2 | ||||
| -rw-r--r-- | drivers/net/arcnet/rfc1201.c | 2 |
4 files changed, 4 insertions, 4 deletions
diff --git a/drivers/net/arcnet/arc-rawmode.c b/drivers/net/arcnet/arc-rawmode.c index d78f30186642..8c651fdee039 100644 --- a/drivers/net/arcnet/arc-rawmode.c +++ b/drivers/net/arcnet/arc-rawmode.c | |||
| @@ -85,7 +85,7 @@ static int build_header(struct sk_buff *skb, struct net_device *dev, | |||
| 85 | unsigned short type, uint8_t daddr) | 85 | unsigned short type, uint8_t daddr) |
| 86 | { | 86 | { |
| 87 | int hdr_size = ARC_HDR_SIZE; | 87 | int hdr_size = ARC_HDR_SIZE; |
| 88 | struct archdr *pkt = (struct archdr *)skb_push(skb, hdr_size); | 88 | struct archdr *pkt = skb_push(skb, hdr_size); |
| 89 | 89 | ||
| 90 | /* Set the source hardware address. | 90 | /* Set the source hardware address. |
| 91 | * | 91 | * |
diff --git a/drivers/net/arcnet/capmode.c b/drivers/net/arcnet/capmode.c index 2056878fb087..a80f4eb9262d 100644 --- a/drivers/net/arcnet/capmode.c +++ b/drivers/net/arcnet/capmode.c | |||
| @@ -101,7 +101,7 @@ static int build_header(struct sk_buff *skb, | |||
| 101 | uint8_t daddr) | 101 | uint8_t daddr) |
| 102 | { | 102 | { |
| 103 | int hdr_size = ARC_HDR_SIZE; | 103 | int hdr_size = ARC_HDR_SIZE; |
| 104 | struct archdr *pkt = (struct archdr *)skb_push(skb, hdr_size); | 104 | struct archdr *pkt = skb_push(skb, hdr_size); |
| 105 | 105 | ||
| 106 | arc_printk(D_PROTO, dev, "Preparing header for cap packet %x.\n", | 106 | arc_printk(D_PROTO, dev, "Preparing header for cap packet %x.\n", |
| 107 | *((int *)&pkt->soft.cap.cookie[0])); | 107 | *((int *)&pkt->soft.cap.cookie[0])); |
diff --git a/drivers/net/arcnet/rfc1051.c b/drivers/net/arcnet/rfc1051.c index 4b1a75469cb1..a7752a5b647f 100644 --- a/drivers/net/arcnet/rfc1051.c +++ b/drivers/net/arcnet/rfc1051.c | |||
| @@ -162,7 +162,7 @@ static int build_header(struct sk_buff *skb, struct net_device *dev, | |||
| 162 | unsigned short type, uint8_t daddr) | 162 | unsigned short type, uint8_t daddr) |
| 163 | { | 163 | { |
| 164 | int hdr_size = ARC_HDR_SIZE + RFC1051_HDR_SIZE; | 164 | int hdr_size = ARC_HDR_SIZE + RFC1051_HDR_SIZE; |
| 165 | struct archdr *pkt = (struct archdr *)skb_push(skb, hdr_size); | 165 | struct archdr *pkt = skb_push(skb, hdr_size); |
| 166 | struct arc_rfc1051 *soft = &pkt->soft.rfc1051; | 166 | struct arc_rfc1051 *soft = &pkt->soft.rfc1051; |
| 167 | 167 | ||
| 168 | /* set the protocol ID according to RFC1051 */ | 168 | /* set the protocol ID according to RFC1051 */ |
diff --git a/drivers/net/arcnet/rfc1201.c b/drivers/net/arcnet/rfc1201.c index 566da5ecdc9d..a4c856282674 100644 --- a/drivers/net/arcnet/rfc1201.c +++ b/drivers/net/arcnet/rfc1201.c | |||
| @@ -379,7 +379,7 @@ static int build_header(struct sk_buff *skb, struct net_device *dev, | |||
| 379 | { | 379 | { |
| 380 | struct arcnet_local *lp = netdev_priv(dev); | 380 | struct arcnet_local *lp = netdev_priv(dev); |
| 381 | int hdr_size = ARC_HDR_SIZE + RFC1201_HDR_SIZE; | 381 | int hdr_size = ARC_HDR_SIZE + RFC1201_HDR_SIZE; |
| 382 | struct archdr *pkt = (struct archdr *)skb_push(skb, hdr_size); | 382 | struct archdr *pkt = skb_push(skb, hdr_size); |
| 383 | struct arc_rfc1201 *soft = &pkt->soft.rfc1201; | 383 | struct arc_rfc1201 *soft = &pkt->soft.rfc1201; |
| 384 | 384 | ||
| 385 | /* set the protocol ID according to RFC1201 */ | 385 | /* set the protocol ID according to RFC1201 */ |
