[PATCH] libata: make ata_dev_knobble() per-device
authorTejun Heo <htejun@gmail.com>
Sun, 12 Feb 2006 14:32:58 +0000 (23:32 +0900)
committerJeff Garzik <jgarzik@pobox.com>
Sun, 12 Feb 2006 19:29:10 +0000 (14:29 -0500)
ata_dev_knobble() unconditionally used the first device of the port to
determine whether a device is bridged or not.  This causes bridge
limit to be incorrectly applied or unapplied for hosts with slave
devices (e.g. ata_piix).

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
drivers/scsi/libata-core.c

index 21ae752cd95c20c31e7b70f2c0992f2600c8423a..5e8a32052a1e6a863f29c4a97dffc1e5aff42414 100644 (file)
@@ -1121,9 +1121,10 @@ err_out:
 }
 
 
-static inline u8 ata_dev_knobble(const struct ata_port *ap)
+static inline u8 ata_dev_knobble(const struct ata_port *ap,
+                                struct ata_device *dev)
 {
-       return ((ap->cbl == ATA_CBL_SATA) && (!ata_id_is_sata(ap->device->id)));
+       return ((ap->cbl == ATA_CBL_SATA) && (!ata_id_is_sata(dev->id)));
 }
 
 /**
@@ -1137,9 +1138,9 @@ static inline u8 ata_dev_knobble(const struct ata_port *ap)
 void ata_dev_config(struct ata_port *ap, unsigned int i)
 {
        /* limit bridge transfers to udma5, 200 sectors */
-       if (ata_dev_knobble(ap)) {
+       if (ata_dev_knobble(ap, &ap->device[i])) {
                printk(KERN_INFO "ata%u(%u): applying bridge limits\n",
-                       ap->id, ap->device->devno);
+                      ap->id, i);
                ap->udma_mask &= ATA_UDMA5;
                ap->host->max_sectors = ATA_MAX_SECTORS;
                ap->host->hostt->max_sectors = ATA_MAX_SECTORS;