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.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 5e590504f3aa..17a637877d03 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -3275,6 +3275,7 @@ static int ata_eh_set_lpm(struct ata_link *link, enum ata_lpm_policy policy,
3275 struct ata_port *ap = ata_is_host_link(link) ? link->ap : NULL; 3275 struct ata_port *ap = ata_is_host_link(link) ? link->ap : NULL;
3276 struct ata_eh_context *ehc = &link->eh_context; 3276 struct ata_eh_context *ehc = &link->eh_context;
3277 struct ata_device *dev, *link_dev = NULL, *lpm_dev = NULL; 3277 struct ata_device *dev, *link_dev = NULL, *lpm_dev = NULL;
3278 enum ata_lpm_policy old_policy = link->lpm_policy;
3278 unsigned int hints = ATA_LPM_EMPTY | ATA_LPM_HIPM; 3279 unsigned int hints = ATA_LPM_EMPTY | ATA_LPM_HIPM;
3279 unsigned int err_mask; 3280 unsigned int err_mask;
3280 int rc; 3281 int rc;
@@ -3338,6 +3339,14 @@ static int ata_eh_set_lpm(struct ata_link *link, enum ata_lpm_policy policy,
3338 goto fail; 3339 goto fail;
3339 } 3340 }
3340 3341
3342 /*
3343 * Low level driver acked the transition. Issue DIPM command
3344 * with the new policy set.
3345 */
3346 link->lpm_policy = policy;
3347 if (ap && ap->slave_link)
3348 ap->slave_link->lpm_policy = policy;
3349
3341 /* host config updated, enable DIPM if transitioning to MIN_POWER */ 3350 /* host config updated, enable DIPM if transitioning to MIN_POWER */
3342 ata_for_each_dev(dev, link, ENABLED) { 3351 ata_for_each_dev(dev, link, ENABLED) {
3343 if (policy == ATA_LPM_MIN_POWER && ata_id_has_dipm(dev->id)) { 3352 if (policy == ATA_LPM_MIN_POWER && ata_id_has_dipm(dev->id)) {
@@ -3353,12 +3362,14 @@ static int ata_eh_set_lpm(struct ata_link *link, enum ata_lpm_policy policy,
3353 } 3362 }
3354 } 3363 }
3355 3364
3356 link->lpm_policy = policy;
3357 if (ap && ap->slave_link)
3358 ap->slave_link->lpm_policy = policy;
3359 return 0; 3365 return 0;
3360 3366
3361fail: 3367fail:
3368 /* restore the old policy */
3369 link->lpm_policy = old_policy;
3370 if (ap && ap->slave_link)
3371 ap->slave_link->lpm_policy = old_policy;
3372
3362 /* if no device or only one more chance is left, disable LPM */ 3373 /* if no device or only one more chance is left, disable LPM */
3363 if (!dev || ehc->tries[dev->devno] <= 2) { 3374 if (!dev || ehc->tries[dev->devno] <= 2) {
3364 ata_link_printk(link, KERN_WARNING, 3375 ata_link_printk(link, KERN_WARNING,