summaryrefslogtreecommitdiff
path: root/drivers/ata/sata_sil.c
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2007-08-06 18:36:23 +0900
committerJeff Garzik <jeff@garzik.org>2007-10-12 14:55:30 -0400
commitf58229f8060055b08b34008ea08f31de1e2f003c (patch)
tree6ca5ef546671cb975ef3632fb032c238eaf1bb4c /drivers/ata/sata_sil.c
parent9af5c9c97dc9d599281778864c72b385f0c63341 (diff)
downloadlinux-f58229f8060055b08b34008ea08f31de1e2f003c.tar.gz
linux-f58229f8060055b08b34008ea08f31de1e2f003c.tar.xz
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/sata_sil.c')
-rw-r--r--drivers/ata/sata_sil.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/ata/sata_sil.c b/drivers/ata/sata_sil.c
index 2ddbe4cc71e4..4c9295a49a49 100644
--- a/drivers/ata/sata_sil.c
+++ b/drivers/ata/sata_sil.c
@@ -303,22 +303,20 @@ static int sil_set_mode (struct ata_port *ap, struct ata_device **r_failed)
struct ata_device *dev;
void __iomem *mmio_base = host->iomap[SIL_MMIO_BAR];
void __iomem *addr = mmio_base + sil_port[ap->port_no].xfer_mode;
- u32 tmp, dev_mode[2];
- unsigned int i;
+ u32 tmp, dev_mode[2] = { };
int rc;
rc = ata_do_set_mode(ap, r_failed);
if (rc)
return rc;
- for (i = 0; i < 2; i++) {
- dev = &ap->link.device[i];
+ ata_link_for_each_dev(dev, &ap->link) {
if (!ata_dev_enabled(dev))
- dev_mode[i] = 0; /* PIO0/1/2 */
+ dev_mode[dev->devno] = 0; /* PIO0/1/2 */
else if (dev->flags & ATA_DFLAG_PIO)
- dev_mode[i] = 1; /* PIO3/4 */
+ dev_mode[dev->devno] = 1; /* PIO3/4 */
else
- dev_mode[i] = 3; /* UDMA */
+ dev_mode[dev->devno] = 3; /* UDMA */
/* value 2 indicates MDMA */
}