#include "transport.h"
#include "protocol.h"
#include "debug.h"
+#include "scsiglue.h"
+
+#define DRV_NAME "ums-alauda"
MODULE_DESCRIPTION("Driver for Alauda-based card readers");
MODULE_AUTHOR("Daniel Drake <dsd@gentoo.org>");
return USB_STOR_TRANSPORT_FAILED;
}
+static struct scsi_host_template alauda_host_template;
+
static int alauda_probe(struct usb_interface *intf,
const struct usb_device_id *id)
{
int result;
result = usb_stor_probe1(&us, intf, id,
- (id - alauda_usb_ids) + alauda_unusual_dev_list);
+ (id - alauda_usb_ids) + alauda_unusual_dev_list,
+ &alauda_host_template);
if (result)
return result;
}
static struct usb_driver alauda_driver = {
- .name = "ums-alauda",
+ .name = DRV_NAME,
.probe = alauda_probe,
.disconnect = usb_stor_disconnect,
.suspend = usb_stor_suspend,
.no_dynamic_id = 1,
};
-module_usb_driver(alauda_driver);
+module_usb_stor_driver(alauda_driver, alauda_host_template, DRV_NAME);
#include "scsiglue.h"
#include "debug.h"
+#define DRV_NAME "ums-cypress"
+
MODULE_DESCRIPTION("SAT support for Cypress USB/ATA bridges with ATACB");
MODULE_AUTHOR("Matthieu Castet <castet.matthieu@free.fr>");
MODULE_LICENSE("GPL");
srb->cmd_len = 12;
}
+static struct scsi_host_template cypress_host_template;
static int cypress_probe(struct usb_interface *intf,
const struct usb_device_id *id)
struct usb_device *device;
result = usb_stor_probe1(&us, intf, id,
- (id - cypress_usb_ids) + cypress_unusual_dev_list);
+ (id - cypress_usb_ids) + cypress_unusual_dev_list,
+ &cypress_host_template);
if (result)
return result;
}
static struct usb_driver cypress_driver = {
- .name = "ums-cypress",
+ .name = DRV_NAME,
.probe = cypress_probe,
.disconnect = usb_stor_disconnect,
.suspend = usb_stor_suspend,
.no_dynamic_id = 1,
};
-module_usb_driver(cypress_driver);
+module_usb_stor_driver(cypress_driver, cypress_host_template, DRV_NAME);
#include "transport.h"
#include "protocol.h"
#include "debug.h"
+#include "scsiglue.h"
+
+#define DRV_NAME "ums-datafab"
MODULE_DESCRIPTION("Driver for Datafab USB Compact Flash reader");
MODULE_AUTHOR("Jimmie Mayfield <mayfield+datafab@sackheads.org>");
return USB_STOR_TRANSPORT_FAILED;
}
+static struct scsi_host_template datafab_host_template;
+
static int datafab_probe(struct usb_interface *intf,
const struct usb_device_id *id)
{
int result;
result = usb_stor_probe1(&us, intf, id,
- (id - datafab_usb_ids) + datafab_unusual_dev_list);
+ (id - datafab_usb_ids) + datafab_unusual_dev_list,
+ &datafab_host_template);
if (result)
return result;
}
static struct usb_driver datafab_driver = {
- .name = "ums-datafab",
+ .name = DRV_NAME,
.probe = datafab_probe,
.disconnect = usb_stor_disconnect,
.suspend = usb_stor_suspend,
.no_dynamic_id = 1,
};
-module_usb_driver(datafab_driver);
+module_usb_stor_driver(datafab_driver, datafab_host_template, DRV_NAME);
#include "transport.h"
#include "protocol.h"
#include "debug.h"
+#include "scsiglue.h"
#define SD_INIT1_FIRMWARE "ene-ub6250/sd_init1.bin"
#define SD_INIT2_FIRMWARE "ene-ub6250/sd_init2.bin"
#define MSP_RW_FIRMWARE "ene-ub6250/msp_rdwr.bin"
#define MS_RW_FIRMWARE "ene-ub6250/ms_rdwr.bin"
+#define DRV_NAME "ums_eneub6250"
+
MODULE_DESCRIPTION("Driver for ENE UB6250 reader");
MODULE_LICENSE("GPL");
MODULE_FIRMWARE(SD_INIT1_FIRMWARE);
return 0;
}
+static struct scsi_host_template ene_ub6250_host_template;
static int ene_ub6250_probe(struct usb_interface *intf,
const struct usb_device_id *id)
struct us_data *us;
result = usb_stor_probe1(&us, intf, id,
- (id - ene_ub6250_usb_ids) + ene_ub6250_unusual_dev_list);
+ (id - ene_ub6250_usb_ids) + ene_ub6250_unusual_dev_list,
+ &ene_ub6250_host_template);
if (result)
return result;
#endif
static struct usb_driver ene_ub6250_driver = {
- .name = "ums_eneub6250",
+ .name = DRV_NAME,
.probe = ene_ub6250_probe,
.disconnect = usb_stor_disconnect,
.suspend = usb_stor_suspend,
.no_dynamic_id = 1,
};
-module_usb_driver(ene_ub6250_driver);
+module_usb_stor_driver(ene_ub6250_driver, ene_ub6250_host_template, DRV_NAME);
#include "transport.h"
#include "protocol.h"
#include "debug.h"
+#include "scsiglue.h"
+
+#define DRV_NAME "ums-freecom"
MODULE_DESCRIPTION("Driver for Freecom USB/IDE adaptor");
MODULE_AUTHOR("David Brown <usb-storage@davidb.org>");
}
#endif
+static struct scsi_host_template freecom_host_template;
+
static int freecom_probe(struct usb_interface *intf,
const struct usb_device_id *id)
{
int result;
result = usb_stor_probe1(&us, intf, id,
- (id - freecom_usb_ids) + freecom_unusual_dev_list);
+ (id - freecom_usb_ids) + freecom_unusual_dev_list,
+ &freecom_host_template);
if (result)
return result;
}
static struct usb_driver freecom_driver = {
- .name = "ums-freecom",
+ .name = DRV_NAME,
.probe = freecom_probe,
.disconnect = usb_stor_disconnect,
.suspend = usb_stor_suspend,
.no_dynamic_id = 1,
};
-module_usb_driver(freecom_driver);
+module_usb_stor_driver(freecom_driver, freecom_host_template, DRV_NAME);
#include "debug.h"
#include "scsiglue.h"
+#define DRV_NAME "ums-isd200"
+
MODULE_DESCRIPTION("Driver for In-System Design, Inc. ISD200 ASIC");
MODULE_AUTHOR("Björn Stenberg <bjorn@haxx.se>");
MODULE_LICENSE("GPL");
isd200_srb_set_bufflen(srb, orig_bufflen);
}
+static struct scsi_host_template isd200_host_template;
+
static int isd200_probe(struct usb_interface *intf,
const struct usb_device_id *id)
{
int result;
result = usb_stor_probe1(&us, intf, id,
- (id - isd200_usb_ids) + isd200_unusual_dev_list);
+ (id - isd200_usb_ids) + isd200_unusual_dev_list,
+ &isd200_host_template);
if (result)
return result;
}
static struct usb_driver isd200_driver = {
- .name = "ums-isd200",
+ .name = DRV_NAME,
.probe = isd200_probe,
.disconnect = usb_stor_disconnect,
.suspend = usb_stor_suspend,
.no_dynamic_id = 1,
};
-module_usb_driver(isd200_driver);
+module_usb_stor_driver(isd200_driver, isd200_host_template, DRV_NAME);
#include "transport.h"
#include "protocol.h"
#include "debug.h"
+#include "scsiglue.h"
+#define DRV_NAME "ums-jumpshot"
MODULE_DESCRIPTION("Driver for Lexar \"Jumpshot\" Compact Flash reader");
MODULE_AUTHOR("Jimmie Mayfield <mayfield+usb@sackheads.org>");
return USB_STOR_TRANSPORT_FAILED;
}
+static struct scsi_host_template jumpshot_host_template;
+
static int jumpshot_probe(struct usb_interface *intf,
const struct usb_device_id *id)
{
int result;
result = usb_stor_probe1(&us, intf, id,
- (id - jumpshot_usb_ids) + jumpshot_unusual_dev_list);
+ (id - jumpshot_usb_ids) + jumpshot_unusual_dev_list,
+ &jumpshot_host_template);
if (result)
return result;
}
static struct usb_driver jumpshot_driver = {
- .name = "ums-jumpshot",
+ .name = DRV_NAME,
.probe = jumpshot_probe,
.disconnect = usb_stor_disconnect,
.suspend = usb_stor_suspend,
.no_dynamic_id = 1,
};
-module_usb_driver(jumpshot_driver);
+module_usb_stor_driver(jumpshot_driver, jumpshot_host_template, DRV_NAME);
#include "usb.h"
#include "transport.h"
#include "debug.h"
+#include "scsiglue.h"
+
+#define DRV_NAME "ums-karma"
MODULE_DESCRIPTION("Driver for Rio Karma");
MODULE_AUTHOR("Bob Copeland <me@bobcopeland.com>, Keith Bennett <keith@mcs.st-and.ac.uk>");
return ret;
}
+static struct scsi_host_template karma_host_template;
+
static int karma_probe(struct usb_interface *intf,
const struct usb_device_id *id)
{
int result;
result = usb_stor_probe1(&us, intf, id,
- (id - karma_usb_ids) + karma_unusual_dev_list);
+ (id - karma_usb_ids) + karma_unusual_dev_list,
+ &karma_host_template);
if (result)
return result;
}
static struct usb_driver karma_driver = {
- .name = "ums-karma",
+ .name = DRV_NAME,
.probe = karma_probe,
.disconnect = usb_stor_disconnect,
.suspend = usb_stor_suspend,
.no_dynamic_id = 1,
};
-module_usb_driver(karma_driver);
+module_usb_stor_driver(karma_driver, karma_host_template, DRV_NAME);
#include <linux/usb/input.h>
#include "usb.h"
#include "debug.h"
+#include "scsiglue.h"
+
+#define DRV_NAME "ums-onetouch"
MODULE_DESCRIPTION("Maxtor USB OneTouch hard drive button driver");
MODULE_AUTHOR("Nick Sillik <n.sillik@temple.edu>");
}
}
+static struct scsi_host_template onetouch_host_template;
+
static int onetouch_probe(struct usb_interface *intf,
const struct usb_device_id *id)
{
int result;
result = usb_stor_probe1(&us, intf, id,
- (id - onetouch_usb_ids) + onetouch_unusual_dev_list);
+ (id - onetouch_usb_ids) + onetouch_unusual_dev_list,
+ &onetouch_host_template);
if (result)
return result;
}
static struct usb_driver onetouch_driver = {
- .name = "ums-onetouch",
+ .name = DRV_NAME,
.probe = onetouch_probe,
.disconnect = usb_stor_disconnect,
.suspend = usb_stor_suspend,
.no_dynamic_id = 1,
};
-module_usb_driver(onetouch_driver);
+module_usb_stor_driver(onetouch_driver, onetouch_host_template, DRV_NAME);
#include "transport.h"
#include "protocol.h"
#include "debug.h"
+#include "scsiglue.h"
+
+#define DRV_NAME "ums-realtek"
MODULE_DESCRIPTION("Driver for Realtek USB Card Reader");
MODULE_AUTHOR("wwang <wei_wang@realsil.com.cn>");
return -EIO;
}
+static struct scsi_host_template realtek_cr_host_template;
+
static int realtek_cr_probe(struct usb_interface *intf,
const struct usb_device_id *id)
{
result = usb_stor_probe1(&us, intf, id,
(id - realtek_cr_ids) +
- realtek_cr_unusual_dev_list);
+ realtek_cr_unusual_dev_list,
+ &realtek_cr_host_template);
if (result)
return result;
}
static struct usb_driver realtek_cr_driver = {
- .name = "ums-realtek",
+ .name = DRV_NAME,
.probe = realtek_cr_probe,
.disconnect = usb_stor_disconnect,
/* .suspend = usb_stor_suspend, */
.no_dynamic_id = 1,
};
-module_usb_driver(realtek_cr_driver);
+module_usb_stor_driver(realtek_cr_driver, realtek_cr_host_template, DRV_NAME);
* this defines our host template, with which we'll allocate hosts
*/
-struct scsi_host_template usb_stor_host_template = {
+static const struct scsi_host_template usb_stor_host_template = {
/* basic userland interface stuff */
.name = "usb-storage",
.proc_name = "usb-storage",
.module = THIS_MODULE
};
+void usb_stor_host_template_init(struct scsi_host_template *sht,
+ const char *name, struct module *owner)
+{
+ *sht = usb_stor_host_template;
+ sht->name = name;
+ sht->proc_name = name;
+ sht->module = owner;
+}
+EXPORT_SYMBOL_GPL(usb_stor_host_template_init);
+
/* To Report "Illegal Request: Invalid Field in CDB */
unsigned char usb_stor_sense_invalidCDB[18] = {
[0] = 0x70, /* current error */
extern void usb_stor_report_device_reset(struct us_data *us);
extern void usb_stor_report_bus_reset(struct us_data *us);
+extern void usb_stor_host_template_init(struct scsi_host_template *sht,
+ const char *name, struct module *owner);
extern unsigned char usb_stor_sense_invalidCDB[18];
-extern struct scsi_host_template usb_stor_host_template;
#endif
#include "transport.h"
#include "protocol.h"
#include "debug.h"
+#include "scsiglue.h"
+
+#define DRV_NAME "ums-sddr09"
MODULE_DESCRIPTION("Driver for SanDisk SDDR-09 SmartMedia reader");
MODULE_AUTHOR("Andries Brouwer <aeb@cwi.nl>, Robert Baruch <autophile@starband.net>");
return sddr09_common_init(us);
}
+static struct scsi_host_template sddr09_host_template;
+
static int sddr09_probe(struct usb_interface *intf,
const struct usb_device_id *id)
{
int result;
result = usb_stor_probe1(&us, intf, id,
- (id - sddr09_usb_ids) + sddr09_unusual_dev_list);
+ (id - sddr09_usb_ids) + sddr09_unusual_dev_list,
+ &sddr09_host_template);
if (result)
return result;
}
static struct usb_driver sddr09_driver = {
- .name = "ums-sddr09",
+ .name = DRV_NAME,
.probe = sddr09_probe,
.disconnect = usb_stor_disconnect,
.suspend = usb_stor_suspend,
.no_dynamic_id = 1,
};
-module_usb_driver(sddr09_driver);
+module_usb_stor_driver(sddr09_driver, sddr09_host_template, DRV_NAME);
#include "transport.h"
#include "protocol.h"
#include "debug.h"
+#include "scsiglue.h"
+
+#define DRV_NAME "ums-sddr55"
MODULE_DESCRIPTION("Driver for SanDisk SDDR-55 SmartMedia reader");
MODULE_AUTHOR("Simon Munton");
return USB_STOR_TRANSPORT_FAILED; // FIXME: sense buffer?
}
+static struct scsi_host_template sddr55_host_template;
static int sddr55_probe(struct usb_interface *intf,
const struct usb_device_id *id)
int result;
result = usb_stor_probe1(&us, intf, id,
- (id - sddr55_usb_ids) + sddr55_unusual_dev_list);
+ (id - sddr55_usb_ids) + sddr55_unusual_dev_list,
+ &sddr55_host_template);
if (result)
return result;
}
static struct usb_driver sddr55_driver = {
- .name = "ums-sddr55",
+ .name = DRV_NAME,
.probe = sddr55_probe,
.disconnect = usb_stor_disconnect,
.suspend = usb_stor_suspend,
.no_dynamic_id = 1,
};
-module_usb_driver(sddr55_driver);
+module_usb_stor_driver(sddr55_driver, sddr55_host_template, DRV_NAME);
#include "transport.h"
#include "protocol.h"
#include "debug.h"
+#include "scsiglue.h"
+
+#define DRV_NAME "ums-usbat"
MODULE_DESCRIPTION("Driver for SCM Microsystems (a.k.a. Shuttle) USB-ATAPI cable");
MODULE_AUTHOR("Daniel Drake <dsd@gentoo.org>, Robert Baruch <autophile@starband.net>");
return init_usbat(us, USBAT_DEV_FLASH);
}
+static struct scsi_host_template usbat_host_template;
+
static int usbat_probe(struct usb_interface *intf,
const struct usb_device_id *id)
{
int result;
result = usb_stor_probe1(&us, intf, id,
- (id - usbat_usb_ids) + usbat_unusual_dev_list);
+ (id - usbat_usb_ids) + usbat_unusual_dev_list,
+ &usbat_host_template);
if (result)
return result;
}
static struct usb_driver usbat_driver = {
- .name = "ums-usbat",
+ .name = DRV_NAME,
.probe = usbat_probe,
.disconnect = usb_stor_disconnect,
.suspend = usb_stor_suspend,
.no_dynamic_id = 1,
};
-module_usb_driver(usbat_driver);
+module_usb_stor_driver(usbat_driver, usbat_host_template, DRV_NAME);
#include "uas-detect.h"
#endif
+#define DRV_NAME "usb-storage"
+
/* Some informational data */
MODULE_AUTHOR("Matthew Dharm <mdharm-usb@one-eyed-alien.net>");
MODULE_DESCRIPTION("USB Mass Storage driver for Linux");
int usb_stor_probe1(struct us_data **pus,
struct usb_interface *intf,
const struct usb_device_id *id,
- struct us_unusual_dev *unusual_dev)
+ struct us_unusual_dev *unusual_dev,
+ struct scsi_host_template *sht)
{
struct Scsi_Host *host;
struct us_data *us;
* Ask the SCSI layer to allocate a host structure, with extra
* space at the end for our private us_data structure.
*/
- host = scsi_host_alloc(&usb_stor_host_template, sizeof(*us));
+ host = scsi_host_alloc(sht, sizeof(*us));
if (!host) {
dev_warn(&intf->dev, "Unable to allocate the scsi host\n");
return -ENOMEM;
}
EXPORT_SYMBOL_GPL(usb_stor_disconnect);
+static struct scsi_host_template usb_stor_host_template;
+
/* The main probe routine for standard devices */
static int storage_probe(struct usb_interface *intf,
const struct usb_device_id *id)
id->idVendor, id->idProduct);
}
- result = usb_stor_probe1(&us, intf, id, unusual_dev);
+ result = usb_stor_probe1(&us, intf, id, unusual_dev,
+ &usb_stor_host_template);
if (result)
return result;
}
static struct usb_driver usb_storage_driver = {
- .name = "usb-storage",
+ .name = DRV_NAME,
.probe = storage_probe,
.disconnect = usb_stor_disconnect,
.suspend = usb_stor_suspend,
.soft_unbind = 1,
};
-module_usb_driver(usb_storage_driver);
+module_usb_stor_driver(usb_storage_driver, usb_stor_host_template, DRV_NAME);
extern int usb_stor_probe1(struct us_data **pus,
struct usb_interface *intf,
const struct usb_device_id *id,
- struct us_unusual_dev *unusual_dev);
+ struct us_unusual_dev *unusual_dev,
+ struct scsi_host_template *sht);
extern int usb_stor_probe2(struct us_data *us);
extern void usb_stor_disconnect(struct usb_interface *intf);
extern void usb_stor_adjust_quirks(struct usb_device *dev,
unsigned long *fflags);
+#define module_usb_stor_driver(__driver, __sht, __name) \
+static int __init __driver##_init(void) \
+{ \
+ usb_stor_host_template_init(&(__sht), __name, THIS_MODULE); \
+ return usb_register(&(__driver)); \
+} \
+module_init(__driver##_init); \
+static void __exit __driver##_exit(void) \
+{ \
+ usb_deregister(&(__driver)); \
+} \
+module_exit(__driver##_exit)
+
#endif