summaryrefslogtreecommitdiffstats
path: root/drivers/nfc/pn533.c
diff options
context:
space:
mode:
authorWaldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>2012-11-26 14:18:37 +0100
committerSamuel Ortiz <sameo@linux.intel.com>2013-01-10 00:44:30 +0100
commitd22b2db69035ae3b8f71a58dfe0bd10ae1ee58d5 (patch)
treee50a9119d488910862a73e44383f46dcbaad443d /drivers/nfc/pn533.c
parent94c5c1561dde894766b1a9135e47b056fdbe13a4 (diff)
downloadblackbird-obmc-linux-d22b2db69035ae3b8f71a58dfe0bd10ae1ee58d5.tar.gz
blackbird-obmc-linux-d22b2db69035ae3b8f71a58dfe0bd10ae1ee58d5.zip
NFC: pn533: Add pn533_alloc_skb for req allocation
Allocate sk_buff for the request. Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/nfc/pn533.c')
-rw-r--r--drivers/nfc/pn533.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/drivers/nfc/pn533.c b/drivers/nfc/pn533.c
index 94c88bb601cd..c34acd0dc5ff 100644
--- a/drivers/nfc/pn533.c
+++ b/drivers/nfc/pn533.c
@@ -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 {
__be16 sens_res;
u8 sel_res;
@@ -2390,15 +2404,11 @@ static void pn533_wq_mi_recv(struct work_struct *work)
nfc_dev_dbg(&dev->interface->dev, "%s", __func__);
/* This is a zero payload size skb */
- skb_cmd = alloc_skb(PN533_FRAME_HEADER_LEN +
- PN533_CMD_DATAEXCH_HEAD_LEN +
- PN533_FRAME_TAIL_LEN,
- GFP_KERNEL);
+ skb_cmd = pn533_alloc_skb(PN533_CMD_DATAEXCH_HEAD_LEN);
if (skb_cmd == NULL)
goto error_cmd;
- skb_reserve(skb_cmd,
- PN533_FRAME_HEADER_LEN + PN533_CMD_DATAEXCH_HEAD_LEN);
+ skb_reserve(skb_cmd, PN533_CMD_DATAEXCH_HEAD_LEN);
rc = pn533_build_tx_frame(dev, skb_cmd, true);
if (rc)
OpenPOWER on IntegriCloud