]> err.no Git - linux-2.6/commitdiff
usb-storage: change remaining semaphore to completion
authorAlan Stern <stern@rowland.harvard.edu>
Thu, 1 May 2008 19:36:13 +0000 (15:36 -0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 21 Jul 2008 22:15:53 +0000 (15:15 -0700)
This patch (as1090) converts the one remaining semaphore in
usb-storage into a completion.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Matthew Dharm <mdharm-usb@one-eyed-alien.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/storage/scsiglue.c
drivers/usb/storage/usb.c
drivers/usb/storage/usb.h

index 1caf3f7af34979a773ca963995d76cf4bd1313b4..043b60b2ad17feca73fb524cb130082e0ed5cd84 100644 (file)
@@ -248,7 +248,7 @@ static int queuecommand(struct scsi_cmnd *srb,
        /* enqueue the command and wake up the control thread */
        srb->scsi_done = done;
        us->srb = srb;
-       up(&(us->sema));
+       complete(&us->cmnd_ready);
 
        return 0;
 }
index 78c0c7ee6b9968f3c5a36a4b805323dc3b8aa2d4..6b14f8d253f15256e51a001cd00e8e20169a86a5 100644 (file)
@@ -312,9 +312,9 @@ static int usb_stor_control_thread(void * __us)
 
        for(;;) {
                US_DEBUGP("*** thread sleeping.\n");
-               if(down_interruptible(&us->sema))
+               if (wait_for_completion_interruptible(&us->cmnd_ready))
                        break;
-                       
+
                US_DEBUGP("*** thread awakened.\n");
 
                /* lock the device pointers */
@@ -825,7 +825,7 @@ static void usb_stor_release_resources(struct us_data *us)
         */
        US_DEBUGP("-- sending exit command to thread\n");
        set_bit(US_FLIDX_DISCONNECTING, &us->dflags);
-       up(&us->sema);
+       complete(&us->cmnd_ready);
        if (us->ctl_thread)
                kthread_stop(us->ctl_thread);
 
@@ -975,7 +975,7 @@ static int storage_probe(struct usb_interface *intf,
        us = host_to_us(host);
        memset(us, 0, sizeof(struct us_data));
        mutex_init(&(us->dev_mutex));
-       init_MUTEX_LOCKED(&(us->sema));
+       init_completion(&us->cmnd_ready);
        init_completion(&(us->notify));
        init_waitqueue_head(&us->delay_wait);
        init_completion(&us->scanning_done);
index b169132f021b94988c500d90588787d367cb323c..8da96da5875d893629a6e21a73c06cec67cba073 100644 (file)
@@ -148,7 +148,7 @@ struct us_data {
        struct task_struct      *ctl_thread;     /* the control thread   */
 
        /* mutual exclusion and synchronization structures */
-       struct semaphore        sema;            /* to sleep thread on      */
+       struct completion       cmnd_ready;      /* to sleep thread on      */
        struct completion       notify;          /* thread begin/end        */
        wait_queue_head_t       delay_wait;      /* wait during scan, reset */
        struct completion       scanning_done;   /* wait for scan thread    */