public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sonypi: Use struct dev_pm_ops for power management
@ 2012-06-23 21:46 Rafael J. Wysocki
  2012-06-27 11:34 ` Mattia Dongili
  0 siblings, 1 reply; 2+ messages in thread
From: Rafael J. Wysocki @ 2012-06-23 21:46 UTC (permalink / raw)
  To: Linux PM list; +Cc: LKML, Matthew Garrett, Mattia Dongili, platform-driver-x86

From: Rafael J. Wysocki <rjw@sisk.pl>

Make the sonypi driver define its PM callbacks through
a struct dev_pm_ops object rather than by using legacy PM hooks
in struct platform_driver.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---

Hi,

If there are no objections, I'd like to push this patch for 3.6 through
the linux-pm tree.

Unfortunately, I don't have the hardware to test it, but I hope it is simple
enough for code inspection to suffice.

Thanks,
Rafael

---
 drivers/char/sonypi.c |   13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

Index: linux/drivers/char/sonypi.c
===================================================================
--- linux.orig/drivers/char/sonypi.c
+++ linux/drivers/char/sonypi.c
@@ -1459,7 +1459,7 @@ static int __devexit sonypi_remove(struc
 #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();
@@ -1467,14 +1467,16 @@ static int sonypi_suspend(struct platfor
 	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_dri
 	.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;

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

* Re: [PATCH] sonypi: Use struct dev_pm_ops for power management
  2012-06-23 21:46 [PATCH] sonypi: Use struct dev_pm_ops for power management Rafael J. Wysocki
@ 2012-06-27 11:34 ` Mattia Dongili
  0 siblings, 0 replies; 2+ messages in thread
From: Mattia Dongili @ 2012-06-27 11:34 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Linux PM list, LKML, Matthew Garrett, platform-driver-x86

On Sat, Jun 23, 2012 at 11:46:26PM +0200, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rjw@sisk.pl>
> 
> Make the sonypi driver define its PM callbacks through
> a struct dev_pm_ops object rather than by using legacy PM hooks
> in struct platform_driver.
> 
> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>

Acked-by: Mattia Dongili <malattia@linux.it>

> ---
> 
> Hi,
> 
> If there are no objections, I'd like to push this patch for 3.6 through
> the linux-pm tree.
> 
> Unfortunately, I don't have the hardware to test it, but I hope it is simple
> enough for code inspection to suffice.

It looks ok to me. I do have the hardware but it's very old, last time I
booted that laptop is at least 5 years ago, not even sure it still boots
actually.

I'll give it a go if I get the time but don't count too much on it so
please include this in 3.6.

Thanks!
-- 
mattia
:wq!

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

end of thread, other threads:[~2012-06-27 11:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-23 21:46 [PATCH] sonypi: Use struct dev_pm_ops for power management Rafael J. Wysocki
2012-06-27 11:34 ` Mattia Dongili

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox