[alsa-devel] [PATCH 3/7] ASoC: codecs: lm4857: Use dev_pm_ops

Lars-Peter Clausen lars at metafoo.de
Mon Feb 7 00:04:19 CET 2011


Use dev_pm_ops instead of legacy I2C power management hooks.

Signed-off-by: Lars-Peter Clausen <lars at metafoo.de>
---
 sound/soc/codecs/lm4857.c |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/sound/soc/codecs/lm4857.c b/sound/soc/codecs/lm4857.c
index 2d726c0..76cdb3f 100644
--- a/sound/soc/codecs/lm4857.c
+++ b/sound/soc/codecs/lm4857.c
@@ -175,9 +175,9 @@ static void lm4857_shutdown(struct i2c_client *client)
 	lm4857_write_regs();
 }
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 
-static int lm4857_suspend(struct i2c_client *client, pm_message_t state)
+static int lm4857_suspend(struct device *dev)
 {
 	lm4857.state = lm4857.regs[LM4857_CTRL] & 0xF;
 
@@ -187,7 +187,7 @@ static int lm4857_suspend(struct i2c_client *client, pm_message_t state)
 	return 0;
 }
 
-static int lm4857_resume(struct i2c_client *dev)
+static int lm4857_resume(struct device *dev)
 {
 	if (lm4857.state) {
 		lm4857.regs[LM4857_CTRL] |= (lm4857.state & 0x0F);
@@ -196,9 +196,11 @@ static int lm4857_resume(struct i2c_client *dev)
 	return 0;
 }
 
+static SIMPLE_DEV_PM_OPS(lm4857_pm_ops, lm4857_suspend, lm4857_resume);
+#define LM4857_PM_OPS (&lm4857_pm_ops)
+
 #else
-#define lm4857_suspend NULL
-#define lm4857_resume NULL
+#define LM4857_PM_OPS NULL
 #endif
 
 static const struct i2c_device_id lm4857_i2c_id[] = {
@@ -210,11 +212,10 @@ static struct i2c_driver lm4857_i2c_driver = {
 	.driver = {
 		.name = "LM4857 I2C Amp",
 		.owner = THIS_MODULE,
+		.pm = LM4857_PM_OPS,
 	},
 	.probe =          lm4857_probe,
 	.remove =         __devexit_p(lm4857_remove),
-	.suspend =        lm4857_suspend,
-	.resume	=         lm4857_resume,
 	.shutdown =       lm4857_shutdown,
 	.id_table =       lm4857_i2c_id,
 };
-- 
1.7.2.3



More information about the Alsa-devel mailing list