Skip to contentSkip to conversation

mfd: tps65090: Fix ifdefs for suspend mode

PATCH In review Mark Brown 2 participants 9 messages Mar 22, 2012 – Mar 26, 2012 Multifunction devices (MFD)

lore
Share & tools
lore

Mark Brown

author
#0 lore raw

PATCH 1/2 mfd: tps65090: Fix ifdefs for suspend mode

CONFIG_PM also covers runtime only PM.

---
 drivers/mfd/tps65090.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/mfd/tps65090.c +2 -2
index a66d4df..ac7e8b1 100644
@@ -334,7 +334,7 @@ static int __devexit tps65090_i2c_remove(struct i2c_client *client)
 	return 0;
 }
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 static int tps65090_i2c_suspend(struct i2c_client *client, pm_message_t state)
 {
 	if (client->irq)
@@ -363,7 +363,7 @@ static struct i2c_driver tps65090_driver = {
 	},
 	.probe		= tps65090_i2c_probe,
 	.remove		= __devexit_p(tps65090_i2c_remove),
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 	.suspend	= tps65090_i2c_suspend,
 	.resume		= tps65090_i2c_resume,
 #endif
Signature · 1 line
1.7.9.1
author
#1 lore raw

PATCH 2/2 mfd: tps65090: Don't use I2C-specific suspend and resume operations

The legacy suspend operations have been deprecated and printing warnings on boot for over a year now.

---

It's not clear to me that we should have these operations at all...

 drivers/mfd/tps65090.c |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)
drivers/mfd/tps65090.c +9 -6
index ac7e8b1..6dc4c345 100644
@@ -335,21 +335,27 @@ static int __devexit tps65090_i2c_remove(struct i2c_client *client)
 }
 
 #ifdef CONFIG_PM_SLEEP
-static int tps65090_i2c_suspend(struct i2c_client *client, pm_message_t state)
+static int tps65090_suspend(struct device *dev)
 {
+	struct i2c_client *client = to_i2c_client(dev);
 	if (client->irq)
 		disable_irq(client->irq);
 	return 0;
 }
 
-static int tps65090_i2c_resume(struct i2c_client *client)
+static int tps65090_resume(struct device *dev)
 {
+	struct i2c_client *client = to_i2c_client(dev);
 	if (client->irq)
 		enable_irq(client->irq);
 	return 0;
 }
 #endif
 
+static const struct dev_pm_ops tps65090_pm_ops = {
+	SET_SYSTEM_SLEEP_PM_OPS(tps65090_suspend, tps65090_resume)
+};
+
 static const struct i2c_device_id tps65090_id_table[] = {
 	{ "tps65090", 0 },
 	{ },
@@ -360,13 +366,10 @@ static struct i2c_driver tps65090_driver = {
 	.driver	= {
 		.name	= "tps65090",
 		.owner	= THIS_MODULE,
+		.pm	= &tps65090_pm_ops,
 	},
 	.probe		= tps65090_i2c_probe,
 	.remove		= __devexit_p(tps65090_i2c_remove),
-#ifdef CONFIG_PM_SLEEP
-	.suspend	= tps65090_i2c_suspend,
-	.resume		= tps65090_i2c_resume,
-#endif
 	.id_table	= tps65090_id_table,
 };
 
Signature · 1 line
1.7.9.1
#2 lore raw

RE: [PATCH 2/2] mfd: tps65090: Don't use I2C-specific suspend and resume operations

Quoted 4 lines

---

It's not clear to me that we should have these operations at all...

Mark,
Can you please explain why do you think that these operations are not needed?

Quoted 56 lines
 drivers/mfd/tps65090.c |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)
drivers/mfd/tps65090.c +8 -2
index ac7e8b1..6dc4c345 100644
@@ -335,21 +335,27 @@ static int __devexit tps65090_i2c_remove(struct
 i2c_client *client)
 }
 
 #ifdef CONFIG_PM_SLEEP
-static int tps65090_i2c_suspend(struct i2c_client *client, pm_message_t state)
+static int tps65090_suspend(struct device *dev)
 {
+	struct i2c_client *client = to_i2c_client(dev);
 	if (client->irq)
 		disable_irq(client->irq);
 	return 0;
 }
 
-static int tps65090_i2c_resume(struct i2c_client *client)
+static int tps65090_resume(struct device *dev)
 {
+	struct i2c_client *client = to_i2c_client(dev);
 	if (client->irq)
 		enable_irq(client->irq);
 	return 0;
 }
 #endif
 
+static const struct dev_pm_ops tps65090_pm_ops = {
+	SET_SYSTEM_SLEEP_PM_OPS(tps65090_suspend, tps65090_resume)
+};
+
 static const struct i2c_device_id tps65090_id_table[] = {
 	{ "tps65090", 0 },
drivers/mfd/tps65090.c +1 -5
 	{ },
@@ -360,13 +366,10 @@ static struct i2c_driver tps65090_driver = {
 	.driver	= {
 		.name	= "tps65090",
 		.owner	= THIS_MODULE,
+		.pm	= &tps65090_pm_ops,
 	},
 	.probe		= tps65090_i2c_probe,
 	.remove		= __devexit_p(tps65090_i2c_remove),
-#ifdef CONFIG_PM_SLEEP
-	.suspend	= tps65090_i2c_suspend,
-	.resume		= tps65090_i2c_resume,
-#endif
 	.id_table	= tps65090_id_table,
 };
 
--

1.7.9.1

#6 lore raw
In reply to Mark Brown
Quoted 2 lines

CONFIG_PM also covers runtime only PM.

Hi Mark,
As CONFIG_PM covers both runtime and full system suspend/resume activities, I do not really understand what we gain with this change.

Can you please provide more details?
Thanks,
Venu

Quoted 17 lines
---
 drivers/mfd/tps65090.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/mfd/tps65090.c +1 -1
index a66d4df..ac7e8b1 100644
@@ -334,7 +334,7 @@ static int __devexit tps65090_i2c_remove(struct
 i2c_client *client)
 	return 0;
 }
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
author
#3 lore raw

Re: [PATCH 2/2] mfd: tps65090: Don't use I2C-specific suspend and resume operations

In reply to Venu Byravarasu
Quoted 5 lines · Venu Byravarasu
Quoted 3 lines

It's not clear to me that we should have these operations at all...

Can you please explain why do you think that these operations are not needed?

They've been deprecated for over a year, if you'd looked at the kernel boot log you'd see that it's been complaining about them at startup time.

author
#7 lore raw
In reply to Venu Byravarasu
Quoted 6 lines · Venu Byravarasu
Quoted 1 line

CONFIG_PM also covers runtime only PM.

As CONFIG_PM covers both runtime and full system suspend/resume activities, I do not really understand what we gain with this change.

Can you please provide more details?

You've only got system sleep PM operations, CONFIG_PM will leave them built when CONFIG_PM_SLEEP is disabled so you'll get build warnings.

#4 lore raw

RE: [PATCH 2/2] mfd: tps65090: Don't use I2C-specific suspend and resume operations

In reply to Mark Brown
Quoted 8 lines
Quoted 3 lines
Quoted 1 line

It's not clear to me that we should have these operations at all...

Can you please explain why do you think that these operations are not

needed?

They've been deprecated for over a year, if you'd looked at the kernel boot log you'd see that it's been complaining about them at startup time.

Thanks, understood.

Acked-by on v1 1/2
#8 lore raw
In reply to Mark Brown

Thanks Mark for clarifying.

Quoted 39 lines

-----Original Message-----
From: Mark Brown [mailto:[email protected]]
Sent: Friday, March 23, 2012 12:09 AM
To: Samuel Ortiz; Venu Byravarasu
Cc: [email protected]; Mark Brown
Subject: [PATCH 1/2] mfd: tps65090: Fix ifdefs for suspend mode

CONFIG_PM also covers runtime only PM.

---
 drivers/mfd/tps65090.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/mfd/tps65090.c +1 -1
index a66d4df..ac7e8b1 100644
@@ -334,7 +334,7 @@ static int __devexit tps65090_i2c_remove(struct
 i2c_client *client)
 	return 0;
 }
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 static int tps65090_i2c_suspend(struct i2c_client *client, pm_message_t state)
 {
drivers/mfd/tps65090.c +1 -2
 	if (client->irq)
@@ -363,7 +363,7 @@ static struct i2c_driver tps65090_driver = {
 	},
 	.probe		= tps65090_i2c_probe,
 	.remove		= __devexit_p(tps65090_i2c_remove),
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 	.suspend	= tps65090_i2c_suspend,
 	.resume		= tps65090_i2c_resume,
 #endif
--

1.7.9.1

Acked-by on v1 2/2
#5 lore raw

RE: [PATCH 2/2] mfd: tps65090: Don't use I2C-specific suspend and resume operations

In reply to Mark Brown

Thanks Mark for clarifying.

Quoted 71 lines

-----Original Message-----
From: Mark Brown [mailto:[email protected]]
Sent: Friday, March 23, 2012 12:09 AM
To: Samuel Ortiz; Venu Byravarasu
Cc: [email protected]; Mark Brown
Subject: [PATCH 2/2] mfd: tps65090: Don't use I2C-specific suspend and resume operations

The legacy suspend operations have been deprecated and printing warnings on boot for over a year now.

---

It's not clear to me that we should have these operations at all...

 drivers/mfd/tps65090.c |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)
drivers/mfd/tps65090.c +8 -2
index ac7e8b1..6dc4c345 100644
@@ -335,21 +335,27 @@ static int __devexit tps65090_i2c_remove(struct
 i2c_client *client)
 }
 
 #ifdef CONFIG_PM_SLEEP
-static int tps65090_i2c_suspend(struct i2c_client *client, pm_message_t state)
+static int tps65090_suspend(struct device *dev)
 {
+	struct i2c_client *client = to_i2c_client(dev);
 	if (client->irq)
 		disable_irq(client->irq);
 	return 0;
 }
 
-static int tps65090_i2c_resume(struct i2c_client *client)
+static int tps65090_resume(struct device *dev)
 {
+	struct i2c_client *client = to_i2c_client(dev);
 	if (client->irq)
 		enable_irq(client->irq);
 	return 0;
 }
 #endif
 
+static const struct dev_pm_ops tps65090_pm_ops = {
+	SET_SYSTEM_SLEEP_PM_OPS(tps65090_suspend, tps65090_resume)
+};
+
 static const struct i2c_device_id tps65090_id_table[] = {
 	{ "tps65090", 0 },
drivers/mfd/tps65090.c +1 -5
 	{ },
@@ -360,13 +366,10 @@ static struct i2c_driver tps65090_driver = {
 	.driver	= {
 		.name	= "tps65090",
 		.owner	= THIS_MODULE,
+		.pm	= &tps65090_pm_ops,
 	},
 	.probe		= tps65090_i2c_probe,
 	.remove		= __devexit_p(tps65090_i2c_remove),
-#ifdef CONFIG_PM_SLEEP
-	.suspend	= tps65090_i2c_suspend,
-	.resume		= tps65090_i2c_resume,
-#endif
 	.id_table	= tps65090_id_table,
 };
 
--

1.7.9.1