linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/9] ide: fix IDE ACPI for slave device-only configurations
@ 2008-08-17 17:14 Bartlomiej Zolnierkiewicz
  2008-08-17 17:15 ` [PATCH 2/9] ide-disk: set_addressing() fixes Bartlomiej Zolnierkiewicz
                   ` (7 more replies)
  0 siblings, 8 replies; 16+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2008-08-17 17:14 UTC (permalink / raw)
  To: linux-ide; +Cc: Bartlomiej Zolnierkiewicz, linux-kernel

ACPI _GTM / _PS0 / _STM were not called if only slave device was present.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
 drivers/ide/ide.c |   21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

Index: b/drivers/ide/ide.c
===================================================================
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -365,15 +365,15 @@ __IDE_DEVSET(pio_mode, 0, NULL, set_pio_
 
 static int generic_ide_suspend(struct device *dev, pm_message_t mesg)
 {
-	ide_drive_t *drive = dev->driver_data;
+	ide_drive_t *drive = dev->driver_data, *pair = ide_get_pair_dev(drive);
 	ide_hwif_t *hwif = HWIF(drive);
 	struct request *rq;
 	struct request_pm_state rqpm;
 	ide_task_t args;
 	int ret;
 
-	/* Call ACPI _GTM only once */
-	if (!(drive->dn % 2))
+	/* call ACPI _GTM only once */
+	if ((drive->dn & 1) == 0 || pair == NULL)
 		ide_acpi_get_timing(hwif);
 
 	memset(&rqpm, 0, sizeof(rqpm));
@@ -389,26 +389,25 @@ static int generic_ide_suspend(struct de
 
 	ret = blk_execute_rq(drive->queue, NULL, rq, 0);
 	blk_put_request(rq);
-	/* only call ACPI _PS3 after both drivers are suspended */
-	if (!ret && (((drive->dn % 2) && hwif->drives[0].present
-		 && hwif->drives[1].present)
-		 || !hwif->drives[0].present
-		 || !hwif->drives[1].present))
+
+	/* call ACPI _PS3 only after both devices are suspended */
+	if (ret == 0 && ((drive->dn & 1) || pair == NULL))
 		ide_acpi_set_state(hwif, 0);
+
 	return ret;
 }
 
 static int generic_ide_resume(struct device *dev)
 {
-	ide_drive_t *drive = dev->driver_data;
+	ide_drive_t *drive = dev->driver_data, *pair = ide_get_pair_dev(drive);
 	ide_hwif_t *hwif = HWIF(drive);
 	struct request *rq;
 	struct request_pm_state rqpm;
 	ide_task_t args;
 	int err;
 
-	/* Call ACPI _STM only once */
-	if (!(drive->dn % 2)) {
+	/* call ACPI _PS0 / _STM only once */
+	if ((drive->dn & 1) == 0 || pair == NULL) {
 		ide_acpi_set_state(hwif, 1);
 		ide_acpi_push_timing(hwif);
 	}

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2008-08-25 20:32 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-17 17:14 [PATCH 1/9] ide: fix IDE ACPI for slave device-only configurations Bartlomiej Zolnierkiewicz
2008-08-17 17:15 ` [PATCH 2/9] ide-disk: set_addressing() fixes Bartlomiej Zolnierkiewicz
2008-08-23 21:45   ` Sergei Shtylyov
2008-08-25 20:23     ` Bartlomiej Zolnierkiewicz
2008-08-17 17:15 ` [PATCH 3/9] ide-disk: remove stale init_idedisk_capacity() documentation Bartlomiej Zolnierkiewicz
2008-08-20 10:06   ` Sergei Shtylyov
2008-08-17 17:15 ` [PATCH 4/9] ide-disk: add ide_do_setfeature() helper Bartlomiej Zolnierkiewicz
2008-08-20 10:04   ` Sergei Shtylyov
2008-08-17 17:15 ` [PATCH 5/9] ide: add device flags Bartlomiej Zolnierkiewicz
2008-08-17 17:15 ` [PATCH 6/9] ide: DMA_PIO_RETRY -> IDE_DFLAG_DMA_PIO_RETRY Bartlomiej Zolnierkiewicz
2008-08-17 17:15 ` [PATCH 7/9] ide: remove superfluous ->media field from ide_driver_t Bartlomiej Zolnierkiewicz
2008-08-23 21:07   ` Sergei Shtylyov
2008-08-17 17:15 ` [PATCH 8/9] ide: remove superfluous ->dma field from ide_hwif_t Bartlomiej Zolnierkiewicz
2008-08-20 10:15   ` Sergei Shtylyov
2008-08-17 17:15 ` [PATCH 9/9] ide: remove superfluous ->waiting_for_dma checks Bartlomiej Zolnierkiewicz
2008-08-20 10:08   ` Sergei Shtylyov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).