diff options
author | Tejun Heo <tj@kernel.org> | 2009-01-29 14:31:31 +0300 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2009-02-03 07:03:08 +0300 |
commit | 9913ff8abf1c70a8d52560dc931e1901d025ad27 (patch) | |
tree | d91ed8d73e9cb554d071e1d1449d5d0ef883e1a3 /drivers/ata | |
parent | 678afac678061ee41bc3007885003c125912a8e2 (diff) | |
download | linux-9913ff8abf1c70a8d52560dc931e1901d025ad27.tar.xz |
libata: check onlineness before using SPD in sata_down_spd_limit()
sata_down_spd_limit() should check whether the link is online before
using the SPD value to determine how to limit the link speed. Factor
out onlineness test and test it from sata_down_spd_limit().
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/ata')
-rw-r--r-- | drivers/ata/libata-core.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index af60d2715825..d006e5c4768c 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -164,6 +164,11 @@ MODULE_LICENSE("GPL"); MODULE_VERSION(DRV_VERSION); +static bool ata_sstatus_online(u32 sstatus) +{ + return (sstatus & 0xf) == 0x3; +} + /** * ata_link_next - link iteration helper * @link: the previous link, NULL to start @@ -2891,7 +2896,7 @@ int sata_down_spd_limit(struct ata_link *link) * If not, use cached value in link->sata_spd. */ rc = sata_scr_read(link, SCR_STATUS, &sstatus); - if (rc == 0) + if (rc == 0 && ata_sstatus_online(sstatus)) spd = (sstatus >> 4) & 0xf; else spd = link->sata_spd; @@ -5162,7 +5167,7 @@ bool ata_phys_link_online(struct ata_link *link) u32 sstatus; if (sata_scr_read(link, SCR_STATUS, &sstatus) == 0 && - (sstatus & 0xf) == 0x3) + ata_sstatus_online(sstatus)) return true; return false; } @@ -5186,7 +5191,7 @@ bool ata_phys_link_offline(struct ata_link *link) u32 sstatus; if (sata_scr_read(link, SCR_STATUS, &sstatus) == 0 && - (sstatus & 0xf) != 0x3) + !ata_sstatus_online(sstatus)) return true; return false; } |