aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/nfc/pn533.c
diff options
context:
space:
mode:
authorWaldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>2012-12-10 08:42:59 -0500
committerSamuel Ortiz <sameo@linux.intel.com>2013-01-09 18:51:45 -0500
commit0c33d2626d651f3f52d6a1e8b612e2830a4ab71f (patch)
treef950bfcd1558aca5df80702b2fc71d5b39796649 /drivers/nfc/pn533.c
parenta5798094e927847f0d503b756a997175d7ce01ec (diff)
NFC: pn533: Cleanup pn533_cmd_complete_t
'params' arg in pn533_cmd_complete_t definition has been deprecated and currently is not in use (resp skb is pass in arg ptr), so remove it. Also 'params_len' arg is used as a transfer status indicator, so simply reword it appropriately. 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.c29
1 files changed, 7 insertions, 22 deletions
diff --git a/drivers/nfc/pn533.c b/drivers/nfc/pn533.c
index 82867a036ccc..db13cd798149 100644
--- a/drivers/nfc/pn533.c
+++ b/drivers/nfc/pn533.c
@@ -109,8 +109,6 @@ MODULE_DEVICE_TABLE(usb, pn533_table);
109 109
110/* PN533 Commands */ 110/* PN533 Commands */
111#define PN533_FRAME_CMD(f) (f->data[1]) 111#define PN533_FRAME_CMD(f) (f->data[1])
112#define PN533_FRAME_CMD_PARAMS_PTR(f) (&f->data[2])
113#define PN533_FRAME_CMD_PARAMS_LEN(f) (f->datalen - 2)
114 112
115#define PN533_CMD_GET_FIRMWARE_VERSION 0x02 113#define PN533_CMD_GET_FIRMWARE_VERSION 0x02
116#define PN533_CMD_RF_CONFIGURATION 0x32 114#define PN533_CMD_RF_CONFIGURATION 0x32
@@ -135,8 +133,7 @@ MODULE_DEVICE_TABLE(usb, pn533_table);
135 133
136struct pn533; 134struct pn533;
137 135
138typedef int (*pn533_cmd_complete_t) (struct pn533 *dev, void *arg, 136typedef int (*pn533_cmd_complete_t) (struct pn533 *dev, void *arg, int status);
139 u8 *params, int params_len);
140 137
141typedef int (*pn533_send_async_complete_t) (struct pn533 *dev, void *arg, 138typedef int (*pn533_send_async_complete_t) (struct pn533 *dev, void *arg,
142 struct sk_buff *resp); 139 struct sk_buff *resp);
@@ -458,19 +455,9 @@ static bool pn533_rx_frame_is_cmd_response(struct pn533_frame *frame, u8 cmd)
458static void pn533_wq_cmd_complete(struct work_struct *work) 455static void pn533_wq_cmd_complete(struct work_struct *work)
459{ 456{
460 struct pn533 *dev = container_of(work, struct pn533, cmd_complete_work); 457 struct pn533 *dev = container_of(work, struct pn533, cmd_complete_work);
461 struct pn533_frame *in_frame;
462 int rc; 458 int rc;
463 459
464 in_frame = dev->wq_in_frame; 460 rc = dev->cmd_complete(dev, dev->cmd_complete_arg, dev->wq_in_error);
465
466 if (dev->wq_in_error)
467 rc = dev->cmd_complete(dev, dev->cmd_complete_arg, NULL,
468 dev->wq_in_error);
469 else
470 rc = dev->cmd_complete(dev, dev->cmd_complete_arg,
471 PN533_FRAME_CMD_PARAMS_PTR(in_frame),
472 PN533_FRAME_CMD_PARAMS_LEN(in_frame));
473
474 if (rc != -EINPROGRESS) 461 if (rc != -EINPROGRESS)
475 queue_work(dev->wq, &dev->cmd_work); 462 queue_work(dev->wq, &dev->cmd_work);
476} 463}
@@ -664,8 +651,7 @@ struct pn533_send_async_complete_arg {
664 struct sk_buff *req; 651 struct sk_buff *req;
665}; 652};
666 653
667static int pn533_send_async_complete(struct pn533 *dev, void *_arg, u8 *params, 654static int pn533_send_async_complete(struct pn533 *dev, void *_arg, int status)
668 int params_len)
669{ 655{
670 struct pn533_send_async_complete_arg *arg = _arg; 656 struct pn533_send_async_complete_arg *arg = _arg;
671 657
@@ -677,12 +663,12 @@ static int pn533_send_async_complete(struct pn533 *dev, void *_arg, u8 *params,
677 663
678 dev_kfree_skb(req); 664 dev_kfree_skb(req);
679 665
680 if (params_len < 0) { 666 if (status < 0) {
681 arg->complete_cb(dev, arg->complete_cb_context, 667 arg->complete_cb(dev, arg->complete_cb_context,
682 ERR_PTR(params_len)); 668 ERR_PTR(status));
683 rc = params_len;
684 dev_kfree_skb(resp); 669 dev_kfree_skb(resp);
685 goto out; 670 kfree(arg);
671 return status;
686 } 672 }
687 673
688 skb_put(resp, PN533_FRAME_SIZE(frame)); 674 skb_put(resp, PN533_FRAME_SIZE(frame));
@@ -691,7 +677,6 @@ static int pn533_send_async_complete(struct pn533 *dev, void *_arg, u8 *params,
691 677
692 rc = arg->complete_cb(dev, arg->complete_cb_context, resp); 678 rc = arg->complete_cb(dev, arg->complete_cb_context, resp);
693 679
694out:
695 kfree(arg); 680 kfree(arg);
696 return rc; 681 return rc;
697} 682}