aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/storage
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2008-05-01 15:36:13 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2008-07-21 18:15:53 -0400
commit7119e3c37fbf7c27adb5929f344c826ecb8c7859 (patch)
tree7218b937cce2fa4b8a87ae1c682552381c906496 /drivers/usb/storage
parent7e4d6c387994294ac8198b624ee71e75de60dfd2 (diff)
usb-storage: change remaining semaphore to completion
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>
Diffstat (limited to 'drivers/usb/storage')
-rw-r--r--drivers/usb/storage/scsiglue.c2
-rw-r--r--drivers/usb/storage/usb.c8
-rw-r--r--drivers/usb/storage/usb.h2
3 files changed, 6 insertions, 6 deletions
diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c
index 1caf3f7af349..043b60b2ad17 100644
--- a/drivers/usb/storage/scsiglue.c
+++ b/drivers/usb/storage/scsiglue.c
@@ -248,7 +248,7 @@ static int queuecommand(struct scsi_cmnd *srb,
248 /* enqueue the command and wake up the control thread */ 248 /* enqueue the command and wake up the control thread */
249 srb->scsi_done = done; 249 srb->scsi_done = done;
250 us->srb = srb; 250 us->srb = srb;
251 up(&(us->sema)); 251 complete(&us->cmnd_ready);
252 252
253 return 0; 253 return 0;
254} 254}
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
index 78c0c7ee6b99..6b14f8d253f1 100644
--- a/drivers/usb/storage/usb.c
+++ b/drivers/usb/storage/usb.c
@@ -312,9 +312,9 @@ static int usb_stor_control_thread(void * __us)
312 312
313 for(;;) { 313 for(;;) {
314 US_DEBUGP("*** thread sleeping.\n"); 314 US_DEBUGP("*** thread sleeping.\n");
315 if(down_interruptible(&us->sema)) 315 if (wait_for_completion_interruptible(&us->cmnd_ready))
316 break; 316 break;
317 317
318 US_DEBUGP("*** thread awakened.\n"); 318 US_DEBUGP("*** thread awakened.\n");
319 319
320 /* lock the device pointers */ 320 /* lock the device pointers */
@@ -825,7 +825,7 @@ static void usb_stor_release_resources(struct us_data *us)
825 */ 825 */
826 US_DEBUGP("-- sending exit command to thread\n"); 826 US_DEBUGP("-- sending exit command to thread\n");
827 set_bit(US_FLIDX_DISCONNECTING, &us->dflags); 827 set_bit(US_FLIDX_DISCONNECTING, &us->dflags);
828 up(&us->sema); 828 complete(&us->cmnd_ready);
829 if (us->ctl_thread) 829 if (us->ctl_thread)
830 kthread_stop(us->ctl_thread); 830 kthread_stop(us->ctl_thread);
831 831
@@ -975,7 +975,7 @@ static int storage_probe(struct usb_interface *intf,
975 us = host_to_us(host); 975 us = host_to_us(host);
976 memset(us, 0, sizeof(struct us_data)); 976 memset(us, 0, sizeof(struct us_data));
977 mutex_init(&(us->dev_mutex)); 977 mutex_init(&(us->dev_mutex));
978 init_MUTEX_LOCKED(&(us->sema)); 978 init_completion(&us->cmnd_ready);
979 init_completion(&(us->notify)); 979 init_completion(&(us->notify));
980 init_waitqueue_head(&us->delay_wait); 980 init_waitqueue_head(&us->delay_wait);
981 init_completion(&us->scanning_done); 981 init_completion(&us->scanning_done);
diff --git a/drivers/usb/storage/usb.h b/drivers/usb/storage/usb.h
index b169132f021b..8da96da5875d 100644
--- a/drivers/usb/storage/usb.h
+++ b/drivers/usb/storage/usb.h
@@ -148,7 +148,7 @@ struct us_data {
148 struct task_struct *ctl_thread; /* the control thread */ 148 struct task_struct *ctl_thread; /* the control thread */
149 149
150 /* mutual exclusion and synchronization structures */ 150 /* mutual exclusion and synchronization structures */
151 struct semaphore sema; /* to sleep thread on */ 151 struct completion cmnd_ready; /* to sleep thread on */
152 struct completion notify; /* thread begin/end */ 152 struct completion notify; /* thread begin/end */
153 wait_queue_head_t delay_wait; /* wait during scan, reset */ 153 wait_queue_head_t delay_wait; /* wait during scan, reset */
154 struct completion scanning_done; /* wait for scan thread */ 154 struct completion scanning_done; /* wait for scan thread */