qlogicfas: finish to convert to new scsi driver model
PATCH 14/15 qlogicfas: finish to convert to new scsi driver model
Signature · 2 lines
-- aris
drivers/scsi/qlogicfas.c +33 -6
@@ -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 */ +
drivers/scsi/qlogicfas.h +4 -1
@@ -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;