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;
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));
}
{
int rc;
- dev->cmd = dev->ops->get_cmd_code(out->data);
dev->cmd_complete = cmd_complete;
dev->cmd_complete_arg = arg;
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));
rc = cmd->complete_cb(dev, cmd->complete_cb_context, resp);
+done:
kfree(cmd);
+ dev->cmd = NULL;
return rc;
}
goto error;
dev->cmd_pending = 1;
+ dev->cmd = cmd;
goto unlock;
}
if (rc < 0) {
dev_kfree_skb(resp);
kfree(cmd);
+ } else {
+ dev->cmd = cmd;
}
return rc;
dev_kfree_skb(cmd->req);
dev_kfree_skb(cmd->resp);
kfree(cmd);
+ return;
}
+
+ dev->cmd = cmd;
}
struct pn533_sync_cmd_response {