Skip to content

Commit

Permalink
NFC: pn533: Cleanup pn533_cmd_complete_t
Browse files Browse the repository at this point in the history
'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>
  • Loading branch information
Waldemar Rymarkiewicz authored and Samuel Ortiz committed Jan 9, 2013
1 parent a579809 commit 0c33d26
Showing 1 changed file with 7 additions and 22 deletions.
29 changes: 7 additions & 22 deletions drivers/nfc/pn533.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,6 @@ MODULE_DEVICE_TABLE(usb, pn533_table);

/* PN533 Commands */
#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_RF_CONFIGURATION 0x32
Expand All @@ -135,8 +133,7 @@ MODULE_DEVICE_TABLE(usb, pn533_table);

struct pn533;

typedef int (*pn533_cmd_complete_t) (struct pn533 *dev, void *arg,
u8 *params, int params_len);
typedef int (*pn533_cmd_complete_t) (struct pn533 *dev, void *arg, int status);

typedef int (*pn533_send_async_complete_t) (struct pn533 *dev, void *arg,
struct sk_buff *resp);
Expand Down Expand Up @@ -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)
{
struct pn533 *dev = container_of(work, struct pn533, cmd_complete_work);
struct pn533_frame *in_frame;
int rc;

in_frame = dev->wq_in_frame;

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));

rc = dev->cmd_complete(dev, dev->cmd_complete_arg, dev->wq_in_error);
if (rc != -EINPROGRESS)
queue_work(dev->wq, &dev->cmd_work);
}
Expand Down Expand Up @@ -664,8 +651,7 @@ struct pn533_send_async_complete_arg {
struct sk_buff *req;
};

static int pn533_send_async_complete(struct pn533 *dev, void *_arg, u8 *params,
int params_len)
static int pn533_send_async_complete(struct pn533 *dev, void *_arg, int status)
{
struct pn533_send_async_complete_arg *arg = _arg;

Expand All @@ -677,12 +663,12 @@ static int pn533_send_async_complete(struct pn533 *dev, void *_arg, u8 *params,

dev_kfree_skb(req);

if (params_len < 0) {
if (status < 0) {
arg->complete_cb(dev, arg->complete_cb_context,
ERR_PTR(params_len));
rc = params_len;
ERR_PTR(status));
dev_kfree_skb(resp);
goto out;
kfree(arg);
return status;
}

skb_put(resp, PN533_FRAME_SIZE(frame));
Expand All @@ -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);

out:
kfree(arg);
return rc;
}
Expand Down

0 comments on commit 0c33d26

Please sign in to comment.