@@ -400,7 +400,6 @@ static void dc390_check_eeprom(struct esp *esp)
static int pci_esp_probe_one(struct pci_dev *pdev,
const struct pci_device_id *id)
{
- struct scsi_host_template *hostt = &scsi_esp_template;
int err = -ENODEV;
struct Scsi_Host *shost;
struct esp *esp;
@@ -417,7 +416,7 @@ static int pci_esp_probe_one(struct pci_dev *pdev,
goto fail_disable_device;
}
- shost = scsi_host_alloc(hostt, sizeof(struct esp));
+ shost = scsi_esp_host_alloc(sizeof(struct esp));
if (!shost) {
dev_printk(KERN_INFO, &pdev->dev,
"failed to allocate scsi host\n");
@@ -2675,8 +2675,7 @@ static const char *esp_info(struct Scsi_Host *host)
return "esp";
}
-struct scsi_host_template scsi_esp_template = {
- .module = THIS_MODULE,
+static struct scsi_host_template scsi_esp_template = {
.name = "esp",
.info = esp_info,
.queuecommand = esp_queuecommand,
@@ -2696,7 +2695,18 @@ struct scsi_host_template scsi_esp_template = {
.skip_settle_delay = 1,
.use_blk_tags = 1,
};
-EXPORT_SYMBOL(scsi_esp_template);
+
+struct Scsi_Host *__scsi_esp_host_alloc(int privsize, struct module *owner)
+{
+ struct Scsi_Host *shost;
+
+ shost = scsi_host_alloc(&scsi_esp_template, privsize);
+ if (shost)
+ shost->module = owner;
+
+ return shost;
+}
+EXPORT_SYMBOL(__scsi_esp_host_alloc);
static void esp_get_signalling(struct Scsi_Host *host)
{
@@ -544,9 +544,8 @@ struct esp {
/* A front-end driver for the ESP chip should do the following in
* it's device probe routine:
- * 1) Allocate the host and private area using scsi_host_alloc()
- * with size 'sizeof(struct esp)'. The first argument to
- * scsi_host_alloc() should be &scsi_esp_template.
+ * 1) Allocate the host and private area using scsi_esp_host_alloc()
+ * with size 'sizeof(struct esp)'.
* 2) Set host->max_id as appropriate.
* 3) Set esp->host to the scsi_host itself, and esp->dev
* to the device object pointer.
@@ -573,7 +572,11 @@ struct esp {
* 13) Check scsi_esp_register() return value, release all resources
* if an error was returned.
*/
-extern struct scsi_host_template scsi_esp_template;
+extern struct Scsi_Host *__scsi_esp_host_alloc(int privsize,
+ struct module *owner);
+#define scsi_esp_host_alloc(privsize) \
+ __scsi_esp_host_alloc(privsize, THIS_MODULE)
+
extern int scsi_esp_register(struct esp *, struct device *);
extern void scsi_esp_unregister(struct esp *);
@@ -131,13 +131,12 @@ static const struct esp_driver_ops jazz_esp_ops = {
static int esp_jazz_probe(struct platform_device *dev)
{
- struct scsi_host_template *tpnt = &scsi_esp_template;
struct Scsi_Host *host;
struct esp *esp;
struct resource *res;
int err;
- host = scsi_host_alloc(tpnt, sizeof(struct esp));
+ host = scsi_esp_host_alloc(sizeof(struct esp));
err = -ENOMEM;
if (!host)
@@ -483,7 +483,6 @@ static struct esp_driver_ops mac_esp_ops = {
static int esp_mac_probe(struct platform_device *dev)
{
- struct scsi_host_template *tpnt = &scsi_esp_template;
struct Scsi_Host *host;
struct esp *esp;
int err;
@@ -495,7 +494,7 @@ static int esp_mac_probe(struct platform_device *dev)
if (dev->id > 1)
return -ENODEV;
- host = scsi_host_alloc(tpnt, sizeof(struct esp));
+ host = scsi_esp_host_alloc(sizeof(struct esp));
err = -ENOMEM;
if (!host)
@@ -196,13 +196,12 @@ static const struct esp_driver_ops sun3x_esp_ops = {
static int esp_sun3x_probe(struct platform_device *dev)
{
- struct scsi_host_template *tpnt = &scsi_esp_template;
struct Scsi_Host *host;
struct esp *esp;
struct resource *res;
int err = -ENOMEM;
- host = scsi_host_alloc(tpnt, sizeof(struct esp));
+ host = scsi_esp_host_alloc(sizeof(struct esp));
if (!host)
goto fail;
@@ -489,12 +489,11 @@ static const struct esp_driver_ops sbus_esp_ops = {
static int esp_sbus_probe_one(struct platform_device *op,
struct platform_device *espdma, int hme)
{
- struct scsi_host_template *tpnt = &scsi_esp_template;
struct Scsi_Host *host;
struct esp *esp;
int err;
- host = scsi_host_alloc(tpnt, sizeof(struct esp));
+ host = scsi_esp_host_alloc(sizeof(struct esp));
err = -ENOMEM;
if (!host)