aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/libata-eh.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2008-10-27 06:59:23 -0400
committerJeff Garzik <jgarzik@redhat.com>2008-10-27 23:55:12 -0400
commit4a9c7b3359889399aacb94019bbdfc9f38d4cff7 (patch)
treea791790f02f2a0a5b3ea66c1526ae79f1711dca8 /drivers/ata/libata-eh.c
parentc77a036beceabbfd85b366193685cb49f38292bd (diff)
libata: fix device iteration bugs
There were several places where only enabled devices should be iterated over but device enabledness wasn't checked. * IDENTIFY data 40 wire check in cable_is_40wire() * xfer_mode/ncq_enabled saving in ata_scsi_error() * DUBIOUS_XFER handling in ata_set_mode() While at it, reformat comments in cable_is_40wire(). Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/ata/libata-eh.c')
-rw-r--r--drivers/ata/libata-eh.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 5d687d7cffae..a6a3b1554c45 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -603,6 +603,9 @@ void ata_scsi_error(struct Scsi_Host *host)
603 ata_link_for_each_dev(dev, link) { 603 ata_link_for_each_dev(dev, link) {
604 int devno = dev->devno; 604 int devno = dev->devno;
605 605
606 if (!ata_dev_enabled(dev))
607 continue;
608
606 ehc->saved_xfer_mode[devno] = dev->xfer_mode; 609 ehc->saved_xfer_mode[devno] = dev->xfer_mode;
607 if (ata_ncq_enabled(dev)) 610 if (ata_ncq_enabled(dev))
608 ehc->saved_ncq_enabled |= 1 << devno; 611 ehc->saved_ncq_enabled |= 1 << devno;
@@ -2787,6 +2790,9 @@ int ata_set_mode(struct ata_link *link, struct ata_device **r_failed_dev)
2787 2790
2788 /* if data transfer is verified, clear DUBIOUS_XFER on ering top */ 2791 /* if data transfer is verified, clear DUBIOUS_XFER on ering top */
2789 ata_link_for_each_dev(dev, link) { 2792 ata_link_for_each_dev(dev, link) {
2793 if (!ata_dev_enabled(dev))
2794 continue;
2795
2790 if (!(dev->flags & ATA_DFLAG_DUBIOUS_XFER)) { 2796 if (!(dev->flags & ATA_DFLAG_DUBIOUS_XFER)) {
2791 struct ata_ering_entry *ent; 2797 struct ata_ering_entry *ent;
2792 2798
@@ -2808,6 +2814,9 @@ int ata_set_mode(struct ata_link *link, struct ata_device **r_failed_dev)
2808 u8 saved_xfer_mode = ehc->saved_xfer_mode[dev->devno]; 2814 u8 saved_xfer_mode = ehc->saved_xfer_mode[dev->devno];
2809 u8 saved_ncq = !!(ehc->saved_ncq_enabled & (1 << dev->devno)); 2815 u8 saved_ncq = !!(ehc->saved_ncq_enabled & (1 << dev->devno));
2810 2816
2817 if (!ata_dev_enabled(dev))
2818 continue;
2819
2811 if (dev->xfer_mode != saved_xfer_mode || 2820 if (dev->xfer_mode != saved_xfer_mode ||
2812 ata_ncq_enabled(dev) != saved_ncq) 2821 ata_ncq_enabled(dev) != saved_ncq)
2813 dev->flags |= ATA_DFLAG_DUBIOUS_XFER; 2822 dev->flags |= ATA_DFLAG_DUBIOUS_XFER;