Commit 0c33d262 authored by Waldemar Rymarkiewicz's avatar Waldemar Rymarkiewicz Committed by Samuel Ortiz

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: default avatarWaldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent a5798094
...@@ -109,8 +109,6 @@ MODULE_DEVICE_TABLE(usb, pn533_table); ...@@ -109,8 +109,6 @@ MODULE_DEVICE_TABLE(usb, pn533_table);
/* PN533 Commands */ /* PN533 Commands */
#define PN533_FRAME_CMD(f) (f->data[1]) #define PN533_FRAME_CMD(f) (f->data[1])
#define PN533_FRAME_CMD_PARAMS_PTR(f) (&f->data[2])
#define PN533_FRAME_CMD_PARAMS_LEN(f) (f->datalen - 2)
#define PN533_CMD_GET_FIRMWARE_VERSION 0x02 #define PN533_CMD_GET_FIRMWARE_VERSION 0x02
#define PN533_CMD_RF_CONFIGURATION 0x32 #define PN533_CMD_RF_CONFIGURATION 0x32
...@@ -135,8 +133,7 @@ MODULE_DEVICE_TABLE(usb, pn533_table); ...@@ -135,8 +133,7 @@ MODULE_DEVICE_TABLE(usb, pn533_table);
struct pn533; struct pn533;
typedef int (*pn533_cmd_complete_t) (struct pn533 *dev, void *arg, typedef int (*pn533_cmd_complete_t) (struct pn533 *dev, void *arg, int status);
u8 *params, int params_len);
typedef int (*pn533_send_async_complete_t) (struct pn533 *dev, void *arg, typedef int (*pn533_send_async_complete_t) (struct pn533 *dev, void *arg,
struct sk_buff *resp); struct sk_buff *resp);
...@@ -458,19 +455,9 @@ static bool pn533_rx_frame_is_cmd_response(struct pn533_frame *frame, u8 cmd) ...@@ -458,19 +455,9 @@ static bool pn533_rx_frame_is_cmd_response(struct pn533_frame *frame, u8 cmd)
static void pn533_wq_cmd_complete(struct work_struct *work) static void pn533_wq_cmd_complete(struct work_struct *work)
{ {
struct pn533 *dev = container_of(work, struct pn533, cmd_complete_work); struct pn533 *dev = container_of(work, struct pn533, cmd_complete_work);
struct pn533_frame *in_frame;
int rc; int rc;
in_frame = dev->wq_in_frame; rc = dev->cmd_complete(dev, dev->cmd_complete_arg, dev->wq_in_error);
if (dev->wq_in_error)
rc = dev->cmd_complete(dev, dev->cmd_complete_arg, NULL,
dev->wq_in_error);
else
rc = dev->cmd_complete(dev, dev->cmd_complete_arg,
PN533_FRAME_CMD_PARAMS_PTR(in_frame),
PN533_FRAME_CMD_PARAMS_LEN(in_frame));
if (rc != -EINPROGRESS) if (rc != -EINPROGRESS)
queue_work(dev->wq, &dev->cmd_work); queue_work(dev->wq, &dev->cmd_work);
} }
...@@ -664,8 +651,7 @@ struct pn533_send_async_complete_arg { ...@@ -664,8 +651,7 @@ struct pn533_send_async_complete_arg {
struct sk_buff *req; struct sk_buff *req;
}; };
static int pn533_send_async_complete(struct pn533 *dev, void *_arg, u8 *params, static int pn533_send_async_complete(struct pn533 *dev, void *_arg, int status)
int params_len)
{ {
struct pn533_send_async_complete_arg *arg = _arg; struct pn533_send_async_complete_arg *arg = _arg;
...@@ -677,12 +663,12 @@ static int pn533_send_async_complete(struct pn533 *dev, void *_arg, u8 *params, ...@@ -677,12 +663,12 @@ static int pn533_send_async_complete(struct pn533 *dev, void *_arg, u8 *params,
dev_kfree_skb(req); dev_kfree_skb(req);
if (params_len < 0) { if (status < 0) {
arg->complete_cb(dev, arg->complete_cb_context, arg->complete_cb(dev, arg->complete_cb_context,
ERR_PTR(params_len)); ERR_PTR(status));
rc = params_len;
dev_kfree_skb(resp); dev_kfree_skb(resp);
goto out; kfree(arg);
return status;
} }
skb_put(resp, PN533_FRAME_SIZE(frame)); 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,7 +677,6 @@ static int pn533_send_async_complete(struct pn533 *dev, void *_arg, u8 *params,
rc = arg->complete_cb(dev, arg->complete_cb_context, resp); rc = arg->complete_cb(dev, arg->complete_cb_context, resp);
out:
kfree(arg); kfree(arg);
return rc; return rc;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment