Skip to contentSkip to conversation

qlogic: call request_irq() with private data

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

lore
Share & tools
lore
#0 lore raw

PATCH 2/3 qlogic: call request_irq() with private data

Signature · 1 line
aris
drivers/scsi/qlogicfas.c renamed from drivers/scsi/qlogicfas.c.orig +8 -5
@@ -667,9 +667,6 @@
 		qlirq = j;
 	} else
 		printk(KERN_INFO "Ql: Using preset IRQ %d\n", qlirq);
-
-	if (qlirq >= 0 && !request_irq(qlirq, do_ql_ihandl, 0, "qlogicfas", NULL))
-		host->can_queue = 1;
 #endif
 	hreg = scsi_host_alloc(host, 0);	/* no host data */
 	if (!hreg)
@@ -677,17 +674,23 @@
 	hreg->io_port = qbase;
 	hreg->n_io_port = 16;
 	hreg->dma_channel = -1;
-	if (qlirq != -1)
-		hreg->irq = qlirq;
+	hreg->irq = qlirq;
+	hreg->can_queue = 1;
 	INIT_LIST_HEAD(&hreg->sht_legacy_list);
 
 	sprintf(qinfo,
 		"Qlogicfas Driver version 0.46, chip %02X at %03X, IRQ %d, TPdma:%d",
 		qltyp, qbase, qlirq, QL_TURBO_PDMA);
 	host->name = qinfo;
+#ifdef QL_USE_IRQ
+	if (qlirq < 0 || request_irq(qlirq, do_ql_ihandl, 0, "qlogicfas", hreg))
+		goto free_scsi_host;
+#endif
 
 	return hreg;
 
+free_scsi_host:
+	kfree(hreg);
 err_release_mem:
 	release_region(qbase, 0x10);
 	if (host->can_queue)
#1 lore raw

drivers/scsi/qlogicfas.c line 693

Quoted 9 lines · Aristeu Sergio Rozanski Filho
drivers/scsi/qlogicfas.c renamed from drivers/scsi/qlogicfas.c.orig +6 -0
+#ifdef QL_USE_IRQ
+	if (qlirq < 0 || request_irq(qlirq, do_ql_ihandl, 0, "qlogicfas", hreg))
+		goto free_scsi_host;
+#endif
 
 	return hreg;
 
+free_scsi_host:
+	kfree(hreg);

should be scsi_host_put() on that last line...

#2 lore raw

hi Jeff, Mike,

Quoted 5 lines

drivers/scsi/qlogicfas.c line 693

Quoted 2 lines
drivers/scsi/qlogicfas.c renamed from drivers/scsi/qlogicfas.c.orig +2 -0
+free_scsi_host:
+	kfree(hreg);

should be scsi_host_put() on that last line...

i'll fix both and resend the patches.
thanks,

Signature · 1 line
aris
#3 lore raw
In reply to Aristeu Sergio Rozanski Filho

drivers/scsi/qlogicfas.c line 678

Quoted 1 line · Aristeu Sergio Rozanski Filho
drivers/scsi/qlogicfas.c renamed from drivers/scsi/qlogicfas.c.orig +1 -0
+	hreg->can_queue = 1;

We already have can_queue set in the host template, so this line is superflous.

drivers/scsi/qlogicfas.c line 688

Quoted 4 lines
drivers/scsi/qlogicfas.c renamed from drivers/scsi/qlogicfas.c.orig +4 -0
+#ifdef QL_USE_IRQ
+	if (qlirq < 0 || request_irq(qlirq, do_ql_ihandl, 0, "qlogicfas", hreg))
+		goto free_scsi_host;
+#endif

Does the driver work at all with QL_USE_IRQ undefined? I don't think so and if I'm right you should probably nuke the ifdef while you're at it.

drivers/scsi/qlogicfas.c line 693

Quoted 2 lines
drivers/scsi/qlogicfas.c renamed from drivers/scsi/qlogicfas.c.orig +2 -0
+free_scsi_host:
+	kfree(hreg);

should be

#ifdef PCMCIA
	scsi_host_put(shost);

#else
scsi_unregister(shost):
#endif

if the reworked version of the previous patch is applied.

Quoted 1 line

if (host->can_queue)

can_queue can't be 0 these days so this one could go away aswell.