diff options
author | Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com> | 2012-11-26 08:18:37 -0500 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2013-01-09 18:44:30 -0500 |
commit | d22b2db69035ae3b8f71a58dfe0bd10ae1ee58d5 (patch) | |
tree | e50a9119d488910862a73e44383f46dcbaad443d /drivers/nfc | |
parent | 94c5c1561dde894766b1a9135e47b056fdbe13a4 (diff) |
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')
-rw-r--r-- | drivers/nfc/pn533.c | 22 |
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) | |||
1062 | } | 1062 | } |
1063 | } | 1063 | } |
1064 | 1064 | ||
1065 | static struct sk_buff *pn533_alloc_skb(unsigned int size) | ||
1066 | { | ||
1067 | struct sk_buff *skb; | ||
1068 | |||
1069 | skb = alloc_skb(PN533_FRAME_HEADER_LEN + | ||
1070 | size + | ||
1071 | PN533_FRAME_TAIL_LEN, GFP_KERNEL); | ||
1072 | |||
1073 | if (skb) | ||
1074 | skb_reserve(skb, PN533_FRAME_HEADER_LEN); | ||
1075 | |||
1076 | return skb; | ||
1077 | } | ||
1078 | |||
1065 | struct pn533_target_type_a { | 1079 | struct pn533_target_type_a { |
1066 | __be16 sens_res; | 1080 | __be16 sens_res; |
1067 | u8 sel_res; | 1081 | u8 sel_res; |
@@ -2390,15 +2404,11 @@ static void pn533_wq_mi_recv(struct work_struct *work) | |||
2390 | nfc_dev_dbg(&dev->interface->dev, "%s", __func__); | 2404 | nfc_dev_dbg(&dev->interface->dev, "%s", __func__); |
2391 | 2405 | ||
2392 | /* This is a zero payload size skb */ | 2406 | /* This is a zero payload size skb */ |
2393 | skb_cmd = alloc_skb(PN533_FRAME_HEADER_LEN + | 2407 | skb_cmd = pn533_alloc_skb(PN533_CMD_DATAEXCH_HEAD_LEN); |
2394 | PN533_CMD_DATAEXCH_HEAD_LEN + | ||
2395 | PN533_FRAME_TAIL_LEN, | ||
2396 | GFP_KERNEL); | ||
2397 | if (skb_cmd == NULL) | 2408 | if (skb_cmd == NULL) |
2398 | goto error_cmd; | 2409 | goto error_cmd; |
2399 | 2410 | ||
2400 | skb_reserve(skb_cmd, | 2411 | skb_reserve(skb_cmd, PN533_CMD_DATAEXCH_HEAD_LEN); |
2401 | PN533_FRAME_HEADER_LEN + PN533_CMD_DATAEXCH_HEAD_LEN); | ||
2402 | 2412 | ||
2403 | rc = pn533_build_tx_frame(dev, skb_cmd, true); | 2413 | rc = pn533_build_tx_frame(dev, skb_cmd, true); |
2404 | if (rc) | 2414 | if (rc) |