aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide')
-rw-r--r--drivers/ide/ide.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c
index 9dcf5aed92cb..64997873b6d7 100644
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -365,15 +365,15 @@ __IDE_DEVSET(pio_mode, 0, NULL, set_pio_mode);
365 365
366static int generic_ide_suspend(struct device *dev, pm_message_t mesg) 366static int generic_ide_suspend(struct device *dev, pm_message_t mesg)
367{ 367{
368 ide_drive_t *drive = dev->driver_data; 368 ide_drive_t *drive = dev->driver_data, *pair = ide_get_pair_dev(drive);
369 ide_hwif_t *hwif = HWIF(drive); 369 ide_hwif_t *hwif = HWIF(drive);
370 struct request *rq; 370 struct request *rq;
371 struct request_pm_state rqpm; 371 struct request_pm_state rqpm;
372 ide_task_t args; 372 ide_task_t args;
373 int ret; 373 int ret;
374 374
375 /* Call ACPI _GTM only once */ 375 /* call ACPI _GTM only once */
376 if (!(drive->dn % 2)) 376 if ((drive->dn & 1) == 0 || pair == NULL)
377 ide_acpi_get_timing(hwif); 377 ide_acpi_get_timing(hwif);
378 378
379 memset(&rqpm, 0, sizeof(rqpm)); 379 memset(&rqpm, 0, sizeof(rqpm));
@@ -389,26 +389,25 @@ static int generic_ide_suspend(struct device *dev, pm_message_t mesg)
389 389
390 ret = blk_execute_rq(drive->queue, NULL, rq, 0); 390 ret = blk_execute_rq(drive->queue, NULL, rq, 0);
391 blk_put_request(rq); 391 blk_put_request(rq);
392 /* only call ACPI _PS3 after both drivers are suspended */ 392
393 if (!ret && (((drive->dn % 2) && hwif->drives[0].present 393 /* call ACPI _PS3 only after both devices are suspended */
394 && hwif->drives[1].present) 394 if (ret == 0 && ((drive->dn & 1) || pair == NULL))
395 || !hwif->drives[0].present
396 || !hwif->drives[1].present))
397 ide_acpi_set_state(hwif, 0); 395 ide_acpi_set_state(hwif, 0);
396
398 return ret; 397 return ret;
399} 398}
400 399
401static int generic_ide_resume(struct device *dev) 400static int generic_ide_resume(struct device *dev)
402{ 401{
403 ide_drive_t *drive = dev->driver_data; 402 ide_drive_t *drive = dev->driver_data, *pair = ide_get_pair_dev(drive);
404 ide_hwif_t *hwif = HWIF(drive); 403 ide_hwif_t *hwif = HWIF(drive);
405 struct request *rq; 404 struct request *rq;
406 struct request_pm_state rqpm; 405 struct request_pm_state rqpm;
407 ide_task_t args; 406 ide_task_t args;
408 int err; 407 int err;
409 408
410 /* Call ACPI _STM only once */ 409 /* call ACPI _PS0 / _STM only once */
411 if (!(drive->dn % 2)) { 410 if ((drive->dn & 1) == 0 || pair == NULL) {
412 ide_acpi_set_state(hwif, 1); 411 ide_acpi_set_state(hwif, 1);
413 ide_acpi_push_timing(hwif); 412 ide_acpi_push_timing(hwif);
414 } 413 }