Commit d22b2db6 authored by Waldemar Rymarkiewicz's avatar Waldemar Rymarkiewicz Committed by Samuel Ortiz

NFC: pn533: Add pn533_alloc_skb for req allocation

Allocate sk_buff for the request.
Signed-off-by: default avatarWaldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent 94c5c156
...@@ -1062,6 +1062,20 @@ static void pn533_send_complete(struct urb *urb) ...@@ -1062,6 +1062,20 @@ static void pn533_send_complete(struct urb *urb)
} }
} }
static struct sk_buff *pn533_alloc_skb(unsigned int size)
{
struct sk_buff *skb;
skb = alloc_skb(PN533_FRAME_HEADER_LEN +
size +
PN533_FRAME_TAIL_LEN, GFP_KERNEL);
if (skb)
skb_reserve(skb, PN533_FRAME_HEADER_LEN);
return skb;
}
struct pn533_target_type_a { struct pn533_target_type_a {
__be16 sens_res; __be16 sens_res;
u8 sel_res; u8 sel_res;
...@@ -2390,15 +2404,11 @@ static void pn533_wq_mi_recv(struct work_struct *work) ...@@ -2390,15 +2404,11 @@ static void pn533_wq_mi_recv(struct work_struct *work)
nfc_dev_dbg(&dev->interface->dev, "%s", __func__); nfc_dev_dbg(&dev->interface->dev, "%s", __func__);
/* This is a zero payload size skb */ /* This is a zero payload size skb */
skb_cmd = alloc_skb(PN533_FRAME_HEADER_LEN + skb_cmd = pn533_alloc_skb(PN533_CMD_DATAEXCH_HEAD_LEN);
PN533_CMD_DATAEXCH_HEAD_LEN +
PN533_FRAME_TAIL_LEN,
GFP_KERNEL);
if (skb_cmd == NULL) if (skb_cmd == NULL)
goto error_cmd; goto error_cmd;
skb_reserve(skb_cmd, skb_reserve(skb_cmd, PN533_CMD_DATAEXCH_HEAD_LEN);
PN533_FRAME_HEADER_LEN + PN533_CMD_DATAEXCH_HEAD_LEN);
rc = pn533_build_tx_frame(dev, skb_cmd, true); rc = pn533_build_tx_frame(dev, skb_cmd, true);
if (rc) if (rc)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment