diff options
author | Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com> | 2012-11-26 08:18:35 -0500 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2013-01-09 18:44:28 -0500 |
commit | 15461aeb53ae2d3bbde6b374de913e3df81d1ad0 (patch) | |
tree | c2f4beba3698359ec9f095e3660fb58fa8b55ca2 /drivers/nfc | |
parent | aada17ac70e33b127c8f8dd425fc735cc0d30e25 (diff) |
NFC: pn533: Add a new pn533_send_data_async iface
This iface is intended to be used with DEP transfers. It differs
from pn533_send_cmd_async() in the way the response skb is allocated.
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 | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/drivers/nfc/pn533.c b/drivers/nfc/pn533.c index 89f747479a4f..0e9bf9dfbbb5 100644 --- a/drivers/nfc/pn533.c +++ b/drivers/nfc/pn533.c | |||
@@ -86,6 +86,12 @@ MODULE_DEVICE_TABLE(usb, pn533_table); | |||
86 | + 2) /* data[0] TFI, data[1] CC */ | 86 | + 2) /* data[0] TFI, data[1] CC */ |
87 | #define PN533_FRAME_TAIL_LEN 2 /* data[len] DCS, data[len + 1] postamble*/ | 87 | #define PN533_FRAME_TAIL_LEN 2 /* data[len] DCS, data[len + 1] postamble*/ |
88 | 88 | ||
89 | /* | ||
90 | * Max extended frame payload len, excluding TFI and CC | ||
91 | * which are already in PN533_FRAME_HEADER_LEN. | ||
92 | */ | ||
93 | #define PN533_FRAME_MAX_PAYLOAD_LEN 263 | ||
94 | |||
89 | #define PN533_FRAME_SIZE(f) (sizeof(struct pn533_frame) + f->datalen + \ | 95 | #define PN533_FRAME_SIZE(f) (sizeof(struct pn533_frame) + f->datalen + \ |
90 | PN533_FRAME_TAIL_LEN) | 96 | PN533_FRAME_TAIL_LEN) |
91 | #define PN533_FRAME_ACK_SIZE (sizeof(struct pn533_frame) + 1) | 97 | #define PN533_FRAME_ACK_SIZE (sizeof(struct pn533_frame) + 1) |
@@ -807,6 +813,31 @@ unlock: | |||
807 | return rc; | 813 | return rc; |
808 | } | 814 | } |
809 | 815 | ||
816 | static int pn533_send_data_async(struct pn533 *dev, u8 cmd_code, | ||
817 | struct sk_buff *req, | ||
818 | pn533_send_async_complete_t complete_cb, | ||
819 | void *complete_cb_context) | ||
820 | { | ||
821 | struct sk_buff *resp; | ||
822 | int rc; | ||
823 | int resp_len = PN533_FRAME_HEADER_LEN + | ||
824 | PN533_FRAME_MAX_PAYLOAD_LEN + | ||
825 | PN533_FRAME_TAIL_LEN; | ||
826 | |||
827 | nfc_dev_dbg(&dev->interface->dev, "%s", __func__); | ||
828 | |||
829 | resp = nfc_alloc_recv_skb(resp_len, GFP_KERNEL); | ||
830 | if (!resp) | ||
831 | return -ENOMEM; | ||
832 | |||
833 | rc = __pn533_send_async(dev, cmd_code, req, resp, resp_len, complete_cb, | ||
834 | complete_cb_context); | ||
835 | if (rc) | ||
836 | dev_kfree_skb(resp); | ||
837 | |||
838 | return rc; | ||
839 | } | ||
840 | |||
810 | static int pn533_send_cmd_async(struct pn533 *dev, u8 cmd_code, | 841 | static int pn533_send_cmd_async(struct pn533 *dev, u8 cmd_code, |
811 | struct sk_buff *req, | 842 | struct sk_buff *req, |
812 | pn533_send_async_complete_t complete_cb, | 843 | pn533_send_async_complete_t complete_cb, |