mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 19:51:31 -04:00
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 <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
parent
59ae1d127a
commit
4df864c1d9
145 changed files with 486 additions and 547 deletions
|
|
@ -179,8 +179,7 @@ static int ib_nl_ip_send_msg(struct rdma_dev_addr *dev_addr,
|
|||
}
|
||||
|
||||
/* Construct the family header first */
|
||||
header = (struct rdma_ls_ip_resolve_header *)
|
||||
skb_put(skb, NLMSG_ALIGN(sizeof(*header)));
|
||||
header = skb_put(skb, NLMSG_ALIGN(sizeof(*header)));
|
||||
header->ifindex = dev_addr->bound_dev_if;
|
||||
nla_put(skb, attrtype, size, daddr);
|
||||
|
||||
|
|
|
|||
|
|
@ -759,8 +759,7 @@ static void ib_nl_set_path_rec_attrs(struct sk_buff *skb,
|
|||
query->mad_buf->context[1] = NULL;
|
||||
|
||||
/* Construct the family header first */
|
||||
header = (struct rdma_ls_resolve_header *)
|
||||
skb_put(skb, NLMSG_ALIGN(sizeof(*header)));
|
||||
header = skb_put(skb, NLMSG_ALIGN(sizeof(*header)));
|
||||
memcpy(header->device_name, query->port->agent->device->name,
|
||||
LS_DEVICE_NAME_MAX);
|
||||
header->port_num = query->port->port_num;
|
||||
|
|
|
|||
|
|
@ -835,7 +835,7 @@ int cxio_rdma_init(struct cxio_rdev *rdev_p, struct t3_rdma_init_attr *attr)
|
|||
if (!skb)
|
||||
return -ENOMEM;
|
||||
pr_debug("%s rdev_p %p\n", __func__, rdev_p);
|
||||
wqe = (struct t3_rdma_init_wr *) __skb_put(skb, sizeof(*wqe));
|
||||
wqe = __skb_put(skb, sizeof(*wqe));
|
||||
wqe->wrh.op_seop_flags = cpu_to_be32(V_FW_RIWR_OP(T3_WR_INIT));
|
||||
wqe->wrh.gen_tid_len = cpu_to_be32(V_FW_RIWR_TID(attr->tid) |
|
||||
V_FW_RIWR_LEN(sizeof(*wqe) >> 3));
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ static void release_tid(struct t3cdev *tdev, u32 hwtid, struct sk_buff *skb)
|
|||
skb = get_skb(skb, sizeof *req, GFP_KERNEL);
|
||||
if (!skb)
|
||||
return;
|
||||
req = (struct cpl_tid_release *) skb_put(skb, sizeof(*req));
|
||||
req = skb_put(skb, sizeof(*req));
|
||||
req->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD));
|
||||
OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_TID_RELEASE, hwtid));
|
||||
skb->priority = CPL_PRIORITY_SETUP;
|
||||
|
|
@ -190,7 +190,7 @@ int iwch_quiesce_tid(struct iwch_ep *ep)
|
|||
|
||||
if (!skb)
|
||||
return -ENOMEM;
|
||||
req = (struct cpl_set_tcb_field *) skb_put(skb, sizeof(*req));
|
||||
req = skb_put(skb, sizeof(*req));
|
||||
req->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD));
|
||||
req->wr.wr_lo = htonl(V_WR_TID(ep->hwtid));
|
||||
OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_SET_TCB_FIELD, ep->hwtid));
|
||||
|
|
@ -211,7 +211,7 @@ int iwch_resume_tid(struct iwch_ep *ep)
|
|||
|
||||
if (!skb)
|
||||
return -ENOMEM;
|
||||
req = (struct cpl_set_tcb_field *) skb_put(skb, sizeof(*req));
|
||||
req = skb_put(skb, sizeof(*req));
|
||||
req->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD));
|
||||
req->wr.wr_lo = htonl(V_WR_TID(ep->hwtid));
|
||||
OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_SET_TCB_FIELD, ep->hwtid));
|
||||
|
|
@ -398,7 +398,7 @@ static int send_halfclose(struct iwch_ep *ep, gfp_t gfp)
|
|||
}
|
||||
skb->priority = CPL_PRIORITY_DATA;
|
||||
set_arp_failure_handler(skb, arp_failure_discard);
|
||||
req = (struct cpl_close_con_req *) skb_put(skb, sizeof(*req));
|
||||
req = skb_put(skb, sizeof(*req));
|
||||
req->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_OFLD_CLOSE_CON));
|
||||
req->wr.wr_lo = htonl(V_WR_TID(ep->hwtid));
|
||||
OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_CLOSE_CON_REQ, ep->hwtid));
|
||||
|
|
@ -455,7 +455,7 @@ static int send_connect(struct iwch_ep *ep)
|
|||
skb->priority = CPL_PRIORITY_SETUP;
|
||||
set_arp_failure_handler(skb, act_open_req_arp_failure);
|
||||
|
||||
req = (struct cpl_act_open_req *) skb_put(skb, sizeof(*req));
|
||||
req = skb_put(skb, sizeof(*req));
|
||||
req->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD));
|
||||
OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_ACT_OPEN_REQ, ep->atid));
|
||||
req->local_port = ep->com.local_addr.sin_port;
|
||||
|
|
@ -546,7 +546,7 @@ static int send_mpa_reject(struct iwch_ep *ep, const void *pdata, u8 plen)
|
|||
return -ENOMEM;
|
||||
}
|
||||
skb_reserve(skb, sizeof(*req));
|
||||
mpa = (struct mpa_message *) skb_put(skb, mpalen);
|
||||
mpa = skb_put(skb, mpalen);
|
||||
memset(mpa, 0, sizeof(*mpa));
|
||||
memcpy(mpa->key, MPA_KEY_REP, sizeof(mpa->key));
|
||||
mpa->flags = MPA_REJECT;
|
||||
|
|
@ -596,7 +596,7 @@ static int send_mpa_reply(struct iwch_ep *ep, const void *pdata, u8 plen)
|
|||
}
|
||||
skb->priority = CPL_PRIORITY_DATA;
|
||||
skb_reserve(skb, sizeof(*req));
|
||||
mpa = (struct mpa_message *) skb_put(skb, mpalen);
|
||||
mpa = skb_put(skb, mpalen);
|
||||
memset(mpa, 0, sizeof(*mpa));
|
||||
memcpy(mpa->key, MPA_KEY_REP, sizeof(mpa->key));
|
||||
mpa->flags = (ep->mpa_attr.crc_enabled ? MPA_CRC : 0) |
|
||||
|
|
@ -800,7 +800,7 @@ static int update_rx_credits(struct iwch_ep *ep, u32 credits)
|
|||
return 0;
|
||||
}
|
||||
|
||||
req = (struct cpl_rx_data_ack *) skb_put(skb, sizeof(*req));
|
||||
req = skb_put(skb, sizeof(*req));
|
||||
req->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD));
|
||||
OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_RX_DATA_ACK, ep->hwtid));
|
||||
req->credit_dack = htonl(V_RX_CREDITS(credits) | V_RX_FORCE_ACK(1));
|
||||
|
|
@ -1205,7 +1205,7 @@ static int listen_start(struct iwch_listen_ep *ep)
|
|||
return -ENOMEM;
|
||||
}
|
||||
|
||||
req = (struct cpl_pass_open_req *) skb_put(skb, sizeof(*req));
|
||||
req = skb_put(skb, sizeof(*req));
|
||||
req->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD));
|
||||
OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_PASS_OPEN_REQ, ep->stid));
|
||||
req->local_port = ep->com.local_addr.sin_port;
|
||||
|
|
@ -1246,7 +1246,7 @@ static int listen_stop(struct iwch_listen_ep *ep)
|
|||
pr_err("%s - failed to alloc skb\n", __func__);
|
||||
return -ENOMEM;
|
||||
}
|
||||
req = (struct cpl_close_listserv_req *) skb_put(skb, sizeof(*req));
|
||||
req = skb_put(skb, sizeof(*req));
|
||||
req->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD));
|
||||
req->cpu_idx = 0;
|
||||
OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_CLOSE_LISTSRV_REQ, ep->stid));
|
||||
|
|
@ -1614,7 +1614,7 @@ static int peer_abort(struct t3cdev *tdev, struct sk_buff *skb, void *ctx)
|
|||
goto out;
|
||||
}
|
||||
rpl_skb->priority = CPL_PRIORITY_DATA;
|
||||
rpl = (struct cpl_abort_rpl *) skb_put(rpl_skb, sizeof(*rpl));
|
||||
rpl = skb_put(rpl_skb, sizeof(*rpl));
|
||||
rpl->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_OFLD_HOST_ABORT_CON_RPL));
|
||||
rpl->wr.wr_lo = htonl(V_WR_TID(ep->hwtid));
|
||||
OPCODE_TID(rpl) = htonl(MK_OPCODE_TID(CPL_ABORT_RPL, ep->hwtid));
|
||||
|
|
|
|||
|
|
@ -597,7 +597,7 @@ static int send_flowc(struct c4iw_ep *ep)
|
|||
else
|
||||
nparams = 9;
|
||||
|
||||
flowc = (struct fw_flowc_wr *)__skb_put(skb, FLOWC_LEN);
|
||||
flowc = __skb_put(skb, FLOWC_LEN);
|
||||
|
||||
flowc->op_to_nparams = cpu_to_be32(FW_WR_OP_V(FW_FLOWC_WR) |
|
||||
FW_FLOWC_WR_NPARAMS_V(nparams));
|
||||
|
|
@ -787,18 +787,16 @@ static int send_connect(struct c4iw_ep *ep)
|
|||
if (ep->com.remote_addr.ss_family == AF_INET) {
|
||||
switch (CHELSIO_CHIP_VERSION(adapter_type)) {
|
||||
case CHELSIO_T4:
|
||||
req = (struct cpl_act_open_req *)skb_put(skb, wrlen);
|
||||
req = skb_put(skb, wrlen);
|
||||
INIT_TP_WR(req, 0);
|
||||
break;
|
||||
case CHELSIO_T5:
|
||||
t5req = (struct cpl_t5_act_open_req *)skb_put(skb,
|
||||
wrlen);
|
||||
t5req = skb_put(skb, wrlen);
|
||||
INIT_TP_WR(t5req, 0);
|
||||
req = (struct cpl_act_open_req *)t5req;
|
||||
break;
|
||||
case CHELSIO_T6:
|
||||
t6req = (struct cpl_t6_act_open_req *)skb_put(skb,
|
||||
wrlen);
|
||||
t6req = skb_put(skb, wrlen);
|
||||
INIT_TP_WR(t6req, 0);
|
||||
req = (struct cpl_act_open_req *)t6req;
|
||||
t5req = (struct cpl_t5_act_open_req *)t6req;
|
||||
|
|
@ -839,18 +837,16 @@ static int send_connect(struct c4iw_ep *ep)
|
|||
} else {
|
||||
switch (CHELSIO_CHIP_VERSION(adapter_type)) {
|
||||
case CHELSIO_T4:
|
||||
req6 = (struct cpl_act_open_req6 *)skb_put(skb, wrlen);
|
||||
req6 = skb_put(skb, wrlen);
|
||||
INIT_TP_WR(req6, 0);
|
||||
break;
|
||||
case CHELSIO_T5:
|
||||
t5req6 = (struct cpl_t5_act_open_req6 *)skb_put(skb,
|
||||
wrlen);
|
||||
t5req6 = skb_put(skb, wrlen);
|
||||
INIT_TP_WR(t5req6, 0);
|
||||
req6 = (struct cpl_act_open_req6 *)t5req6;
|
||||
break;
|
||||
case CHELSIO_T6:
|
||||
t6req6 = (struct cpl_t6_act_open_req6 *)skb_put(skb,
|
||||
wrlen);
|
||||
t6req6 = skb_put(skb, wrlen);
|
||||
INIT_TP_WR(t6req6, 0);
|
||||
req6 = (struct cpl_act_open_req6 *)t6req6;
|
||||
t5req6 = (struct cpl_t5_act_open_req6 *)t6req6;
|
||||
|
|
@ -1904,7 +1900,7 @@ static int send_fw_act_open_req(struct c4iw_ep *ep, unsigned int atid)
|
|||
int win;
|
||||
|
||||
skb = get_skb(NULL, sizeof(*req), GFP_KERNEL);
|
||||
req = (struct fw_ofld_connection_wr *)__skb_put(skb, sizeof(*req));
|
||||
req = __skb_put(skb, sizeof(*req));
|
||||
memset(req, 0, sizeof(*req));
|
||||
req->op_compl = htonl(WR_OP_V(FW_OFLD_CONNECTION_WR));
|
||||
req->len16_pkd = htonl(FW_WR_LEN16_V(DIV_ROUND_UP(sizeof(*req), 16)));
|
||||
|
|
@ -3807,7 +3803,7 @@ static void send_fw_pass_open_req(struct c4iw_dev *dev, struct sk_buff *skb,
|
|||
req_skb = alloc_skb(sizeof(struct fw_ofld_connection_wr), GFP_KERNEL);
|
||||
if (!req_skb)
|
||||
return;
|
||||
req = (struct fw_ofld_connection_wr *)__skb_put(req_skb, sizeof(*req));
|
||||
req = __skb_put(req_skb, sizeof(*req));
|
||||
memset(req, 0, sizeof(*req));
|
||||
req->op_compl = htonl(WR_OP_V(FW_OFLD_CONNECTION_WR) | FW_WR_COMPL_F);
|
||||
req->len16_pkd = htonl(FW_WR_LEN16_V(DIV_ROUND_UP(sizeof(*req), 16)));
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ static int destroy_cq(struct c4iw_rdev *rdev, struct t4_cq *cq,
|
|||
wr_len = sizeof *res_wr + sizeof *res;
|
||||
set_wr_txq(skb, CPL_PRIORITY_CONTROL, 0);
|
||||
|
||||
res_wr = (struct fw_ri_res_wr *)__skb_put(skb, wr_len);
|
||||
res_wr = __skb_put(skb, wr_len);
|
||||
memset(res_wr, 0, wr_len);
|
||||
res_wr->op_nres = cpu_to_be32(
|
||||
FW_WR_OP_V(FW_RI_RES_WR) |
|
||||
|
|
@ -114,7 +114,7 @@ static int create_cq(struct c4iw_rdev *rdev, struct t4_cq *cq,
|
|||
}
|
||||
set_wr_txq(skb, CPL_PRIORITY_CONTROL, 0);
|
||||
|
||||
res_wr = (struct fw_ri_res_wr *)__skb_put(skb, wr_len);
|
||||
res_wr = __skb_put(skb, wr_len);
|
||||
memset(res_wr, 0, wr_len);
|
||||
res_wr->op_nres = cpu_to_be32(
|
||||
FW_WR_OP_V(FW_RI_RES_WR) |
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ static int _c4iw_write_mem_dma_aligned(struct c4iw_rdev *rdev, u32 addr,
|
|||
}
|
||||
set_wr_txq(skb, CPL_PRIORITY_CONTROL, 0);
|
||||
|
||||
req = (struct ulp_mem_io *)__skb_put(skb, wr_len);
|
||||
req = __skb_put(skb, wr_len);
|
||||
memset(req, 0, wr_len);
|
||||
INIT_ULPTX_WR(req, wr_len, 0, 0);
|
||||
req->wr.wr_hi = cpu_to_be32(FW_WR_OP_V(FW_ULPTX_WR) |
|
||||
|
|
@ -142,7 +142,7 @@ static int _c4iw_write_mem_inline(struct c4iw_rdev *rdev, u32 addr, u32 len,
|
|||
}
|
||||
set_wr_txq(skb, CPL_PRIORITY_CONTROL, 0);
|
||||
|
||||
req = (struct ulp_mem_io *)__skb_put(skb, wr_len);
|
||||
req = __skb_put(skb, wr_len);
|
||||
memset(req, 0, wr_len);
|
||||
INIT_ULPTX_WR(req, wr_len, 0, 0);
|
||||
|
||||
|
|
|
|||
|
|
@ -293,7 +293,7 @@ static int create_qp(struct c4iw_rdev *rdev, struct t4_wq *wq,
|
|||
}
|
||||
set_wr_txq(skb, CPL_PRIORITY_CONTROL, 0);
|
||||
|
||||
res_wr = (struct fw_ri_res_wr *)__skb_put(skb, wr_len);
|
||||
res_wr = __skb_put(skb, wr_len);
|
||||
memset(res_wr, 0, wr_len);
|
||||
res_wr->op_nres = cpu_to_be32(
|
||||
FW_WR_OP_V(FW_RI_RES_WR) |
|
||||
|
|
@ -1228,7 +1228,7 @@ static void post_terminate(struct c4iw_qp *qhp, struct t4_cqe *err_cqe,
|
|||
|
||||
set_wr_txq(skb, CPL_PRIORITY_DATA, qhp->ep->txq_idx);
|
||||
|
||||
wqe = (struct fw_ri_wr *)__skb_put(skb, sizeof(*wqe));
|
||||
wqe = __skb_put(skb, sizeof(*wqe));
|
||||
memset(wqe, 0, sizeof *wqe);
|
||||
wqe->op_compl = cpu_to_be32(FW_WR_OP_V(FW_RI_INIT_WR));
|
||||
wqe->flowid_len16 = cpu_to_be32(
|
||||
|
|
@ -1350,7 +1350,7 @@ static int rdma_fini(struct c4iw_dev *rhp, struct c4iw_qp *qhp,
|
|||
|
||||
set_wr_txq(skb, CPL_PRIORITY_DATA, ep->txq_idx);
|
||||
|
||||
wqe = (struct fw_ri_wr *)__skb_put(skb, sizeof(*wqe));
|
||||
wqe = __skb_put(skb, sizeof(*wqe));
|
||||
memset(wqe, 0, sizeof *wqe);
|
||||
wqe->op_compl = cpu_to_be32(
|
||||
FW_WR_OP_V(FW_RI_INIT_WR) |
|
||||
|
|
@ -1419,7 +1419,7 @@ static int rdma_init(struct c4iw_dev *rhp, struct c4iw_qp *qhp)
|
|||
}
|
||||
set_wr_txq(skb, CPL_PRIORITY_DATA, qhp->ep->txq_idx);
|
||||
|
||||
wqe = (struct fw_ri_wr *)__skb_put(skb, sizeof(*wqe));
|
||||
wqe = __skb_put(skb, sizeof(*wqe));
|
||||
memset(wqe, 0, sizeof *wqe);
|
||||
wqe->op_compl = cpu_to_be32(
|
||||
FW_WR_OP_V(FW_RI_INIT_WR) |
|
||||
|
|
|
|||
Loading…
Reference in a new issue