aboutsummaryrefslogtreecommitdiff
path: root/drivers/nfc
diff options
context:
space:
mode:
authorWaldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>2013-04-03 08:02:05 +0200
committerSamuel Ortiz <sameo@linux.intel.com>2013-04-11 16:29:03 +0200
commit2c206fb7fea4676f08c4b356003ada7ae462bed5 (patch)
treec833b28d696f04f66932dc12b099d37685767b88 /drivers/nfc
parent4231604b3e867bd8cff7ae81a3068615954aa1c8 (diff)
NFC: pn533: Keep cmd context in pn533 struct
Keep cmd context in pn533 struct instead of only cmd code. The context already includes cmd_code. 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.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/nfc/pn533.c b/drivers/nfc/pn533.c
index 2f39209507d..147ad05122b 100644
--- a/drivers/nfc/pn533.c
+++ b/drivers/nfc/pn533.c
@@ -334,7 +334,7 @@ struct pn533 {
void *cmd_complete_arg;
void *cmd_complete_mi_arg;
struct mutex cmd_lock;
- u8 cmd;
+ struct pn533_cmd *cmd;
struct pn533_poll_modulations *poll_mod_active[PN533_POLL_MOD_MAX + 1];
u8 poll_mod_count;
@@ -502,7 +502,8 @@ static struct pn533_frame_ops pn533_std_frame_ops = {
static bool pn533_rx_frame_is_cmd_response(struct pn533 *dev, void *frame)
{
- return (dev->ops->get_cmd_code(frame) == PN533_CMD_RESPONSE(dev->cmd));
+ return (dev->ops->get_cmd_code(frame) ==
+ PN533_CMD_RESPONSE(dev->cmd->cmd_code));
}
@@ -648,7 +649,6 @@ static int __pn533_send_frame_async(struct pn533 *dev,
{
int rc;
- dev->cmd = dev->ops->get_cmd_code(out->data);
dev->cmd_complete = cmd_complete;
dev->cmd_complete_arg = arg;
@@ -707,8 +707,7 @@ static int pn533_send_async_complete(struct pn533 *dev, void *arg, int status)
rc = cmd->complete_cb(dev, cmd->complete_cb_context,
ERR_PTR(status));
dev_kfree_skb(resp);
- kfree(cmd);
- return rc;
+ goto done;
}
skb_put(resp, dev->ops->rx_frame_size(resp->data));
@@ -717,7 +716,9 @@ static int pn533_send_async_complete(struct pn533 *dev, void *arg, int status)
rc = cmd->complete_cb(dev, cmd->complete_cb_context, resp);
+done:
kfree(cmd);
+ dev->cmd = NULL;
return rc;
}
@@ -754,6 +755,7 @@ static int __pn533_send_async(struct pn533 *dev, u8 cmd_code,
goto error;
dev->cmd_pending = 1;
+ dev->cmd = cmd;
goto unlock;
}
@@ -862,6 +864,8 @@ static int pn533_send_cmd_direct_async(struct pn533 *dev, u8 cmd_code,
if (rc < 0) {
dev_kfree_skb(resp);
kfree(cmd);
+ } else {
+ dev->cmd = cmd;
}
return rc;
@@ -893,7 +897,10 @@ static void pn533_wq_cmd(struct work_struct *work)
dev_kfree_skb(cmd->req);
dev_kfree_skb(cmd->resp);
kfree(cmd);
+ return;
}
+
+ dev->cmd = cmd;
}
struct pn533_sync_cmd_response {