提交 70fcc005 编写于 作者: A Alan Stern 提交者: Greg Kroah-Hartman

usb-storage: make sddr55 a separate module

This patch (as1209) converts usb-storage's sddr55 subdriver into a
separate module.
Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 32d5493e
...@@ -95,12 +95,14 @@ config USB_STORAGE_SDDR09 ...@@ -95,12 +95,14 @@ config USB_STORAGE_SDDR09
If this driver is compiled as a module, it will be named ums-sddr09. If this driver is compiled as a module, it will be named ums-sddr09.
config USB_STORAGE_SDDR55 config USB_STORAGE_SDDR55
bool "SanDisk SDDR-55 SmartMedia support" tristate "SanDisk SDDR-55 SmartMedia support"
depends on USB_STORAGE depends on USB_STORAGE
help help
Say Y here to include additional code to support the Sandisk SDDR-55 Say Y here to include additional code to support the Sandisk SDDR-55
SmartMedia reader in the USB Mass Storage driver. SmartMedia reader in the USB Mass Storage driver.
If this driver is compiled as a module, it will be named ums-sddr55.
config USB_STORAGE_JUMPSHOT config USB_STORAGE_JUMPSHOT
bool "Lexar Jumpshot Compact Flash Reader" bool "Lexar Jumpshot Compact Flash Reader"
depends on USB_STORAGE depends on USB_STORAGE
......
...@@ -11,7 +11,6 @@ obj-$(CONFIG_USB_STORAGE) += usb-storage.o ...@@ -11,7 +11,6 @@ obj-$(CONFIG_USB_STORAGE) += usb-storage.o
usb-storage-obj-$(CONFIG_USB_STORAGE_DEBUG) += debug.o usb-storage-obj-$(CONFIG_USB_STORAGE_DEBUG) += debug.o
usb-storage-obj-$(CONFIG_USB_STORAGE_USBAT) += shuttle_usbat.o usb-storage-obj-$(CONFIG_USB_STORAGE_USBAT) += shuttle_usbat.o
usb-storage-obj-$(CONFIG_USB_STORAGE_SDDR55) += sddr55.o
usb-storage-obj-$(CONFIG_USB_STORAGE_FREECOM) += freecom.o usb-storage-obj-$(CONFIG_USB_STORAGE_FREECOM) += freecom.o
usb-storage-obj-$(CONFIG_USB_STORAGE_DATAFAB) += datafab.o usb-storage-obj-$(CONFIG_USB_STORAGE_DATAFAB) += datafab.o
usb-storage-obj-$(CONFIG_USB_STORAGE_JUMPSHOT) += jumpshot.o usb-storage-obj-$(CONFIG_USB_STORAGE_JUMPSHOT) += jumpshot.o
...@@ -31,6 +30,8 @@ endif ...@@ -31,6 +30,8 @@ endif
obj-$(CONFIG_USB_STORAGE_ISD200) += ums-isd200.o obj-$(CONFIG_USB_STORAGE_ISD200) += ums-isd200.o
obj-$(CONFIG_USB_STORAGE_SDDR09) += ums-sddr09.o obj-$(CONFIG_USB_STORAGE_SDDR09) += ums-sddr09.o
obj-$(CONFIG_USB_STORAGE_SDDR55) += ums-sddr55.o
ums-isd200-objs := isd200.o ums-isd200-objs := isd200.o
ums-sddr09-objs := sddr09.o ums-sddr09-objs := sddr09.o
ums-sddr55-objs := sddr55.o
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <linux/jiffies.h> #include <linux/jiffies.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/module.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <scsi/scsi.h> #include <scsi/scsi.h>
...@@ -33,7 +34,45 @@ ...@@ -33,7 +34,45 @@
#include "transport.h" #include "transport.h"
#include "protocol.h" #include "protocol.h"
#include "debug.h" #include "debug.h"
#include "sddr55.h"
/*
* The table of devices
*/
#define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \
vendorName, productName, useProtocol, useTransport, \
initFunction, flags) \
{ USB_DEVICE_VER(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax), \
.driver_info = (flags)|(USB_US_TYPE_STOR<<24) }
struct usb_device_id sddr55_usb_ids[] = {
# include "unusual_sddr55.h"
{ } /* Terminating entry */
};
MODULE_DEVICE_TABLE(usb, sddr55_usb_ids);
#undef UNUSUAL_DEV
/*
* The flags table
*/
#define UNUSUAL_DEV(idVendor, idProduct, bcdDeviceMin, bcdDeviceMax, \
vendor_name, product_name, use_protocol, use_transport, \
init_function, Flags) \
{ \
.vendorName = vendor_name, \
.productName = product_name, \
.useProtocol = use_protocol, \
.useTransport = use_transport, \
.initFunction = init_function, \
}
static struct us_unusual_dev sddr55_unusual_dev_list[] = {
# include "unusual_sddr55.h"
{ } /* Terminating entry */
};
#undef UNUSUAL_DEV
#define short_pack(lsb,msb) ( ((u16)(lsb)) | ( ((u16)(msb))<<8 ) ) #define short_pack(lsb,msb) ( ((u16)(lsb)) | ( ((u16)(msb))<<8 ) )
...@@ -513,7 +552,8 @@ static int sddr55_read_deviceID(struct us_data *us, ...@@ -513,7 +552,8 @@ static int sddr55_read_deviceID(struct us_data *us,
} }
int sddr55_reset(struct us_data *us) { static int sddr55_reset(struct us_data *us)
{
return 0; return 0;
} }
...@@ -734,7 +774,7 @@ static void sddr55_card_info_destructor(void *extra) { ...@@ -734,7 +774,7 @@ static void sddr55_card_info_destructor(void *extra) {
/* /*
* Transport for the Sandisk SDDR-55 * Transport for the Sandisk SDDR-55
*/ */
int sddr55_transport(struct scsi_cmnd *srb, struct us_data *us) static int sddr55_transport(struct scsi_cmnd *srb, struct us_data *us)
{ {
int result; int result;
static unsigned char inquiry_response[8] = { static unsigned char inquiry_response[8] = {
...@@ -931,3 +971,49 @@ int sddr55_transport(struct scsi_cmnd *srb, struct us_data *us) ...@@ -931,3 +971,49 @@ int sddr55_transport(struct scsi_cmnd *srb, struct us_data *us)
return USB_STOR_TRANSPORT_FAILED; // FIXME: sense buffer? return USB_STOR_TRANSPORT_FAILED; // FIXME: sense buffer?
} }
static int sddr55_probe(struct usb_interface *intf,
const struct usb_device_id *id)
{
struct us_data *us;
int result;
result = usb_stor_probe1(&us, intf, id,
(id - sddr55_usb_ids) + sddr55_unusual_dev_list);
if (result)
return result;
us->transport_name = "SDDR55";
us->transport = sddr55_transport;
us->transport_reset = sddr55_reset;
us->max_lun = 0;
result = usb_stor_probe2(us);
return result;
}
static struct usb_driver sddr55_driver = {
.name = "ums-sddr55",
.probe = sddr55_probe,
.disconnect = usb_stor_disconnect,
.suspend = usb_stor_suspend,
.resume = usb_stor_resume,
.reset_resume = usb_stor_reset_resume,
.pre_reset = usb_stor_pre_reset,
.post_reset = usb_stor_post_reset,
.id_table = sddr55_usb_ids,
.soft_unbind = 1,
};
static int __init sddr55_init(void)
{
return usb_register(&sddr55_driver);
}
static void __exit sddr55_exit(void)
{
usb_deregister(&sddr55_driver);
}
module_init(sddr55_init);
module_exit(sddr55_exit);
...@@ -1098,15 +1098,6 @@ UNUSUAL_DEV( 0x07c4, 0xa006, 0x0000, 0xffff, ...@@ -1098,15 +1098,6 @@ UNUSUAL_DEV( 0x07c4, 0xa006, 0x0000, 0xffff,
US_SC_SCSI, US_PR_DATAFAB, NULL, US_SC_SCSI, US_PR_DATAFAB, NULL,
0 ), 0 ),
#endif #endif
#ifdef CONFIG_USB_STORAGE_SDDR55
/* Contributed by Peter Waechtler */
UNUSUAL_DEV( 0x07c4, 0xa103, 0x0000, 0x9999,
"Datafab",
"MDSM-B reader",
US_SC_SCSI, US_PR_SDDR55, NULL,
US_FL_FIX_INQUIRY ),
#endif
#ifdef CONFIG_USB_STORAGE_DATAFAB #ifdef CONFIG_USB_STORAGE_DATAFAB
/* Submitted by Olaf Hering <olh@suse.de> */ /* Submitted by Olaf Hering <olh@suse.de> */
...@@ -1116,14 +1107,6 @@ UNUSUAL_DEV( 0x07c4, 0xa109, 0x0000, 0xffff, ...@@ -1116,14 +1107,6 @@ UNUSUAL_DEV( 0x07c4, 0xa109, 0x0000, 0xffff,
US_SC_SCSI, US_PR_DATAFAB, NULL, US_SC_SCSI, US_PR_DATAFAB, NULL,
0 ), 0 ),
#endif #endif
#ifdef CONFIG_USB_STORAGE_SDDR55
/* SM part - aeb <Andries.Brouwer@cwi.nl> */
UNUSUAL_DEV( 0x07c4, 0xa109, 0x0000, 0xffff,
"Datafab Systems, Inc.",
"USB to CF + SM Combo (LC1)",
US_SC_SCSI, US_PR_SDDR55, NULL,
US_FL_SINGLE_LUN ),
#endif
#ifdef CONFIG_USB_STORAGE_DATAFAB #ifdef CONFIG_USB_STORAGE_DATAFAB
/* Reported by Felix Moeller <felix@derklecks.de> /* Reported by Felix Moeller <felix@derklecks.de>
...@@ -1348,13 +1331,6 @@ UNUSUAL_DEV( 0x0c0b, 0xa109, 0x0000, 0xffff, ...@@ -1348,13 +1331,6 @@ UNUSUAL_DEV( 0x0c0b, 0xa109, 0x0000, 0xffff,
US_SC_SCSI, US_PR_DATAFAB, NULL, US_SC_SCSI, US_PR_DATAFAB, NULL,
US_FL_SINGLE_LUN ), US_FL_SINGLE_LUN ),
#endif #endif
#ifdef CONFIG_USB_STORAGE_SDDR55
UNUSUAL_DEV( 0x0c0b, 0xa109, 0x0000, 0xffff,
"Acomdata",
"SM",
US_SC_SCSI, US_PR_SDDR55, NULL,
US_FL_SINGLE_LUN ),
#endif
UNUSUAL_DEV( 0x0d49, 0x7310, 0x0000, 0x9999, UNUSUAL_DEV( 0x0d49, 0x7310, 0x0000, 0x9999,
"Maxtor", "Maxtor",
...@@ -2041,14 +2017,6 @@ UNUSUAL_DEV( 0x4146, 0xba01, 0x0100, 0x0100, ...@@ -2041,14 +2017,6 @@ UNUSUAL_DEV( 0x4146, 0xba01, 0x0100, 0x0100,
"Micro Mini 1GB", "Micro Mini 1GB",
US_SC_DEVICE, US_PR_DEVICE, NULL, US_FL_NOT_LOCKABLE ), US_SC_DEVICE, US_PR_DEVICE, NULL, US_FL_NOT_LOCKABLE ),
#ifdef CONFIG_USB_STORAGE_SDDR55
UNUSUAL_DEV( 0x55aa, 0xa103, 0x0000, 0x9999,
"Sandisk",
"ImageMate SDDR55",
US_SC_SCSI, US_PR_SDDR55, NULL,
US_FL_SINGLE_LUN),
#endif
/* Reported by Andrew Simmons <andrew.simmons@gmail.com> */ /* Reported by Andrew Simmons <andrew.simmons@gmail.com> */
UNUSUAL_DEV( 0xed06, 0x4500, 0x0001, 0x0001, UNUSUAL_DEV( 0xed06, 0x4500, 0x0001, 0x0001,
"DataStor", "DataStor",
......
/* Driver for SanDisk SDDR-55 SmartMedia reader /* Unusual Devices File for SanDisk SDDR-55 SmartMedia reader
* Header File
*
* Current development and maintenance by:
* (c) 2002 Simon Munton
*
* See sddr55.c for more explanation
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the * under the terms of the GNU General Public License as published by the
...@@ -21,12 +15,30 @@ ...@@ -21,12 +15,30 @@
* 675 Mass Ave, Cambridge, MA 02139, USA. * 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#ifndef _USB_SHUTTLE_EUSB_SDDR55_H #if defined(CONFIG_USB_STORAGE_SDDR55) || \
#define _USB_SHUTTLE_EUSB_SDDR55_H defined(CONFIG_USB_STORAGE_SDDR55_MODULE)
/* Contributed by Peter Waechtler */
UNUSUAL_DEV( 0x07c4, 0xa103, 0x0000, 0x9999,
"Datafab",
"MDSM-B reader",
US_SC_SCSI, US_PR_SDDR55, NULL,
US_FL_FIX_INQUIRY),
/* SM part - aeb <Andries.Brouwer@cwi.nl> */
UNUSUAL_DEV( 0x07c4, 0xa109, 0x0000, 0xffff,
"Datafab Systems, Inc.",
"USB to CF + SM Combo (LC1)",
US_SC_SCSI, US_PR_SDDR55, NULL, 0),
/* Sandisk SDDR-55 stuff */ UNUSUAL_DEV( 0x0c0b, 0xa109, 0x0000, 0xffff,
"Acomdata",
"SM",
US_SC_SCSI, US_PR_SDDR55, NULL, 0),
extern int sddr55_transport(struct scsi_cmnd *srb, struct us_data *us); UNUSUAL_DEV( 0x55aa, 0xa103, 0x0000, 0x9999,
extern int sddr55_reset(struct us_data *us); "Sandisk",
"ImageMate SDDR55",
US_SC_SCSI, US_PR_SDDR55, NULL, 0),
#endif #endif /* defined(CONFIG_USB_STORAGE_SDDR55) || ... */
...@@ -69,9 +69,6 @@ ...@@ -69,9 +69,6 @@
#ifdef CONFIG_USB_STORAGE_USBAT #ifdef CONFIG_USB_STORAGE_USBAT
#include "shuttle_usbat.h" #include "shuttle_usbat.h"
#endif #endif
#ifdef CONFIG_USB_STORAGE_SDDR55
#include "sddr55.h"
#endif
#ifdef CONFIG_USB_STORAGE_FREECOM #ifdef CONFIG_USB_STORAGE_FREECOM
#include "freecom.h" #include "freecom.h"
#endif #endif
...@@ -625,15 +622,6 @@ static void get_transport(struct us_data *us) ...@@ -625,15 +622,6 @@ static void get_transport(struct us_data *us)
break; break;
#endif #endif
#ifdef CONFIG_USB_STORAGE_SDDR55
case US_PR_SDDR55:
us->transport_name = "SDDR55";
us->transport = sddr55_transport;
us->transport_reset = sddr55_reset;
us->max_lun = 0;
break;
#endif
#ifdef CONFIG_USB_STORAGE_FREECOM #ifdef CONFIG_USB_STORAGE_FREECOM
case US_PR_FREECOM: case US_PR_FREECOM:
us->transport_name = "Freecom"; us->transport_name = "Freecom";
......
...@@ -79,6 +79,7 @@ struct ignore_entry { ...@@ -79,6 +79,7 @@ struct ignore_entry {
static struct ignore_entry ignore_ids[] = { static struct ignore_entry ignore_ids[] = {
# include "unusual_isd200.h" # include "unusual_isd200.h"
# include "unusual_sddr09.h" # include "unusual_sddr09.h"
# include "unusual_sddr55.h"
{ } /* Terminating entry */ { } /* Terminating entry */
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册