linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] Input: ad7877 - Convert to dev_pm_ops
@ 2011-01-19 12:45 Mark Brown
  2011-01-19 12:45 ` [PATCH 2/3] Input: ad7979 - Convert SPI " Mark Brown
  2011-01-19 12:45 ` [PATCH 3/3] Input: ads7846 - Convert " Mark Brown
  0 siblings, 2 replies; 6+ messages in thread
From: Mark Brown @ 2011-01-19 12:45 UTC (permalink / raw)
  To: Michael Hennerich, Dmitry Torokhov
  Cc: Mike Frysinger, linux-input, Mark Brown

There is a move to deprecate bus-specific PM operations and move to
using dev_pm_ops instead in order to reduce the amount of boilerplate
code in buses and facilitiate updates to the PM core. Do this move for
the ad7879 SPI driver.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 drivers/input/touchscreen/ad7877.c |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/drivers/input/touchscreen/ad7877.c b/drivers/input/touchscreen/ad7877.c
index a1952fc..6ee868f 100644
--- a/drivers/input/touchscreen/ad7877.c
+++ b/drivers/input/touchscreen/ad7877.c
@@ -41,6 +41,7 @@
 #include <linux/delay.h>
 #include <linux/input.h>
 #include <linux/interrupt.h>
+#include <linux/pm.h>
 #include <linux/slab.h>
 #include <linux/spi/spi.h>
 #include <linux/spi/ad7877.h>
@@ -827,26 +828,25 @@ static int __devexit ad7877_remove(struct spi_device *spi)
 }
 
 #ifdef CONFIG_PM
-static int ad7877_suspend(struct spi_device *spi, pm_message_t message)
+static int ad7877_suspend(struct device *dev)
 {
-	struct ad7877 *ts = dev_get_drvdata(&spi->dev);
+	struct ad7877 *ts = dev_get_drvdata(dev);
 
 	ad7877_disable(ts);
 
 	return 0;
 }
 
-static int ad7877_resume(struct spi_device *spi)
+static int ad7877_resume(struct device *dev)
 {
-	struct ad7877 *ts = dev_get_drvdata(&spi->dev);
+	struct ad7877 *ts = dev_get_drvdata(dev);
 
 	ad7877_enable(ts);
 
 	return 0;
 }
-#else
-#define ad7877_suspend NULL
-#define ad7877_resume  NULL
+
+static SIMPLE_DEV_PM_OPS(ad7877_pm, ad7877_suspend, ad7877_resume);
 #endif
 
 static struct spi_driver ad7877_driver = {
@@ -854,11 +854,12 @@ static struct spi_driver ad7877_driver = {
 		.name	= "ad7877",
 		.bus	= &spi_bus_type,
 		.owner	= THIS_MODULE,
+#ifdef CONFIG_PM
+		.pm	= &ad7877_pm,
+#endif
 	},
 	.probe		= ad7877_probe,
 	.remove		= __devexit_p(ad7877_remove),
-	.suspend	= ad7877_suspend,
-	.resume		= ad7877_resume,
 };
 
 static int __init ad7877_init(void)
-- 
1.7.2.3


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

* [PATCH 2/3] Input: ad7979 - Convert SPI to dev_pm_ops
  2011-01-19 12:45 [PATCH 1/3] Input: ad7877 - Convert to dev_pm_ops Mark Brown
@ 2011-01-19 12:45 ` Mark Brown
  2011-01-19 17:40   ` Dmitry Torokhov
  2011-01-19 12:45 ` [PATCH 3/3] Input: ads7846 - Convert " Mark Brown
  1 sibling, 1 reply; 6+ messages in thread
From: Mark Brown @ 2011-01-19 12:45 UTC (permalink / raw)
  To: Michael Hennerich, Dmitry Torokhov
  Cc: Mike Frysinger, linux-input, Mark Brown

There is a move to deprecate bus-specific PM operations and move to
using dev_pm_ops instead in order to reduce the amount of boilerplate
code in buses and facilitiate updates to the PM core. Do this move for
the ad7979 SPI driver.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 drivers/input/touchscreen/ad7879-spi.c |   17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/drivers/input/touchscreen/ad7879-spi.c b/drivers/input/touchscreen/ad7879-spi.c
index 59c6e68..0b135a6 100644
--- a/drivers/input/touchscreen/ad7879-spi.c
+++ b/drivers/input/touchscreen/ad7879-spi.c
@@ -7,6 +7,7 @@
  */
 
 #include <linux/input.h>	/* BUS_SPI */
+#include <linux/pm.h>
 #include <linux/spi/spi.h>
 
 #include "ad7879.h"
@@ -21,8 +22,9 @@
 #define AD7879_READCMD(reg)  (AD7879_CMD(reg) | AD7879_CMD_READ)
 
 #ifdef CONFIG_PM
-static int ad7879_spi_suspend(struct spi_device *spi, pm_message_t message)
+static int ad7879_spi_suspend(struct device *dev)
 {
+	struct spi_device *spi = to_spi_device(dev);
 	struct ad7879 *ts = spi_get_drvdata(spi);
 
 	ad7879_suspend(ts);
@@ -30,17 +32,17 @@ static int ad7879_spi_suspend(struct spi_device *spi, pm_message_t message)
 	return 0;
 }
 
-static int ad7879_spi_resume(struct spi_device *spi)
+static int ad7879_spi_resume(struct device *dev)
 {
+	struct spi_device *spi = to_spi_device(dev);
 	struct ad7879 *ts = spi_get_drvdata(spi);
 
 	ad7879_resume(ts);
 
 	return 0;
 }
-#else
-# define ad7879_spi_suspend NULL
-# define ad7879_spi_resume  NULL
+
+static SIMPLE_DEV_PM_OPS(ad7879_spi_pm, ad7879_spi_suspend, ad7879_spi_resume);
 #endif
 
 /*
@@ -173,11 +175,12 @@ static struct spi_driver ad7879_spi_driver = {
 		.name	= "ad7879",
 		.bus	= &spi_bus_type,
 		.owner	= THIS_MODULE,
+#ifdef CONFIG_PM
+		.pm	= &ad7879_spi_pm,
+#endif
 	},
 	.probe		= ad7879_spi_probe,
 	.remove		= __devexit_p(ad7879_spi_remove),
-	.suspend	= ad7879_spi_suspend,
-	.resume		= ad7879_spi_resume,
 };
 
 static int __init ad7879_spi_init(void)
-- 
1.7.2.3


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

* [PATCH 3/3] Input: ads7846 - Convert to dev_pm_ops
  2011-01-19 12:45 [PATCH 1/3] Input: ad7877 - Convert to dev_pm_ops Mark Brown
  2011-01-19 12:45 ` [PATCH 2/3] Input: ad7979 - Convert SPI " Mark Brown
@ 2011-01-19 12:45 ` Mark Brown
  1 sibling, 0 replies; 6+ messages in thread
From: Mark Brown @ 2011-01-19 12:45 UTC (permalink / raw)
  To: Michael Hennerich, Dmitry Torokhov
  Cc: Mike Frysinger, linux-input, Mark Brown

There is a move to deprecate bus-specific PM operations and move to
using dev_pm_ops instead in order to reduce the amount of boilerplate
code in buses and facilitiate updates to the PM core. Do this move for
the ads7846 driver.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 drivers/input/touchscreen/ads7846.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
index 14ea54b..ff13b93 100644
--- a/drivers/input/touchscreen/ads7846.c
+++ b/drivers/input/touchscreen/ads7846.c
@@ -26,6 +26,7 @@
 #include <linux/input.h>
 #include <linux/interrupt.h>
 #include <linux/slab.h>
+#include <linux/pm.h>
 #include <linux/gpio.h>
 #include <linux/spi/spi.h>
 #include <linux/spi/ads7846.h>
@@ -892,9 +893,9 @@ static irqreturn_t ads7846_irq(int irq, void *handle)
 	return IRQ_HANDLED;
 }
 
-static int ads7846_suspend(struct spi_device *spi, pm_message_t message)
+static int ads7846_suspend(struct device *dev)
 {
-	struct ads7846 *ts = dev_get_drvdata(&spi->dev);
+	struct ads7846 *ts = dev_get_drvdata(dev);
 
 	mutex_lock(&ts->lock);
 
@@ -914,9 +915,9 @@ static int ads7846_suspend(struct spi_device *spi, pm_message_t message)
 	return 0;
 }
 
-static int ads7846_resume(struct spi_device *spi)
+static int ads7846_resume(struct device *dev)
 {
-	struct ads7846 *ts = dev_get_drvdata(&spi->dev);
+	struct ads7846 *ts = dev_get_drvdata(dev);
 
 	mutex_lock(&ts->lock);
 
@@ -936,6 +937,8 @@ static int ads7846_resume(struct spi_device *spi)
 	return 0;
 }
 
+static SIMPLE_DEV_PM_OPS(ads7846_pm, ads7846_suspend, ads7846_resume);
+
 static int __devinit ads7846_setup_pendown(struct spi_device *spi, struct ads7846 *ts)
 {
 	struct ads7846_platform_data *pdata = spi->dev.platform_data;
@@ -1402,11 +1405,10 @@ static struct spi_driver ads7846_driver = {
 		.name	= "ads7846",
 		.bus	= &spi_bus_type,
 		.owner	= THIS_MODULE,
+		.pm	= &ads7846_pm,
 	},
 	.probe		= ads7846_probe,
 	.remove		= __devexit_p(ads7846_remove),
-	.suspend	= ads7846_suspend,
-	.resume		= ads7846_resume,
 };
 
 static int __init ads7846_init(void)
-- 
1.7.2.3


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

* Re: [PATCH 2/3] Input: ad7979 - Convert SPI to dev_pm_ops
  2011-01-19 12:45 ` [PATCH 2/3] Input: ad7979 - Convert SPI " Mark Brown
@ 2011-01-19 17:40   ` Dmitry Torokhov
  2011-01-19 18:39     ` Mark Brown
  0 siblings, 1 reply; 6+ messages in thread
From: Dmitry Torokhov @ 2011-01-19 17:40 UTC (permalink / raw)
  To: Mark Brown; +Cc: Michael Hennerich, Mike Frysinger, linux-input

Hi Mark,

On Wed, Jan 19, 2011 at 12:45:38PM +0000, Mark Brown wrote:
> +
> +static SIMPLE_DEV_PM_OPS(ad7879_spi_pm, ad7879_spi_suspend, ad7879_spi_resume);
>  #endif
>  

I was looking at SIMPLE_DEV_PM_OPS definition and it turns into noop if
CONFIG_PM_SLEEP is not set (for systems with runtime PM only, for
example). This will lead to "unused function" compiler warnings (and I
think I have seen such reports for randconfig compiles off linux-next).

Do you think we coudl augment your patch thusly:

diff --git a/drivers/input/touchscreen/ad7879-spi.c b/drivers/input/touchscreen/ad7879-spi.c
index 0b135a6..ddf732f 100644
--- a/drivers/input/touchscreen/ad7879-spi.c
+++ b/drivers/input/touchscreen/ad7879-spi.c
@@ -21,7 +21,7 @@
 #define AD7879_WRITECMD(reg) (AD7879_CMD(reg))
 #define AD7879_READCMD(reg)  (AD7879_CMD(reg) | AD7879_CMD_READ)
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 static int ad7879_spi_suspend(struct device *dev)
 {
 	struct spi_device *spi = to_spi_device(dev);
@@ -41,9 +41,9 @@ static int ad7879_spi_resume(struct device *dev)
 
 	return 0;
 }
+#endif
 
 static SIMPLE_DEV_PM_OPS(ad7879_spi_pm, ad7879_spi_suspend, ad7879_spi_resume);
-#endif
 
 /*
  * ad7879_read/write are only used for initial setup and for sysfs controls.
@@ -175,9 +175,7 @@ static struct spi_driver ad7879_spi_driver = {
 		.name	= "ad7879",
 		.bus	= &spi_bus_type,
 		.owner	= THIS_MODULE,
-#ifdef CONFIG_PM
 		.pm	= &ad7879_spi_pm,
-#endif
 	},
 	.probe		= ad7879_spi_probe,
 	.remove		= __devexit_p(ad7879_spi_remove),

Thanks,
Dmitry

-- 
Dmitry

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

* Re: [PATCH 2/3] Input: ad7979 - Convert SPI to dev_pm_ops
  2011-01-19 17:40   ` Dmitry Torokhov
@ 2011-01-19 18:39     ` Mark Brown
  2011-01-19 18:53       ` Dmitry Torokhov
  0 siblings, 1 reply; 6+ messages in thread
From: Mark Brown @ 2011-01-19 18:39 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: Michael Hennerich, Mike Frysinger, linux-input

On Wed, Jan 19, 2011 at 09:40:38AM -0800, Dmitry Torokhov wrote:

> I was looking at SIMPLE_DEV_PM_OPS definition and it turns into noop if
> CONFIG_PM_SLEEP is not set (for systems with runtime PM only, for
> example). This will lead to "unused function" compiler warnings (and I
> think I have seen such reports for randconfig compiles off linux-next).

> Do you think we coudl augment your patch thusly:

Looks sane to me - do you want me to redo the updates?

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

* Re: [PATCH 2/3] Input: ad7979 - Convert SPI to dev_pm_ops
  2011-01-19 18:39     ` Mark Brown
@ 2011-01-19 18:53       ` Dmitry Torokhov
  0 siblings, 0 replies; 6+ messages in thread
From: Dmitry Torokhov @ 2011-01-19 18:53 UTC (permalink / raw)
  To: Mark Brown; +Cc: Michael Hennerich, Mike Frysinger, linux-input

On Wed, Jan 19, 2011 at 06:39:16PM +0000, Mark Brown wrote:
> On Wed, Jan 19, 2011 at 09:40:38AM -0800, Dmitry Torokhov wrote:
> 
> > I was looking at SIMPLE_DEV_PM_OPS definition and it turns into noop if
> > CONFIG_PM_SLEEP is not set (for systems with runtime PM only, for
> > example). This will lead to "unused function" compiler warnings (and I
> > think I have seen such reports for randconfig compiles off linux-next).
> 
> > Do you think we coudl augment your patch thusly:
> 
> Looks sane to me - do you want me to redo the updates?

If it is not too much bother...

-- 
Dmitry

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

end of thread, other threads:[~2011-01-19 18:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-19 12:45 [PATCH 1/3] Input: ad7877 - Convert to dev_pm_ops Mark Brown
2011-01-19 12:45 ` [PATCH 2/3] Input: ad7979 - Convert SPI " Mark Brown
2011-01-19 17:40   ` Dmitry Torokhov
2011-01-19 18:39     ` Mark Brown
2011-01-19 18:53       ` Dmitry Torokhov
2011-01-19 12:45 ` [PATCH 3/3] Input: ads7846 - Convert " Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).