diff options
author | Tejun Heo <htejun@gmail.com> | 2007-08-06 05:36:23 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-10-12 14:55:30 -0400 |
commit | f58229f8060055b08b34008ea08f31de1e2f003c (patch) | |
tree | 6ca5ef546671cb975ef3632fb032c238eaf1bb4c /drivers/ata/pata_ixp4xx_cf.c | |
parent | 9af5c9c97dc9d599281778864c72b385f0c63341 (diff) |
libata-link: implement and use link/device iterators
Multiple links and different number of devices per link should be
considered to iterate over links and devices. This patch implements
and uses link and device iterators - ata_port_for_each_link() and
ata_link_for_each_dev() - and ata_link_max_devices().
This change makes a lot of functions iterate over only possible
devices instead of from dev 0 to dev ATA_MAX_DEVICES. All such
changes have been examined and nothing should be broken.
While at it, add a separating comment before device helpers to
distinguish them better from link helpers and others.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/pata_ixp4xx_cf.c')
-rw-r--r-- | drivers/ata/pata_ixp4xx_cf.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/ata/pata_ixp4xx_cf.c b/drivers/ata/pata_ixp4xx_cf.c index 3e2b8ce5fa37..7db315a9baad 100644 --- a/drivers/ata/pata_ixp4xx_cf.c +++ b/drivers/ata/pata_ixp4xx_cf.c | |||
@@ -28,10 +28,9 @@ | |||
28 | 28 | ||
29 | static int ixp4xx_set_mode(struct ata_port *ap, struct ata_device **error) | 29 | static int ixp4xx_set_mode(struct ata_port *ap, struct ata_device **error) |
30 | { | 30 | { |
31 | int i; | 31 | struct ata_device *dev; |
32 | 32 | ||
33 | for (i = 0; i < ATA_MAX_DEVICES; i++) { | 33 | ata_link_for_each_dev(dev, &ap->link) { |
34 | struct ata_device *dev = &ap->link.device[i]; | ||
35 | if (ata_dev_enabled(dev)) { | 34 | if (ata_dev_enabled(dev)) { |
36 | ata_dev_printk(dev, KERN_INFO, "configured for PIO0\n"); | 35 | ata_dev_printk(dev, KERN_INFO, "configured for PIO0\n"); |
37 | dev->pio_mode = XFER_PIO_0; | 36 | dev->pio_mode = XFER_PIO_0; |