summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2013-11-14 17:27:27 +0400
committerSarah Sharp <sarah.a.sharp@linux.intel.com>2014-03-05 03:38:25 +0400
commit673331c87c492898a9152f3754f3174128e1514a (patch)
tree69166878d07aae21555e6f5188e82780d4ffb8f1
parent3a4462e0e2fe8f715f54147d36b5433a7ff5a85a (diff)
downloadlinux-673331c87c492898a9152f3754f3174128e1514a.tar.xz
uas: Use the right error codes for different kinds of errors
Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
-rw-r--r--drivers/usb/storage/uas.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c
index fceffccc1be1..6ec48c2daf45 100644
--- a/drivers/usb/storage/uas.c
+++ b/drivers/usb/storage/uas.c
@@ -146,7 +146,8 @@ static void uas_do_work(struct work_struct *work)
}
static void uas_mark_cmd_dead(struct uas_dev_info *devinfo,
- struct uas_cmd_info *cmdinfo, const char *caller)
+ struct uas_cmd_info *cmdinfo,
+ int result, const char *caller)
{
struct scsi_pointer *scp = (void *)cmdinfo;
struct scsi_cmnd *cmnd = container_of(scp, struct scsi_cmnd, SCp);
@@ -156,10 +157,12 @@ static void uas_mark_cmd_dead(struct uas_dev_info *devinfo,
WARN_ON_ONCE(cmdinfo->state & COMMAND_ABORTED);
cmdinfo->state |= COMMAND_ABORTED;
cmdinfo->state &= ~IS_IN_WORK_LIST;
+ cmnd->result = result << 16;
list_move_tail(&cmdinfo->list, &devinfo->dead_list);
}
-static void uas_abort_inflight(struct uas_dev_info *devinfo)
+static void uas_abort_inflight(struct uas_dev_info *devinfo, int result,
+ const char *caller)
{
struct uas_cmd_info *cmdinfo;
struct uas_cmd_info *temp;
@@ -167,7 +170,7 @@ static void uas_abort_inflight(struct uas_dev_info *devinfo)
spin_lock_irqsave(&devinfo->lock, flags);
list_for_each_entry_safe(cmdinfo, temp, &devinfo->inflight_list, list)
- uas_mark_cmd_dead(devinfo, cmdinfo, __func__);
+ uas_mark_cmd_dead(devinfo, cmdinfo, result, caller);
spin_unlock_irqrestore(&devinfo->lock, flags);
}
@@ -289,10 +292,8 @@ static int uas_try_complete(struct scsi_cmnd *cmnd, const char *caller)
cmdinfo->state |= COMMAND_COMPLETED;
usb_free_urb(cmdinfo->data_in_urb);
usb_free_urb(cmdinfo->data_out_urb);
- if (cmdinfo->state & COMMAND_ABORTED) {
+ if (cmdinfo->state & COMMAND_ABORTED)
scmd_printk(KERN_INFO, cmnd, "abort completed\n");
- cmnd->result = DID_ABORT << 16;
- }
list_del(&cmdinfo->list);
cmnd->scsi_done(cmnd);
return 0;
@@ -824,7 +825,7 @@ static int uas_eh_abort_handler(struct scsi_cmnd *cmnd)
return FAILED;
}
- uas_mark_cmd_dead(devinfo, cmdinfo, __func__);
+ uas_mark_cmd_dead(devinfo, cmdinfo, DID_ABORT, __func__);
if (cmdinfo->state & COMMAND_INFLIGHT) {
spin_unlock_irqrestore(&devinfo->lock, flags);
ret = uas_eh_task_mgmt(cmnd, "ABORT TASK", TMF_ABORT_TASK);
@@ -860,7 +861,7 @@ static int uas_eh_bus_reset_handler(struct scsi_cmnd *cmnd)
shost_printk(KERN_INFO, sdev->host, "%s start\n", __func__);
devinfo->resetting = 1;
- uas_abort_inflight(devinfo);
+ uas_abort_inflight(devinfo, DID_RESET, __func__);
usb_kill_anchored_urbs(&devinfo->cmd_urbs);
usb_kill_anchored_urbs(&devinfo->sense_urbs);
usb_kill_anchored_urbs(&devinfo->data_urbs);
@@ -1153,7 +1154,7 @@ static void uas_disconnect(struct usb_interface *intf)
devinfo->resetting = 1;
cancel_work_sync(&devinfo->work);
- uas_abort_inflight(devinfo);
+ uas_abort_inflight(devinfo, DID_NO_CONNECT, __func__);
usb_kill_anchored_urbs(&devinfo->cmd_urbs);
usb_kill_anchored_urbs(&devinfo->sense_urbs);
usb_kill_anchored_urbs(&devinfo->data_urbs);