aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2009-02-12 14:47:59 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2009-03-24 19:20:34 -0400
commit70fcc0050733a7cd1b452cfa3de3a9b376412565 (patch)
tree96bcabf7718687324d3f3845f2ae9915d6473a48
parent32d5493eb83a217c3b1eba4b98cd6d19864f71a8 (diff)
usb-storage: make sddr55 a separate module
This patch (as1209) converts usb-storage's sddr55 subdriver into a separate module. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/usb/storage/Kconfig4
-rw-r--r--drivers/usb/storage/Makefile3
-rw-r--r--drivers/usb/storage/sddr55.c92
-rw-r--r--drivers/usb/storage/sddr55.h32
-rw-r--r--drivers/usb/storage/unusual_devs.h32
-rw-r--r--drivers/usb/storage/unusual_sddr55.h44
-rw-r--r--drivers/usb/storage/usb.c12
-rw-r--r--drivers/usb/storage/usual-tables.c1
8 files changed, 139 insertions, 81 deletions
diff --git a/drivers/usb/storage/Kconfig b/drivers/usb/storage/Kconfig
index fc356a770a76..e6cc245257f8 100644
--- a/drivers/usb/storage/Kconfig
+++ b/drivers/usb/storage/Kconfig
@@ -95,12 +95,14 @@ config USB_STORAGE_SDDR09
95 If this driver is compiled as a module, it will be named ums-sddr09. 95 If this driver is compiled as a module, it will be named ums-sddr09.
96 96
97config USB_STORAGE_SDDR55 97config USB_STORAGE_SDDR55
98 bool "SanDisk SDDR-55 SmartMedia support" 98 tristate "SanDisk SDDR-55 SmartMedia support"
99 depends on USB_STORAGE 99 depends on USB_STORAGE
100 help 100 help
101 Say Y here to include additional code to support the Sandisk SDDR-55 101 Say Y here to include additional code to support the Sandisk SDDR-55
102 SmartMedia reader in the USB Mass Storage driver. 102 SmartMedia reader in the USB Mass Storage driver.
103 103
104 If this driver is compiled as a module, it will be named ums-sddr55.
105
104config USB_STORAGE_JUMPSHOT 106config USB_STORAGE_JUMPSHOT
105 bool "Lexar Jumpshot Compact Flash Reader" 107 bool "Lexar Jumpshot Compact Flash Reader"
106 depends on USB_STORAGE 108 depends on USB_STORAGE
diff --git a/drivers/usb/storage/Makefile b/drivers/usb/storage/Makefile
index b47f94e59fdc..5fb7847e41a4 100644
--- a/drivers/usb/storage/Makefile
+++ b/drivers/usb/storage/Makefile
@@ -11,7 +11,6 @@ obj-$(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_USBAT) += shuttle_usbat.o 13usb-storage-obj-$(CONFIG_USB_STORAGE_USBAT) += shuttle_usbat.o
14usb-storage-obj-$(CONFIG_USB_STORAGE_SDDR55) += sddr55.o
15usb-storage-obj-$(CONFIG_USB_STORAGE_FREECOM) += freecom.o 14usb-storage-obj-$(CONFIG_USB_STORAGE_FREECOM) += freecom.o
16usb-storage-obj-$(CONFIG_USB_STORAGE_DATAFAB) += datafab.o 15usb-storage-obj-$(CONFIG_USB_STORAGE_DATAFAB) += datafab.o
17usb-storage-obj-$(CONFIG_USB_STORAGE_JUMPSHOT) += jumpshot.o 16usb-storage-obj-$(CONFIG_USB_STORAGE_JUMPSHOT) += jumpshot.o
@@ -31,6 +30,8 @@ endif
31 30
32obj-$(CONFIG_USB_STORAGE_ISD200) += ums-isd200.o 31obj-$(CONFIG_USB_STORAGE_ISD200) += ums-isd200.o
33obj-$(CONFIG_USB_STORAGE_SDDR09) += ums-sddr09.o 32obj-$(CONFIG_USB_STORAGE_SDDR09) += ums-sddr09.o
33obj-$(CONFIG_USB_STORAGE_SDDR55) += ums-sddr55.o
34 34
35ums-isd200-objs := isd200.o 35ums-isd200-objs := isd200.o
36ums-sddr09-objs := sddr09.o 36ums-sddr09-objs := sddr09.o
37ums-sddr55-objs := sddr55.o
diff --git a/drivers/usb/storage/sddr55.c b/drivers/usb/storage/sddr55.c
index 5a0106ba256c..e97716f8eb02 100644
--- a/drivers/usb/storage/sddr55.c
+++ b/drivers/usb/storage/sddr55.c
@@ -24,6 +24,7 @@
24 24
25#include <linux/jiffies.h> 25#include <linux/jiffies.h>
26#include <linux/errno.h> 26#include <linux/errno.h>
27#include <linux/module.h>
27#include <linux/slab.h> 28#include <linux/slab.h>
28 29
29#include <scsi/scsi.h> 30#include <scsi/scsi.h>
@@ -33,7 +34,45 @@
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 "sddr55.h" 37
38
39/*
40 * The table of devices
41 */
42#define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \
43 vendorName, productName, useProtocol, useTransport, \
44 initFunction, flags) \
45{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \
46 .driver_info = (flags)|(USB_US_TYPE_STOR<<24) }
47
48struct usb_device_id sddr55_usb_ids[] = {
49# include "unusual_sddr55.h"
50 { } /* Terminating entry */
51};
52MODULE_DEVICE_TABLE(usb, sddr55_usb_ids);
53
54#undef UNUSUAL_DEV
55
56/*
57 * The flags table
58 */
59#define UNUSUAL_DEV(idVendor, idProduct, bcdDeviceMin, bcdDeviceMax, \
60 vendor_name, product_name, use_protocol, use_transport, \
61 init_function, Flags) \
62{ \
63 .vendorName = vendor_name, \
64 .productName = product_name, \
65 .useProtocol = use_protocol, \
66 .useTransport = use_transport, \
67 .initFunction = init_function, \
68}
69
70static struct us_unusual_dev sddr55_unusual_dev_list[] = {
71# include "unusual_sddr55.h"
72 { } /* Terminating entry */
73};
74
75#undef UNUSUAL_DEV
37 76
38 77
39#define short_pack(lsb,msb) ( ((u16)(lsb)) | ( ((u16)(msb))<<8 ) ) 78#define short_pack(lsb,msb) ( ((u16)(lsb)) | ( ((u16)(msb))<<8 ) )
@@ -513,7 +552,8 @@ static int sddr55_read_deviceID(struct us_data *us,
513} 552}
514 553
515 554
516int sddr55_reset(struct us_data *us) { 555static int sddr55_reset(struct us_data *us)
556{
517 return 0; 557 return 0;
518} 558}
519 559
@@ -734,7 +774,7 @@ static void sddr55_card_info_destructor(void *extra) {
734/* 774/*
735 * Transport for the Sandisk SDDR-55 775 * Transport for the Sandisk SDDR-55
736 */ 776 */
737int sddr55_transport(struct scsi_cmnd *srb, struct us_data *us) 777static int sddr55_transport(struct scsi_cmnd *srb, struct us_data *us)
738{ 778{
739 int result; 779 int result;
740 static unsigned char inquiry_response[8] = { 780 static unsigned char inquiry_response[8] = {
@@ -931,3 +971,49 @@ int sddr55_transport(struct scsi_cmnd *srb, struct us_data *us)
931 return USB_STOR_TRANSPORT_FAILED; // FIXME: sense buffer? 971 return USB_STOR_TRANSPORT_FAILED; // FIXME: sense buffer?
932} 972}
933 973
974
975static int sddr55_probe(struct usb_interface *intf,
976 const struct usb_device_id *id)
977{
978 struct us_data *us;
979 int result;
980
981 result = usb_stor_probe1(&us, intf, id,
982 (id - sddr55_usb_ids) + sddr55_unusual_dev_list);
983 if (result)
984 return result;
985
986 us->transport_name = "SDDR55";
987 us->transport = sddr55_transport;
988 us->transport_reset = sddr55_reset;
989 us->max_lun = 0;
990
991 result = usb_stor_probe2(us);
992 return result;
993}
994
995static struct usb_driver sddr55_driver = {
996 .name = "ums-sddr55",
997 .probe = sddr55_probe,
998 .disconnect = usb_stor_disconnect,
999 .suspend = usb_stor_suspend,
1000 .resume = usb_stor_resume,
1001 .reset_resume = usb_stor_reset_resume,
1002 .pre_reset = usb_stor_pre_reset,
1003 .post_reset = usb_stor_post_reset,
1004 .id_table = sddr55_usb_ids,
1005 .soft_unbind = 1,
1006};
1007
1008static int __init sddr55_init(void)
1009{
1010 return usb_register(&sddr55_driver);
1011}
1012
1013static void __exit sddr55_exit(void)
1014{
1015 usb_deregister(&sddr55_driver);
1016}
1017
1018module_init(sddr55_init);
1019module_exit(sddr55_exit);
diff --git a/drivers/usb/storage/sddr55.h b/drivers/usb/storage/sddr55.h
deleted file mode 100644
index a815a0470c84..000000000000
--- a/drivers/usb/storage/sddr55.h
+++ /dev/null
@@ -1,32 +0,0 @@
1/* Driver for SanDisk SDDR-55 SmartMedia reader
2 * Header File
3 *
4 * Current development and maintenance by:
5 * (c) 2002 Simon Munton
6 *
7 * See sddr55.c for more explanation
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2, or (at your option) any
12 * later version.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 675 Mass Ave, Cambridge, MA 02139, USA.
22 */
23
24#ifndef _USB_SHUTTLE_EUSB_SDDR55_H
25#define _USB_SHUTTLE_EUSB_SDDR55_H
26
27/* Sandisk SDDR-55 stuff */
28
29extern int sddr55_transport(struct scsi_cmnd *srb, struct us_data *us);
30extern int sddr55_reset(struct us_data *us);
31
32#endif
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
index 83ce1d33554a..50034e141f94 100644
--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -1098,15 +1098,6 @@ UNUSUAL_DEV( 0x07c4, 0xa006, 0x0000, 0xffff,
1098 US_SC_SCSI, US_PR_DATAFAB, NULL, 1098 US_SC_SCSI, US_PR_DATAFAB, NULL,
1099 0 ), 1099 0 ),
1100#endif 1100#endif
1101
1102#ifdef CONFIG_USB_STORAGE_SDDR55
1103/* Contributed by Peter Waechtler */
1104UNUSUAL_DEV( 0x07c4, 0xa103, 0x0000, 0x9999,
1105 "Datafab",
1106 "MDSM-B reader",
1107 US_SC_SCSI, US_PR_SDDR55, NULL,
1108 US_FL_FIX_INQUIRY ),
1109#endif
1110 1101
1111#ifdef CONFIG_USB_STORAGE_DATAFAB 1102#ifdef CONFIG_USB_STORAGE_DATAFAB
1112/* Submitted by Olaf Hering <olh@suse.de> */ 1103/* Submitted by Olaf Hering <olh@suse.de> */
@@ -1116,14 +1107,6 @@ UNUSUAL_DEV( 0x07c4, 0xa109, 0x0000, 0xffff,
1116 US_SC_SCSI, US_PR_DATAFAB, NULL, 1107 US_SC_SCSI, US_PR_DATAFAB, NULL,
1117 0 ), 1108 0 ),
1118#endif 1109#endif
1119#ifdef CONFIG_USB_STORAGE_SDDR55
1120/* SM part - aeb <Andries.Brouwer@cwi.nl> */
1121UNUSUAL_DEV( 0x07c4, 0xa109, 0x0000, 0xffff,
1122 "Datafab Systems, Inc.",
1123 "USB to CF + SM Combo (LC1)",
1124 US_SC_SCSI, US_PR_SDDR55, NULL,
1125 US_FL_SINGLE_LUN ),
1126#endif
1127 1110
1128#ifdef CONFIG_USB_STORAGE_DATAFAB 1111#ifdef CONFIG_USB_STORAGE_DATAFAB
1129/* Reported by Felix Moeller <felix@derklecks.de> 1112/* Reported by Felix Moeller <felix@derklecks.de>
@@ -1348,13 +1331,6 @@ UNUSUAL_DEV( 0x0c0b, 0xa109, 0x0000, 0xffff,
1348 US_SC_SCSI, US_PR_DATAFAB, NULL, 1331 US_SC_SCSI, US_PR_DATAFAB, NULL,
1349 US_FL_SINGLE_LUN ), 1332 US_FL_SINGLE_LUN ),
1350#endif 1333#endif
1351#ifdef CONFIG_USB_STORAGE_SDDR55
1352UNUSUAL_DEV( 0x0c0b, 0xa109, 0x0000, 0xffff,
1353 "Acomdata",
1354 "SM",
1355 US_SC_SCSI, US_PR_SDDR55, NULL,
1356 US_FL_SINGLE_LUN ),
1357#endif
1358 1334
1359UNUSUAL_DEV( 0x0d49, 0x7310, 0x0000, 0x9999, 1335UNUSUAL_DEV( 0x0d49, 0x7310, 0x0000, 0x9999,
1360 "Maxtor", 1336 "Maxtor",
@@ -2041,14 +2017,6 @@ UNUSUAL_DEV( 0x4146, 0xba01, 0x0100, 0x0100,
2041 "Micro Mini 1GB", 2017 "Micro Mini 1GB",
2042 US_SC_DEVICE, US_PR_DEVICE, NULL, US_FL_NOT_LOCKABLE ), 2018 US_SC_DEVICE, US_PR_DEVICE, NULL, US_FL_NOT_LOCKABLE ),
2043 2019
2044#ifdef CONFIG_USB_STORAGE_SDDR55
2045UNUSUAL_DEV( 0x55aa, 0xa103, 0x0000, 0x9999,
2046 "Sandisk",
2047 "ImageMate SDDR55",
2048 US_SC_SCSI, US_PR_SDDR55, NULL,
2049 US_FL_SINGLE_LUN),
2050#endif
2051
2052/* Reported by Andrew Simmons <andrew.simmons@gmail.com> */ 2020/* Reported by Andrew Simmons <andrew.simmons@gmail.com> */
2053UNUSUAL_DEV( 0xed06, 0x4500, 0x0001, 0x0001, 2021UNUSUAL_DEV( 0xed06, 0x4500, 0x0001, 0x0001,
2054 "DataStor", 2022 "DataStor",
diff --git a/drivers/usb/storage/unusual_sddr55.h b/drivers/usb/storage/unusual_sddr55.h
new file mode 100644
index 000000000000..ae81ef7a1cfd
--- /dev/null
+++ b/drivers/usb/storage/unusual_sddr55.h
@@ -0,0 +1,44 @@
1/* Unusual Devices File for SanDisk SDDR-55 SmartMedia reader
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_SDDR55) || \
19 defined(CONFIG_USB_STORAGE_SDDR55_MODULE)
20
21/* Contributed by Peter Waechtler */
22UNUSUAL_DEV( 0x07c4, 0xa103, 0x0000, 0x9999,
23 "Datafab",
24 "MDSM-B reader",
25 US_SC_SCSI, US_PR_SDDR55, NULL,
26 US_FL_FIX_INQUIRY),
27
28/* SM part - aeb <Andries.Brouwer@cwi.nl> */
29UNUSUAL_DEV( 0x07c4, 0xa109, 0x0000, 0xffff,
30 "Datafab Systems, Inc.",
31 "USB to CF + SM Combo (LC1)",
32 US_SC_SCSI, US_PR_SDDR55, NULL, 0),
33
34UNUSUAL_DEV( 0x0c0b, 0xa109, 0x0000, 0xffff,
35 "Acomdata",
36 "SM",
37 US_SC_SCSI, US_PR_SDDR55, NULL, 0),
38
39UNUSUAL_DEV( 0x55aa, 0xa103, 0x0000, 0x9999,
40 "Sandisk",
41 "ImageMate SDDR55",
42 US_SC_SCSI, US_PR_SDDR55, NULL, 0),
43
44#endif /* defined(CONFIG_USB_STORAGE_SDDR55) || ... */
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
index e65cbba452b0..238f271d8171 100644
--- a/drivers/usb/storage/usb.c
+++ b/drivers/usb/storage/usb.c
@@ -69,9 +69,6 @@
69#ifdef CONFIG_USB_STORAGE_USBAT 69#ifdef CONFIG_USB_STORAGE_USBAT
70#include "shuttle_usbat.h" 70#include "shuttle_usbat.h"
71#endif 71#endif
72#ifdef CONFIG_USB_STORAGE_SDDR55
73#include "sddr55.h"
74#endif
75#ifdef CONFIG_USB_STORAGE_FREECOM 72#ifdef CONFIG_USB_STORAGE_FREECOM
76#include "freecom.h" 73#include "freecom.h"
77#endif 74#endif
@@ -625,15 +622,6 @@ static void get_transport(struct us_data *us)
625 break; 622 break;
626#endif 623#endif
627 624
628#ifdef CONFIG_USB_STORAGE_SDDR55
629 case US_PR_SDDR55:
630 us->transport_name = "SDDR55";
631 us->transport = sddr55_transport;
632 us->transport_reset = sddr55_reset;
633 us->max_lun = 0;
634 break;
635#endif
636
637#ifdef CONFIG_USB_STORAGE_FREECOM 625#ifdef CONFIG_USB_STORAGE_FREECOM
638 case US_PR_FREECOM: 626 case US_PR_FREECOM:
639 us->transport_name = "Freecom"; 627 us->transport_name = "Freecom";
diff --git a/drivers/usb/storage/usual-tables.c b/drivers/usb/storage/usual-tables.c
index 61ebddcc9ae0..5f2703fa48e6 100644
--- a/drivers/usb/storage/usual-tables.c
+++ b/drivers/usb/storage/usual-tables.c
@@ -79,6 +79,7 @@ struct ignore_entry {
79static struct ignore_entry ignore_ids[] = { 79static struct ignore_entry ignore_ids[] = {
80# include "unusual_isd200.h" 80# include "unusual_isd200.h"
81# include "unusual_sddr09.h" 81# include "unusual_sddr09.h"
82# include "unusual_sddr55.h"
82 { } /* Terminating entry */ 83 { } /* Terminating entry */
83}; 84};
84 85