aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/keucr/usb.c2
-rw-r--r--drivers/usb/storage/Kconfig14
-rw-r--r--drivers/usb/storage/Makefile9
-rw-r--r--drivers/usb/storage/alauda.c2
-rw-r--r--drivers/usb/storage/cypress_atacb.c2
-rw-r--r--drivers/usb/storage/datafab.c2
-rw-r--r--drivers/usb/storage/ene_ub6250.c2
-rw-r--r--drivers/usb/storage/freecom.c2
-rw-r--r--drivers/usb/storage/isd200.c5
-rw-r--r--drivers/usb/storage/jumpshot.c2
-rw-r--r--drivers/usb/storage/karma.c2
-rw-r--r--drivers/usb/storage/libusual.c243
-rw-r--r--drivers/usb/storage/onetouch.c2
-rw-r--r--drivers/usb/storage/realtek_cr.c2
-rw-r--r--drivers/usb/storage/sddr09.c2
-rw-r--r--drivers/usb/storage/sddr55.c2
-rw-r--r--drivers/usb/storage/shuttle_usbat.c2
-rw-r--r--drivers/usb/storage/unusual_devs.h36
-rw-r--r--drivers/usb/storage/usb.c17
-rw-r--r--drivers/usb/storage/usual-tables.c18
20 files changed, 42 insertions, 326 deletions
diff --git a/drivers/staging/keucr/usb.c b/drivers/staging/keucr/usb.c
index 483303402735..55a0b82c6391 100644
--- a/drivers/staging/keucr/usb.c
+++ b/drivers/staging/keucr/usb.c
@@ -320,7 +320,7 @@ static int get_device_info(struct us_data *us, const struct usb_device_id *id)
320 320
321 us->subclass = idesc->bInterfaceSubClass; 321 us->subclass = idesc->bInterfaceSubClass;
322 us->protocol = idesc->bInterfaceProtocol; 322 us->protocol = idesc->bInterfaceProtocol;
323 us->fflags = USB_US_ORIG_FLAGS(id->driver_info); 323 us->fflags = id->driver_info;
324 us->Power_IsResum = false; 324 us->Power_IsResum = false;
325 325
326 if (us->fflags & US_FL_IGNORE_DEVICE) 326 if (us->fflags & US_FL_IGNORE_DEVICE)
diff --git a/drivers/usb/storage/Kconfig b/drivers/usb/storage/Kconfig
index 7691c866637b..0ae7bb64b5ea 100644
--- a/drivers/usb/storage/Kconfig
+++ b/drivers/usb/storage/Kconfig
@@ -213,17 +213,3 @@ config USB_UAS
213 say 'Y' or 'M' here and the kernel will use the right driver. 213 say 'Y' or 'M' here and the kernel will use the right driver.
214 214
215 If you compile this driver as a module, it will be named uas. 215 If you compile this driver as a module, it will be named uas.
216
217config USB_LIBUSUAL
218 bool "The shared table of common (or usual) storage devices"
219 depends on USB
220 help
221 This module contains a table of common (or usual) devices
222 for usb-storage and ub drivers, and allows to switch binding
223 of these devices without rebuilding modules.
224
225 Typical syntax of /etc/modprobe.d/*conf is:
226
227 options libusual bias="ub"
228
229 If unsure, say N.
diff --git a/drivers/usb/storage/Makefile b/drivers/usb/storage/Makefile
index 82e6416a2d47..4cd55481b309 100644
--- a/drivers/usb/storage/Makefile
+++ b/drivers/usb/storage/Makefile
@@ -12,16 +12,9 @@ obj-$(CONFIG_USB_STORAGE) += usb-storage.o
12 12
13usb-storage-y := scsiglue.o protocol.o transport.o usb.o 13usb-storage-y := scsiglue.o protocol.o transport.o usb.o
14usb-storage-y += initializers.o sierra_ms.o option_ms.o 14usb-storage-y += initializers.o sierra_ms.o option_ms.o
15 15usb-storage-y += usual-tables.o
16usb-storage-$(CONFIG_USB_STORAGE_DEBUG) += debug.o 16usb-storage-$(CONFIG_USB_STORAGE_DEBUG) += debug.o
17 17
18ifeq ($(CONFIG_USB_LIBUSUAL),)
19 usb-storage-y += usual-tables.o
20else
21 obj-$(CONFIG_USB) += usb-libusual.o
22 usb-libusual-y := libusual.o usual-tables.o
23endif
24
25obj-$(CONFIG_USB_STORAGE_ALAUDA) += ums-alauda.o 18obj-$(CONFIG_USB_STORAGE_ALAUDA) += ums-alauda.o
26obj-$(CONFIG_USB_STORAGE_CYPRESS_ATACB) += ums-cypress.o 19obj-$(CONFIG_USB_STORAGE_CYPRESS_ATACB) += ums-cypress.o
27obj-$(CONFIG_USB_STORAGE_DATAFAB) += ums-datafab.o 20obj-$(CONFIG_USB_STORAGE_DATAFAB) += ums-datafab.o
diff --git a/drivers/usb/storage/alauda.c b/drivers/usb/storage/alauda.c
index bab8c8fe8290..be5564cc8e01 100644
--- a/drivers/usb/storage/alauda.c
+++ b/drivers/usb/storage/alauda.c
@@ -137,7 +137,7 @@ static int init_alauda(struct us_data *us);
137 vendorName, productName, useProtocol, useTransport, \ 137 vendorName, productName, useProtocol, useTransport, \
138 initFunction, flags) \ 138 initFunction, flags) \
139{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \ 139{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \
140 .driver_info = (flags)|(USB_US_TYPE_STOR<<24) } 140 .driver_info = (flags) }
141 141
142static struct usb_device_id alauda_usb_ids[] = { 142static struct usb_device_id alauda_usb_ids[] = {
143# include "unusual_alauda.h" 143# include "unusual_alauda.h"
diff --git a/drivers/usb/storage/cypress_atacb.c b/drivers/usb/storage/cypress_atacb.c
index 5fe451d16e68..070b5c0ebbf9 100644
--- a/drivers/usb/storage/cypress_atacb.c
+++ b/drivers/usb/storage/cypress_atacb.c
@@ -41,7 +41,7 @@ MODULE_LICENSE("GPL");
41 vendorName, productName, useProtocol, useTransport, \ 41 vendorName, productName, useProtocol, useTransport, \
42 initFunction, flags) \ 42 initFunction, flags) \
43{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \ 43{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \
44 .driver_info = (flags)|(USB_US_TYPE_STOR<<24) } 44 .driver_info = (flags) }
45 45
46static struct usb_device_id cypress_usb_ids[] = { 46static struct usb_device_id cypress_usb_ids[] = {
47# include "unusual_cypress.h" 47# include "unusual_cypress.h"
diff --git a/drivers/usb/storage/datafab.c b/drivers/usb/storage/datafab.c
index 35e9c51e6696..494fee5af41d 100644
--- a/drivers/usb/storage/datafab.c
+++ b/drivers/usb/storage/datafab.c
@@ -86,7 +86,7 @@ static int datafab_determine_lun(struct us_data *us,
86 vendorName, productName, useProtocol, useTransport, \ 86 vendorName, productName, useProtocol, useTransport, \
87 initFunction, flags) \ 87 initFunction, flags) \
88{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \ 88{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \
89 .driver_info = (flags)|(USB_US_TYPE_STOR<<24) } 89 .driver_info = (flags) }
90 90
91static struct usb_device_id datafab_usb_ids[] = { 91static struct usb_device_id datafab_usb_ids[] = {
92# include "unusual_datafab.h" 92# include "unusual_datafab.h"
diff --git a/drivers/usb/storage/ene_ub6250.c b/drivers/usb/storage/ene_ub6250.c
index 95edee53d860..118b134a1dad 100644
--- a/drivers/usb/storage/ene_ub6250.c
+++ b/drivers/usb/storage/ene_ub6250.c
@@ -52,7 +52,7 @@ MODULE_FIRMWARE(MS_RW_FIRMWARE);
52 vendorName, productName, useProtocol, useTransport, \ 52 vendorName, productName, useProtocol, useTransport, \
53 initFunction, flags) \ 53 initFunction, flags) \
54{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \ 54{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \
55 .driver_info = (flags)|(USB_US_TYPE_STOR<<24) } 55 .driver_info = (flags)}
56 56
57static struct usb_device_id ene_ub6250_usb_ids[] = { 57static struct usb_device_id ene_ub6250_usb_ids[] = {
58# include "unusual_ene_ub6250.h" 58# include "unusual_ene_ub6250.h"
diff --git a/drivers/usb/storage/freecom.c b/drivers/usb/storage/freecom.c
index 042cf9ef3153..e6df087dca9d 100644
--- a/drivers/usb/storage/freecom.c
+++ b/drivers/usb/storage/freecom.c
@@ -117,7 +117,7 @@ static int init_freecom(struct us_data *us);
117 vendorName, productName, useProtocol, useTransport, \ 117 vendorName, productName, useProtocol, useTransport, \
118 initFunction, flags) \ 118 initFunction, flags) \
119{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \ 119{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \
120 .driver_info = (flags)|(USB_US_TYPE_STOR<<24) } 120 .driver_info = (flags) }
121 121
122static struct usb_device_id freecom_usb_ids[] = { 122static struct usb_device_id freecom_usb_ids[] = {
123# include "unusual_freecom.h" 123# include "unusual_freecom.h"
diff --git a/drivers/usb/storage/isd200.c b/drivers/usb/storage/isd200.c
index 31fa24e7e68a..ecea47877364 100644
--- a/drivers/usb/storage/isd200.c
+++ b/drivers/usb/storage/isd200.c
@@ -74,7 +74,7 @@ static int isd200_Initialization(struct us_data *us);
74 vendorName, productName, useProtocol, useTransport, \ 74 vendorName, productName, useProtocol, useTransport, \
75 initFunction, flags) \ 75 initFunction, flags) \
76{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \ 76{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \
77 .driver_info = (flags)|(USB_US_TYPE_STOR<<24) } 77 .driver_info = (flags) }
78 78
79static struct usb_device_id isd200_usb_ids[] = { 79static struct usb_device_id isd200_usb_ids[] = {
80# include "unusual_isd200.h" 80# include "unusual_isd200.h"
@@ -83,7 +83,6 @@ static struct usb_device_id isd200_usb_ids[] = {
83MODULE_DEVICE_TABLE(usb, isd200_usb_ids); 83MODULE_DEVICE_TABLE(usb, isd200_usb_ids);
84 84
85#undef UNUSUAL_DEV 85#undef UNUSUAL_DEV
86#undef USUAL_DEV
87 86
88/* 87/*
89 * The flags table 88 * The flags table
@@ -105,8 +104,6 @@ static struct us_unusual_dev isd200_unusual_dev_list[] = {
105}; 104};
106 105
107#undef UNUSUAL_DEV 106#undef UNUSUAL_DEV
108#undef USUAL_DEV
109
110 107
111/* Timeout defines (in Seconds) */ 108/* Timeout defines (in Seconds) */
112 109
diff --git a/drivers/usb/storage/jumpshot.c b/drivers/usb/storage/jumpshot.c
index e3b97383186a..ddc78780b1ad 100644
--- a/drivers/usb/storage/jumpshot.c
+++ b/drivers/usb/storage/jumpshot.c
@@ -69,7 +69,7 @@ MODULE_LICENSE("GPL");
69 vendorName, productName, useProtocol, useTransport, \ 69 vendorName, productName, useProtocol, useTransport, \
70 initFunction, flags) \ 70 initFunction, flags) \
71{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \ 71{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \
72 .driver_info = (flags)|(USB_US_TYPE_STOR<<24) } 72 .driver_info = (flags) }
73 73
74static struct usb_device_id jumpshot_usb_ids[] = { 74static struct usb_device_id jumpshot_usb_ids[] = {
75# include "unusual_jumpshot.h" 75# include "unusual_jumpshot.h"
diff --git a/drivers/usb/storage/karma.c b/drivers/usb/storage/karma.c
index a8708eae9788..f085ffb606c8 100644
--- a/drivers/usb/storage/karma.c
+++ b/drivers/usb/storage/karma.c
@@ -57,7 +57,7 @@ static int rio_karma_init(struct us_data *us);
57 vendorName, productName, useProtocol, useTransport, \ 57 vendorName, productName, useProtocol, useTransport, \
58 initFunction, flags) \ 58 initFunction, flags) \
59{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \ 59{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \
60 .driver_info = (flags)|(USB_US_TYPE_STOR<<24) } 60 .driver_info = (flags) }
61 61
62static struct usb_device_id karma_usb_ids[] = { 62static struct usb_device_id karma_usb_ids[] = {
63# include "unusual_karma.h" 63# include "unusual_karma.h"
diff --git a/drivers/usb/storage/libusual.c b/drivers/usb/storage/libusual.c
deleted file mode 100644
index fe3ffe1459b2..000000000000
--- a/drivers/usb/storage/libusual.c
+++ /dev/null
@@ -1,243 +0,0 @@
1/*
2 * libusual
3 *
4 * The libusual contains the table of devices common for ub and usb-storage.
5 */
6#include <linux/kernel.h>
7#include <linux/module.h>
8#include <linux/usb.h>
9#include <linux/usb_usual.h>
10#include <linux/vmalloc.h>
11#include <linux/kthread.h>
12#include <linux/mutex.h>
13
14/*
15 */
16#define USU_MOD_FL_THREAD 1 /* Thread is running */
17#define USU_MOD_FL_PRESENT 2 /* The module is loaded */
18
19struct mod_status {
20 unsigned long fls;
21};
22
23static struct mod_status stat[3];
24static DEFINE_SPINLOCK(usu_lock);
25
26/*
27 */
28#define USB_US_DEFAULT_BIAS USB_US_TYPE_STOR
29static atomic_t usu_bias = ATOMIC_INIT(USB_US_DEFAULT_BIAS);
30
31#define BIAS_NAME_SIZE (sizeof("usb-storage"))
32static const char *bias_names[3] = { "none", "usb-storage", "ub" };
33
34static DEFINE_MUTEX(usu_probe_mutex);
35static DECLARE_COMPLETION(usu_end_notify);
36static atomic_t total_threads = ATOMIC_INIT(0);
37
38static int usu_probe_thread(void *arg);
39
40/*
41 * @type: the module type as an integer
42 */
43void usb_usual_set_present(int type)
44{
45 struct mod_status *st;
46 unsigned long flags;
47
48 if (type <= 0 || type >= 3)
49 return;
50 st = &stat[type];
51 spin_lock_irqsave(&usu_lock, flags);
52 st->fls |= USU_MOD_FL_PRESENT;
53 spin_unlock_irqrestore(&usu_lock, flags);
54}
55EXPORT_SYMBOL_GPL(usb_usual_set_present);
56
57void usb_usual_clear_present(int type)
58{
59 struct mod_status *st;
60 unsigned long flags;
61
62 if (type <= 0 || type >= 3)
63 return;
64 st = &stat[type];
65 spin_lock_irqsave(&usu_lock, flags);
66 st->fls &= ~USU_MOD_FL_PRESENT;
67 spin_unlock_irqrestore(&usu_lock, flags);
68}
69EXPORT_SYMBOL_GPL(usb_usual_clear_present);
70
71/*
72 * Match the calling driver type against the table.
73 * Returns: 0 if the device matches.
74 */
75int usb_usual_check_type(const struct usb_device_id *id, int caller_type)
76{
77 int id_type = USB_US_TYPE(id->driver_info);
78
79 if (caller_type <= 0 || caller_type >= 3)
80 return -EINVAL;
81
82 /* Drivers grab fixed assignment devices */
83 if (id_type == caller_type)
84 return 0;
85 /* Drivers grab devices biased to them */
86 if (id_type == USB_US_TYPE_NONE && caller_type == atomic_read(&usu_bias))
87 return 0;
88 return -ENODEV;
89}
90EXPORT_SYMBOL_GPL(usb_usual_check_type);
91
92/*
93 */
94static int usu_probe(struct usb_interface *intf,
95 const struct usb_device_id *id)
96{
97 int rc;
98 unsigned long type;
99 struct task_struct* task;
100 unsigned long flags;
101
102 type = USB_US_TYPE(id->driver_info);
103 if (type == 0)
104 type = atomic_read(&usu_bias);
105
106 spin_lock_irqsave(&usu_lock, flags);
107 if ((stat[type].fls & (USU_MOD_FL_THREAD|USU_MOD_FL_PRESENT)) != 0) {
108 spin_unlock_irqrestore(&usu_lock, flags);
109 return -ENXIO;
110 }
111 stat[type].fls |= USU_MOD_FL_THREAD;
112 spin_unlock_irqrestore(&usu_lock, flags);
113
114 task = kthread_run(usu_probe_thread, (void*)type, "libusual_%ld", type);
115 if (IS_ERR(task)) {
116 rc = PTR_ERR(task);
117 printk(KERN_WARNING "libusual: "
118 "Unable to start the thread for %s: %d\n",
119 bias_names[type], rc);
120 spin_lock_irqsave(&usu_lock, flags);
121 stat[type].fls &= ~USU_MOD_FL_THREAD;
122 spin_unlock_irqrestore(&usu_lock, flags);
123 return rc; /* Not being -ENXIO causes a message printed */
124 }
125 atomic_inc(&total_threads);
126
127 return -ENXIO;
128}
129
130static void usu_disconnect(struct usb_interface *intf)
131{
132 ; /* We should not be here. */
133}
134
135static struct usb_driver usu_driver = {
136 .name = "libusual",
137 .probe = usu_probe,
138 .disconnect = usu_disconnect,
139 .id_table = usb_storage_usb_ids,
140};
141
142/*
143 * A whole new thread for a purpose of request_module seems quite stupid.
144 * The request_module forks once inside again. However, if we attempt
145 * to load a storage module from our own modprobe thread, that module
146 * references our symbols, which cannot be resolved until our module is
147 * initialized. I wish there was a way to wait for the end of initialization.
148 * The module notifier reports MODULE_STATE_COMING only.
149 * So, we wait until module->init ends as the next best thing.
150 */
151static int usu_probe_thread(void *arg)
152{
153 int type = (unsigned long) arg;
154 struct mod_status *st = &stat[type];
155 int rc;
156 unsigned long flags;
157
158 mutex_lock(&usu_probe_mutex);
159 rc = request_module(bias_names[type]);
160 spin_lock_irqsave(&usu_lock, flags);
161 if (rc == 0 && (st->fls & USU_MOD_FL_PRESENT) == 0) {
162 /*
163 * This should not happen, but let us keep tabs on it.
164 */
165 printk(KERN_NOTICE "libusual: "
166 "modprobe for %s succeeded, but module is not present\n",
167 bias_names[type]);
168 }
169 st->fls &= ~USU_MOD_FL_THREAD;
170 spin_unlock_irqrestore(&usu_lock, flags);
171 mutex_unlock(&usu_probe_mutex);
172
173 complete_and_exit(&usu_end_notify, 0);
174}
175
176/*
177 */
178static int __init usb_usual_init(void)
179{
180 int rc;
181
182 mutex_lock(&usu_probe_mutex);
183 rc = usb_register(&usu_driver);
184 mutex_unlock(&usu_probe_mutex);
185 return rc;
186}
187
188static void __exit usb_usual_exit(void)
189{
190 /*
191 * We do not check for any drivers present, because
192 * they keep us pinned with symbol references.
193 */
194
195 usb_deregister(&usu_driver);
196
197 while (atomic_read(&total_threads) > 0) {
198 wait_for_completion(&usu_end_notify);
199 atomic_dec(&total_threads);
200 }
201}
202
203/*
204 * Validate and accept the bias parameter.
205 */
206static int usu_set_bias(const char *bias_s, struct kernel_param *kp)
207{
208 int i;
209 int len;
210 int bias_n = 0;
211
212 len = strlen(bias_s);
213 if (len == 0)
214 return -EDOM;
215 if (bias_s[len-1] == '\n')
216 --len;
217
218 for (i = 1; i < 3; i++) {
219 if (strncmp(bias_s, bias_names[i], len) == 0) {
220 bias_n = i;
221 break;
222 }
223 }
224 if (bias_n == 0)
225 return -EINVAL;
226
227 atomic_set(&usu_bias, bias_n);
228 return 0;
229}
230
231static int usu_get_bias(char *buffer, struct kernel_param *kp)
232{
233 return strlen(strcpy(buffer, bias_names[atomic_read(&usu_bias)]));
234}
235
236module_init(usb_usual_init);
237module_exit(usb_usual_exit);
238
239module_param_call(bias, usu_set_bias, usu_get_bias, NULL, S_IRUGO|S_IWUSR);
240__MODULE_PARM_TYPE(bias, "string");
241MODULE_PARM_DESC(bias, "Bias to usb-storage or ub");
242
243MODULE_LICENSE("GPL");
diff --git a/drivers/usb/storage/onetouch.c b/drivers/usb/storage/onetouch.c
index 886567a3806d..cb79de61f4c8 100644
--- a/drivers/usb/storage/onetouch.c
+++ b/drivers/usb/storage/onetouch.c
@@ -67,7 +67,7 @@ struct usb_onetouch {
67 vendorName, productName, useProtocol, useTransport, \ 67 vendorName, productName, useProtocol, useTransport, \
68 initFunction, flags) \ 68 initFunction, flags) \
69{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \ 69{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \
70 .driver_info = (flags)|(USB_US_TYPE_STOR<<24) } 70 .driver_info = (flags) }
71 71
72static struct usb_device_id onetouch_usb_ids[] = { 72static struct usb_device_id onetouch_usb_ids[] = {
73# include "unusual_onetouch.h" 73# include "unusual_onetouch.h"
diff --git a/drivers/usb/storage/realtek_cr.c b/drivers/usb/storage/realtek_cr.c
index 63cf2822e299..d36446dd7ae8 100644
--- a/drivers/usb/storage/realtek_cr.c
+++ b/drivers/usb/storage/realtek_cr.c
@@ -172,7 +172,7 @@ static int init_realtek_cr(struct us_data *us);
172 initFunction, flags) \ 172 initFunction, flags) \
173{\ 173{\
174 USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \ 174 USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \
175 .driver_info = (flags)|(USB_US_TYPE_STOR<<24)\ 175 .driver_info = (flags) \
176} 176}
177 177
178static const struct usb_device_id realtek_cr_ids[] = { 178static const struct usb_device_id realtek_cr_ids[] = {
diff --git a/drivers/usb/storage/sddr09.c b/drivers/usb/storage/sddr09.c
index 3252a62b31bc..7bd54e0d5120 100644
--- a/drivers/usb/storage/sddr09.c
+++ b/drivers/usb/storage/sddr09.c
@@ -69,7 +69,7 @@ static int usb_stor_sddr09_init(struct us_data *us);
69 vendorName, productName, useProtocol, useTransport, \ 69 vendorName, productName, useProtocol, useTransport, \
70 initFunction, flags) \ 70 initFunction, flags) \
71{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \ 71{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \
72 .driver_info = (flags)|(USB_US_TYPE_STOR<<24) } 72 .driver_info = (flags) }
73 73
74static struct usb_device_id sddr09_usb_ids[] = { 74static struct usb_device_id sddr09_usb_ids[] = {
75# include "unusual_sddr09.h" 75# include "unusual_sddr09.h"
diff --git a/drivers/usb/storage/sddr55.c b/drivers/usb/storage/sddr55.c
index c144078065a7..d278c5a99b7a 100644
--- a/drivers/usb/storage/sddr55.c
+++ b/drivers/usb/storage/sddr55.c
@@ -46,7 +46,7 @@ MODULE_LICENSE("GPL");
46 vendorName, productName, useProtocol, useTransport, \ 46 vendorName, productName, useProtocol, useTransport, \
47 initFunction, flags) \ 47 initFunction, flags) \
48{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \ 48{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \
49 .driver_info = (flags)|(USB_US_TYPE_STOR<<24) } 49 .driver_info = (flags) }
50 50
51static struct usb_device_id sddr55_usb_ids[] = { 51static struct usb_device_id sddr55_usb_ids[] = {
52# include "unusual_sddr55.h" 52# include "unusual_sddr55.h"
diff --git a/drivers/usb/storage/shuttle_usbat.c b/drivers/usb/storage/shuttle_usbat.c
index fa1ceebc465c..daf2fc58ae02 100644
--- a/drivers/usb/storage/shuttle_usbat.c
+++ b/drivers/usb/storage/shuttle_usbat.c
@@ -168,7 +168,7 @@ static int init_usbat_flash(struct us_data *us);
168 vendorName, productName, useProtocol, useTransport, \ 168 vendorName, productName, useProtocol, useTransport, \
169 initFunction, flags) \ 169 initFunction, flags) \
170{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \ 170{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \
171 .driver_info = (flags)|(USB_US_TYPE_STOR<<24) } 171 .driver_info = (flags) }
172 172
173static struct usb_device_id usbat_usb_ids[] = { 173static struct usb_device_id usbat_usb_ids[] = {
174# include "unusual_usbat.h" 174# include "unusual_usbat.h"
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
index 62a31bea0634..779cd954abcb 100644
--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -2038,25 +2038,25 @@ UNUSUAL_DEV( 0xed10, 0x7636, 0x0001, 0x0001,
2038 USB_SC_DEVICE, USB_PR_DEVICE, NULL, US_FL_NOT_LOCKABLE ), 2038 USB_SC_DEVICE, USB_PR_DEVICE, NULL, US_FL_NOT_LOCKABLE ),
2039 2039
2040/* Control/Bulk transport for all SubClass values */ 2040/* Control/Bulk transport for all SubClass values */
2041USUAL_DEV(USB_SC_RBC, USB_PR_CB, USB_US_TYPE_STOR), 2041USUAL_DEV(USB_SC_RBC, USB_PR_CB),
2042USUAL_DEV(USB_SC_8020, USB_PR_CB, USB_US_TYPE_STOR), 2042USUAL_DEV(USB_SC_8020, USB_PR_CB),
2043USUAL_DEV(USB_SC_QIC, USB_PR_CB, USB_US_TYPE_STOR), 2043USUAL_DEV(USB_SC_QIC, USB_PR_CB),
2044USUAL_DEV(USB_SC_UFI, USB_PR_CB, USB_US_TYPE_STOR), 2044USUAL_DEV(USB_SC_UFI, USB_PR_CB),
2045USUAL_DEV(USB_SC_8070, USB_PR_CB, USB_US_TYPE_STOR), 2045USUAL_DEV(USB_SC_8070, USB_PR_CB),
2046USUAL_DEV(USB_SC_SCSI, USB_PR_CB, USB_US_TYPE_STOR), 2046USUAL_DEV(USB_SC_SCSI, USB_PR_CB),
2047 2047
2048/* Control/Bulk/Interrupt transport for all SubClass values */ 2048/* Control/Bulk/Interrupt transport for all SubClass values */
2049USUAL_DEV(USB_SC_RBC, USB_PR_CBI, USB_US_TYPE_STOR), 2049USUAL_DEV(USB_SC_RBC, USB_PR_CBI),
2050USUAL_DEV(USB_SC_8020, USB_PR_CBI, USB_US_TYPE_STOR), 2050USUAL_DEV(USB_SC_8020, USB_PR_CBI),
2051USUAL_DEV(USB_SC_QIC, USB_PR_CBI, USB_US_TYPE_STOR), 2051USUAL_DEV(USB_SC_QIC, USB_PR_CBI),
2052USUAL_DEV(USB_SC_UFI, USB_PR_CBI, USB_US_TYPE_STOR), 2052USUAL_DEV(USB_SC_UFI, USB_PR_CBI),
2053USUAL_DEV(USB_SC_8070, USB_PR_CBI, USB_US_TYPE_STOR), 2053USUAL_DEV(USB_SC_8070, USB_PR_CBI),
2054USUAL_DEV(USB_SC_SCSI, USB_PR_CBI, USB_US_TYPE_STOR), 2054USUAL_DEV(USB_SC_SCSI, USB_PR_CBI),
2055 2055
2056/* Bulk-only transport for all SubClass values */ 2056/* Bulk-only transport for all SubClass values */
2057USUAL_DEV(USB_SC_RBC, USB_PR_BULK, USB_US_TYPE_STOR), 2057USUAL_DEV(USB_SC_RBC, USB_PR_BULK),
2058USUAL_DEV(USB_SC_8020, USB_PR_BULK, USB_US_TYPE_STOR), 2058USUAL_DEV(USB_SC_8020, USB_PR_BULK),
2059USUAL_DEV(USB_SC_QIC, USB_PR_BULK, USB_US_TYPE_STOR), 2059USUAL_DEV(USB_SC_QIC, USB_PR_BULK),
2060USUAL_DEV(USB_SC_UFI, USB_PR_BULK, USB_US_TYPE_STOR), 2060USUAL_DEV(USB_SC_UFI, USB_PR_BULK),
2061USUAL_DEV(USB_SC_8070, USB_PR_BULK, USB_US_TYPE_STOR), 2061USUAL_DEV(USB_SC_8070, USB_PR_BULK),
2062USUAL_DEV(USB_SC_SCSI, USB_PR_BULK, 0), 2062USUAL_DEV(USB_SC_SCSI, USB_PR_BULK),
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
index d012fe4329e7..12aa72630aed 100644
--- a/drivers/usb/storage/usb.c
+++ b/drivers/usb/storage/usb.c
@@ -114,7 +114,7 @@ MODULE_PARM_DESC(quirks, "supplemental list of device IDs and their quirks");
114 114
115#define COMPLIANT_DEV UNUSUAL_DEV 115#define COMPLIANT_DEV UNUSUAL_DEV
116 116
117#define USUAL_DEV(use_protocol, use_transport, use_type) \ 117#define USUAL_DEV(use_protocol, use_transport) \
118{ \ 118{ \
119 .useProtocol = use_protocol, \ 119 .useProtocol = use_protocol, \
120 .useTransport = use_transport, \ 120 .useTransport = use_transport, \
@@ -126,7 +126,7 @@ static struct us_unusual_dev us_unusual_dev_list[] = {
126}; 126};
127 127
128static struct us_unusual_dev for_dynamic_ids = 128static struct us_unusual_dev for_dynamic_ids =
129 USUAL_DEV(USB_SC_SCSI, USB_PR_BULK, 0); 129 USUAL_DEV(USB_SC_SCSI, USB_PR_BULK);
130 130
131#undef UNUSUAL_DEV 131#undef UNUSUAL_DEV
132#undef COMPLIANT_DEV 132#undef COMPLIANT_DEV
@@ -564,7 +564,7 @@ static int get_device_info(struct us_data *us, const struct usb_device_id *id,
564 us->protocol = (unusual_dev->useTransport == USB_PR_DEVICE) ? 564 us->protocol = (unusual_dev->useTransport == USB_PR_DEVICE) ?
565 idesc->bInterfaceProtocol : 565 idesc->bInterfaceProtocol :
566 unusual_dev->useTransport; 566 unusual_dev->useTransport;
567 us->fflags = USB_US_ORIG_FLAGS(id->driver_info); 567 us->fflags = id->driver_info;
568 adjust_quirks(us); 568 adjust_quirks(us);
569 569
570 if (us->fflags & US_FL_IGNORE_DEVICE) { 570 if (us->fflags & US_FL_IGNORE_DEVICE) {
@@ -1041,13 +1041,10 @@ static int storage_probe(struct usb_interface *intf,
1041 int size; 1041 int size;
1042 1042
1043 /* 1043 /*
1044 * If libusual is configured, let it decide whether a standard
1045 * device should be handled by usb-storage or by ub.
1046 * If the device isn't standard (is handled by a subdriver 1044 * If the device isn't standard (is handled by a subdriver
1047 * module) then don't accept it. 1045 * module) then don't accept it.
1048 */ 1046 */
1049 if (usb_usual_check_type(id, USB_US_TYPE_STOR) || 1047 if (usb_usual_ignore_device(intf))
1050 usb_usual_ignore_device(intf))
1051 return -ENXIO; 1048 return -ENXIO;
1052 1049
1053 /* 1050 /*
@@ -1105,10 +1102,8 @@ static int __init usb_stor_init(void)
1105 1102
1106 /* register the driver, return usb_register return code if error */ 1103 /* register the driver, return usb_register return code if error */
1107 retval = usb_register(&usb_storage_driver); 1104 retval = usb_register(&usb_storage_driver);
1108 if (retval == 0) { 1105 if (retval == 0)
1109 pr_info("USB Mass Storage support registered.\n"); 1106 pr_info("USB Mass Storage support registered.\n");
1110 usb_usual_set_present(USB_US_TYPE_STOR);
1111 }
1112 return retval; 1107 return retval;
1113} 1108}
1114 1109
@@ -1122,8 +1117,6 @@ static void __exit usb_stor_exit(void)
1122 */ 1117 */
1123 US_DEBUGP("-- calling usb_deregister()\n"); 1118 US_DEBUGP("-- calling usb_deregister()\n");
1124 usb_deregister(&usb_storage_driver) ; 1119 usb_deregister(&usb_storage_driver) ;
1125
1126 usb_usual_clear_present(USB_US_TYPE_STOR);
1127} 1120}
1128 1121
1129module_init(usb_stor_init); 1122module_init(usb_stor_init);
diff --git a/drivers/usb/storage/usual-tables.c b/drivers/usb/storage/usual-tables.c
index b96927914f89..b78a526910fb 100644
--- a/drivers/usb/storage/usual-tables.c
+++ b/drivers/usb/storage/usual-tables.c
@@ -34,31 +34,23 @@
34 vendorName, productName, useProtocol, useTransport, \ 34 vendorName, productName, useProtocol, useTransport, \
35 initFunction, flags) \ 35 initFunction, flags) \
36{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \ 36{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \
37 .driver_info = (flags)|(USB_US_TYPE_STOR<<24) }
38
39#define COMPLIANT_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \
40 vendorName, productName, useProtocol, useTransport, \
41 initFunction, flags) \
42{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \
43 .driver_info = (flags) } 37 .driver_info = (flags) }
44 38
45#define USUAL_DEV(useProto, useTrans, useType) \ 39#define COMPLIANT_DEV UNUSUAL_DEV
46{ USB_INTERFACE_INFO(USB_CLASS_MASS_STORAGE, useProto, useTrans), \ 40
47 .driver_info = ((useType)<<24) } 41#define USUAL_DEV(useProto, useTrans) \
42{ USB_INTERFACE_INFO(USB_CLASS_MASS_STORAGE, useProto, useTrans) }
48 43
49struct usb_device_id usb_storage_usb_ids[] = { 44struct usb_device_id usb_storage_usb_ids[] = {
50# include "unusual_devs.h" 45# include "unusual_devs.h"
51 { } /* Terminating entry */ 46 { } /* Terminating entry */
52}; 47};
53EXPORT_SYMBOL_GPL(usb_storage_usb_ids);
54
55MODULE_DEVICE_TABLE(usb, usb_storage_usb_ids); 48MODULE_DEVICE_TABLE(usb, usb_storage_usb_ids);
56 49
57#undef UNUSUAL_DEV 50#undef UNUSUAL_DEV
58#undef COMPLIANT_DEV 51#undef COMPLIANT_DEV
59#undef USUAL_DEV 52#undef USUAL_DEV
60 53
61
62/* 54/*
63 * The table of devices to ignore 55 * The table of devices to ignore
64 */ 56 */
@@ -95,7 +87,6 @@ static struct ignore_entry ignore_ids[] = {
95 87
96#undef UNUSUAL_DEV 88#undef UNUSUAL_DEV
97 89
98
99/* Return an error if a device is in the ignore_ids list */ 90/* Return an error if a device is in the ignore_ids list */
100int usb_usual_ignore_device(struct usb_interface *intf) 91int usb_usual_ignore_device(struct usb_interface *intf)
101{ 92{
@@ -115,4 +106,3 @@ int usb_usual_ignore_device(struct usb_interface *intf)
115 } 106 }
116 return 0; 107 return 0;
117} 108}
118EXPORT_SYMBOL_GPL(usb_usual_ignore_device);