|
@@ -3793,7 +3793,7 @@ typedef struct adv_req {
|
|
/*
|
|
/*
|
|
* Structure allocated for each board.
|
|
* Structure allocated for each board.
|
|
*
|
|
*
|
|
- * This structure is allocated by scsi_register() at the end
|
|
|
|
|
|
+ * This structure is allocated by scsi_host_alloc() at the end
|
|
* of the 'Scsi_Host' structure starting at the 'hostdata'
|
|
* of the 'Scsi_Host' structure starting at the 'hostdata'
|
|
* field. It is guaranteed to be allocated from DMA-able memory.
|
|
* field. It is guaranteed to be allocated from DMA-able memory.
|
|
*/
|
|
*/
|
|
@@ -4632,17 +4632,12 @@ advansys_biosparam(struct scsi_device *sdev, struct block_device *bdev,
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
-static int __init advansys_detect(struct scsi_host_template *tpnt);
|
|
|
|
-static int advansys_release(struct Scsi_Host *shp);
|
|
|
|
-
|
|
|
|
-static struct scsi_host_template driver_template = {
|
|
|
|
|
|
+static struct scsi_host_template advansys_template = {
|
|
.proc_name = "advansys",
|
|
.proc_name = "advansys",
|
|
#ifdef CONFIG_PROC_FS
|
|
#ifdef CONFIG_PROC_FS
|
|
.proc_info = advansys_proc_info,
|
|
.proc_info = advansys_proc_info,
|
|
#endif
|
|
#endif
|
|
.name = "advansys",
|
|
.name = "advansys",
|
|
- .detect = advansys_detect,
|
|
|
|
- .release = advansys_release,
|
|
|
|
.info = advansys_info,
|
|
.info = advansys_info,
|
|
.queuecommand = advansys_queuecommand,
|
|
.queuecommand = advansys_queuecommand,
|
|
.eh_bus_reset_handler = advansys_reset,
|
|
.eh_bus_reset_handler = advansys_reset,
|
|
@@ -4650,8 +4645,8 @@ static struct scsi_host_template driver_template = {
|
|
.slave_configure = advansys_slave_configure,
|
|
.slave_configure = advansys_slave_configure,
|
|
/*
|
|
/*
|
|
* Because the driver may control an ISA adapter 'unchecked_isa_dma'
|
|
* Because the driver may control an ISA adapter 'unchecked_isa_dma'
|
|
- * must be set. The flag will be cleared in advansys_detect for non-ISA
|
|
|
|
- * adapters. Refer to the comment in scsi_module.c for more information.
|
|
|
|
|
|
+ * must be set. The flag will be cleared in advansys_board_found
|
|
|
|
+ * for non-ISA adapters.
|
|
*/
|
|
*/
|
|
.unchecked_isa_dma = 1,
|
|
.unchecked_isa_dma = 1,
|
|
/*
|
|
/*
|
|
@@ -4664,8 +4659,6 @@ static struct scsi_host_template driver_template = {
|
|
.use_clustering = ENABLE_CLUSTERING,
|
|
.use_clustering = ENABLE_CLUSTERING,
|
|
};
|
|
};
|
|
|
|
|
|
-#include "scsi_module.c"
|
|
|
|
-
|
|
|
|
/*
|
|
/*
|
|
* --- Miscellaneous Driver Functions
|
|
* --- Miscellaneous Driver Functions
|
|
*/
|
|
*/
|
|
@@ -17839,8 +17832,8 @@ advansys_board_found(int iop, struct device *dev, int bus_type)
|
|
* Register the adapter, get its configuration, and
|
|
* Register the adapter, get its configuration, and
|
|
* initialize it.
|
|
* initialize it.
|
|
*/
|
|
*/
|
|
- ASC_DBG(2, "advansys_board_found: scsi_register()\n");
|
|
|
|
- shost = scsi_register(&driver_template, sizeof(asc_board_t));
|
|
|
|
|
|
+ ASC_DBG(2, "advansys_board_found: scsi_host_alloc()\n");
|
|
|
|
+ shost = scsi_host_alloc(&advansys_template, sizeof(asc_board_t));
|
|
|
|
|
|
if (!shost)
|
|
if (!shost)
|
|
return NULL;
|
|
return NULL;
|
|
@@ -18503,6 +18496,11 @@ advansys_board_found(int iop, struct device *dev, int bus_type)
|
|
|
|
|
|
ASC_DBG_PRT_SCSI_HOST(2, shost);
|
|
ASC_DBG_PRT_SCSI_HOST(2, shost);
|
|
|
|
|
|
|
|
+ ret = scsi_add_host(shost, dev);
|
|
|
|
+ if (ret)
|
|
|
|
+ goto err_free_wide_mem;
|
|
|
|
+
|
|
|
|
+ scsi_scan_host(shost);
|
|
return shost;
|
|
return shost;
|
|
|
|
|
|
err_free_wide_mem:
|
|
err_free_wide_mem:
|
|
@@ -18519,7 +18517,7 @@ advansys_board_found(int iop, struct device *dev, int bus_type)
|
|
if (boardp->ioremap_addr)
|
|
if (boardp->ioremap_addr)
|
|
iounmap(boardp->ioremap_addr);
|
|
iounmap(boardp->ioremap_addr);
|
|
err_shost:
|
|
err_shost:
|
|
- scsi_unregister(shost);
|
|
|
|
|
|
+ scsi_host_put(shost);
|
|
asc_board_count--;
|
|
asc_board_count--;
|
|
return NULL;
|
|
return NULL;
|
|
}
|
|
}
|
|
@@ -18537,9 +18535,8 @@ advansys_board_found(int iop, struct device *dev, int bus_type)
|
|
* it must not call SCSI mid-level functions including scsi_malloc()
|
|
* it must not call SCSI mid-level functions including scsi_malloc()
|
|
* and scsi_free().
|
|
* and scsi_free().
|
|
*/
|
|
*/
|
|
-static int __init advansys_detect(struct scsi_host_template *tpnt)
|
|
|
|
|
|
+static int __init advansys_detect(void)
|
|
{
|
|
{
|
|
- static int detect_called = ASC_FALSE;
|
|
|
|
int iop;
|
|
int iop;
|
|
int bus;
|
|
int bus;
|
|
int ioport = 0;
|
|
int ioport = 0;
|
|
@@ -18561,14 +18558,6 @@ static int __init advansys_detect(struct scsi_host_template *tpnt)
|
|
};
|
|
};
|
|
#endif /* CONFIG_PCI */
|
|
#endif /* CONFIG_PCI */
|
|
|
|
|
|
- if (detect_called == ASC_FALSE) {
|
|
|
|
- detect_called = ASC_TRUE;
|
|
|
|
- } else {
|
|
|
|
- printk
|
|
|
|
- ("AdvanSys SCSI: advansys_detect() multiple calls ignored\n");
|
|
|
|
- return 0;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
ASC_DBG(1, "advansys_detect: begin\n");
|
|
ASC_DBG(1, "advansys_detect: begin\n");
|
|
|
|
|
|
asc_board_count = 0;
|
|
asc_board_count = 0;
|
|
@@ -18829,6 +18818,7 @@ static int advansys_release(struct Scsi_Host *shost)
|
|
asc_board_t *boardp;
|
|
asc_board_t *boardp;
|
|
|
|
|
|
ASC_DBG(1, "advansys_release: begin\n");
|
|
ASC_DBG(1, "advansys_release: begin\n");
|
|
|
|
+ scsi_remove_host(shost);
|
|
boardp = ASC_BOARDP(shost);
|
|
boardp = ASC_BOARDP(shost);
|
|
free_irq(shost->irq, shost);
|
|
free_irq(shost->irq, shost);
|
|
if (shost->dma_channel != NO_ISA_DMA) {
|
|
if (shost->dma_channel != NO_ISA_DMA) {
|
|
@@ -18841,7 +18831,7 @@ static int advansys_release(struct Scsi_Host *shost)
|
|
advansys_wide_free_mem(boardp);
|
|
advansys_wide_free_mem(boardp);
|
|
}
|
|
}
|
|
kfree(boardp->prtbuf);
|
|
kfree(boardp->prtbuf);
|
|
- scsi_unregister(shost);
|
|
|
|
|
|
+ scsi_host_put(shost);
|
|
ASC_DBG(1, "advansys_release: end\n");
|
|
ASC_DBG(1, "advansys_release: end\n");
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
@@ -18867,4 +18857,25 @@ static struct pci_device_id advansys_pci_tbl[] __devinitdata = {
|
|
MODULE_DEVICE_TABLE(pci, advansys_pci_tbl);
|
|
MODULE_DEVICE_TABLE(pci, advansys_pci_tbl);
|
|
#endif /* CONFIG_PCI */
|
|
#endif /* CONFIG_PCI */
|
|
|
|
|
|
|
|
+static int __init advansys_init(void)
|
|
|
|
+{
|
|
|
|
+ int count;
|
|
|
|
+ count = advansys_detect();
|
|
|
|
+ if (count == 0)
|
|
|
|
+ return -ENODEV;
|
|
|
|
+
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static void __exit advansys_exit(void)
|
|
|
|
+{
|
|
|
|
+ int i;
|
|
|
|
+
|
|
|
|
+ for (i = 0; i < asc_board_count; i++)
|
|
|
|
+ advansys_release(asc_host[i]);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+module_init(advansys_init);
|
|
|
|
+module_exit(advansys_exit);
|
|
|
|
+
|
|
MODULE_LICENSE("GPL");
|
|
MODULE_LICENSE("GPL");
|