Skip to contentSkip to conversation

i2c-au1550: dev_pm_ops conversion.

PATCH Superseded Manuel Lauss 2 participants 4 messages Jul 20, 2009 – Jul 29, 2009 3 messages not in the archive I2C subsystem host drivers

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i2c-au1550: dev_pm_ops conversion.

---
Run-tested on Au1200.

 drivers/i2c/busses/i2c-au1550.c |   23 ++++++++++-------------
 1 files changed, 10 insertions(+), 13 deletions(-)
drivers/i2c/busses/i2c-au1550.c +10 -13
index 532828b..6565012 100644
@@ -440,40 +440,37 @@ i2c_au1550_remove(struct platform_device *pdev)
 	return 0;
 }
 
-#ifdef CONFIG_PM
-static int
-i2c_au1550_suspend(struct platform_device *pdev, pm_message_t state)
+static int i2c_au1550_suspend(struct device *dev)
 {
-	struct i2c_au1550_data *priv = platform_get_drvdata(pdev);
+	struct i2c_au1550_data *priv = dev_get_drvdata(dev);
 
 	i2c_au1550_disable(priv);
 
 	return 0;
 }
 
-static int
-i2c_au1550_resume(struct platform_device *pdev)
+static int i2c_au1550_resume(struct device *dev)
 {
-	struct i2c_au1550_data *priv = platform_get_drvdata(pdev);
+	struct i2c_au1550_data *priv = dev_get_drvdata(dev);
 
 	i2c_au1550_setup(priv);
 
 	return 0;
 }
-#else
-#define i2c_au1550_suspend	NULL
-#define i2c_au1550_resume	NULL
-#endif
+
+static struct dev_pm_ops au1xpsc_smbus_pmops = {
+	.resume		= i2c_au1550_resume,
+	.suspend	= i2c_au1550_suspend,
+};
 
 static struct platform_driver au1xpsc_smbus_driver = {
 	.driver = {
 		.name	= "au1xpsc_smbus",
 		.owner	= THIS_MODULE,
+		.pm	= &au1xpsc_smbus_pmops,
 	},
 	.probe		= i2c_au1550_probe,
 	.remove		= __devexit_p(i2c_au1550_remove),
-	.suspend	= i2c_au1550_suspend,
-	.resume		= i2c_au1550_resume,
 };
 
 static int __init
Signature · 1 line
1.6.3.3

A message that is not in the archive (sent off-list or not yet received): 1248115661-20189-1-git-send-email-manuel.lauss-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#2 lore raw
Quoted 44 lines · Manuel Lauss

---
Run-tested on Au1200.

 drivers/i2c/busses/i2c-au1550.c |   23 ++++++++++-------------
 1 files changed, 10 insertions(+), 13 deletions(-)
drivers/i2c/busses/i2c-au1550.c +5 -11
index 532828b..6565012 100644
@@ -440,40 +440,37 @@ i2c_au1550_remove(struct platform_device *pdev)
 	return 0;
 }
 
-#ifdef CONFIG_PM
-static int
-i2c_au1550_suspend(struct platform_device *pdev, pm_message_t state)
+static int i2c_au1550_suspend(struct device *dev)
 {
-	struct i2c_au1550_data *priv = platform_get_drvdata(pdev);
+	struct i2c_au1550_data *priv = dev_get_drvdata(dev);
 
 	i2c_au1550_disable(priv);
 
 	return 0;
 }
 
-static int
-i2c_au1550_resume(struct platform_device *pdev)
+static int i2c_au1550_resume(struct device *dev)
 {
-	struct i2c_au1550_data *priv = platform_get_drvdata(pdev);
+	struct i2c_au1550_data *priv = dev_get_drvdata(dev);
 
 	i2c_au1550_setup(priv);
 
 	return 0;
 }
-#else
-#define i2c_au1550_suspend	NULL
-#define i2c_au1550_resume	NULL
-#endif
+

drivers/i2c/busses/i2c-au1550.c i2c_au1550_remove(struct platform_device *pdev) · line 470

Quoted 10 lines
drivers/i2c/busses/i2c-au1550.c +5 -0
+static struct dev_pm_ops au1xpsc_smbus_pmops = {
+	.resume		= i2c_au1550_resume,
+	.suspend	= i2c_au1550_suspend,
+};
 
 static struct platform_driver au1xpsc_smbus_driver = {
 	.driver = {
 		.name	= "au1xpsc_smbus",
 		.owner	= THIS_MODULE,
+		.pm	= &au1xpsc_smbus_pmops,

hmm, why not

		.pm	= (struct dev_pm_ops &) {
			.suspend	= ...,
			.resume		= ...,
		},

?

Quoted 15 lines
drivers/i2c/busses/i2c-au1550.c +0 -2
 	},
 	.probe		= i2c_au1550_probe,
 	.remove		= __devexit_p(i2c_au1550_remove),
-	.suspend	= i2c_au1550_suspend,
-	.resume		= i2c_au1550_resume,
 };
 
 static int __init
Signature · 6 lines
1.6.3.3

--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Signature · 3 lines
Ben ([email protected], http://www.fluff.org/)

  'a smiley only costs 4 bytes'

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw

Hi Ben,

Quoted 18 lines · Ben Dooks
Quoted 11 lines
drivers/i2c/busses/i2c-au1550.c +5 -0
+
+static struct dev_pm_ops au1xpsc_smbus_pmops = {
+     .resume         = i2c_au1550_resume,
+     .suspend        = i2c_au1550_suspend,
+};

 static struct platform_driver au1xpsc_smbus_driver = { .driver = {
              .name   = "au1xpsc_smbus", .owner  = THIS_MODULE,
+             .pm     = &au1xpsc_smbus_pmops,

hmm, why not
               .pm     = (struct dev_pm_ops &) {
                       .suspend        = ...,
                       .resume         = ...,
               },

Quoted 1 line

?

I remember one patch being shot down on account of having this style. I prefer the original style too, but I've no objections to changing it...

Thank you!
Manuel Lauss

A message that is not in the archive (sent off-list or not yet received): f861ec6f0907202202w104f269au8086a243b68d9b3a-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#6 lore raw
Quoted 22 lines · Manuel Lauss

Hi Ben,

Quoted 18 lines · Ben Dooks
Quoted 11 lines
drivers/i2c/busses/i2c-au1550.c +5 -0
+
+static struct dev_pm_ops au1xpsc_smbus_pmops = {
+ ? ? .resume ? ? ? ? = i2c_au1550_resume,
+ ? ? .suspend ? ? ? ?= i2c_au1550_suspend,
+};

?static struct platform_driver au1xpsc_smbus_driver = { ? ? ? .driver = {
? ? ? ? ? ? ? .name ? = "au1xpsc_smbus",
? ? ? ? ? ? ? .owner ?= THIS_MODULE,
+ ? ? ? ? ? ? .pm ? ? = &au1xpsc_smbus_pmops,

hmm, why not
? ? ? ? ? ? ? ?.pm ? ? = (struct dev_pm_ops &) {
? ? ? ? ? ? ? ? ? ? ? ?.suspend ? ? ? ?= ...,
? ? ? ? ? ? ? ? ? ? ? ?.resume ? ? ? ? = ...,
? ? ? ? ? ? ? ?},

Quoted 5 lines
Quoted 1 line

?

I remember one patch being shot down on account of having this style. I prefer the original style too, but I've no objections to changing it...

no objections on style, the only thing to change is to put the #ifdef CONFIG_PM back.

Quoted 6 lines

Thank you!
Manuel Lauss
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 3 lines
Ben ([email protected], http://www.fluff.org/)

  'a smiley only costs 4 bytes'