aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libata-core.c
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2006-03-05 14:31:57 -0500
committerJeff Garzik <jeff@garzik.org>2006-03-11 19:03:39 -0500
commit23e71c3d3e88b9f554ecd47d6f9aec76e89e2e6d (patch)
tree0dd04ce65cc57a8d82d9b42eec47338977bf7b2d /drivers/scsi/libata-core.c
parentff8854b2719b9d26f5d3e84db4f66eb7e35e4ed9 (diff)
[PATCH] libata: use xfer_mask helpers in ata_dev_set_mode()
Rewrite hardcoded xfer_mode string determination in ata_dev_set_mode() using xfer_mask helpers. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/scsi/libata-core.c')
-rw-r--r--drivers/scsi/libata-core.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index 84a8550c56a4..88495127efb2 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -1752,9 +1752,6 @@ static u8 base_from_shift(unsigned int shift)
1752 1752
1753static void ata_dev_set_mode(struct ata_port *ap, struct ata_device *dev) 1753static void ata_dev_set_mode(struct ata_port *ap, struct ata_device *dev)
1754{ 1754{
1755 int ofs, idx;
1756 u8 base;
1757
1758 if (!ata_dev_present(dev) || (ap->flags & ATA_FLAG_PORT_DISABLED)) 1755 if (!ata_dev_present(dev) || (ap->flags & ATA_FLAG_PORT_DISABLED))
1759 return; 1756 return;
1760 1757
@@ -1763,22 +1760,18 @@ static void ata_dev_set_mode(struct ata_port *ap, struct ata_device *dev)
1763 1760
1764 ata_dev_set_xfermode(ap, dev); 1761 ata_dev_set_xfermode(ap, dev);
1765 1762
1766 base = base_from_shift(dev->xfer_shift);
1767 ofs = dev->xfer_mode - base;
1768 idx = ofs + dev->xfer_shift;
1769 WARN_ON(idx >= ARRAY_SIZE(xfer_mode_str));
1770
1771 if (ata_dev_revalidate(ap, dev, 0)) { 1763 if (ata_dev_revalidate(ap, dev, 0)) {
1772 printk(KERN_ERR "ata%u: failed to revalidate after set " 1764 printk(KERN_ERR "ata%u: failed to revalidate after set "
1773 "xfermode, disabled\n", ap->id); 1765 "xfermode, disabled\n", ap->id);
1774 ata_port_disable(ap); 1766 ata_port_disable(ap);
1775 } 1767 }
1776 1768
1777 DPRINTK("idx=%d xfer_shift=%u, xfer_mode=0x%x, base=0x%x, offset=%d\n", 1769 DPRINTK("xfer_shift=%u, xfer_mode=0x%x\n",
1778 idx, dev->xfer_shift, (int)dev->xfer_mode, (int)base, ofs); 1770 dev->xfer_shift, (int)dev->xfer_mode);
1779 1771
1780 printk(KERN_INFO "ata%u: dev %u configured for %s\n", 1772 printk(KERN_INFO "ata%u: dev %u configured for %s\n",
1781 ap->id, dev->devno, xfer_mode_str[idx]); 1773 ap->id, dev->devno,
1774 ata_mode_string(ata_xfer_mode2mask(dev->xfer_mode)));
1782} 1775}
1783 1776
1784static int ata_host_set_pio(struct ata_port *ap) 1777static int ata_host_set_pio(struct ata_port *ap)