Commit f7d83e8b authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] scsi/imm.c cleanup and fixes (4/8)

	* killed include of scsi_module.h and switched from scsi_register()
to scsi_alloc_host().  We still keep the old detect logics at that point,
it will be gone later.
parent 3a527da7
...@@ -20,6 +20,9 @@ ...@@ -20,6 +20,9 @@
#define IMM_PROBE_EPP17 0x0100 #define IMM_PROBE_EPP17 0x0100
#define IMM_PROBE_EPP19 0x0200 #define IMM_PROBE_EPP19 0x0200
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/blkdev.h> #include <linux/blkdev.h>
#include <asm/io.h> #include <asm/io.h>
#include <linux/parport.h> #include <linux/parport.h>
...@@ -77,17 +80,6 @@ static void imm_wakeup(void *ref) ...@@ -77,17 +80,6 @@ static void imm_wakeup(void *ref)
return; return;
} }
static int imm_release(struct Scsi_Host *host)
{
imm_struct *dev = imm_dev(host);
int host_no = host->unique_id;
printk("Releasing imm%i\n", host_no);
scsi_unregister(host);
parport_unregister_device(dev->dev);
return 0;
}
static int imm_pb_claim(imm_struct *dev) static int imm_pb_claim(imm_struct *dev)
{ {
if (parport_claim(dev->dev)) { if (parport_claim(dev->dev)) {
...@@ -108,25 +100,6 @@ static inline void imm_pb_release(imm_struct *dev) ...@@ -108,25 +100,6 @@ static inline void imm_pb_release(imm_struct *dev)
* Parallel port probing routines * * Parallel port probing routines *
***************************************************************************/ ***************************************************************************/
static Scsi_Host_Template driver_template = {
.proc_name = "imm",
.proc_info = imm_proc_info,
.name = "Iomega VPI2 (imm) interface",
.detect = imm_detect,
.release = imm_release,
.queuecommand = imm_queuecommand,
.eh_abort_handler = imm_abort,
.eh_bus_reset_handler = imm_reset,
.eh_host_reset_handler = imm_reset,
.bios_param = imm_biosparam,
.this_id = 7,
.sg_tablesize = SG_ALL,
.cmd_per_lun = 1,
.use_clustering = ENABLE_CLUSTERING,
};
#include "scsi_module.c"
static int imm_detect(Scsi_Host_Template * host) static int imm_detect(Scsi_Host_Template * host)
{ {
struct Scsi_Host *hreg; struct Scsi_Host *hreg;
...@@ -214,11 +187,10 @@ static int imm_detect(Scsi_Host_Template * host) ...@@ -214,11 +187,10 @@ static int imm_detect(Scsi_Host_Template * host)
INIT_WORK(&dev->imm_tq, imm_interrupt, dev); INIT_WORK(&dev->imm_tq, imm_interrupt, dev);
host->can_queue = IMM_CAN_QUEUE; hreg = scsi_host_alloc(host, 0);
host->sg_tablesize = imm_sg;
hreg = scsi_register(host, 0);
if (hreg == NULL) if (hreg == NULL)
continue; continue;
list_add_tail(&hreg->sht_legacy_list, &host->legacy_hosts);
hreg->io_port = pb->base; hreg->io_port = pb->base;
hreg->n_io_port = ports; hreg->n_io_port = ports;
hreg->dma_channel = -1; hreg->dma_channel = -1;
...@@ -1238,4 +1210,66 @@ static int device_check(imm_struct *dev) ...@@ -1238,4 +1210,66 @@ static int device_check(imm_struct *dev)
return 1; return 1;
} }
static Scsi_Host_Template driver_template = {
.module = THIS_MODULE,
.proc_name = "imm",
.proc_info = imm_proc_info,
.name = "Iomega VPI2 (imm) interface",
.queuecommand = imm_queuecommand,
.eh_abort_handler = imm_abort,
.eh_bus_reset_handler = imm_reset,
.eh_host_reset_handler = imm_reset,
.bios_param = imm_biosparam,
.this_id = 7,
.sg_tablesize = SG_ALL,
.cmd_per_lun = 1,
.use_clustering = ENABLE_CLUSTERING,
.can_queue = 1,
};
static int __init imm_driver_init(void)
{
struct scsi_host_template *sht = &driver_template;
struct Scsi_Host *shost;
struct list_head *l;
int error;
INIT_LIST_HEAD(&sht->legacy_hosts);
imm_detect(sht);
if (list_empty(&sht->legacy_hosts))
return -ENODEV;
list_for_each_entry(shost, &sht->legacy_hosts, sht_legacy_list) {
error = scsi_add_host(shost, NULL);
if (error)
goto fail;
scsi_scan_host(shost);
}
return 0;
fail:
l = &shost->sht_legacy_list;
while ((l = l->prev) != &sht->legacy_hosts)
scsi_remove_host(list_entry(l, struct Scsi_Host, sht_legacy_list));
return error;
}
static void __exit imm_driver_exit(void)
{
struct scsi_host_template *sht = &driver_template;
struct Scsi_Host *host, *s;
list_for_each_entry(host, &sht->legacy_hosts, sht_legacy_list)
scsi_remove_host(host);
list_for_each_entry_safe(host, s, &sht->legacy_hosts, sht_legacy_list) {
imm_struct *dev = imm_dev(host);
list_del(&host->sht_legacy_list);
scsi_host_put(host);
parport_unregister_device(dev->dev);
}
}
module_init(imm_driver_init);
module_exit(imm_driver_exit);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -108,11 +108,7 @@ static char *IMM_MODE_STRING[] = ...@@ -108,11 +108,7 @@ static char *IMM_MODE_STRING[] =
[IMM_UNKNOWN] = "Unknown", [IMM_UNKNOWN] = "Unknown",
}; };
/* This is a global option */
int imm_sg = SG_ALL; /* enable/disable scatter-gather. */
/* other options */ /* other options */
#define IMM_CAN_QUEUE 1 /* use "queueing" interface */
#define IMM_BURST_SIZE 512 /* data burst size */ #define IMM_BURST_SIZE 512 /* data burst size */
#define IMM_SELECT_TMO 500 /* 500 how long to wait for target ? */ #define IMM_SELECT_TMO 500 /* 500 how long to wait for target ? */
#define IMM_SPIN_TMO 5000 /* 50000 imm_wait loop limiter */ #define IMM_SPIN_TMO 5000 /* 50000 imm_wait loop limiter */
...@@ -144,17 +140,7 @@ int imm_sg = SG_ALL; /* enable/disable scatter-gather. */ ...@@ -144,17 +140,7 @@ int imm_sg = SG_ALL; /* enable/disable scatter-gather. */
#endif #endif
static int imm_engine(imm_struct *, Scsi_Cmnd *); static int imm_engine(imm_struct *, Scsi_Cmnd *);
static int imm_in(imm_struct *, char *, int);
static int imm_init(imm_struct *); static int imm_init(imm_struct *);
static void imm_interrupt(void *); static void imm_interrupt(void *);
static int imm_out(imm_struct *, char *, int);
static int imm_detect(Scsi_Host_Template *);
static int imm_queuecommand(Scsi_Cmnd *, void (*done) (Scsi_Cmnd *));
static int imm_abort(Scsi_Cmnd *);
static int imm_reset(Scsi_Cmnd *);
static int imm_proc_info(struct Scsi_Host *, char *, char **, off_t, int, int);
static int imm_biosparam(struct scsi_device *, struct block_device *,
sector_t, int *);
#endif /* _IMM_H */ #endif /* _IMM_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment