aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/libata-eh.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ata/libata-eh.c')
-rw-r--r--drivers/ata/libata-eh.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index a645cd3ab163..06a4db1ec10e 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -3232,7 +3232,7 @@ static int ata_eh_maybe_retry_flush(struct ata_device *dev)
3232static int ata_eh_set_lpm(struct ata_link *link, enum ata_lpm_policy policy, 3232static int ata_eh_set_lpm(struct ata_link *link, enum ata_lpm_policy policy,
3233 struct ata_device **r_failed_dev) 3233 struct ata_device **r_failed_dev)
3234{ 3234{
3235 struct ata_port *ap = link->ap; 3235 struct ata_port *ap = ata_is_host_link(link) ? link->ap : NULL;
3236 struct ata_eh_context *ehc = &link->eh_context; 3236 struct ata_eh_context *ehc = &link->eh_context;
3237 struct ata_device *dev, *link_dev = NULL, *lpm_dev = NULL; 3237 struct ata_device *dev, *link_dev = NULL, *lpm_dev = NULL;
3238 unsigned int hints = ATA_LPM_EMPTY | ATA_LPM_HIPM; 3238 unsigned int hints = ATA_LPM_EMPTY | ATA_LPM_HIPM;
@@ -3278,9 +3278,12 @@ static int ata_eh_set_lpm(struct ata_link *link, enum ata_lpm_policy policy,
3278 } 3278 }
3279 } 3279 }
3280 3280
3281 rc = ap->ops->set_lpm(link, policy, hints); 3281 if (ap) {
3282 if (!rc && ap->slave_link) 3282 rc = ap->ops->set_lpm(link, policy, hints);
3283 rc = ap->ops->set_lpm(ap->slave_link, policy, hints); 3283 if (!rc && ap->slave_link)
3284 rc = ap->ops->set_lpm(ap->slave_link, policy, hints);
3285 } else
3286 rc = sata_pmp_set_lpm(link, policy, hints);
3284 3287
3285 /* 3288 /*
3286 * Attribute link config failure to the first (LPM) enabled 3289 * Attribute link config failure to the first (LPM) enabled
@@ -3412,8 +3415,14 @@ static int ata_eh_schedule_probe(struct ata_device *dev)
3412 ehc->saved_ncq_enabled &= ~(1 << dev->devno); 3415 ehc->saved_ncq_enabled &= ~(1 << dev->devno);
3413 3416
3414 /* the link maybe in a deep sleep, wake it up */ 3417 /* the link maybe in a deep sleep, wake it up */
3415 if (link->lpm_policy > ATA_LPM_MAX_POWER) 3418 if (link->lpm_policy > ATA_LPM_MAX_POWER) {
3416 link->ap->ops->set_lpm(link, ATA_LPM_MAX_POWER, ATA_LPM_EMPTY); 3419 if (ata_is_host_link(link))
3420 link->ap->ops->set_lpm(link, ATA_LPM_MAX_POWER,
3421 ATA_LPM_EMPTY);
3422 else
3423 sata_pmp_set_lpm(link, ATA_LPM_MAX_POWER,
3424 ATA_LPM_EMPTY);
3425 }
3417 3426
3418 /* Record and count probe trials on the ering. The specific 3427 /* Record and count probe trials on the ering. The specific
3419 * error mask used is irrelevant. Because a successful device 3428 * error mask used is irrelevant. Because a successful device