diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-12-29 14:27:37 -0500 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-12-29 14:27:37 -0500 |
commit | e2984c628c924442132304ae662da433f41c05c9 (patch) | |
tree | c7ed2d995fbd96fc9e4cdd12c395640bd2e6fab5 /drivers/ide/ide.c | |
parent | 1d35364acbd5ab7d67bb39cfc5dd3ed0fbefb4b8 (diff) |
ide: move Power Management support to ide-pm.c
There should be no functional changes caused by this patch.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide.c')
-rw-r--r-- | drivers/ide/ide.c | 74 |
1 files changed, 0 insertions, 74 deletions
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c index 41d042053548..f0f09f702e9c 100644 --- a/drivers/ide/ide.c +++ b/drivers/ide/ide.c | |||
@@ -388,80 +388,6 @@ ide_ext_devset_rw_sync(unmaskirq, unmaskirq); | |||
388 | ide_ext_devset_rw_sync(using_dma, using_dma); | 388 | ide_ext_devset_rw_sync(using_dma, using_dma); |
389 | __IDE_DEVSET(pio_mode, DS_SYNC, NULL, set_pio_mode); | 389 | __IDE_DEVSET(pio_mode, DS_SYNC, NULL, set_pio_mode); |
390 | 390 | ||
391 | static int generic_ide_suspend(struct device *dev, pm_message_t mesg) | ||
392 | { | ||
393 | ide_drive_t *drive = dev->driver_data, *pair = ide_get_pair_dev(drive); | ||
394 | ide_hwif_t *hwif = HWIF(drive); | ||
395 | struct request *rq; | ||
396 | struct request_pm_state rqpm; | ||
397 | ide_task_t args; | ||
398 | int ret; | ||
399 | |||
400 | /* call ACPI _GTM only once */ | ||
401 | if ((drive->dn & 1) == 0 || pair == NULL) | ||
402 | ide_acpi_get_timing(hwif); | ||
403 | |||
404 | memset(&rqpm, 0, sizeof(rqpm)); | ||
405 | memset(&args, 0, sizeof(args)); | ||
406 | rq = blk_get_request(drive->queue, READ, __GFP_WAIT); | ||
407 | rq->cmd_type = REQ_TYPE_PM_SUSPEND; | ||
408 | rq->special = &args; | ||
409 | rq->data = &rqpm; | ||
410 | rqpm.pm_step = IDE_PM_START_SUSPEND; | ||
411 | if (mesg.event == PM_EVENT_PRETHAW) | ||
412 | mesg.event = PM_EVENT_FREEZE; | ||
413 | rqpm.pm_state = mesg.event; | ||
414 | |||
415 | ret = blk_execute_rq(drive->queue, NULL, rq, 0); | ||
416 | blk_put_request(rq); | ||
417 | |||
418 | /* call ACPI _PS3 only after both devices are suspended */ | ||
419 | if (ret == 0 && ((drive->dn & 1) || pair == NULL)) | ||
420 | ide_acpi_set_state(hwif, 0); | ||
421 | |||
422 | return ret; | ||
423 | } | ||
424 | |||
425 | static int generic_ide_resume(struct device *dev) | ||
426 | { | ||
427 | ide_drive_t *drive = dev->driver_data, *pair = ide_get_pair_dev(drive); | ||
428 | ide_hwif_t *hwif = HWIF(drive); | ||
429 | struct request *rq; | ||
430 | struct request_pm_state rqpm; | ||
431 | ide_task_t args; | ||
432 | int err; | ||
433 | |||
434 | /* call ACPI _PS0 / _STM only once */ | ||
435 | if ((drive->dn & 1) == 0 || pair == NULL) { | ||
436 | ide_acpi_set_state(hwif, 1); | ||
437 | ide_acpi_push_timing(hwif); | ||
438 | } | ||
439 | |||
440 | ide_acpi_exec_tfs(drive); | ||
441 | |||
442 | memset(&rqpm, 0, sizeof(rqpm)); | ||
443 | memset(&args, 0, sizeof(args)); | ||
444 | rq = blk_get_request(drive->queue, READ, __GFP_WAIT); | ||
445 | rq->cmd_type = REQ_TYPE_PM_RESUME; | ||
446 | rq->cmd_flags |= REQ_PREEMPT; | ||
447 | rq->special = &args; | ||
448 | rq->data = &rqpm; | ||
449 | rqpm.pm_step = IDE_PM_START_RESUME; | ||
450 | rqpm.pm_state = PM_EVENT_ON; | ||
451 | |||
452 | err = blk_execute_rq(drive->queue, NULL, rq, 1); | ||
453 | blk_put_request(rq); | ||
454 | |||
455 | if (err == 0 && dev->driver) { | ||
456 | ide_driver_t *drv = to_ide_driver(dev->driver); | ||
457 | |||
458 | if (drv->resume) | ||
459 | drv->resume(drive); | ||
460 | } | ||
461 | |||
462 | return err; | ||
463 | } | ||
464 | |||
465 | /** | 391 | /** |
466 | * ide_device_get - get an additional reference to a ide_drive_t | 392 | * ide_device_get - get an additional reference to a ide_drive_t |
467 | * @drive: device to get a reference to | 393 | * @drive: device to get a reference to |