patch-2.4.21 linux-2.4.21/drivers/usb/storage/usb.c
Next file: linux-2.4.21/drivers/usb/storage/usb.h
Previous file: linux-2.4.21/drivers/usb/storage/unusual_devs.h
Back to the patch index
Back to the overall index
- Lines: 45
- Date:
2003-06-13 07:51:37.000000000 -0700
- Orig file:
linux-2.4.20/drivers/usb/storage/usb.c
- Orig date:
2002-11-28 15:53:15.000000000 -0800
diff -urN linux-2.4.20/drivers/usb/storage/usb.c linux-2.4.21/drivers/usb/storage/usb.c
@@ -343,6 +343,7 @@
set_current_state(TASK_INTERRUPTIBLE);
for(;;) {
+ unsigned long flags;
US_DEBUGP("*** thread sleeping.\n");
if(down_interruptible(&us->sema))
break;
@@ -350,7 +351,7 @@
US_DEBUGP("*** thread awakened.\n");
/* lock access to the queue element */
- down(&(us->queue_exclusion));
+ spin_lock_irqsave(&(us->queue_exclusion), flags);
/* take the command off the queue */
action = us->action;
@@ -358,7 +359,7 @@
us->srb = us->queue_srb;
/* release the queue lock as fast as possible */
- up(&(us->queue_exclusion));
+ spin_unlock_irqrestore(&(us->queue_exclusion), flags);
switch (action) {
case US_ACT_COMMAND:
@@ -469,7 +470,8 @@
us->srb->result);
set_current_state(TASK_INTERRUPTIBLE);
us->srb->scsi_done(us->srb);
- } else {
+ };
+ if (atomic_read(&us->abortcnt) != 0) {
US_DEBUGP("scsi command aborted\n");
set_current_state(TASK_INTERRUPTIBLE);
complete(&(us->notify));
@@ -773,7 +775,7 @@
/* Initialize the mutexes only when the struct is new */
init_completion(&(ss->notify));
init_MUTEX_LOCKED(&(ss->ip_waitq));
- init_MUTEX(&(ss->queue_exclusion));
+ spin_lock_init(&(ss->queue_exclusion));
init_MUTEX(&(ss->irq_urb_sem));
init_MUTEX(&(ss->current_urb_sem));
init_MUTEX(&(ss->dev_semaphore));
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)