Skip to contentSkip to conversation

qlogic: use scsi_host_alloc instead scsi_register

PATCH In review Aristeu Sergio Rozanski Filho 3 participants 3 messages Oct 16, 2003 – Oct 17, 2003 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 qlogic: use scsi_host_alloc instead scsi_register

hi,
these patches fixes qlogic_cs module loading and unloading.

Signature · 1 line
aris
drivers/scsi/qlogicfas.c renamed from drivers/scsi/qlogicfas.c.orig +2 -1
@@ -671,7 +671,7 @@
 	if (qlirq >= 0 && !request_irq(qlirq, do_ql_ihandl, 0, "qlogicfas", NULL))
 		host->can_queue = 1;
 #endif
-	hreg = scsi_register(host, 0);	/* no host data */
+	hreg = scsi_host_alloc(host, 0);	/* no host data */
 	if (!hreg)
 		goto err_release_mem;
 	hreg->io_port = qbase;
@@ -679,6 +679,7 @@
 	hreg->dma_channel = -1;
 	if (qlirq != -1)
 		hreg->irq = qlirq;
+	INIT_LIST_HEAD(&hreg->sht_legacy_list);
 
 	sprintf(qinfo,
 		"Qlogicfas Driver version 0.46, chip %02X at %03X, IRQ %d, TPdma:%d",
#1 lore raw

drivers/scsi/qlogicfas.c line 675

Quoted 9 lines · Aristeu Sergio Rozanski Filho
drivers/scsi/qlogicfas.c renamed from drivers/scsi/qlogicfas.c.orig +1 -1
@@ -671,7 +671,7 @@
 	if (qlirq >= 0 && !request_irq(qlirq, do_ql_ihandl, 0, "qlogicfas", NULL))
 		host->can_queue = 1;
 #endif
-	hreg = scsi_register(host, 0);	/* no host data */
+	hreg = scsi_host_alloc(host, 0);	/* no host data */
 	if (!hreg)

I think this will break the non-PCMCIA version now. scsi_register also adds the host to the template's legacy_hosts list. With your patch init_this_scsi_driver will call the template's detect function then never call scsi_add_host and scsi_scan_host because that list is empty.

Mike

#2 lore raw
In reply to Aristeu Sergio Rozanski Filho
Quoted 11 lines · Aristeu Sergio Rozanski Filho

+++ linux/drivers/scsi/qlogicfas.c 2003-10-15 23:41:28.000000000 -0200

drivers/scsi/qlogicfas.c renamed from drivers/scsi/qlogicfas.c.orig +1 -1
@@ -671,7 +671,7 @@
 	if (qlirq >= 0 && !request_irq(qlirq, do_ql_ihandl, 0, "qlogicfas", NULL))
 		host->can_queue = 1;
 #endif
-	hreg = scsi_register(host, 0);	/* no host data */
+	hreg = scsi_host_alloc(host, 0);	/* no host data */
 	if (!hreg)
 		goto err_release_mem;
 	hreg->io_port = qbase;

drivers/scsi/qlogicfas.c line 682

Quoted 4 lines
drivers/scsi/qlogicfas.c renamed from drivers/scsi/qlogicfas.c.orig +1 -0
@@ -679,6 +679,7 @@
 	hreg->dma_channel = -1;
 	if (qlirq != -1)
 		hreg->irq = qlirq;
+	INIT_LIST_HEAD(&hreg->sht_legacy_list);

This is not good - please use scsi_register for the !PCMCIA case instead of opencoding it - sht_legacy_list should be completely opaque to drivers. Maybe once the current freeze is over we can convert qlogic.c to a proper new-style driver and merge qlogic_cs into it instead of having two copies of the same codebase compiled with slightly different cpp symbols.