aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/ide.h
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-01-06 11:20:56 -0500
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-01-06 11:20:56 -0500
commit2bd24a1cfc99d242c2cff9a6b74ca49fcaac3fb6 (patch)
treed4797f56699e9da367e12b5e1d01b108241424f6 /include/linux/ide.h
parent5e7f3a46690f7f6c9f2781c700ab4370874aa0e8 (diff)
ide: add port and host iterators
Add ide_port_for_each_dev() / ide_host_for_each_port() iterators and update IDE code to use them. While at it: - s/unit/i/ variable in ide_port_wait_ready(), ide_probe_port(), ide_port_tune_devices(), ide_port_init_devices_data(), do_reset1(), ide_acpi_set_state() and scc_dma_end() - s/d/i/ variable in ide_proc_port_register_devices() There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'include/linux/ide.h')
-rw-r--r--include/linux/ide.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/include/linux/ide.h b/include/linux/ide.h
index f00086b10be3..4cecd923fc79 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -753,7 +753,7 @@ typedef struct hwif_s {
753 753
754 unsigned long sata_scr[SATA_NR_PORTS]; 754 unsigned long sata_scr[SATA_NR_PORTS];
755 755
756 ide_drive_t *devices[MAX_DRIVES]; 756 ide_drive_t *devices[MAX_DRIVES + 1];
757 757
758 u8 major; /* our major number */ 758 u8 major; /* our major number */
759 u8 index; /* 0 for ide0; 1 for ide1; ... */ 759 u8 index; /* 0 for ide0; 1 for ide1; ... */
@@ -861,7 +861,7 @@ typedef struct hwif_s {
861#define MAX_HOST_PORTS 4 861#define MAX_HOST_PORTS 4
862 862
863struct ide_host { 863struct ide_host {
864 ide_hwif_t *ports[MAX_HOST_PORTS]; 864 ide_hwif_t *ports[MAX_HOST_PORTS + 1];
865 unsigned int n_ports; 865 unsigned int n_ports;
866 struct device *dev[2]; 866 struct device *dev[2];
867 unsigned int (*init_chipset)(struct pci_dev *); 867 unsigned int (*init_chipset)(struct pci_dev *);
@@ -1604,4 +1604,11 @@ static inline ide_drive_t *ide_get_pair_dev(ide_drive_t *drive)
1604 1604
1605 return (peer->dev_flags & IDE_DFLAG_PRESENT) ? peer : NULL; 1605 return (peer->dev_flags & IDE_DFLAG_PRESENT) ? peer : NULL;
1606} 1606}
1607
1608#define ide_port_for_each_dev(i, dev, port) \
1609 for ((i) = 0; ((dev) = (port)->devices[i]) || (i) < MAX_DRIVES; (i)++)
1610
1611#define ide_host_for_each_port(i, port, host) \
1612 for ((i) = 0; ((port) = (host)->ports[i]) || (i) < MAX_HOST_PORTS; (i)++)
1613
1607#endif /* _IDE_H */ 1614#endif /* _IDE_H */