mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
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 <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
parent
af72868b90
commit
d58ff35122
126 changed files with 204 additions and 234 deletions
|
|
@ -354,7 +354,7 @@ static inline void make_tx_data_wr(struct cxgbi_sock *csk, struct sk_buff *skb,
|
|||
struct l2t_entry *l2t = csk->l2t;
|
||||
|
||||
skb_reset_transport_header(skb);
|
||||
req = (struct tx_data_wr *)__skb_push(skb, sizeof(*req));
|
||||
req = __skb_push(skb, sizeof(*req));
|
||||
req->wr_hi = htonl(V_WR_OP(FW_WROPCODE_OFLD_TX_DATA) |
|
||||
(req_completion ? F_WR_COMPL : 0));
|
||||
req->wr_lo = htonl(V_WR_TID(csk->tid));
|
||||
|
|
|
|||
|
|
@ -644,7 +644,7 @@ static inline void make_tx_data_wr(struct cxgbi_sock *csk, struct sk_buff *skb,
|
|||
unsigned int wr_ulp_mode = 0, val;
|
||||
bool imm = is_ofld_imm(skb);
|
||||
|
||||
req = (struct fw_ofld_tx_data_wr *)__skb_push(skb, sizeof(*req));
|
||||
req = __skb_push(skb, sizeof(*req));
|
||||
|
||||
if (imm) {
|
||||
req->op_to_immdlen = htonl(FW_WR_OP_V(FW_OFLD_TX_DATA_WR) |
|
||||
|
|
|
|||
|
|
@ -626,7 +626,7 @@ static int fcoe_ctlr_encaps(struct fcoe_ctlr *fip, struct fc_lport *lport,
|
|||
fh = (struct fc_frame_header *)skb->data;
|
||||
op = *(u8 *)(fh + 1);
|
||||
dlen = sizeof(struct fip_encaps) + skb->len; /* len before push */
|
||||
cap = (struct fip_encaps_head *)skb_push(skb, sizeof(*cap));
|
||||
cap = skb_push(skb, sizeof(*cap));
|
||||
memset(cap, 0, sizeof(*cap));
|
||||
|
||||
if (lport->point_to_multipoint) {
|
||||
|
|
|
|||
|
|
@ -1000,8 +1000,7 @@ void fnic_eth_send(struct fcoe_ctlr *fip, struct sk_buff *skb)
|
|||
|
||||
if (!fnic->vlan_hw_insert) {
|
||||
eth_hdr = (struct ethhdr *)skb_mac_header(skb);
|
||||
vlan_hdr = (struct vlan_ethhdr *)skb_push(skb,
|
||||
sizeof(*vlan_hdr) - sizeof(*eth_hdr));
|
||||
vlan_hdr = skb_push(skb, sizeof(*vlan_hdr) - sizeof(*eth_hdr));
|
||||
memcpy(vlan_hdr, eth_hdr, 2 * ETH_ALEN);
|
||||
vlan_hdr->h_vlan_proto = htons(ETH_P_8021Q);
|
||||
vlan_hdr->h_vlan_encapsulated_proto = eth_hdr->h_proto;
|
||||
|
|
@ -1067,7 +1066,7 @@ static int fnic_send_frame(struct fnic *fnic, struct fc_frame *fp)
|
|||
|
||||
if (!fnic->vlan_hw_insert) {
|
||||
eth_hdr_len = sizeof(*vlan_hdr) + sizeof(*fcoe_hdr);
|
||||
vlan_hdr = (struct vlan_ethhdr *)skb_push(skb, eth_hdr_len);
|
||||
vlan_hdr = skb_push(skb, eth_hdr_len);
|
||||
eth_hdr = (struct ethhdr *)vlan_hdr;
|
||||
vlan_hdr->h_vlan_proto = htons(ETH_P_8021Q);
|
||||
vlan_hdr->h_vlan_encapsulated_proto = htons(ETH_P_FCOE);
|
||||
|
|
@ -1075,7 +1074,7 @@ static int fnic_send_frame(struct fnic *fnic, struct fc_frame *fp)
|
|||
fcoe_hdr = (struct fcoe_hdr *)(vlan_hdr + 1);
|
||||
} else {
|
||||
eth_hdr_len = sizeof(*eth_hdr) + sizeof(*fcoe_hdr);
|
||||
eth_hdr = (struct ethhdr *)skb_push(skb, eth_hdr_len);
|
||||
eth_hdr = skb_push(skb, eth_hdr_len);
|
||||
eth_hdr->h_proto = htons(ETH_P_FCOE);
|
||||
fcoe_hdr = (struct fcoe_hdr *)(eth_hdr + 1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -125,8 +125,7 @@ void qedf_fip_send(struct fcoe_ctlr *fip, struct sk_buff *skb)
|
|||
sub = fiph->fip_subcode;
|
||||
|
||||
if (!qedf->vlan_hw_insert) {
|
||||
vlan_hdr = (struct vlan_ethhdr *)skb_push(skb, sizeof(*vlan_hdr)
|
||||
- sizeof(*eth_hdr));
|
||||
vlan_hdr = skb_push(skb, sizeof(*vlan_hdr) - sizeof(*eth_hdr));
|
||||
memcpy(vlan_hdr, eth_hdr, 2 * ETH_ALEN);
|
||||
vlan_hdr->h_vlan_proto = htons(ETH_P_8021Q);
|
||||
vlan_hdr->h_vlan_encapsulated_proto = eth_hdr->h_proto;
|
||||
|
|
|
|||
Loading…
Reference in a new issue