[PATCH 6/8] ide: separate PCI specific init from generic init in ide_pci_setup_ports()

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <linux-ide@...>
Cc: Bartlomiej Zolnierkiewicz <bzolnier@...>, <linux-kernel@...>
Date: Sunday, January 6, 2008 - 1:03 pm

* Setup ->mate and ->channel in ide_pci_setup_ports() instead of
  in ide_hwif_configure().

* Make 'port' parameter for ide_hwif_configure() 'unsigned int'.

* Separate PCI specific init from generic init in ide_pci_setup_ports().

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
+28 bytes
 drivers/ide/setup-pci.c |   29 +++++++++++++++++++++--------
 1 file changed, 21 insertions(+), 8 deletions(-)

Index: b/drivers/ide/setup-pci.c
===================================================================
--- a/drivers/ide/setup-pci.c
+++ b/drivers/ide/setup-pci.c
@@ -337,7 +337,8 @@ static int ide_pci_check_iomem(struct pc
  *	ide_hwif_configure	-	configure an IDE interface
  *	@dev: PCI device holding interface
  *	@d: IDE port info
- *	@mate: Paired interface if any
+ *	@port: port number
+ *	@irq: PCI IRQ
  *
  *	Perform the initial set up for the hardware interface structure. This
  *	is done per interface port rather than per PCI device. There may be
@@ -346,7 +347,9 @@ static int ide_pci_check_iomem(struct pc
  *	Returns the new hardware interface structure, or NULL on a failure
  */
 
-static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev, const struct ide_port_info *d, ide_hwif_t *mate, int port, int irq)
+static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev,
+				      const struct ide_port_info *d,
+				      unsigned int port, int irq)
 {
 	unsigned long ctl = 0, base = 0;
 	ide_hwif_t *hwif;
@@ -392,12 +395,7 @@ static ide_hwif_t *ide_hwif_configure(st
 
 	hwif->dev = &dev->dev;
 	hwif->cds = d;
-	hwif->channel = port;
 
-	if (mate) {
-		hwif->mate = mate;
-		mate->mate = hwif;
-	}
 	return hwif;
 }
 
@@ -525,10 +523,25 @@ void ide_pci_setup_ports(struct pci_dev 
 			continue;	/* port not enabled */
 		}
 
-		if ((hwif = ide_hwif_configure(dev, d, mate, port, pciirq)) == NULL)
+		hwif = ide_hwif_configure(dev, d, port, pciirq);
+		if (hwif == NULL)
 			continue;
 
 		*(idx + port) = hwif->index;
+	}
+
+	for (port = 0; port < channels; ++port) {
+		if (*(idx + port) == 0xff)
+			continue;
+
+		hwif = &ide_hwifs[*(idx + port)];
+
+		if (mate) {
+			hwif->mate = mate;
+			mate->mate = hwif;
+		}
+
+		hwif->channel = port;
 
 		if (d->init_iops)
 			d->init_iops(hwif);
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 0/8] ide: more IDE probing code rework, Bartlomiej Zolnierkiewicz..., (Sun Jan 6, 1:02 pm)
[PATCH 8/8] ide: add -&gt;cable_detect method to ide_hwif_t, Bartlomiej Zolnierkiewicz..., (Sun Jan 6, 1:03 pm)
[PATCH 7/8] ide: add struct ide_port_info instances to legac..., Bartlomiej Zolnierkiewicz..., (Sun Jan 6, 1:03 pm)
Re: [PATCH 7/8] ide: add struct ide_port_info instances to l..., Bartlomiej Zolnierkiewicz..., (Sun Feb 10, 1:04 pm)
Re: [PATCH 7/8] ide: add struct ide_port_info instances to l..., Bartlomiej Zolnierkiewicz..., (Sun Feb 10, 7:16 pm)
Re: [PATCH 7/8] ide: add struct ide_port_info instances to l..., Bartlomiej Zolnierkiewicz..., (Fri Feb 1, 7:35 pm)
[PATCH 6/8] ide: separate PCI specific init from generic ini..., Bartlomiej Zolnierkiewicz..., (Sun Jan 6, 1:03 pm)
[PATCH 5/8] ide: always set DMA masks in ide_pci_setup_ports(), Bartlomiej Zolnierkiewicz..., (Sun Jan 6, 1:02 pm)
[PATCH 4/8] macide: remove drive-&gt;capacity64 quirk, Bartlomiej Zolnierkiewicz..., (Sun Jan 6, 1:02 pm)
[PATCH 3/8] atiixp/cs5535/scc_pata: fix "idex=ata66" paramet..., Bartlomiej Zolnierkiewicz..., (Sun Jan 6, 1:02 pm)
[PATCH 2/8] au1xxx-ide: fix -&gt;io_32bit handling, Bartlomiej Zolnierkiewicz..., (Sun Jan 6, 1:02 pm)
[PATCH 1/8] dtc2278: fix -&gt;io_32bit handling, Bartlomiej Zolnierkiewicz..., (Sun Jan 6, 1:02 pm)