Skip to content

Commit

Permalink
sonypi: Use struct dev_pm_ops for power management
Browse files Browse the repository at this point in the history
Make the sonypi driver define its PM callbacks through
a struct dev_pm_ops object rather than by using legacy PM hooks
in struct acpi_device_ops.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Mattia Dongili <malattia@linux.it>
  • Loading branch information
Rafael J. Wysocki committed Jul 1, 2012
1 parent 8ff847f commit 199ac05
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions drivers/char/sonypi.c
Original file line number Diff line number Diff line change
@@ -1459,22 +1459,24 @@ static int __devexit sonypi_remove(struct platform_device *dev)
#ifdef CONFIG_PM
static int old_camera_power;

static int sonypi_suspend(struct platform_device *dev, pm_message_t state)
static int sonypi_suspend(struct device *dev)
{
old_camera_power = sonypi_device.camera_power;
sonypi_disable();

return 0;
}

static int sonypi_resume(struct platform_device *dev)
static int sonypi_resume(struct device *dev)
{
sonypi_enable(old_camera_power);
return 0;
}

static SIMPLE_DEV_PM_OPS(sonypi_pm, sonypi_suspend, sonypi_resume);
#define SONYPI_PM (&sonypi_pm)
#else
#define sonypi_suspend NULL
#define sonypi_resume NULL
#define SONYPI_PM NULL
#endif

static void sonypi_shutdown(struct platform_device *dev)
@@ -1486,12 +1488,11 @@ static struct platform_driver sonypi_driver = {
.driver = {
.name = "sonypi",
.owner = THIS_MODULE,
.pm = SONYPI_PM,
},
.probe = sonypi_probe,
.remove = __devexit_p(sonypi_remove),
.shutdown = sonypi_shutdown,
.suspend = sonypi_suspend,
.resume = sonypi_resume,
};

static struct platform_device *sonypi_platform_device;

0 comments on commit 199ac05

Please sign in to comment.