summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>2013-04-03 08:02:11 +0200
committerSamuel Ortiz <sameo@linux.intel.com>2013-04-11 16:29:06 +0200
commitf87bc9fb62780970ff437e9d556b143cbe9f6528 (patch)
tree1eb22ef41ae3ba2d9ff83d7d74c4852358b67220
parentd5590bba37f3c7d496195648532d5313abb43891 (diff)
NFC: pn533: Move wq_in_error to cmd context
Rename 'wq_in_error' field to more relevant 'status' and move it to cmd context struct. Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
-rw-r--r--drivers/nfc/pn533.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/drivers/nfc/pn533.c b/drivers/nfc/pn533.c
index 326cefbfb14..edee0d55d8f 100644
--- a/drivers/nfc/pn533.c
+++ b/drivers/nfc/pn533.c
@@ -331,7 +331,6 @@ struct pn533 {
struct list_head cmd_queue;
struct pn533_cmd *cmd;
u8 cmd_pending;
- int wq_in_error;
struct mutex cmd_lock; /* protects cmd queue */
void *cmd_complete_mi_arg;
@@ -357,6 +356,7 @@ struct pn533 {
struct pn533_cmd {
struct list_head queue;
u8 code;
+ int status;
struct sk_buff *req;
struct sk_buff *resp;
int resp_len;
@@ -506,8 +506,11 @@ static bool pn533_rx_frame_is_cmd_response(struct pn533 *dev, void *frame)
static void pn533_recv_response(struct urb *urb)
{
struct pn533 *dev = urb->context;
+ struct pn533_cmd *cmd = dev->cmd;
u8 *in_frame;
+ cmd->status = urb->status;
+
switch (urb->status) {
case 0:
break; /* success */
@@ -516,13 +519,11 @@ static void pn533_recv_response(struct urb *urb)
nfc_dev_dbg(&dev->interface->dev,
"The urb has been canceled (status %d)",
urb->status);
- dev->wq_in_error = urb->status;
goto sched_wq;
case -ESHUTDOWN:
default:
nfc_dev_err(&dev->interface->dev,
"Urb failure (status %d)", urb->status);
- dev->wq_in_error = urb->status;
goto sched_wq;
}
@@ -534,19 +535,17 @@ static void pn533_recv_response(struct urb *urb)
if (!dev->ops->rx_is_frame_valid(in_frame)) {
nfc_dev_err(&dev->interface->dev, "Received an invalid frame");
- dev->wq_in_error = -EIO;
+ cmd->status = -EIO;
goto sched_wq;
}
if (!pn533_rx_frame_is_cmd_response(dev, in_frame)) {
nfc_dev_err(&dev->interface->dev,
"It it not the response to the last command");
- dev->wq_in_error = -EIO;
+ cmd->status = -EIO;
goto sched_wq;
}
- dev->wq_in_error = 0;
-
sched_wq:
queue_work(dev->wq, &dev->cmd_complete_work);
}
@@ -561,9 +560,12 @@ static int pn533_submit_urb_for_response(struct pn533 *dev, gfp_t flags)
static void pn533_recv_ack(struct urb *urb)
{
struct pn533 *dev = urb->context;
+ struct pn533_cmd *cmd = dev->cmd;
struct pn533_std_frame *in_frame;
int rc;
+ cmd->status = urb->status;
+
switch (urb->status) {
case 0:
break; /* success */
@@ -572,13 +574,11 @@ static void pn533_recv_ack(struct urb *urb)
nfc_dev_dbg(&dev->interface->dev,
"The urb has been stopped (status %d)",
urb->status);
- dev->wq_in_error = urb->status;
goto sched_wq;
case -ESHUTDOWN:
default:
nfc_dev_err(&dev->interface->dev,
"Urb failure (status %d)", urb->status);
- dev->wq_in_error = urb->status;
goto sched_wq;
}
@@ -586,7 +586,7 @@ static void pn533_recv_ack(struct urb *urb)
if (!pn533_std_rx_frame_is_ack(in_frame)) {
nfc_dev_err(&dev->interface->dev, "Received an invalid ack");
- dev->wq_in_error = -EIO;
+ cmd->status = -EIO;
goto sched_wq;
}
@@ -594,7 +594,7 @@ static void pn533_recv_ack(struct urb *urb)
if (rc) {
nfc_dev_err(&dev->interface->dev,
"usb_submit_urb failed with result %d", rc);
- dev->wq_in_error = rc;
+ cmd->status = rc;
goto sched_wq;
}
@@ -676,7 +676,7 @@ static void pn533_build_cmd_frame(struct pn533 *dev, u8 cmd_code,
static int pn533_send_async_complete(struct pn533 *dev)
{
struct pn533_cmd *cmd = dev->cmd;
- int status = dev->wq_in_error;
+ int status = cmd->status;
struct sk_buff *req = cmd->req;
struct sk_buff *resp = cmd->resp;