aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/storage/libusual.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-04-25 15:40:57 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-25 15:40:57 -0400
commit37b05b17985ecc43a33e2a8cbdaa220115de4703 (patch)
tree8213bf790182711677018ed322a9ccf61470242e /drivers/usb/storage/libusual.c
parentce1d5b23a8d1e19866ab82bdec0dc41fde5273d8 (diff)
parent4953d141dc5db748475001cfbfdcc42e66cf900e (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6: (120 commits) usb: don't update devnum for wusb devices wusb: make ep0_reinit available for modules wusb: devices dont use a set address wusb: teach choose_address() about wireless devices wusb: add link wusb-usb device wusb: add authenticathed bit to usb_dev USB: remove unnecessary type casting of urb->context usb serial: more fixes and groundwork for tty changes USB: replace remaining __FUNCTION__ occurrences USB: usbfs: export the URB_NO_INTERRUPT flag to userspace USB: fix compile problems in ehci-hcd USB: ehci: qh_completions cleanup and bugfix USB: cdc-acm: signedness fix USB: add documentation about callbacks USB: don't explicitly reenable root-hub status interrupts USB: OHCI: turn off RD when remote wakeup is disabled USB: HCDs use the do_remote_wakeup flag USB: g_file_storage: ignore bulk-out data after invalid CBW USB: serial: remove endpoints setting checks from core and header USB: serial: remove unneeded number endpoints settings ...
Diffstat (limited to 'drivers/usb/storage/libusual.c')
-rw-r--r--drivers/usb/storage/libusual.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/usb/storage/libusual.c b/drivers/usb/storage/libusual.c
index 55b952084f0c..a28d49122e7a 100644
--- a/drivers/usb/storage/libusual.c
+++ b/drivers/usb/storage/libusual.c
@@ -9,6 +9,7 @@
9#include <linux/usb_usual.h> 9#include <linux/usb_usual.h>
10#include <linux/vmalloc.h> 10#include <linux/vmalloc.h>
11#include <linux/kthread.h> 11#include <linux/kthread.h>
12#include <linux/mutex.h>
12 13
13/* 14/*
14 */ 15 */
@@ -30,7 +31,7 @@ static atomic_t usu_bias = ATOMIC_INIT(USB_US_DEFAULT_BIAS);
30#define BIAS_NAME_SIZE (sizeof("usb-storage")) 31#define BIAS_NAME_SIZE (sizeof("usb-storage"))
31static const char *bias_names[3] = { "none", "usb-storage", "ub" }; 32static const char *bias_names[3] = { "none", "usb-storage", "ub" };
32 33
33static struct semaphore usu_init_notify; 34static DEFINE_MUTEX(usu_probe_mutex);
34static DECLARE_COMPLETION(usu_end_notify); 35static DECLARE_COMPLETION(usu_end_notify);
35static atomic_t total_threads = ATOMIC_INIT(0); 36static atomic_t total_threads = ATOMIC_INIT(0);
36 37
@@ -178,10 +179,7 @@ static int usu_probe_thread(void *arg)
178 int rc; 179 int rc;
179 unsigned long flags; 180 unsigned long flags;
180 181
181 /* A completion does not work here because it's counted. */ 182 mutex_lock(&usu_probe_mutex);
182 down(&usu_init_notify);
183 up(&usu_init_notify);
184
185 rc = request_module(bias_names[type]); 183 rc = request_module(bias_names[type]);
186 spin_lock_irqsave(&usu_lock, flags); 184 spin_lock_irqsave(&usu_lock, flags);
187 if (rc == 0 && (st->fls & USU_MOD_FL_PRESENT) == 0) { 185 if (rc == 0 && (st->fls & USU_MOD_FL_PRESENT) == 0) {
@@ -194,6 +192,7 @@ static int usu_probe_thread(void *arg)
194 } 192 }
195 st->fls &= ~USU_MOD_FL_THREAD; 193 st->fls &= ~USU_MOD_FL_THREAD;
196 spin_unlock_irqrestore(&usu_lock, flags); 194 spin_unlock_irqrestore(&usu_lock, flags);
195 mutex_unlock(&usu_probe_mutex);
197 196
198 complete_and_exit(&usu_end_notify, 0); 197 complete_and_exit(&usu_end_notify, 0);
199} 198}
@@ -204,10 +203,9 @@ static int __init usb_usual_init(void)
204{ 203{
205 int rc; 204 int rc;
206 205
207 sema_init(&usu_init_notify, 0); 206 mutex_lock(&usu_probe_mutex);
208
209 rc = usb_register(&usu_driver); 207 rc = usb_register(&usu_driver);
210 up(&usu_init_notify); 208 mutex_unlock(&usu_probe_mutex);
211 return rc; 209 return rc;
212} 210}
213 211