diff options
author | Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com> | 2012-12-10 08:42:57 -0500 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2013-01-09 18:51:44 -0500 |
commit | e8f40531113c7e8c6266886803d5bf3a9e5c8d1b (patch) | |
tree | cc414391829bb0662c201f4d8f535080de9f1ba0 /drivers/nfc/pn533.c | |
parent | 5b5a4437ae078cbe35020e74eb0b66ebedc2a2c0 (diff) |
NFC: pn533: Use skb in __pn533_send_cmd_frame_asyn
__pn533_send_cmd_frame_async() should be frame type independent. So, don't
use pn533_frame type params and instead use skb for req and resp pointers.
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.c | 44 |
1 files changed, 18 insertions, 26 deletions
diff --git a/drivers/nfc/pn533.c b/drivers/nfc/pn533.c index 5bc0c7cfea9a..cfbfc1183926 100644 --- a/drivers/nfc/pn533.c +++ b/drivers/nfc/pn533.c | |||
@@ -606,28 +606,27 @@ static int pn533_send_ack(struct pn533 *dev, gfp_t flags) | |||
606 | return rc; | 606 | return rc; |
607 | } | 607 | } |
608 | 608 | ||
609 | static int __pn533_send_cmd_frame_async(struct pn533 *dev, | 609 | static int __pn533_send_frame_async(struct pn533 *dev, |
610 | struct pn533_frame *out_frame, | 610 | struct sk_buff *out, |
611 | struct pn533_frame *in_frame, | 611 | struct sk_buff *in, |
612 | int in_frame_len, | 612 | int in_len, |
613 | pn533_cmd_complete_t cmd_complete, | 613 | pn533_cmd_complete_t cmd_complete, |
614 | void *arg) | 614 | void *arg) |
615 | { | 615 | { |
616 | int rc; | 616 | int rc; |
617 | 617 | ||
618 | dev->cmd = PN533_FRAME_CMD(out_frame); | 618 | dev->cmd = PN533_FRAME_CMD(((struct pn533_frame *)out->data)); |
619 | dev->cmd_complete = cmd_complete; | 619 | dev->cmd_complete = cmd_complete; |
620 | dev->cmd_complete_arg = arg; | 620 | dev->cmd_complete_arg = arg; |
621 | 621 | ||
622 | dev->out_urb->transfer_buffer = out_frame; | 622 | dev->out_urb->transfer_buffer = out->data; |
623 | dev->out_urb->transfer_buffer_length = | 623 | dev->out_urb->transfer_buffer_length = out->len; |
624 | PN533_FRAME_SIZE(out_frame); | ||
625 | 624 | ||
626 | dev->in_urb->transfer_buffer = in_frame; | 625 | dev->in_urb->transfer_buffer = in->data; |
627 | dev->in_urb->transfer_buffer_length = in_frame_len; | 626 | dev->in_urb->transfer_buffer_length = in_len; |
628 | 627 | ||
629 | print_hex_dump(KERN_DEBUG, "PN533 TX: ", DUMP_PREFIX_NONE, 16, 1, | 628 | print_hex_dump(KERN_DEBUG, "PN533 TX: ", DUMP_PREFIX_NONE, 16, 1, |
630 | out_frame, PN533_FRAME_SIZE(out_frame), false); | 629 | out->data, out->len, false); |
631 | 630 | ||
632 | rc = usb_submit_urb(dev->out_urb, GFP_KERNEL); | 631 | rc = usb_submit_urb(dev->out_urb, GFP_KERNEL); |
633 | if (rc) | 632 | if (rc) |
@@ -725,11 +724,8 @@ static int __pn533_send_async(struct pn533 *dev, u8 cmd_code, | |||
725 | mutex_lock(&dev->cmd_lock); | 724 | mutex_lock(&dev->cmd_lock); |
726 | 725 | ||
727 | if (!dev->cmd_pending) { | 726 | if (!dev->cmd_pending) { |
728 | rc = __pn533_send_cmd_frame_async(dev, | 727 | rc = __pn533_send_frame_async(dev, req, resp, resp_len, |
729 | (struct pn533_frame *)req->data, | 728 | pn533_send_async_complete, arg); |
730 | (struct pn533_frame *)resp->data, | ||
731 | resp_len, pn533_send_async_complete, | ||
732 | arg); | ||
733 | if (rc) | 729 | if (rc) |
734 | goto error; | 730 | goto error; |
735 | 731 | ||
@@ -844,10 +840,8 @@ static int pn533_send_cmd_direct_async(struct pn533 *dev, u8 cmd_code, | |||
844 | 840 | ||
845 | pn533_build_cmd_frame(cmd_code, req); | 841 | pn533_build_cmd_frame(cmd_code, req); |
846 | 842 | ||
847 | rc = __pn533_send_cmd_frame_async(dev, (struct pn533_frame *)req->data, | 843 | rc = __pn533_send_frame_async(dev, req, resp, resp_len, |
848 | (struct pn533_frame *)resp->data, | 844 | pn533_send_async_complete, arg); |
849 | resp_len, pn533_send_async_complete, | ||
850 | arg); | ||
851 | if (rc < 0) { | 845 | if (rc < 0) { |
852 | dev_kfree_skb(resp); | 846 | dev_kfree_skb(resp); |
853 | kfree(arg); | 847 | kfree(arg); |
@@ -875,12 +869,10 @@ static void pn533_wq_cmd(struct work_struct *work) | |||
875 | 869 | ||
876 | mutex_unlock(&dev->cmd_lock); | 870 | mutex_unlock(&dev->cmd_lock); |
877 | 871 | ||
878 | __pn533_send_cmd_frame_async(dev, | 872 | __pn533_send_frame_async(dev, cmd->req, cmd->resp, |
879 | (struct pn533_frame *)cmd->req->data, | 873 | PN533_NORMAL_FRAME_MAX_LEN, |
880 | (struct pn533_frame *)cmd->resp->data, | 874 | pn533_send_async_complete, |
881 | PN533_NORMAL_FRAME_MAX_LEN, | 875 | cmd->arg); |
882 | pn533_send_async_complete, | ||
883 | cmd->arg); | ||
884 | 876 | ||
885 | kfree(cmd); | 877 | kfree(cmd); |
886 | } | 878 | } |