public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [patch][14/15] qlogicfas: finish to convert to new scsi driver model
@ 2004-03-09 13:43 Aristeu Sergio Rozanski Filho
  0 siblings, 0 replies; only message in thread
From: Aristeu Sergio Rozanski Filho @ 2004-03-09 13:43 UTC (permalink / raw)
  To: linux-scsi


[-- Attachment #1.1: Type: text/plain, Size: 17 bytes --]



-- 
aris


[-- Attachment #1.2: 14-qlogicfas-convert_to_new_scsi_driver_model.patch --]
[-- Type: text/plain, Size: 3212 bytes --]

diff -ur linux-2.6.3-applied/drivers/scsi/qlogicfas.c linux-2.6.3-work/drivers/scsi/qlogicfas.c
--- linux-2.6.3-applied/drivers/scsi/qlogicfas.c	2004-03-08 21:12:49.000000000 -0300
+++ linux-2.6.3-work/drivers/scsi/qlogicfas.c	2004-03-09 10:09:13.000000000 -0300
@@ -467,6 +467,7 @@
 	return 0;
 }
 
+#ifndef PCMCIA
 /*
  *	Look for qlogic card and init if found 
  */
@@ -561,6 +562,7 @@
 	priv->qbase = qbase;
 	priv->qlirq = qlirq;
 	priv->qinitid = qinitid;
+	priv->shost = hreg;
 
 	sprintf(priv->qinfo,
 		"Qlogicfas Driver version 0.46, chip %02X at %03X, IRQ %d, TPdma:%d",
@@ -589,6 +591,7 @@
 }
 
 #define MAX_QLOGICFAS	8
+static qlogicfas_priv_t cards;
 static int iobase[MAX_QLOGICFAS];
 static int irq[MAX_QLOGICFAS] = { [0 ... MAX_QLOGICFAS-1] = -1 };
 MODULE_PARM(iobase, "1-" __MODULE_STRING(MAX_QLOGICFAS) "i");
@@ -598,14 +601,20 @@
 
 int __devinit qlogicfas_detect(Scsi_Host_Template *sht)
 {
+	struct Scsi_Host	*shost;
+	qlogicfas_priv_t	priv;
 	int	i,
 		num = 0;
 
 	for (i = 0; i < MAX_QLOGICFAS; i++) {
-		if (__qlogicfas_detect(sht, iobase[num], irq[num]) == NULL) {
+		shost = __qlogicfas_detect(sht, iobase[num], irq[num]);
+		if (shost == NULL) {
 			/* no more devices */
 			break;
 		}
+		priv = (qlogicfas_priv_t)&(shost->hostdata[0]);
+		priv->next = cards;
+		cards = priv;
 		num++;
 	}
 
@@ -632,6 +641,7 @@
 
 	return 0;
 }
+#endif	/* ifndef PCMCIA */
 
 /* 
  *	Return bios parameters 
@@ -722,8 +732,6 @@
 	.module			= THIS_MODULE,
 	.name			= qlogicfas_name,
 	.proc_name		= qlogicfas_name,
-	.detect			= qlogicfas_detect,
-	.release		= qlogicfas_release,
 	.info			= qlogicfas_info,
 	.queuecommand		= qlogicfas_queuecommand,
 	.eh_abort_handler	= qlogicfas_abort,
@@ -739,6 +747,25 @@
 };
 
 #ifndef PCMCIA
-#define driver_template qlogicfas_driver_template
-#include "scsi_module.c"
-#endif
+static __init int qlogicfas_init(void)
+{
+	if (!qlogicfas_detect(&qlogicfas_driver_template)) {
+		/* no cards found */
+		return -ENODEV;
+	}
+
+	return 0;
+}
+
+static __exit void qlogicfas_exit(void)
+{
+	qlogicfas_priv_t	priv;
+
+	for (priv = cards; priv != NULL; priv = priv->next)
+		qlogicfas_release(priv->shost);
+}
+
+module_init(qlogicfas_init);
+module_exit(qlogicfas_exit);
+#endif	/* ifndef PCMCIA */
+
diff -ur linux-2.6.3-applied/drivers/scsi/qlogicfas.h linux-2.6.3-work/drivers/scsi/qlogicfas.h
--- linux-2.6.3-applied/drivers/scsi/qlogicfas.h	2004-03-08 21:12:49.000000000 -0300
+++ linux-2.6.3-work/drivers/scsi/qlogicfas.h	2004-03-09 10:01:45.000000000 -0300
@@ -84,6 +84,8 @@
 #define QL_INT_ACTIVE_HIGH 0
 #endif
 
+struct qlogicfas_priv;
+typedef struct qlogicfas_priv *qlogicfas_priv_t;
 struct qlogicfas_priv {
 	 int		qbase;		/* Port */
 	 int		qinitid;	/* initiator ID */
@@ -91,8 +93,9 @@
 	 int		qlirq;		/* IRQ being used */
 	 char		qinfo[80];	/* description */
 	 Scsi_Cmnd 	*qlcmd;		/* current command being processed */
+	 struct Scsi_Host	*shost;	/* pointer back to host */
+	 qlogicfas_priv_t	next;	/* next private struct */
 };
-typedef struct qlogicfas_priv *qlogicfas_priv_t;
 
 extern int qlcfg5;
 extern int qlcfg6;

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-03-09 13:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-03-09 13:43 [patch][14/15] qlogicfas: finish to convert to new scsi driver model Aristeu Sergio Rozanski Filho

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox