diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2009-02-12 14:48:26 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-03-24 19:20:35 -0400 |
commit | c10337846c93bd914dd3003ffb001adc583b313e (patch) | |
tree | 32cb40a67324c7033c32fcae2e35609c192bb878 /drivers/usb/storage | |
parent | a74bba3bf92cb6425789ae5050bdcca1283bc6f4 (diff) |
usb-storage: make karma a separate module
This patch (as1216) converts usb-storage's karma subdriver into a
separate module.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/storage')
-rw-r--r-- | drivers/usb/storage/Kconfig | 4 | ||||
-rw-r--r-- | drivers/usb/storage/Makefile | 3 | ||||
-rw-r--r-- | drivers/usb/storage/karma.c | 96 | ||||
-rw-r--r-- | drivers/usb/storage/karma.h | 7 | ||||
-rw-r--r-- | drivers/usb/storage/unusual_devs.h | 7 | ||||
-rw-r--r-- | drivers/usb/storage/unusual_karma.h | 26 | ||||
-rw-r--r-- | drivers/usb/storage/usb.c | 12 | ||||
-rw-r--r-- | drivers/usb/storage/usual-tables.c | 1 |
8 files changed, 123 insertions, 33 deletions
diff --git a/drivers/usb/storage/Kconfig b/drivers/usb/storage/Kconfig index c56c2c6d37b7..8adece1dd294 100644 --- a/drivers/usb/storage/Kconfig +++ b/drivers/usb/storage/Kconfig | |||
@@ -144,7 +144,7 @@ config USB_STORAGE_ONETOUCH | |||
144 | cuts) | 144 | cuts) |
145 | 145 | ||
146 | config USB_STORAGE_KARMA | 146 | config USB_STORAGE_KARMA |
147 | bool "Support for Rio Karma music player" | 147 | tristate "Support for Rio Karma music player" |
148 | depends on USB_STORAGE | 148 | depends on USB_STORAGE |
149 | help | 149 | help |
150 | Say Y here to include additional code to support the Rio Karma | 150 | Say Y here to include additional code to support the Rio Karma |
@@ -155,6 +155,8 @@ config USB_STORAGE_KARMA | |||
155 | on the resulting scsi device node returns the Karma to normal | 155 | on the resulting scsi device node returns the Karma to normal |
156 | operation. | 156 | operation. |
157 | 157 | ||
158 | If this driver is compiled as a module, it will be named ums-karma. | ||
159 | |||
158 | config USB_STORAGE_CYPRESS_ATACB | 160 | config USB_STORAGE_CYPRESS_ATACB |
159 | tristate "SAT emulation on Cypress USB/ATA Bridge with ATACB" | 161 | tristate "SAT emulation on Cypress USB/ATA Bridge with ATACB" |
160 | depends on USB_STORAGE | 162 | depends on USB_STORAGE |
diff --git a/drivers/usb/storage/Makefile b/drivers/usb/storage/Makefile index fea05c0b6765..870680ea3709 100644 --- a/drivers/usb/storage/Makefile +++ b/drivers/usb/storage/Makefile | |||
@@ -11,7 +11,6 @@ obj-$(CONFIG_USB_STORAGE) += usb-storage.o | |||
11 | 11 | ||
12 | usb-storage-obj-$(CONFIG_USB_STORAGE_DEBUG) += debug.o | 12 | usb-storage-obj-$(CONFIG_USB_STORAGE_DEBUG) += debug.o |
13 | usb-storage-obj-$(CONFIG_USB_STORAGE_ONETOUCH) += onetouch.o | 13 | usb-storage-obj-$(CONFIG_USB_STORAGE_ONETOUCH) += onetouch.o |
14 | usb-storage-obj-$(CONFIG_USB_STORAGE_KARMA) += karma.o | ||
15 | 14 | ||
16 | usb-storage-objs := scsiglue.o protocol.o transport.o usb.o \ | 15 | usb-storage-objs := scsiglue.o protocol.o transport.o usb.o \ |
17 | initializers.o sierra_ms.o option_ms.o $(usb-storage-obj-y) | 16 | initializers.o sierra_ms.o option_ms.o $(usb-storage-obj-y) |
@@ -28,6 +27,7 @@ obj-$(CONFIG_USB_STORAGE_DATAFAB) += ums-datafab.o | |||
28 | obj-$(CONFIG_USB_STORAGE_FREECOM) += ums-freecom.o | 27 | obj-$(CONFIG_USB_STORAGE_FREECOM) += ums-freecom.o |
29 | obj-$(CONFIG_USB_STORAGE_ISD200) += ums-isd200.o | 28 | obj-$(CONFIG_USB_STORAGE_ISD200) += ums-isd200.o |
30 | obj-$(CONFIG_USB_STORAGE_JUMPSHOT) += ums-jumpshot.o | 29 | obj-$(CONFIG_USB_STORAGE_JUMPSHOT) += ums-jumpshot.o |
30 | obj-$(CONFIG_USB_STORAGE_KARMA) += ums-karma.o | ||
31 | obj-$(CONFIG_USB_STORAGE_SDDR09) += ums-sddr09.o | 31 | obj-$(CONFIG_USB_STORAGE_SDDR09) += ums-sddr09.o |
32 | obj-$(CONFIG_USB_STORAGE_SDDR55) += ums-sddr55.o | 32 | obj-$(CONFIG_USB_STORAGE_SDDR55) += ums-sddr55.o |
33 | obj-$(CONFIG_USB_STORAGE_USBAT) += ums-usbat.o | 33 | obj-$(CONFIG_USB_STORAGE_USBAT) += ums-usbat.o |
@@ -38,6 +38,7 @@ ums-datafab-objs := datafab.o | |||
38 | ums-freecom-objs := freecom.o | 38 | ums-freecom-objs := freecom.o |
39 | ums-isd200-objs := isd200.o | 39 | ums-isd200-objs := isd200.o |
40 | ums-jumpshot-objs := jumpshot.o | 40 | ums-jumpshot-objs := jumpshot.o |
41 | ums-karma-objs := karma.o | ||
41 | ums-sddr09-objs := sddr09.o | 42 | ums-sddr09-objs := sddr09.o |
42 | ums-sddr55-objs := sddr55.o | 43 | ums-sddr55-objs := sddr55.o |
43 | ums-usbat-objs := shuttle_usbat.o | 44 | ums-usbat-objs := shuttle_usbat.o |
diff --git a/drivers/usb/storage/karma.c b/drivers/usb/storage/karma.c index 0d79ae5683f7..cfb8e60866b8 100644 --- a/drivers/usb/storage/karma.c +++ b/drivers/usb/storage/karma.c | |||
@@ -18,6 +18,8 @@ | |||
18 | * 675 Mass Ave, Cambridge, MA 02139, USA. | 18 | * 675 Mass Ave, Cambridge, MA 02139, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <linux/module.h> | ||
22 | |||
21 | #include <scsi/scsi.h> | 23 | #include <scsi/scsi.h> |
22 | #include <scsi/scsi_cmnd.h> | 24 | #include <scsi/scsi_cmnd.h> |
23 | #include <scsi/scsi_device.h> | 25 | #include <scsi/scsi_device.h> |
@@ -25,7 +27,6 @@ | |||
25 | #include "usb.h" | 27 | #include "usb.h" |
26 | #include "transport.h" | 28 | #include "transport.h" |
27 | #include "debug.h" | 29 | #include "debug.h" |
28 | #include "karma.h" | ||
29 | 30 | ||
30 | #define RIO_PREFIX "RIOP\x00" | 31 | #define RIO_PREFIX "RIOP\x00" |
31 | #define RIO_PREFIX_LEN 5 | 32 | #define RIO_PREFIX_LEN 5 |
@@ -36,13 +37,53 @@ | |||
36 | #define RIO_LEAVE_STORAGE 0x2 | 37 | #define RIO_LEAVE_STORAGE 0x2 |
37 | #define RIO_RESET 0xC | 38 | #define RIO_RESET 0xC |
38 | 39 | ||
39 | extern int usb_stor_Bulk_transport(struct scsi_cmnd *, struct us_data *); | ||
40 | |||
41 | struct karma_data { | 40 | struct karma_data { |
42 | int in_storage; | 41 | int in_storage; |
43 | char *recv; | 42 | char *recv; |
44 | }; | 43 | }; |
45 | 44 | ||
45 | static int rio_karma_init(struct us_data *us); | ||
46 | |||
47 | |||
48 | /* | ||
49 | * The table of devices | ||
50 | */ | ||
51 | #define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \ | ||
52 | vendorName, productName, useProtocol, useTransport, \ | ||
53 | initFunction, flags) \ | ||
54 | { USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \ | ||
55 | .driver_info = (flags)|(USB_US_TYPE_STOR<<24) } | ||
56 | |||
57 | struct usb_device_id karma_usb_ids[] = { | ||
58 | # include "unusual_karma.h" | ||
59 | { } /* Terminating entry */ | ||
60 | }; | ||
61 | MODULE_DEVICE_TABLE(usb, karma_usb_ids); | ||
62 | |||
63 | #undef UNUSUAL_DEV | ||
64 | |||
65 | /* | ||
66 | * The flags table | ||
67 | */ | ||
68 | #define UNUSUAL_DEV(idVendor, idProduct, bcdDeviceMin, bcdDeviceMax, \ | ||
69 | vendor_name, product_name, use_protocol, use_transport, \ | ||
70 | init_function, Flags) \ | ||
71 | { \ | ||
72 | .vendorName = vendor_name, \ | ||
73 | .productName = product_name, \ | ||
74 | .useProtocol = use_protocol, \ | ||
75 | .useTransport = use_transport, \ | ||
76 | .initFunction = init_function, \ | ||
77 | } | ||
78 | |||
79 | static struct us_unusual_dev karma_unusual_dev_list[] = { | ||
80 | # include "unusual_karma.h" | ||
81 | { } /* Terminating entry */ | ||
82 | }; | ||
83 | |||
84 | #undef UNUSUAL_DEV | ||
85 | |||
86 | |||
46 | /* | 87 | /* |
47 | * Send commands to Rio Karma. | 88 | * Send commands to Rio Karma. |
48 | * | 89 | * |
@@ -104,7 +145,7 @@ err: | |||
104 | * Trap START_STOP and READ_10 to leave/re-enter storage mode. | 145 | * Trap START_STOP and READ_10 to leave/re-enter storage mode. |
105 | * Everything else is propagated to the normal bulk layer. | 146 | * Everything else is propagated to the normal bulk layer. |
106 | */ | 147 | */ |
107 | int rio_karma_transport(struct scsi_cmnd *srb, struct us_data *us) | 148 | static int rio_karma_transport(struct scsi_cmnd *srb, struct us_data *us) |
108 | { | 149 | { |
109 | int ret; | 150 | int ret; |
110 | struct karma_data *data = (struct karma_data *) us->extra; | 151 | struct karma_data *data = (struct karma_data *) us->extra; |
@@ -133,7 +174,7 @@ static void rio_karma_destructor(void *extra) | |||
133 | kfree(data->recv); | 174 | kfree(data->recv); |
134 | } | 175 | } |
135 | 176 | ||
136 | int rio_karma_init(struct us_data *us) | 177 | static int rio_karma_init(struct us_data *us) |
137 | { | 178 | { |
138 | int ret = 0; | 179 | int ret = 0; |
139 | struct karma_data *data = kzalloc(sizeof(struct karma_data), GFP_NOIO); | 180 | struct karma_data *data = kzalloc(sizeof(struct karma_data), GFP_NOIO); |
@@ -153,3 +194,48 @@ int rio_karma_init(struct us_data *us) | |||
153 | out: | 194 | out: |
154 | return ret; | 195 | return ret; |
155 | } | 196 | } |
197 | |||
198 | static int karma_probe(struct usb_interface *intf, | ||
199 | const struct usb_device_id *id) | ||
200 | { | ||
201 | struct us_data *us; | ||
202 | int result; | ||
203 | |||
204 | result = usb_stor_probe1(&us, intf, id, | ||
205 | (id - karma_usb_ids) + karma_unusual_dev_list); | ||
206 | if (result) | ||
207 | return result; | ||
208 | |||
209 | us->transport_name = "Rio Karma/Bulk"; | ||
210 | us->transport = rio_karma_transport; | ||
211 | us->transport_reset = usb_stor_Bulk_reset; | ||
212 | |||
213 | result = usb_stor_probe2(us); | ||
214 | return result; | ||
215 | } | ||
216 | |||
217 | static struct usb_driver karma_driver = { | ||
218 | .name = "ums-karma", | ||
219 | .probe = karma_probe, | ||
220 | .disconnect = usb_stor_disconnect, | ||
221 | .suspend = usb_stor_suspend, | ||
222 | .resume = usb_stor_resume, | ||
223 | .reset_resume = usb_stor_reset_resume, | ||
224 | .pre_reset = usb_stor_pre_reset, | ||
225 | .post_reset = usb_stor_post_reset, | ||
226 | .id_table = karma_usb_ids, | ||
227 | .soft_unbind = 1, | ||
228 | }; | ||
229 | |||
230 | static int __init karma_init(void) | ||
231 | { | ||
232 | return usb_register(&karma_driver); | ||
233 | } | ||
234 | |||
235 | static void __exit karma_exit(void) | ||
236 | { | ||
237 | usb_deregister(&karma_driver); | ||
238 | } | ||
239 | |||
240 | module_init(karma_init); | ||
241 | module_exit(karma_exit); | ||
diff --git a/drivers/usb/storage/karma.h b/drivers/usb/storage/karma.h deleted file mode 100644 index 8a60972af8c5..000000000000 --- a/drivers/usb/storage/karma.h +++ /dev/null | |||
@@ -1,7 +0,0 @@ | |||
1 | #ifndef _KARMA_USB_H | ||
2 | #define _KARMA_USB_H | ||
3 | |||
4 | extern int rio_karma_init(struct us_data *us); | ||
5 | extern int rio_karma_transport(struct scsi_cmnd *srb, struct us_data *us); | ||
6 | |||
7 | #endif | ||
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index bcdb74dfa3db..83e34a6ad59d 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h | |||
@@ -276,13 +276,6 @@ UNUSUAL_DEV( 0x0457, 0x0151, 0x0100, 0x0100, | |||
276 | US_SC_DEVICE, US_PR_DEVICE, NULL, | 276 | US_SC_DEVICE, US_PR_DEVICE, NULL, |
277 | US_FL_NOT_LOCKABLE ), | 277 | US_FL_NOT_LOCKABLE ), |
278 | 278 | ||
279 | #ifdef CONFIG_USB_STORAGE_KARMA | ||
280 | UNUSUAL_DEV( 0x045a, 0x5210, 0x0101, 0x0101, | ||
281 | "Rio", | ||
282 | "Rio Karma", | ||
283 | US_SC_SCSI, US_PR_KARMA, rio_karma_init, 0), | ||
284 | #endif | ||
285 | |||
286 | /* Reported by Tamas Kerecsen <kerecsen@bigfoot.com> | 279 | /* Reported by Tamas Kerecsen <kerecsen@bigfoot.com> |
287 | * Obviously the PROM has not been customized by the VAR; | 280 | * Obviously the PROM has not been customized by the VAR; |
288 | * the Vendor and Product string descriptors are: | 281 | * the Vendor and Product string descriptors are: |
diff --git a/drivers/usb/storage/unusual_karma.h b/drivers/usb/storage/unusual_karma.h new file mode 100644 index 000000000000..12ae3a03e802 --- /dev/null +++ b/drivers/usb/storage/unusual_karma.h | |||
@@ -0,0 +1,26 @@ | |||
1 | /* Unusual Devices File for the Rio Karma | ||
2 | * | ||
3 | * This program is free software; you can redistribute it and/or modify it | ||
4 | * under the terms of the GNU General Public License as published by the | ||
5 | * Free Software Foundation; either version 2, or (at your option) any | ||
6 | * later version. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, but | ||
9 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
11 | * General Public License for more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License along | ||
14 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
15 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
16 | */ | ||
17 | |||
18 | #if defined(CONFIG_USB_STORAGE_KARMA) || \ | ||
19 | defined(CONFIG_USB_STORAGE_KARMA_MODULE) | ||
20 | |||
21 | UNUSUAL_DEV( 0x045a, 0x5210, 0x0101, 0x0101, | ||
22 | "Rio", | ||
23 | "Rio Karma", | ||
24 | US_SC_SCSI, US_PR_KARMA, rio_karma_init, 0), | ||
25 | |||
26 | #endif /* defined(CONFIG_USB_STORAGE_KARMA) || ... */ | ||
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c index cd039c008462..c5abf9bbce16 100644 --- a/drivers/usb/storage/usb.c +++ b/drivers/usb/storage/usb.c | |||
@@ -69,9 +69,6 @@ | |||
69 | #ifdef CONFIG_USB_STORAGE_ONETOUCH | 69 | #ifdef CONFIG_USB_STORAGE_ONETOUCH |
70 | #include "onetouch.h" | 70 | #include "onetouch.h" |
71 | #endif | 71 | #endif |
72 | #ifdef CONFIG_USB_STORAGE_KARMA | ||
73 | #include "karma.h" | ||
74 | #endif | ||
75 | #include "sierra_ms.h" | 72 | #include "sierra_ms.h" |
76 | #include "option_ms.h" | 73 | #include "option_ms.h" |
77 | 74 | ||
@@ -594,15 +591,6 @@ static void get_transport(struct us_data *us) | |||
594 | us->transport = usb_stor_Bulk_transport; | 591 | us->transport = usb_stor_Bulk_transport; |
595 | us->transport_reset = usb_stor_Bulk_reset; | 592 | us->transport_reset = usb_stor_Bulk_reset; |
596 | break; | 593 | break; |
597 | |||
598 | #ifdef CONFIG_USB_STORAGE_KARMA | ||
599 | case US_PR_KARMA: | ||
600 | us->transport_name = "Rio Karma/Bulk"; | ||
601 | us->transport = rio_karma_transport; | ||
602 | us->transport_reset = usb_stor_Bulk_reset; | ||
603 | break; | ||
604 | #endif | ||
605 | |||
606 | } | 594 | } |
607 | } | 595 | } |
608 | 596 | ||
diff --git a/drivers/usb/storage/usual-tables.c b/drivers/usb/storage/usual-tables.c index ad102e8e191b..bce086fcef5e 100644 --- a/drivers/usb/storage/usual-tables.c +++ b/drivers/usb/storage/usual-tables.c | |||
@@ -83,6 +83,7 @@ static struct ignore_entry ignore_ids[] = { | |||
83 | # include "unusual_freecom.h" | 83 | # include "unusual_freecom.h" |
84 | # include "unusual_isd200.h" | 84 | # include "unusual_isd200.h" |
85 | # include "unusual_jumpshot.h" | 85 | # include "unusual_jumpshot.h" |
86 | # include "unusual_karma.h" | ||
86 | # include "unusual_sddr09.h" | 87 | # include "unusual_sddr09.h" |
87 | # include "unusual_sddr55.h" | 88 | # include "unusual_sddr55.h" |
88 | # include "unusual_usbat.h" | 89 | # include "unusual_usbat.h" |