aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/storage
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2012-11-30 05:54:42 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-01-11 15:14:17 -0500
commitefefecf33adefcd28edfd3cee282aa9cbc3374ca (patch)
treed94508ab3346f23ad7bf0965aef2f76be8b21f89 /drivers/usb/storage
parentb06e48afd17b29542b04c6a8b4a7f1a7c2e446c2 (diff)
uas: add IS_IN_WORK_LIST flag
Keep track whenever the request is linked into the work list or not. Needed for request abort. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/storage')
-rw-r--r--drivers/usb/storage/uas.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c
index a972e53656f5..05f1f2b8c33b 100644
--- a/drivers/usb/storage/uas.c
+++ b/drivers/usb/storage/uas.c
@@ -67,6 +67,7 @@ enum {
67 COMMAND_COMPLETED = (1 << 11), 67 COMMAND_COMPLETED = (1 << 11),
68 COMMAND_ABORTED = (1 << 12), 68 COMMAND_ABORTED = (1 << 12),
69 UNLINK_DATA_URBS = (1 << 13), 69 UNLINK_DATA_URBS = (1 << 13),
70 IS_IN_WORK_LIST = (1 << 14),
70}; 71};
71 72
72/* Overrides scsi_pointer */ 73/* Overrides scsi_pointer */
@@ -131,6 +132,8 @@ static void uas_do_work(struct work_struct *work)
131 struct uas_dev_info *devinfo = (void *)cmnd->device->hostdata; 132 struct uas_dev_info *devinfo = (void *)cmnd->device->hostdata;
132 spin_lock_irqsave(&devinfo->lock, flags); 133 spin_lock_irqsave(&devinfo->lock, flags);
133 err = uas_submit_urbs(cmnd, cmnd->device->hostdata, GFP_ATOMIC); 134 err = uas_submit_urbs(cmnd, cmnd->device->hostdata, GFP_ATOMIC);
135 if (!err)
136 cmdinfo->state &= ~IS_IN_WORK_LIST;
134 spin_unlock_irqrestore(&devinfo->lock, flags); 137 spin_unlock_irqrestore(&devinfo->lock, flags);
135 if (err) { 138 if (err) {
136 list_del(&cmdinfo->list); 139 list_del(&cmdinfo->list);
@@ -193,7 +196,7 @@ static void uas_log_cmd_state(struct scsi_cmnd *cmnd, const char *caller)
193 struct uas_cmd_info *ci = (void *)&cmnd->SCp; 196 struct uas_cmd_info *ci = (void *)&cmnd->SCp;
194 197
195 scmd_printk(KERN_INFO, cmnd, "%s %p tag %d, inflight:" 198 scmd_printk(KERN_INFO, cmnd, "%s %p tag %d, inflight:"
196 "%s%s%s%s%s%s%s%s%s%s%s%s%s\n", 199 "%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
197 caller, cmnd, cmnd->request->tag, 200 caller, cmnd, cmnd->request->tag,
198 (ci->state & SUBMIT_STATUS_URB) ? " s-st" : "", 201 (ci->state & SUBMIT_STATUS_URB) ? " s-st" : "",
199 (ci->state & ALLOC_DATA_IN_URB) ? " a-in" : "", 202 (ci->state & ALLOC_DATA_IN_URB) ? " a-in" : "",
@@ -207,7 +210,8 @@ static void uas_log_cmd_state(struct scsi_cmnd *cmnd, const char *caller)
207 (ci->state & DATA_OUT_URB_INFLIGHT) ? " OUT" : "", 210 (ci->state & DATA_OUT_URB_INFLIGHT) ? " OUT" : "",
208 (ci->state & COMMAND_COMPLETED) ? " done" : "", 211 (ci->state & COMMAND_COMPLETED) ? " done" : "",
209 (ci->state & COMMAND_ABORTED) ? " abort" : "", 212 (ci->state & COMMAND_ABORTED) ? " abort" : "",
210 (ci->state & UNLINK_DATA_URBS) ? " unlink": ""); 213 (ci->state & UNLINK_DATA_URBS) ? " unlink": "",
214 (ci->state & IS_IN_WORK_LIST) ? " work" : "");
211} 215}
212 216
213static int uas_try_complete(struct scsi_cmnd *cmnd, const char *caller) 217static int uas_try_complete(struct scsi_cmnd *cmnd, const char *caller)
@@ -244,6 +248,7 @@ static void uas_xfer_data(struct urb *urb, struct scsi_cmnd *cmnd,
244 if (err) { 248 if (err) {
245 spin_lock(&uas_work_lock); 249 spin_lock(&uas_work_lock);
246 list_add_tail(&cmdinfo->list, &uas_work_list); 250 list_add_tail(&cmdinfo->list, &uas_work_list);
251 cmdinfo->state |= IS_IN_WORK_LIST;
247 spin_unlock(&uas_work_lock); 252 spin_unlock(&uas_work_lock);
248 schedule_work(&uas_work); 253 schedule_work(&uas_work);
249 } 254 }
@@ -643,6 +648,7 @@ static int uas_queuecommand_lck(struct scsi_cmnd *cmnd,
643 } 648 }
644 spin_lock(&uas_work_lock); 649 spin_lock(&uas_work_lock);
645 list_add_tail(&cmdinfo->list, &uas_work_list); 650 list_add_tail(&cmdinfo->list, &uas_work_list);
651 cmdinfo->state |= IS_IN_WORK_LIST;
646 spin_unlock(&uas_work_lock); 652 spin_unlock(&uas_work_lock);
647 schedule_work(&uas_work); 653 schedule_work(&uas_work);
648 } 654 }