aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/storage
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2009-02-12 14:48:11 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2009-03-24 19:20:34 -0400
commit0d62939fab3cf28a23ac6934cec599793d3a1d9d (patch)
tree1493af55ad42675eb1be08161c67294ea8692025 /drivers/usb/storage
parent26d6818f19d0ab018f28a20d699511c1efdf508b (diff)
usb-storage: make freecom a separate module
This patch (as1212) converts usb-storage's freecom 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/Kconfig4
-rw-r--r--drivers/usb/storage/Makefile3
-rw-r--r--drivers/usb/storage/freecom.c95
-rw-r--r--drivers/usb/storage/unusual_devs.h7
-rw-r--r--drivers/usb/storage/unusual_freecom.h (renamed from drivers/usb/storage/freecom.h)24
-rw-r--r--drivers/usb/storage/usb.c12
-rw-r--r--drivers/usb/storage/usual-tables.c1
7 files changed, 104 insertions, 42 deletions
diff --git a/drivers/usb/storage/Kconfig b/drivers/usb/storage/Kconfig
index 44c6b1940f77..14508b8a55fb 100644
--- a/drivers/usb/storage/Kconfig
+++ b/drivers/usb/storage/Kconfig
@@ -39,12 +39,14 @@ config USB_STORAGE_DATAFAB
39 Datafab has a web page at <http://www.datafabusa.com/>. 39 Datafab has a web page at <http://www.datafabusa.com/>.
40 40
41config USB_STORAGE_FREECOM 41config USB_STORAGE_FREECOM
42 bool "Freecom USB/ATAPI Bridge support" 42 tristate "Freecom USB/ATAPI Bridge support"
43 depends on USB_STORAGE 43 depends on USB_STORAGE
44 help 44 help
45 Support for the Freecom USB to IDE/ATAPI adaptor. 45 Support for the Freecom USB to IDE/ATAPI adaptor.
46 Freecom has a web page at <http://www.freecom.de/>. 46 Freecom has a web page at <http://www.freecom.de/>.
47 47
48 If this driver is compiled as a module, it will be named ums-freecom.
49
48config USB_STORAGE_ISD200 50config USB_STORAGE_ISD200
49 tristate "ISD-200 USB/ATA Bridge support" 51 tristate "ISD-200 USB/ATA Bridge support"
50 depends on USB_STORAGE 52 depends on USB_STORAGE
diff --git a/drivers/usb/storage/Makefile b/drivers/usb/storage/Makefile
index 2387368cb7ae..93e91ec3a2d2 100644
--- a/drivers/usb/storage/Makefile
+++ b/drivers/usb/storage/Makefile
@@ -10,7 +10,6 @@ EXTRA_CFLAGS := -Idrivers/scsi
10obj-$(CONFIG_USB_STORAGE) += usb-storage.o 10obj-$(CONFIG_USB_STORAGE) += usb-storage.o
11 11
12usb-storage-obj-$(CONFIG_USB_STORAGE_DEBUG) += debug.o 12usb-storage-obj-$(CONFIG_USB_STORAGE_DEBUG) += debug.o
13usb-storage-obj-$(CONFIG_USB_STORAGE_FREECOM) += freecom.o
14usb-storage-obj-$(CONFIG_USB_STORAGE_DATAFAB) += datafab.o 13usb-storage-obj-$(CONFIG_USB_STORAGE_DATAFAB) += datafab.o
15usb-storage-obj-$(CONFIG_USB_STORAGE_JUMPSHOT) += jumpshot.o 14usb-storage-obj-$(CONFIG_USB_STORAGE_JUMPSHOT) += jumpshot.o
16usb-storage-obj-$(CONFIG_USB_STORAGE_ALAUDA) += alauda.o 15usb-storage-obj-$(CONFIG_USB_STORAGE_ALAUDA) += alauda.o
@@ -27,12 +26,14 @@ else
27endif 26endif
28 27
29obj-$(CONFIG_USB_STORAGE_CYPRESS_ATACB) += ums-cypress.o 28obj-$(CONFIG_USB_STORAGE_CYPRESS_ATACB) += ums-cypress.o
29obj-$(CONFIG_USB_STORAGE_FREECOM) += ums-freecom.o
30obj-$(CONFIG_USB_STORAGE_ISD200) += ums-isd200.o 30obj-$(CONFIG_USB_STORAGE_ISD200) += ums-isd200.o
31obj-$(CONFIG_USB_STORAGE_SDDR09) += ums-sddr09.o 31obj-$(CONFIG_USB_STORAGE_SDDR09) += ums-sddr09.o
32obj-$(CONFIG_USB_STORAGE_SDDR55) += ums-sddr55.o 32obj-$(CONFIG_USB_STORAGE_SDDR55) += ums-sddr55.o
33obj-$(CONFIG_USB_STORAGE_USBAT) += ums-usbat.o 33obj-$(CONFIG_USB_STORAGE_USBAT) += ums-usbat.o
34 34
35ums-cypress-objs := cypress_atacb.o 35ums-cypress-objs := cypress_atacb.o
36ums-freecom-objs := freecom.o
36ums-isd200-objs := isd200.o 37ums-isd200-objs := isd200.o
37ums-sddr09-objs := sddr09.o 38ums-sddr09-objs := sddr09.o
38ums-sddr55-objs := sddr55.o 39ums-sddr55-objs := sddr55.o
diff --git a/drivers/usb/storage/freecom.c b/drivers/usb/storage/freecom.c
index 73ac7262239e..393047b3890d 100644
--- a/drivers/usb/storage/freecom.c
+++ b/drivers/usb/storage/freecom.c
@@ -26,6 +26,7 @@
26 * (http://www.freecom.de/) 26 * (http://www.freecom.de/)
27 */ 27 */
28 28
29#include <linux/module.h>
29#include <scsi/scsi.h> 30#include <scsi/scsi.h>
30#include <scsi/scsi_cmnd.h> 31#include <scsi/scsi_cmnd.h>
31 32
@@ -33,7 +34,6 @@
33#include "transport.h" 34#include "transport.h"
34#include "protocol.h" 35#include "protocol.h"
35#include "debug.h" 36#include "debug.h"
36#include "freecom.h"
37 37
38#ifdef CONFIG_USB_STORAGE_DEBUG 38#ifdef CONFIG_USB_STORAGE_DEBUG
39static void pdump (void *, int); 39static void pdump (void *, int);
@@ -103,6 +103,47 @@ struct freecom_status {
103#define FCM_PACKET_LENGTH 64 103#define FCM_PACKET_LENGTH 64
104#define FCM_STATUS_PACKET_LENGTH 4 104#define FCM_STATUS_PACKET_LENGTH 4
105 105
106static int init_freecom(struct us_data *us);
107
108
109/*
110 * The table of devices
111 */
112#define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \
113 vendorName, productName, useProtocol, useTransport, \
114 initFunction, flags) \
115{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \
116 .driver_info = (flags)|(USB_US_TYPE_STOR<<24) }
117
118struct usb_device_id freecom_usb_ids[] = {
119# include "unusual_freecom.h"
120 { } /* Terminating entry */
121};
122MODULE_DEVICE_TABLE(usb, freecom_usb_ids);
123
124#undef UNUSUAL_DEV
125
126/*
127 * The flags table
128 */
129#define UNUSUAL_DEV(idVendor, idProduct, bcdDeviceMin, bcdDeviceMax, \
130 vendor_name, product_name, use_protocol, use_transport, \
131 init_function, Flags) \
132{ \
133 .vendorName = vendor_name, \
134 .productName = product_name, \
135 .useProtocol = use_protocol, \
136 .useTransport = use_transport, \
137 .initFunction = init_function, \
138}
139
140static struct us_unusual_dev freecom_unusual_dev_list[] = {
141# include "unusual_freecom.h"
142 { } /* Terminating entry */
143};
144
145#undef UNUSUAL_DEV
146
106static int 147static int
107freecom_readdata (struct scsi_cmnd *srb, struct us_data *us, 148freecom_readdata (struct scsi_cmnd *srb, struct us_data *us,
108 unsigned int ipipe, unsigned int opipe, int count) 149 unsigned int ipipe, unsigned int opipe, int count)
@@ -173,7 +214,7 @@ freecom_writedata (struct scsi_cmnd *srb, struct us_data *us,
173 * Transport for the Freecom USB/IDE adaptor. 214 * Transport for the Freecom USB/IDE adaptor.
174 * 215 *
175 */ 216 */
176int freecom_transport(struct scsi_cmnd *srb, struct us_data *us) 217static int freecom_transport(struct scsi_cmnd *srb, struct us_data *us)
177{ 218{
178 struct freecom_cb_wrap *fcb; 219 struct freecom_cb_wrap *fcb;
179 struct freecom_status *fst; 220 struct freecom_status *fst;
@@ -377,8 +418,7 @@ int freecom_transport(struct scsi_cmnd *srb, struct us_data *us)
377 return USB_STOR_TRANSPORT_GOOD; 418 return USB_STOR_TRANSPORT_GOOD;
378} 419}
379 420
380int 421static int init_freecom(struct us_data *us)
381freecom_init (struct us_data *us)
382{ 422{
383 int result; 423 int result;
384 char *buffer = us->iobuf; 424 char *buffer = us->iobuf;
@@ -417,7 +457,7 @@ freecom_init (struct us_data *us)
417 return USB_STOR_TRANSPORT_GOOD; 457 return USB_STOR_TRANSPORT_GOOD;
418} 458}
419 459
420int usb_stor_freecom_reset(struct us_data *us) 460static int usb_stor_freecom_reset(struct us_data *us)
421{ 461{
422 printk (KERN_CRIT "freecom reset called\n"); 462 printk (KERN_CRIT "freecom reset called\n");
423 463
@@ -479,3 +519,48 @@ static void pdump (void *ibuffer, int length)
479} 519}
480#endif 520#endif
481 521
522static int freecom_probe(struct usb_interface *intf,
523 const struct usb_device_id *id)
524{
525 struct us_data *us;
526 int result;
527
528 result = usb_stor_probe1(&us, intf, id,
529 (id - freecom_usb_ids) + freecom_unusual_dev_list);
530 if (result)
531 return result;
532
533 us->transport_name = "Freecom";
534 us->transport = freecom_transport;
535 us->transport_reset = usb_stor_freecom_reset;
536 us->max_lun = 0;
537
538 result = usb_stor_probe2(us);
539 return result;
540}
541
542static struct usb_driver freecom_driver = {
543 .name = "ums-freecom",
544 .probe = freecom_probe,
545 .disconnect = usb_stor_disconnect,
546 .suspend = usb_stor_suspend,
547 .resume = usb_stor_resume,
548 .reset_resume = usb_stor_reset_resume,
549 .pre_reset = usb_stor_pre_reset,
550 .post_reset = usb_stor_post_reset,
551 .id_table = freecom_usb_ids,
552 .soft_unbind = 1,
553};
554
555static int __init freecom_init(void)
556{
557 return usb_register(&freecom_driver);
558}
559
560static void __exit freecom_exit(void)
561{
562 usb_deregister(&freecom_driver);
563}
564
565module_init(freecom_init);
566module_exit(freecom_exit);
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
index 6462c4c54dc0..eef2075cf2eb 100644
--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -958,13 +958,6 @@ UNUSUAL_DEV( 0x0781, 0x0100, 0x0100, 0x0100,
958 US_SC_SCSI, US_PR_CB, NULL, 958 US_SC_SCSI, US_PR_CB, NULL,
959 US_FL_SINGLE_LUN ), 959 US_FL_SINGLE_LUN ),
960 960
961#ifdef CONFIG_USB_STORAGE_FREECOM
962UNUSUAL_DEV( 0x07ab, 0xfc01, 0x0000, 0x9999,
963 "Freecom",
964 "USB-IDE",
965 US_SC_QIC, US_PR_FREECOM, freecom_init, 0),
966#endif
967
968/* Reported by Eero Volotinen <eero@ping-viini.org> */ 961/* Reported by Eero Volotinen <eero@ping-viini.org> */
969UNUSUAL_DEV( 0x07ab, 0xfccd, 0x0000, 0x9999, 962UNUSUAL_DEV( 0x07ab, 0xfccd, 0x0000, 0x9999,
970 "Freecom Technologies", 963 "Freecom Technologies",
diff --git a/drivers/usb/storage/freecom.h b/drivers/usb/storage/unusual_freecom.h
index 20d0fe6ba0c8..375867942391 100644
--- a/drivers/usb/storage/freecom.h
+++ b/drivers/usb/storage/unusual_freecom.h
@@ -1,13 +1,4 @@
1/* Driver for Freecom USB/IDE adaptor 1/* Unusual Devices File for the Freecom USB/IDE adaptor
2 *
3 * Freecom v0.1:
4 *
5 * First release
6 *
7 * Current development and maintenance by:
8 * (c) 2000 David Brown <usb-storage@davidb.org>
9 *
10 * See freecom.c for more explanation
11 * 2 *
12 * This program is free software; you can redistribute it and/or modify it 3 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the 4 * under the terms of the GNU General Public License as published by the
@@ -24,11 +15,12 @@
24 * 675 Mass Ave, Cambridge, MA 02139, USA. 15 * 675 Mass Ave, Cambridge, MA 02139, USA.
25 */ 16 */
26 17
27#ifndef _FREECOM_USB_H 18#if defined(CONFIG_USB_STORAGE_FREECOM) || \
28#define _FREECOM_USB_H 19 defined(CONFIG_USB_STORAGE_FREECOM_MODULE)
29 20
30extern int freecom_transport(struct scsi_cmnd *srb, struct us_data *us); 21UNUSUAL_DEV( 0x07ab, 0xfc01, 0x0000, 0x9999,
31extern int usb_stor_freecom_reset(struct us_data *us); 22 "Freecom",
32extern int freecom_init (struct us_data *us); 23 "USB-IDE",
24 US_SC_QIC, US_PR_FREECOM, init_freecom, 0),
33 25
34#endif 26#endif /* defined(CONFIG_USB_STORAGE_FREECOM) || ... */
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
index 3ad22a8142cc..985275d5d4c5 100644
--- a/drivers/usb/storage/usb.c
+++ b/drivers/usb/storage/usb.c
@@ -66,9 +66,6 @@
66#include "debug.h" 66#include "debug.h"
67#include "initializers.h" 67#include "initializers.h"
68 68
69#ifdef CONFIG_USB_STORAGE_FREECOM
70#include "freecom.h"
71#endif
72#ifdef CONFIG_USB_STORAGE_DATAFAB 69#ifdef CONFIG_USB_STORAGE_DATAFAB
73#include "datafab.h" 70#include "datafab.h"
74#endif 71#endif
@@ -607,15 +604,6 @@ static void get_transport(struct us_data *us)
607 us->transport_reset = usb_stor_Bulk_reset; 604 us->transport_reset = usb_stor_Bulk_reset;
608 break; 605 break;
609 606
610#ifdef CONFIG_USB_STORAGE_FREECOM
611 case US_PR_FREECOM:
612 us->transport_name = "Freecom";
613 us->transport = freecom_transport;
614 us->transport_reset = usb_stor_freecom_reset;
615 us->max_lun = 0;
616 break;
617#endif
618
619#ifdef CONFIG_USB_STORAGE_DATAFAB 607#ifdef CONFIG_USB_STORAGE_DATAFAB
620 case US_PR_DATAFAB: 608 case US_PR_DATAFAB:
621 us->transport_name = "Datafab Bulk-Only"; 609 us->transport_name = "Datafab Bulk-Only";
diff --git a/drivers/usb/storage/usual-tables.c b/drivers/usb/storage/usual-tables.c
index 899a8c8da712..a50f0eefb739 100644
--- a/drivers/usb/storage/usual-tables.c
+++ b/drivers/usb/storage/usual-tables.c
@@ -78,6 +78,7 @@ struct ignore_entry {
78 78
79static struct ignore_entry ignore_ids[] = { 79static struct ignore_entry ignore_ids[] = {
80# include "unusual_cypress.h" 80# include "unusual_cypress.h"
81# include "unusual_freecom.h"
81# include "unusual_isd200.h" 82# include "unusual_isd200.h"
82# include "unusual_sddr09.h" 83# include "unusual_sddr09.h"
83# include "unusual_sddr55.h" 84# include "unusual_sddr55.h"