summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/usb/storage/alauda.c12
-rw-r--r--drivers/usb/storage/cypress_atacb.c10
-rw-r--r--drivers/usb/storage/datafab.c12
-rw-r--r--drivers/usb/storage/ene_ub6250.c11
-rw-r--r--drivers/usb/storage/freecom.c12
-rw-r--r--drivers/usb/storage/isd200.c11
-rw-r--r--drivers/usb/storage/jumpshot.c11
-rw-r--r--drivers/usb/storage/karma.c12
-rw-r--r--drivers/usb/storage/onetouch.c12
-rw-r--r--drivers/usb/storage/realtek_cr.c12
-rw-r--r--drivers/usb/storage/scsiglue.c12
-rw-r--r--drivers/usb/storage/scsiglue.h3
-rw-r--r--drivers/usb/storage/sddr09.c12
-rw-r--r--drivers/usb/storage/sddr55.c11
-rw-r--r--drivers/usb/storage/shuttle_usbat.c12
-rw-r--r--drivers/usb/storage/usb.c16
-rw-r--r--drivers/usb/storage/usb.h16
17 files changed, 150 insertions, 47 deletions
diff --git a/drivers/usb/storage/alauda.c b/drivers/usb/storage/alauda.c
index 4b55ab66a534..171fa7d793bc 100644
--- a/drivers/usb/storage/alauda.c
+++ b/drivers/usb/storage/alauda.c
@@ -42,6 +42,9 @@
#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>");
@@ -1232,6 +1235,8 @@ static int alauda_transport(struct scsi_cmnd *srb, struct us_data *us)
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)
{
@@ -1239,7 +1244,8 @@ static int alauda_probe(struct usb_interface *intf,
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;
@@ -1253,7 +1259,7 @@ static int alauda_probe(struct usb_interface *intf,
}
static struct usb_driver alauda_driver = {
- .name = "ums-alauda",
+ .name = DRV_NAME,
.probe = alauda_probe,
.disconnect = usb_stor_disconnect,
.suspend = usb_stor_suspend,
@@ -1266,4 +1272,4 @@ static struct usb_driver alauda_driver = {
.no_dynamic_id = 1,
};
-module_usb_driver(alauda_driver);
+module_usb_stor_driver(alauda_driver, alauda_host_template, DRV_NAME);
diff --git a/drivers/usb/storage/cypress_atacb.c b/drivers/usb/storage/cypress_atacb.c
index b3466d1395f2..c80d3dec9a34 100644
--- a/drivers/usb/storage/cypress_atacb.c
+++ b/drivers/usb/storage/cypress_atacb.c
@@ -30,6 +30,8 @@
#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");
@@ -241,6 +243,7 @@ end:
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)
@@ -250,7 +253,8 @@ static int cypress_probe(struct usb_interface *intf,
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;
@@ -273,7 +277,7 @@ static int cypress_probe(struct usb_interface *intf,
}
static struct usb_driver cypress_driver = {
- .name = "ums-cypress",
+ .name = DRV_NAME,
.probe = cypress_probe,
.disconnect = usb_stor_disconnect,
.suspend = usb_stor_suspend,
@@ -286,4 +290,4 @@ static struct usb_driver cypress_driver = {
.no_dynamic_id = 1,
};
-module_usb_driver(cypress_driver);
+module_usb_stor_driver(cypress_driver, cypress_host_template, DRV_NAME);
diff --git a/drivers/usb/storage/datafab.c b/drivers/usb/storage/datafab.c
index 7b17c2169812..aa4f51944a4a 100644
--- a/drivers/usb/storage/datafab.c
+++ b/drivers/usb/storage/datafab.c
@@ -59,6 +59,9 @@
#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>");
@@ -721,6 +724,8 @@ static int datafab_transport(struct scsi_cmnd *srb, struct us_data *us)
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)
{
@@ -728,7 +733,8 @@ static int datafab_probe(struct usb_interface *intf,
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;
@@ -742,7 +748,7 @@ static int datafab_probe(struct usb_interface *intf,
}
static struct usb_driver datafab_driver = {
- .name = "ums-datafab",
+ .name = DRV_NAME,
.probe = datafab_probe,
.disconnect = usb_stor_disconnect,
.suspend = usb_stor_suspend,
@@ -755,4 +761,4 @@ static struct usb_driver datafab_driver = {
.no_dynamic_id = 1,
};
-module_usb_driver(datafab_driver);
+module_usb_stor_driver(datafab_driver, datafab_host_template, DRV_NAME);
diff --git a/drivers/usb/storage/ene_ub6250.c b/drivers/usb/storage/ene_ub6250.c
index 56f782bef36b..f3cf4cecd2b7 100644
--- a/drivers/usb/storage/ene_ub6250.c
+++ b/drivers/usb/storage/ene_ub6250.c
@@ -28,6 +28,7 @@
#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"
@@ -36,6 +37,8 @@
#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);
@@ -2307,6 +2310,7 @@ static int ene_transport(struct scsi_cmnd *srb, struct us_data *us)
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)
@@ -2316,7 +2320,8 @@ static int ene_ub6250_probe(struct usb_interface *intf,
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;
@@ -2404,7 +2409,7 @@ static int ene_ub6250_reset_resume(struct usb_interface *iface)
#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,
@@ -2417,4 +2422,4 @@ static struct usb_driver ene_ub6250_driver = {
.no_dynamic_id = 1,
};
-module_usb_driver(ene_ub6250_driver);
+module_usb_stor_driver(ene_ub6250_driver, ene_ub6250_host_template, DRV_NAME);
diff --git a/drivers/usb/storage/freecom.c b/drivers/usb/storage/freecom.c
index ef16068b7087..3f2b08966b9d 100644
--- a/drivers/usb/storage/freecom.c
+++ b/drivers/usb/storage/freecom.c
@@ -34,6 +34,9 @@
#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>");
@@ -523,6 +526,8 @@ static void pdump(struct us_data *us, void *ibuffer, int length)
}
#endif
+static struct scsi_host_template freecom_host_template;
+
static int freecom_probe(struct usb_interface *intf,
const struct usb_device_id *id)
{
@@ -530,7 +535,8 @@ static int freecom_probe(struct usb_interface *intf,
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;
@@ -544,7 +550,7 @@ static int freecom_probe(struct usb_interface *intf,
}
static struct usb_driver freecom_driver = {
- .name = "ums-freecom",
+ .name = DRV_NAME,
.probe = freecom_probe,
.disconnect = usb_stor_disconnect,
.suspend = usb_stor_suspend,
@@ -557,4 +563,4 @@ static struct usb_driver freecom_driver = {
.no_dynamic_id = 1,
};
-module_usb_driver(freecom_driver);
+module_usb_stor_driver(freecom_driver, freecom_host_template, DRV_NAME);
diff --git a/drivers/usb/storage/isd200.c b/drivers/usb/storage/isd200.c
index 076178645ba4..1bac215202d2 100644
--- a/drivers/usb/storage/isd200.c
+++ b/drivers/usb/storage/isd200.c
@@ -60,6 +60,8 @@
#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");
@@ -1537,6 +1539,8 @@ static void isd200_ata_command(struct scsi_cmnd *srb, struct us_data *us)
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)
{
@@ -1544,7 +1548,8 @@ static int isd200_probe(struct usb_interface *intf,
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;
@@ -1556,7 +1561,7 @@ static int isd200_probe(struct usb_interface *intf,
}
static struct usb_driver isd200_driver = {
- .name = "ums-isd200",
+ .name = DRV_NAME,
.probe = isd200_probe,
.disconnect = usb_stor_disconnect,
.suspend = usb_stor_suspend,
@@ -1569,4 +1574,4 @@ static struct usb_driver isd200_driver = {
.no_dynamic_id = 1,
};
-module_usb_driver(isd200_driver);
+module_usb_stor_driver(isd200_driver, isd200_host_template, DRV_NAME);
diff --git a/drivers/usb/storage/jumpshot.c b/drivers/usb/storage/jumpshot.c
index 563078be6547..ee613e258db0 100644
--- a/drivers/usb/storage/jumpshot.c
+++ b/drivers/usb/storage/jumpshot.c
@@ -56,7 +56,9 @@
#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>");
@@ -647,6 +649,8 @@ static int jumpshot_transport(struct scsi_cmnd *srb, struct us_data *us)
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)
{
@@ -654,7 +658,8 @@ static int jumpshot_probe(struct usb_interface *intf,
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;
@@ -668,7 +673,7 @@ static int jumpshot_probe(struct usb_interface *intf,
}
static struct usb_driver jumpshot_driver = {
- .name = "ums-jumpshot",
+ .name = DRV_NAME,
.probe = jumpshot_probe,
.disconnect = usb_stor_disconnect,
.suspend = usb_stor_suspend,
@@ -681,4 +686,4 @@ static struct usb_driver jumpshot_driver = {
.no_dynamic_id = 1,
};
-module_usb_driver(jumpshot_driver);
+module_usb_stor_driver(jumpshot_driver, jumpshot_host_template, DRV_NAME);
diff --git a/drivers/usb/storage/karma.c b/drivers/usb/storage/karma.c
index 94d16ee5e84b..ae201e69475c 100644
--- a/drivers/usb/storage/karma.c
+++ b/drivers/usb/storage/karma.c
@@ -28,6 +28,9 @@
#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>");
@@ -200,6 +203,8 @@ out:
return ret;
}
+static struct scsi_host_template karma_host_template;
+
static int karma_probe(struct usb_interface *intf,
const struct usb_device_id *id)
{
@@ -207,7 +212,8 @@ static int karma_probe(struct usb_interface *intf,
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;
@@ -220,7 +226,7 @@ static int karma_probe(struct usb_interface *intf,
}
static struct usb_driver karma_driver = {
- .name = "ums-karma",
+ .name = DRV_NAME,
.probe = karma_probe,
.disconnect = usb_stor_disconnect,
.suspend = usb_stor_suspend,
@@ -233,4 +239,4 @@ static struct usb_driver karma_driver = {
.no_dynamic_id = 1,
};
-module_usb_driver(karma_driver);
+module_usb_stor_driver(karma_driver, karma_host_template, DRV_NAME);
diff --git a/drivers/usb/storage/onetouch.c b/drivers/usb/storage/onetouch.c
index 74e2aa23b045..acc3d03d8c1e 100644
--- a/drivers/usb/storage/onetouch.c
+++ b/drivers/usb/storage/onetouch.c
@@ -35,6 +35,9 @@
#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>");
@@ -283,6 +286,8 @@ static void onetouch_release_input(void *onetouch_)
}
}
+static struct scsi_host_template onetouch_host_template;
+
static int onetouch_probe(struct usb_interface *intf,
const struct usb_device_id *id)
{
@@ -290,7 +295,8 @@ static int onetouch_probe(struct usb_interface *intf,
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;
@@ -301,7 +307,7 @@ static int onetouch_probe(struct usb_interface *intf,
}
static struct usb_driver onetouch_driver = {
- .name = "ums-onetouch",
+ .name = DRV_NAME,
.probe = onetouch_probe,
.disconnect = usb_stor_disconnect,
.suspend = usb_stor_suspend,
@@ -314,4 +320,4 @@ static struct usb_driver onetouch_driver = {
.no_dynamic_id = 1,
};
-module_usb_driver(onetouch_driver);
+module_usb_stor_driver(onetouch_driver, onetouch_host_template, DRV_NAME);
diff --git a/drivers/usb/storage/realtek_cr.c b/drivers/usb/storage/realtek_cr.c
index 27e4a580d2ed..20433563a601 100644
--- a/drivers/usb/storage/realtek_cr.c
+++ b/drivers/usb/storage/realtek_cr.c
@@ -39,6 +39,9 @@
#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>");
@@ -1034,6 +1037,8 @@ INIT_FAIL:
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)
{
@@ -1044,7 +1049,8 @@ static int realtek_cr_probe(struct usb_interface *intf,
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;
@@ -1054,7 +1060,7 @@ static int realtek_cr_probe(struct usb_interface *intf,
}
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, */
@@ -1070,4 +1076,4 @@ static struct usb_driver realtek_cr_driver = {
.no_dynamic_id = 1,
};
-module_usb_driver(realtek_cr_driver);
+module_usb_stor_driver(realtek_cr_driver, realtek_cr_host_template, DRV_NAME);
diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c
index a8cbbffe822c..c922d8b64362 100644
--- a/drivers/usb/storage/scsiglue.c
+++ b/drivers/usb/storage/scsiglue.c
@@ -536,7 +536,7 @@ static struct device_attribute *sysfs_device_attr_list[] = {
* 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",
@@ -588,6 +588,16 @@ struct scsi_host_template usb_stor_host_template = {
.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 */
diff --git a/drivers/usb/storage/scsiglue.h b/drivers/usb/storage/scsiglue.h
index ffa1cca93d2c..5494d87607fb 100644
--- a/drivers/usb/storage/scsiglue.h
+++ b/drivers/usb/storage/scsiglue.h
@@ -41,8 +41,9 @@
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
diff --git a/drivers/usb/storage/sddr09.c b/drivers/usb/storage/sddr09.c
index 3847053d732c..b74603689b9e 100644
--- a/drivers/usb/storage/sddr09.c
+++ b/drivers/usb/storage/sddr09.c
@@ -52,6 +52,9 @@
#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>");
@@ -1738,6 +1741,8 @@ usb_stor_sddr09_init(struct us_data *us) {
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)
{
@@ -1745,7 +1750,8 @@ static int sddr09_probe(struct usb_interface *intf,
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;
@@ -1766,7 +1772,7 @@ static int sddr09_probe(struct usb_interface *intf,
}
static struct usb_driver sddr09_driver = {
- .name = "ums-sddr09",
+ .name = DRV_NAME,
.probe = sddr09_probe,
.disconnect = usb_stor_disconnect,
.suspend = usb_stor_suspend,
@@ -1779,4 +1785,4 @@ static struct usb_driver sddr09_driver = {
.no_dynamic_id = 1,
};
-module_usb_driver(sddr09_driver);
+module_usb_stor_driver(sddr09_driver, sddr09_host_template, DRV_NAME);
diff --git a/drivers/usb/storage/sddr55.c b/drivers/usb/storage/sddr55.c
index aacedef9667c..e5e0a25ecd96 100644
--- a/drivers/usb/storage/sddr55.c
+++ b/drivers/usb/storage/sddr55.c
@@ -34,6 +34,9 @@
#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");
@@ -968,6 +971,7 @@ static int sddr55_transport(struct scsi_cmnd *srb, struct us_data *us)
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)
@@ -976,7 +980,8 @@ static int sddr55_probe(struct usb_interface *intf,
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;
@@ -990,7 +995,7 @@ static int sddr55_probe(struct usb_interface *intf,
}
static struct usb_driver sddr55_driver = {
- .name = "ums-sddr55",
+ .name = DRV_NAME,
.probe = sddr55_probe,
.disconnect = usb_stor_disconnect,
.suspend = usb_stor_suspend,
@@ -1003,4 +1008,4 @@ static struct usb_driver sddr55_driver = {
.no_dynamic_id = 1,
};
-module_usb_driver(sddr55_driver);
+module_usb_stor_driver(sddr55_driver, sddr55_host_template, DRV_NAME);
diff --git a/drivers/usb/storage/shuttle_usbat.c b/drivers/usb/storage/shuttle_usbat.c
index 008d805c3d21..a3ec86b913a1 100644
--- a/drivers/usb/storage/shuttle_usbat.c
+++ b/drivers/usb/storage/shuttle_usbat.c
@@ -53,6 +53,9 @@
#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>");
@@ -1834,6 +1837,8 @@ static int init_usbat_flash(struct us_data *us)
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)
{
@@ -1841,7 +1846,8 @@ static int usbat_probe(struct usb_interface *intf,
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;
@@ -1858,7 +1864,7 @@ static int usbat_probe(struct usb_interface *intf,
}
static struct usb_driver usbat_driver = {
- .name = "ums-usbat",
+ .name = DRV_NAME,
.probe = usbat_probe,
.disconnect = usb_stor_disconnect,
.suspend = usb_stor_suspend,
@@ -1871,4 +1877,4 @@ static struct usb_driver usbat_driver = {
.no_dynamic_id = 1,
};
-module_usb_driver(usbat_driver);
+module_usb_stor_driver(usbat_driver, usbat_host_template, DRV_NAME);
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
index 6c10c888f35f..43576ed31ccd 100644
--- a/drivers/usb/storage/usb.c
+++ b/drivers/usb/storage/usb.c
@@ -76,6 +76,8 @@
#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");
@@ -924,7 +926,8 @@ static unsigned int usb_stor_sg_tablesize(struct usb_interface *intf)
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;
@@ -936,7 +939,7 @@ int usb_stor_probe1(struct us_data **pus,
* 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;
@@ -1073,6 +1076,8 @@ void usb_stor_disconnect(struct usb_interface *intf)
}
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)
@@ -1113,7 +1118,8 @@ static int storage_probe(struct usb_interface *intf,
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;
@@ -1124,7 +1130,7 @@ static int storage_probe(struct usb_interface *intf,
}
static struct usb_driver usb_storage_driver = {
- .name = "usb-storage",
+ .name = DRV_NAME,
.probe = storage_probe,
.disconnect = usb_stor_disconnect,
.suspend = usb_stor_suspend,
@@ -1137,4 +1143,4 @@ static struct usb_driver usb_storage_driver = {
.soft_unbind = 1,
};
-module_usb_driver(usb_storage_driver);
+module_usb_stor_driver(usb_storage_driver, usb_stor_host_template, DRV_NAME);
diff --git a/drivers/usb/storage/usb.h b/drivers/usb/storage/usb.h
index 307e339a9478..da0ad3241728 100644
--- a/drivers/usb/storage/usb.h
+++ b/drivers/usb/storage/usb.h
@@ -197,11 +197,25 @@ extern int usb_stor_post_reset(struct usb_interface *iface);
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