ide: fix resume for CONFIG_BLK_DEV_IDEACPI=y
commit 2f0d0fd2a6
("ide-acpi: cleanup
do_drive_get_GTF()") didn't account for the lack of hwif->acpidata
check in generic_ide_suspend() [ indirect user of do_drive_get_GTF()
through ide_acpi_exec_tfs() ] resulting in broken resume when ACPI
support is enabled but ACPI data is unavailable.
Fix it by adding ide_port_acpi() helper for checking if port needs
ACPI handling and cleaning generic_ide_{suspend,resume}() to use it
instead of hiding hwif->acpidata and ide_noacpi checks in IDE ACPI
helpers (this should help in preventing similar bugs in the future).
While at it:
- kill superfluous debugging printks in ide_acpi_{get,push}_timing()
Reported-and-tested-by: Etienne Basset <etienne.basset@numericable.fr>
Also-reported-and-tested-by: Jeff Chua <jeff.chua.linux@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
9c72ebef5a
commit
2bf427b25b
@@ -10,9 +10,11 @@ int generic_ide_suspend(struct device *dev, pm_message_t mesg)
|
||||
struct request_pm_state rqpm;
|
||||
int ret;
|
||||
|
||||
/* call ACPI _GTM only once */
|
||||
if ((drive->dn & 1) == 0 || pair == NULL)
|
||||
ide_acpi_get_timing(hwif);
|
||||
if (ide_port_acpi(hwif)) {
|
||||
/* call ACPI _GTM only once */
|
||||
if ((drive->dn & 1) == 0 || pair == NULL)
|
||||
ide_acpi_get_timing(hwif);
|
||||
}
|
||||
|
||||
memset(&rqpm, 0, sizeof(rqpm));
|
||||
rq = blk_get_request(drive->queue, READ, __GFP_WAIT);
|
||||
@@ -26,9 +28,11 @@ int generic_ide_suspend(struct device *dev, pm_message_t mesg)
|
||||
ret = blk_execute_rq(drive->queue, NULL, rq, 0);
|
||||
blk_put_request(rq);
|
||||
|
||||
/* call ACPI _PS3 only after both devices are suspended */
|
||||
if (ret == 0 && ((drive->dn & 1) || pair == NULL))
|
||||
ide_acpi_set_state(hwif, 0);
|
||||
if (ret == 0 && ide_port_acpi(hwif)) {
|
||||
/* call ACPI _PS3 only after both devices are suspended */
|
||||
if ((drive->dn & 1) || pair == NULL)
|
||||
ide_acpi_set_state(hwif, 0);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -42,13 +46,15 @@ int generic_ide_resume(struct device *dev)
|
||||
struct request_pm_state rqpm;
|
||||
int err;
|
||||
|
||||
/* call ACPI _PS0 / _STM only once */
|
||||
if ((drive->dn & 1) == 0 || pair == NULL) {
|
||||
ide_acpi_set_state(hwif, 1);
|
||||
ide_acpi_push_timing(hwif);
|
||||
}
|
||||
if (ide_port_acpi(hwif)) {
|
||||
/* call ACPI _PS0 / _STM only once */
|
||||
if ((drive->dn & 1) == 0 || pair == NULL) {
|
||||
ide_acpi_set_state(hwif, 1);
|
||||
ide_acpi_push_timing(hwif);
|
||||
}
|
||||
|
||||
ide_acpi_exec_tfs(drive);
|
||||
ide_acpi_exec_tfs(drive);
|
||||
}
|
||||
|
||||
memset(&rqpm, 0, sizeof(rqpm));
|
||||
rq = blk_get_request(drive->queue, READ, __GFP_WAIT);
|
||||
|
Reference in New Issue
Block a user