2007-05-27 14:52:13

by Jeff Garzik

[permalink] [raw]
Subject: [PATCH 0/5] SCSI/initio fixes, cleanups, PCI API support


This patchset presents the path to PCI API support in the initio driver.

But the first patch really begs the question: Has this driver really
been broken since Oct 2003? If so, let's just delete it.

drivers/scsi/initio.c | 206 +++++++++++++++++++++++++++++---------------------
drivers/scsi/initio.h | 10 +-
2 files changed, 127 insertions(+), 89 deletions(-)


2007-05-27 14:54:14

by Jeff Garzik

[permalink] [raw]
Subject: [PATCH 1/5] SCSI/initio PCI DMA fix


The 'pci_dev' member of HCS is referenced during PCI DMA, but never
actually assigned a value. Let's give it a useful value.

Has this driver been broken since PCI DMA support was added in Oct 2003?

Signed-off-by: Jeff Garzik <[email protected]>

a5eec1873b5934de70c589ad0f4596f78c4d0dd3
diff --git a/drivers/scsi/initio.c b/drivers/scsi/initio.c
index 7e7635c..8951494 100644
--- a/drivers/scsi/initio.c
+++ b/drivers/scsi/initio.c
@@ -583,7 +583,8 @@ void tul_read_eeprom(WORD CurBase)
} /* read_eeprom */

static int Addi91u_into_Adapter_table(WORD wBIOS, WORD wBASE, BYTE bInterrupt,
- BYTE bBus, BYTE bDevice)
+ BYTE bBus, BYTE bDevice,
+ struct pci_dev *pci_dev)
{
int i, j;

@@ -609,6 +610,7 @@ static int Addi91u_into_Adapter_table(WORD wBIOS, WORD wBASE, BYTE bInterrupt,
i91u_adpt[i].ADPT_BIOS = wBIOS;
i91u_adpt[i].ADPT_Bus = bBus;
i91u_adpt[i].ADPT_Device = bDevice;
+ i91u_adpt[i].pci_dev = pci_dev;
return 0;
}
return 1;
@@ -642,6 +644,7 @@ static void tul_stop_bm(HCS * pCurHcb)
/***************************************************************************/
static void get_tulipPCIConfig(HCS * pCurHcb, int ch_idx)
{
+ pCurHcb->pci_dev = i91u_adpt[ch_idx].pci_dev;
pCurHcb->HCS_Base = i91u_adpt[ch_idx].ADPT_BASE; /* Supply base address */
pCurHcb->HCS_BIOS = i91u_adpt[ch_idx].ADPT_BIOS; /* Supply BIOS address */
pCurHcb->HCS_Intr = i91u_adpt[ch_idx].ADPT_INTR; /* Supply interrupt line */
@@ -2789,7 +2792,8 @@ static int tul_NewReturnNumberOfAdapters(void)
(pDev->resource[0].start),
pDev->irq,
pDev->bus->number,
- (pDev->devfn >> 3)
+ (pDev->devfn >> 3),
+ pDev
) == 0)
iAdapters++;
}
diff --git a/drivers/scsi/initio.h b/drivers/scsi/initio.h
index acb67a4..dcd42e2 100644
--- a/drivers/scsi/initio.h
+++ b/drivers/scsi/initio.h
@@ -529,6 +529,7 @@ typedef struct I91u_Adpt_Struc {
UBYTE ADPT_Bus; /* 2 */
UBYTE ADPT_Device; /* 3 */
UBYTE ADPT_INTR; /* 4 */
+ struct pci_dev *pci_dev;
} INI_ADPT_STRUCT;


2007-05-27 14:56:15

by Jeff Garzik

[permalink] [raw]
Subject: [PATCH 2/5] SCSI/initio pci_dev, pci_dev->irq simplifications


Now that pci_dev is available in the adapter table, we can logically
simplify Addi91u_into_Adapter_table(), HCS and INI_ADPT_STRUCT.

Signed-off-by: Jeff Garzik <[email protected]>

0151ba1cfeb6565bd1e79b5ba913423f19602d2e
diff --git a/drivers/scsi/initio.c b/drivers/scsi/initio.c
index 8951494..d25a228 100644
--- a/drivers/scsi/initio.c
+++ b/drivers/scsi/initio.c
@@ -582,10 +582,9 @@ void tul_read_eeprom(WORD CurBase)
TUL_WR(CurBase + TUL_GCTRL, gctrl & ~TUL_GCTRL_EEPROM_BIT);
} /* read_eeprom */

-static int Addi91u_into_Adapter_table(WORD wBIOS, WORD wBASE, BYTE bInterrupt,
- BYTE bBus, BYTE bDevice,
- struct pci_dev *pci_dev)
+static int Addi91u_into_Adapter_table(WORD wBIOS, struct pci_dev *pci_dev)
{
+ WORD wBASE = pci_dev->resource[0].start;
int i, j;

for (i = 0; i < MAX_SUPPORTED_ADAPTERS; i++) {
@@ -600,16 +599,14 @@ static int Addi91u_into_Adapter_table(WORD wBIOS, WORD wBASE, BYTE bInterrupt,
}
for (j = MAX_SUPPORTED_ADAPTERS - 1; j > i; j--) {
i91u_adpt[j].ADPT_BASE = i91u_adpt[j - 1].ADPT_BASE;
- i91u_adpt[j].ADPT_INTR = i91u_adpt[j - 1].ADPT_INTR;
i91u_adpt[j].ADPT_BIOS = i91u_adpt[j - 1].ADPT_BIOS;
i91u_adpt[j].ADPT_Bus = i91u_adpt[j - 1].ADPT_Bus;
i91u_adpt[j].ADPT_Device = i91u_adpt[j - 1].ADPT_Device;
}
i91u_adpt[i].ADPT_BASE = wBASE;
- i91u_adpt[i].ADPT_INTR = bInterrupt;
i91u_adpt[i].ADPT_BIOS = wBIOS;
- i91u_adpt[i].ADPT_Bus = bBus;
- i91u_adpt[i].ADPT_Device = bDevice;
+ i91u_adpt[i].ADPT_Bus = pci_dev->bus->number;
+ i91u_adpt[i].ADPT_Device = pci_dev->devfn >> 3;
i91u_adpt[i].pci_dev = pci_dev;
return 0;
}
@@ -623,7 +620,6 @@ static void init_i91uAdapter_table(void)
for (i = 0; i < MAX_SUPPORTED_ADAPTERS; i++) { /* Initialize adapter structure */
i91u_adpt[i].ADPT_BIOS = 0xffff;
i91u_adpt[i].ADPT_BASE = 0xffff;
- i91u_adpt[i].ADPT_INTR = 0xff;
i91u_adpt[i].ADPT_Bus = 0xff;
i91u_adpt[i].ADPT_Device = 0xff;
}
@@ -647,8 +643,6 @@ static void get_tulipPCIConfig(HCS * pCurHcb, int ch_idx)
pCurHcb->pci_dev = i91u_adpt[ch_idx].pci_dev;
pCurHcb->HCS_Base = i91u_adpt[ch_idx].ADPT_BASE; /* Supply base address */
pCurHcb->HCS_BIOS = i91u_adpt[ch_idx].ADPT_BIOS; /* Supply BIOS address */
- pCurHcb->HCS_Intr = i91u_adpt[ch_idx].ADPT_INTR; /* Supply interrupt line */
- return;
}

/***************************************************************************/
@@ -777,7 +771,7 @@ static int init_tulip(HCS * pCurHcb, SCB * scbp, int tul_num_scb,
pCurHcb->HCS_MaxTags[i] = 0xFF;
} /* for */
printk("i91u: PCI Base=0x%04X, IRQ=%d, BIOS=0x%04X0, SCSI ID=%d\n",
- pCurHcb->HCS_Base, pCurHcb->HCS_Intr,
+ pCurHcb->HCS_Base, pCurHcb->pci_dev->irq,
pCurHcb->HCS_BIOS, pCurHcb->HCS_SCSI_ID);
/*------------------- reset SCSI Bus ---------------------------*/
if (pCurHcb->HCS_Config & HCC_SCSI_RESET) {
@@ -2788,13 +2782,7 @@ static int tul_NewReturnNumberOfAdapters(void)
continue;
}

- if (Addi91u_into_Adapter_table(wBIOS,
- (pDev->resource[0].start),
- pDev->irq,
- pDev->bus->number,
- (pDev->devfn >> 3),
- pDev
- ) == 0)
+ if (Addi91u_into_Adapter_table(wBIOS, pDev) == 0)
iAdapters++;
}
}
@@ -2865,15 +2853,17 @@ static int i91u_detect(struct scsi_host_template * tpnt)
hreg->unique_id = pHCB->HCS_Base;
hreg->max_id = pHCB->HCS_MaxTar;
hreg->max_lun = 32; /* 10/21/97 */
- hreg->irq = pHCB->HCS_Intr;
+ hreg->irq = pHCB->pci_dev->irq;
hreg->this_id = pHCB->HCS_SCSI_ID; /* Assign HCS index */
hreg->base = (unsigned long)pHCB;
hreg->sg_tablesize = TOTAL_SG_ENTRY; /* Maximun support is 32 */

/* Initial tulip chip */
- ok = request_irq(pHCB->HCS_Intr, i91u_intr, IRQF_DISABLED | IRQF_SHARED, "i91u", hreg);
+ ok = request_irq(pHCB->pci_dev->irq, i91u_intr,
+ IRQF_DISABLED | IRQF_SHARED, "i91u", hreg);
if (ok < 0) {
- printk(KERN_WARNING "i91u: unable to request IRQ %d\n\n", pHCB->HCS_Intr);
+ printk(KERN_ERR "i91u: unable to request IRQ %d\n\n",
+ pHCB->pci_dev->irq);
return 0;
}
}
diff --git a/drivers/scsi/initio.h b/drivers/scsi/initio.h
index dcd42e2..817b696 100644
--- a/drivers/scsi/initio.h
+++ b/drivers/scsi/initio.h
@@ -528,7 +528,6 @@ typedef struct I91u_Adpt_Struc {
UWORD ADPT_BASE; /* 1 */
UBYTE ADPT_Bus; /* 2 */
UBYTE ADPT_Device; /* 3 */
- UBYTE ADPT_INTR; /* 4 */
struct pci_dev *pci_dev;
} INI_ADPT_STRUCT;

@@ -536,10 +535,15 @@ typedef struct I91u_Adpt_Struc {
/***********************************************************************
Host Adapter Control Structure
************************************************************************/
+/*
+ * TODO: Remove the "xxx_Unused" struct members only after determining
+ * that this struct does not have special GFP_DMA alignment/padding
+ * restrictions that hamper modification of Ha_Ctrl_Struc.
+ */
typedef struct Ha_Ctrl_Struc {
UWORD HCS_Base; /* 00 */
UWORD HCS_BIOS; /* 02 */
- UBYTE HCS_Intr; /* 04 */
+ UBYTE HCS_Intr_Unused; /* 04 */
UBYTE HCS_SCSI_ID; /* 05 */
UBYTE HCS_MaxTar; /* 06 */
UBYTE HCS_NumScbs; /* 07 */

2007-05-27 14:57:19

by Jeff Garzik

[permalink] [raw]
Subject: [PATCH 3/5] SCSI/initio minor cleanups


Two minor cleanups:
* eliminate unused ADPT_Device struct member
* eliminate redundant return statements

Signed-off-by: Jeff Garzik <[email protected]>

8ce38698fb5c65128621823e34830ed6c738f3be
diff --git a/drivers/scsi/initio.c b/drivers/scsi/initio.c
index d25a228..2bc2390 100644
--- a/drivers/scsi/initio.c
+++ b/drivers/scsi/initio.c
@@ -402,7 +402,6 @@ static void tul_se2_instr(WORD CurBase, UCHAR instr)
}
TUL_WR(CurBase + TUL_NVRAM, SE2CS); /* -CLK */
tul_se2_wait();
- return;
}


@@ -415,7 +414,6 @@ void tul_se2_ew_en(WORD CurBase)
tul_se2_instr(CurBase, 0x30); /* EWEN */
TUL_WR(CurBase + TUL_NVRAM, 0); /* -CS */
tul_se2_wait();
- return;
}


@@ -427,7 +425,6 @@ void tul_se2_ew_ds(WORD CurBase)
tul_se2_instr(CurBase, 0); /* EWDS */
TUL_WR(CurBase + TUL_NVRAM, 0); /* -CS */
tul_se2_wait();
- return;
}


@@ -501,7 +498,6 @@ static void tul_se2_wr(WORD CurBase, UCHAR adr, USHORT writeWord)
break; /* write complete */
}
TUL_WR(CurBase + TUL_NVRAM, 0); /* -CS */
- return;
}


@@ -559,7 +555,6 @@ void tul_se2_update_all(WORD CurBase)
}

tul_se2_ew_ds(CurBase); /* Disable write */
- return;
}

/*************************************************************************
@@ -601,12 +596,10 @@ static int Addi91u_into_Adapter_table(WORD wBIOS, struct pci_dev *pci_dev)
i91u_adpt[j].ADPT_BASE = i91u_adpt[j - 1].ADPT_BASE;
i91u_adpt[j].ADPT_BIOS = i91u_adpt[j - 1].ADPT_BIOS;
i91u_adpt[j].ADPT_Bus = i91u_adpt[j - 1].ADPT_Bus;
- i91u_adpt[j].ADPT_Device = i91u_adpt[j - 1].ADPT_Device;
}
i91u_adpt[i].ADPT_BASE = wBASE;
i91u_adpt[i].ADPT_BIOS = wBIOS;
i91u_adpt[i].ADPT_Bus = pci_dev->bus->number;
- i91u_adpt[i].ADPT_Device = pci_dev->devfn >> 3;
i91u_adpt[i].pci_dev = pci_dev;
return 0;
}
@@ -617,13 +610,12 @@ static void init_i91uAdapter_table(void)
{
int i;

- for (i = 0; i < MAX_SUPPORTED_ADAPTERS; i++) { /* Initialize adapter structure */
+ /* Initialize adapter structure */
+ for (i = 0; i < MAX_SUPPORTED_ADAPTERS; i++) {
i91u_adpt[i].ADPT_BIOS = 0xffff;
i91u_adpt[i].ADPT_BASE = 0xffff;
i91u_adpt[i].ADPT_Bus = 0xff;
- i91u_adpt[i].ADPT_Device = 0xff;
}
- return;
}

static void tul_stop_bm(HCS * pCurHcb)
@@ -915,8 +907,8 @@ static void tul_unlink_pend_scb(HCS * pCurHcb, SCB * pCurScb)
pPrevScb = pTmpScb;
pTmpScb = pTmpScb->SCB_NxtScb;
}
- return;
}
+
/***************************************************************************/
static void tul_append_busy_scb(HCS * pCurHcb, SCB * scbp)
{
@@ -990,7 +982,6 @@ static void tul_unlink_busy_scb(HCS * pCurHcb, SCB * pCurScb)
pPrevScb = pTmpScb;
pTmpScb = pTmpScb->SCB_NxtScb;
}
- return;
}

/***************************************************************************/
@@ -1297,7 +1288,6 @@ static void tul_exec_scb(HCS * pCurHcb, SCB * pCurScb)
TUL_WR(pCurHcb->HCS_Base + TUL_Mask, 0x0F);
}
spin_unlock_irqrestore(&(pCurHcb->HCS_SemaphLock), flags);
- return;
}

/***************************************************************************/
@@ -1507,7 +1497,6 @@ void tulip_scsi(HCS * pCurHcb)
pCurScb->SCB_HaStat = 0x16; /* bad command */
tul_append_done_scb(pCurHcb, pCurScb);
}
- return;
}


@@ -2548,7 +2537,6 @@ void tul_select_atn_stop(HCS * pCurHcb, SCB * pCurScb)
pCurHcb->HCS_ActScb = pCurScb;
pCurHcb->HCS_ActTcs = &pCurHcb->HCS_Tcs[pCurScb->SCB_Target];
TUL_WR(pCurHcb->HCS_Base + TUL_SCmd, TSC_SELATNSTOP);
- return;
}


@@ -2566,7 +2554,6 @@ void tul_select_atn(HCS * pCurHcb, SCB * pCurScb)
pCurHcb->HCS_ActTcs = &pCurHcb->HCS_Tcs[pCurScb->SCB_Target];
pCurHcb->HCS_ActScb = pCurScb;
TUL_WR(pCurHcb->HCS_Base + TUL_SCmd, TSC_SEL_ATN);
- return;
}

/***************************************************************************/
@@ -2585,7 +2572,6 @@ void tul_select_atn3(HCS * pCurHcb, SCB * pCurScb)
pCurHcb->HCS_ActTcs = &pCurHcb->HCS_Tcs[pCurScb->SCB_Target];
pCurHcb->HCS_ActScb = pCurScb;
TUL_WR(pCurHcb->HCS_Base + TUL_SCmd, TSC_SEL_ATN3);
- return;
}

/***************************************************************************/
diff --git a/drivers/scsi/initio.h b/drivers/scsi/initio.h
index 817b696..8186d14 100644
--- a/drivers/scsi/initio.h
+++ b/drivers/scsi/initio.h
@@ -527,7 +527,6 @@ typedef struct I91u_Adpt_Struc {
UWORD ADPT_BIOS; /* 0 */
UWORD ADPT_BASE; /* 1 */
UBYTE ADPT_Bus; /* 2 */
- UBYTE ADPT_Device; /* 3 */
struct pci_dev *pci_dev;
} INI_ADPT_STRUCT;

2007-05-27 14:58:22

by Jeff Garzik

[permalink] [raw]
Subject: [PATCH 4/5] SCSI/initio PCI dev init factorization


Factor PCI device init into separate function. No code changes,
except for return value differences.

Signed-off-by: Jeff Garzik <[email protected]>

6714c073a9df8c923fbfc661a1f287dfd1a74852
diff --git a/drivers/scsi/initio.c b/drivers/scsi/initio.c
index 2bc2390..702dcf5 100644
--- a/drivers/scsi/initio.c
+++ b/drivers/scsi/initio.c
@@ -2742,38 +2742,53 @@ static irqreturn_t i91u_intr(int irqno, void *dev_id)
return IRQ_HANDLED;
}

+static int tul_pci_dev_init(struct pci_dev *pDev)
+{
+ long dRegValue;
+ WORD wBIOS;
+ int rc;
+
+ rc = pci_enable_device(pDev);
+ if (rc)
+ return rc;
+
+ pci_read_config_dword(pDev, 0x44, (u32 *) & dRegValue);
+ wBIOS = (UWORD) (dRegValue & 0xFF);
+ if (((dRegValue & 0xFF00) >> 8) == 0xFF)
+ dRegValue = 0;
+ wBIOS = (wBIOS << 8) + ((UWORD) ((dRegValue & 0xFF00) >> 8));
+
+ rc = pci_set_dma_mask(pDev, DMA_32BIT_MASK);
+ if (rc) {
+ printk(KERN_WARNING
+ "i91u: Could not set 32 bit DMA mask\n");
+ return rc;
+ }
+
+ rc = Addi91u_into_Adapter_table(wBIOS, pDev);
+ if (rc)
+ return -ENODEV;
+
+ return 0;
+}
+
static int tul_NewReturnNumberOfAdapters(void)
{
struct pci_dev *pDev = NULL; /* Start from none */
int iAdapters = 0;
- long dRegValue;
- WORD wBIOS;
- int i = 0;
+ int i;

init_i91uAdapter_table();

for (i = 0; i < ARRAY_SIZE(i91u_pci_devices); i++)
{
while ((pDev = pci_find_device(i91u_pci_devices[i].vendor, i91u_pci_devices[i].device, pDev)) != NULL) {
- if (pci_enable_device(pDev))
- continue;
- pci_read_config_dword(pDev, 0x44, (u32 *) & dRegValue);
- wBIOS = (UWORD) (dRegValue & 0xFF);
- if (((dRegValue & 0xFF00) >> 8) == 0xFF)
- dRegValue = 0;
- wBIOS = (wBIOS << 8) + ((UWORD) ((dRegValue & 0xFF00) >> 8));
- if (pci_set_dma_mask(pDev, DMA_32BIT_MASK)) {
- printk(KERN_WARNING
- "i91u: Could not set 32 bit DMA mask\n");
- continue;
- }
-
- if (Addi91u_into_Adapter_table(wBIOS, pDev) == 0)
+ if (tul_pci_dev_init(pDev) == 0)
iAdapters++;
}
}

- return (iAdapters);
+ return iAdapters;
}

static int i91u_detect(struct scsi_host_template * tpnt)

2007-05-27 15:00:08

by Jeff Garzik

[permalink] [raw]
Subject: [PATCH 5/5] SCSI/initio conversion to PCI driver API


Prior simplifications in this patchset now permit a minimal conversion
to the new PCI API.

Further improvements and simplifications are certainly possible; those
should be presented in a separate patchset.

DO NOT APPLY (yet). For feedback (and testers?) only.


3f42ce6a28b81cb057b2304e3aca6e873618a6fd
diff --git a/drivers/scsi/initio.c b/drivers/scsi/initio.c
index 702dcf5..e54449f 100644
--- a/drivers/scsi/initio.c
+++ b/drivers/scsi/initio.c
@@ -242,6 +242,7 @@ static void tul_read_eeprom(WORD CurBase);
/* ---- INTERNAL VARIABLES ---- */
static HCS tul_hcs[MAX_SUPPORTED_ADAPTERS];
static INI_ADPT_STRUCT i91u_adpt[MAX_SUPPORTED_ADAPTERS];
+static int i91u_adpt_count;

/*NVRAM nvram, *nvramp = &nvram; */
static NVRAM i91unvram;
@@ -2769,26 +2770,13 @@ static int tul_pci_dev_init(struct pci_dev *pDev)
if (rc)
return -ENODEV;

+ i91u_adpt_count++;
return 0;
}

static int tul_NewReturnNumberOfAdapters(void)
{
- struct pci_dev *pDev = NULL; /* Start from none */
- int iAdapters = 0;
- int i;
-
- init_i91uAdapter_table();
-
- for (i = 0; i < ARRAY_SIZE(i91u_pci_devices); i++)
- {
- while ((pDev = pci_find_device(i91u_pci_devices[i].vendor, i91u_pci_devices[i].device, pDev)) != NULL) {
- if (tul_pci_dev_init(pDev) == 0)
- iAdapters++;
- }
- }
-
- return iAdapters;
+ return i91u_adpt_count;
}

static int i91u_detect(struct scsi_host_template * tpnt)
@@ -2843,7 +2831,7 @@ static int i91u_detect(struct scsi_host_template * tpnt)
request_region(pHCB->HCS_Base, 256, "i91u"); /* Register */

pHCB->HCS_Index = i; /* 7/29/98 */
- hreg = scsi_register(tpnt, sizeof(HCS));
+ hreg = scsi_host_alloc(tpnt, sizeof(HCS));
if(hreg == NULL) {
release_region(pHCB->HCS_Base, 256);
return 0;
@@ -2865,8 +2853,21 @@ static int i91u_detect(struct scsi_host_template * tpnt)
if (ok < 0) {
printk(KERN_ERR "i91u: unable to request IRQ %d\n\n",
pHCB->pci_dev->irq);
+ scsi_host_put(hreg);
+ release_region(pHCB->HCS_Base, 256);
+ return 0;
+ }
+
+ if (scsi_add_host(hreg, &pHCB->pci_dev->dev)) {
+ free_irq(pHCB->pci_dev->irq, hreg);
+ scsi_host_put(hreg);
+ release_region(pHCB->HCS_Base, 256);
return 0;
}
+
+ scsi_scan_host(hreg);
+
+ pci_set_drvdata(pHCB->pci_dev, hreg);
}

tpnt->this_id = -1;
@@ -3138,22 +3139,11 @@ static void i91uSCBPost(BYTE * pHcb, BYTE * pScb)
tul_release_scb(pHCB, pSCB); /* Release SCB for current channel */
}

-/*
- * Release ressources
- */
-static int i91u_release(struct Scsi_Host *hreg)
-{
- free_irq(hreg->irq, hreg);
- release_region(hreg->io_port, 256);
- return 0;
-}
MODULE_LICENSE("Dual BSD/GPL");

static struct scsi_host_template driver_template = {
.proc_name = "INI9100U",
.name = i91u_REVID,
- .detect = i91u_detect,
- .release = i91u_release,
.queuecommand = i91u_queuecommand,
// .abort = i91u_abort,
// .reset = i91u_reset,
@@ -3165,5 +3155,54 @@ static struct scsi_host_template driver_template = {
.cmd_per_lun = 1,
.use_clustering = ENABLE_CLUSTERING,
};
-#include "scsi_module.c"

+static int __devinit i91u_pci_probe(struct pci_dev *pdev,
+ const struct pci_device_id *ent)
+{
+ return tul_pci_dev_init(pdev);
+}
+
+static void __devexit i91u_pci_remove(struct pci_dev *pdev)
+{
+ struct Scsi_Host *hreg = pci_get_drvdata(pdev);
+
+ scsi_remove_host(hreg);
+ free_irq(hreg->irq, hreg);
+ release_region(hreg->io_port, 256);
+ scsi_host_put(hreg);
+ pci_set_drvdata(pdev, NULL);
+ pci_disable_device(pdev);
+}
+
+static struct pci_driver i91u_pci_driver = {
+ .name = "initio",
+ .id_table = i91u_pci_devices,
+ .probe = i91u_pci_probe,
+ .remove = i91u_pci_remove,
+};
+
+static int __init i91u_init(void)
+{
+ int rc;
+
+ init_i91uAdapter_table();
+
+ rc = pci_register_driver(&i91u_pci_driver);
+ if (rc)
+ return rc;
+
+ if (!i91u_detect(&driver_template)) {
+ pci_unregister_driver(&i91u_pci_driver);
+ return -ENODEV;
+ }
+
+ return 0;
+}
+
+static void __exit i91u_exit(void)
+{
+ pci_unregister_driver(&i91u_pci_driver);
+}
+
+module_init(i91u_init);
+module_exit(i91u_exit);

2007-05-27 15:04:11

by Jeff Garzik

[permalink] [raw]
Subject: Re: [PATCH 5/5] SCSI/initio conversion to PCI driver API

Jeff Garzik wrote:
> Prior simplifications in this patchset now permit a minimal conversion
> to the new PCI API.
>
> Further improvements and simplifications are certainly possible; those
> should be presented in a separate patchset.
>
> DO NOT APPLY (yet). For feedback (and testers?) only.


This only applies to patch #5.

Patches 1 through 4 should go upstream, IMO.

Jeff


2007-05-27 15:12:32

by James Bottomley

[permalink] [raw]
Subject: Re: [PATCH 5/5] SCSI/initio conversion to PCI driver API

On Sun, 2007-05-27 at 11:03 -0400, Jeff Garzik wrote:
> Jeff Garzik wrote:
> > Prior simplifications in this patchset now permit a minimal conversion
> > to the new PCI API.
> >
> > Further improvements and simplifications are certainly possible; those
> > should be presented in a separate patchset.
> >
> > DO NOT APPLY (yet). For feedback (and testers?) only.
>
>
> This only applies to patch #5.
>
> Patches 1 through 4 should go upstream, IMO.

Erm, actually, you're treading all over Alan:

http://git.kernel.org/?p=linux/kernel/git/jejb/scsi-misc-2.6.git;a=commit;h=72d39fea9017bbb1407620bf89dfe8d1fb658e35

Could you rebase your patches to scsi-misc-2.6 and resubmit (if there's
anything Alan hasn't covered)?

Thanks,

James


2007-05-27 15:43:18

by Alan

[permalink] [raw]
Subject: Re: [PATCH 0/5] SCSI/initio fixes, cleanups, PCI API support

On Sun, 27 May 2007 10:52:00 -0400
Jeff Garzik <[email protected]> wrote:

>
> This patchset presents the path to PCI API support in the initio driver.
>
> But the first patch really begs the question: Has this driver really
> been broken since Oct 2003? If so, let's just delete it.

Jeff. I (and Christoph) have already done a complete initio overhaul
including the PCI API and Hotplug and submitted it.

Has it been broken - no. The value was always NULL so it always worked on
x86-32. Its a sucky driver but its not defunct.

2007-05-27 15:43:53

by Alan

[permalink] [raw]
Subject: Re: [PATCH 5/5] SCSI/initio conversion to PCI driver API

On Sun, 27 May 2007 11:03:53 -0400
Jeff Garzik <[email protected]> wrote:

> Jeff Garzik wrote:
> > Prior simplifications in this patchset now permit a minimal conversion
> > to the new PCI API.
> >
> > Further improvements and simplifications are certainly possible; those
> > should be presented in a separate patchset.
> >
> > DO NOT APPLY (yet). For feedback (and testers?) only.
>
>
> This only applies to patch #5.
>
> Patches 1 through 4 should go upstream, IMO.

NAK all five.

There is a complete overhaul already done.

Alan

2007-05-27 15:45:49

by Jeff Garzik

[permalink] [raw]
Subject: Re: [PATCH 5/5] SCSI/initio conversion to PCI driver API

James Bottomley wrote:
> On Sun, 2007-05-27 at 11:03 -0400, Jeff Garzik wrote:
>> Jeff Garzik wrote:
>>> Prior simplifications in this patchset now permit a minimal conversion
>>> to the new PCI API.
>>>
>>> Further improvements and simplifications are certainly possible; those
>>> should be presented in a separate patchset.
>>>
>>> DO NOT APPLY (yet). For feedback (and testers?) only.
>>
>> This only applies to patch #5.
>>
>> Patches 1 through 4 should go upstream, IMO.
>
> Erm, actually, you're treading all over Alan:
>
> http://git.kernel.org/?p=linux/kernel/git/jejb/scsi-misc-2.6.git;a=commit;h=72d39fea9017bbb1407620bf89dfe8d1fb658e35
>
> Could you rebase your patches to scsi-misc-2.6 and resubmit (if there's
> anything Alan hasn't covered)?


Hey, if it's tested at least minimally that's the minimum I hoped to
achieve. It sounds like you can drop all patches, though if it takes
forever for scsi-misc-2.6 to go upstream, users in the interim will be
denied the make-it-actually-work fix provided in patch #1, if that matters.

Jeff