* [PATCH] Input: ad7879 - Convert I2C to dev_pm_ops
@ 2011-01-05 19:01 Mark Brown
2011-01-05 22:14 ` Dmitry Torokhov
0 siblings, 1 reply; 7+ messages in thread
From: Mark Brown @ 2011-01-05 19:01 UTC (permalink / raw)
To: Dmitry Torokhov, Mike Frysinger, Michael Hennerich
Cc: linux-input, Mark Brown
There is a general move towards the use of dev_pm_ops rather than
bus specific suspend APIs as this simplifies both the bus and PM core
implementations. Convert the ad7879-ts I2C support over.
Compile tested only.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
drivers/input/touchscreen/ad7879-i2c.c | 15 +++++++++------
1 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/drivers/input/touchscreen/ad7879-i2c.c b/drivers/input/touchscreen/ad7879-i2c.c
index d82a38e..72b37c3 100644
--- a/drivers/input/touchscreen/ad7879-i2c.c
+++ b/drivers/input/touchscreen/ad7879-i2c.c
@@ -10,14 +10,16 @@
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/types.h>
+#include <linux/pm.h>
#include "ad7879.h"
#define AD7879_DEVID 0x79 /* AD7879-1/AD7889-1 */
#ifdef CONFIG_PM
-static int ad7879_i2c_suspend(struct i2c_client *client, pm_message_t message)
+static int ad7879_i2c_suspend(struct device *dev)
{
+ struct i2c_client *client = to_i2c_client(dev);
struct ad7879 *ts = i2c_get_clientdata(client);
ad7879_suspend(ts);
@@ -25,17 +27,19 @@ static int ad7879_i2c_suspend(struct i2c_client *client, pm_message_t message)
return 0;
}
-static int ad7879_i2c_resume(struct i2c_client *client)
+static int ad7879_i2c_resume(struct device *dev)
{
+ struct i2c_client *client = to_i2c_client(dev);
struct ad7879 *ts = i2c_get_clientdata(client);
ad7879_resume(ts);
return 0;
}
+
+static SIMPLE_DEV_PM_OPS(ad7879_i2c_pm, ad7879_i2c_suspend, ad7879_i2c_resume);
#else
-# define ad7879_i2c_suspend NULL
-# define ad7879_i2c_resume NULL
+# define ad7879_i2c_pm NULL
#endif
/* All registers are word-sized.
@@ -117,11 +121,10 @@ static struct i2c_driver ad7879_i2c_driver = {
.driver = {
.name = "ad7879",
.owner = THIS_MODULE,
+ .pm = &ad7879_i2c_pm,
},
.probe = ad7879_i2c_probe,
.remove = __devexit_p(ad7879_i2c_remove),
- .suspend = ad7879_i2c_suspend,
- .resume = ad7879_i2c_resume,
.id_table = ad7879_id,
};
--
1.7.2.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] Input: ad7879 - Convert I2C to dev_pm_ops
2011-01-05 19:01 [PATCH] Input: ad7879 - Convert I2C to dev_pm_ops Mark Brown
@ 2011-01-05 22:14 ` Dmitry Torokhov
2011-01-05 22:41 ` Mark Brown
2011-01-06 12:15 ` Mark Brown
0 siblings, 2 replies; 7+ messages in thread
From: Dmitry Torokhov @ 2011-01-05 22:14 UTC (permalink / raw)
To: Mark Brown; +Cc: Mike Frysinger, Michael Hennerich, linux-input
Hi Mark,
On Wed, Jan 05, 2011 at 07:01:35PM +0000, Mark Brown wrote:
> +# define ad7879_i2c_pm NULL
> #endif
>
> /* All registers are word-sized.
> @@ -117,11 +121,10 @@ static struct i2c_driver ad7879_i2c_driver = {
> .driver = {
> .name = "ad7879",
> .owner = THIS_MODULE,
> + .pm = &ad7879_i2c_pm,
I do not think you tested it with !CONFIG_PM since &NULL is not valid
expression (& requires an lvalue for operand).
Please change to guard .pm = &ad7879_i2c_pm with #ifdef.
Thanks.
--
Dmitry
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Input: ad7879 - Convert I2C to dev_pm_ops
2011-01-05 22:14 ` Dmitry Torokhov
@ 2011-01-05 22:41 ` Mark Brown
2011-01-06 0:09 ` Dmitry Torokhov
2011-01-06 12:15 ` Mark Brown
1 sibling, 1 reply; 7+ messages in thread
From: Mark Brown @ 2011-01-05 22:41 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: Mike Frysinger, Michael Hennerich, linux-input
On Wed, Jan 05, 2011 at 02:14:32PM -0800, Dmitry Torokhov wrote:
> I do not think you tested it with !CONFIG_PM since &NULL is not valid
> expression (& requires an lvalue for operand).
Oh, fail. I knew there was a reason why dev_pm_ops stuff caused hassle.
But then I do have to wonder who exactly builds without PM enabled these
days.
> Please change to guard .pm = &ad7879_i2c_pm with #ifdef.
Meh, I guess. Though that ends up being annoying in general as some of
the PM functions (things like poweroff) are active even without PM
enabled, it always feels clearer to just have the struct there all the
time and carry on with the standard NULLs for functions.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Input: ad7879 - Convert I2C to dev_pm_ops
2011-01-05 22:41 ` Mark Brown
@ 2011-01-06 0:09 ` Dmitry Torokhov
2011-01-06 0:37 ` Mark Brown
0 siblings, 1 reply; 7+ messages in thread
From: Dmitry Torokhov @ 2011-01-06 0:09 UTC (permalink / raw)
To: Mark Brown; +Cc: Mike Frysinger, Michael Hennerich, linux-input
On Wed, Jan 05, 2011 at 10:41:46PM +0000, Mark Brown wrote:
> On Wed, Jan 05, 2011 at 02:14:32PM -0800, Dmitry Torokhov wrote:
>
> > I do not think you tested it with !CONFIG_PM since &NULL is not valid
> > expression (& requires an lvalue for operand).
>
> Oh, fail. I knew there was a reason why dev_pm_ops stuff caused hassle.
> But then I do have to wonder who exactly builds without PM enabled these
> days.
Well, I kind of agree. Maybe someone should start looking into removing
CONFIG_PM, we are in 2011 now...
>
> > Please change to guard .pm = &ad7879_i2c_pm with #ifdef.
>
> Meh, I guess. Though that ends up being annoying in general as some of
> the PM functions (things like poweroff) are active even without PM
> enabled,
Most of the drivers do not need special handlers for poweroff though...
I actually do not much liek the "simple" initializator as it usually
does way more than needed.
> it always feels clearer to just have the struct there all the
> time and carry on with the standard NULLs for functions.
Thanks.
--
Dmitry
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Input: ad7879 - Convert I2C to dev_pm_ops
2011-01-06 0:09 ` Dmitry Torokhov
@ 2011-01-06 0:37 ` Mark Brown
0 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2011-01-06 0:37 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: Mike Frysinger, Michael Hennerich, linux-input
On Wed, Jan 05, 2011 at 04:09:34PM -0800, Dmitry Torokhov wrote:
> I actually do not much liek the "simple" initializator as it usually
> does way more than needed.
It does mean that we're exactly replicating the set of calls that get
done where the legacy methods are used (at least for the simple buses
like I2C) which is pretty important for this sort of mechanical update.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Input: ad7879 - Convert I2C to dev_pm_ops
2011-01-05 22:14 ` Dmitry Torokhov
2011-01-05 22:41 ` Mark Brown
@ 2011-01-06 12:15 ` Mark Brown
2011-01-07 1:15 ` Dmitry Torokhov
1 sibling, 1 reply; 7+ messages in thread
From: Mark Brown @ 2011-01-06 12:15 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: Mike Frysinger, Michael Hennerich, linux-input
On Wed, Jan 05, 2011 at 02:14:32PM -0800, Dmitry Torokhov wrote:
> Please change to guard .pm = &ad7879_i2c_pm with #ifdef.
I've sent out updated versions of this and the other affected patches;
the rest were already either not guarding at all or had the define due
to following the idiom of the existing driver.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Input: ad7879 - Convert I2C to dev_pm_ops
2011-01-06 12:15 ` Mark Brown
@ 2011-01-07 1:15 ` Dmitry Torokhov
0 siblings, 0 replies; 7+ messages in thread
From: Dmitry Torokhov @ 2011-01-07 1:15 UTC (permalink / raw)
To: Mark Brown; +Cc: Mike Frysinger, Michael Hennerich, linux-input
On Thu, Jan 06, 2011 at 12:15:56PM +0000, Mark Brown wrote:
> On Wed, Jan 05, 2011 at 02:14:32PM -0800, Dmitry Torokhov wrote:
>
> > Please change to guard .pm = &ad7879_i2c_pm with #ifdef.
>
> I've sent out updated versions of this and the other affected patches;
> the rest were already either not guarding at all or had the define due
> to following the idiom of the existing driver.
Thanks Mark. I'll get them in.
--
Dmitry
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2011-01-07 1:15 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-05 19:01 [PATCH] Input: ad7879 - Convert I2C to dev_pm_ops Mark Brown
2011-01-05 22:14 ` Dmitry Torokhov
2011-01-05 22:41 ` Mark Brown
2011-01-06 0:09 ` Dmitry Torokhov
2011-01-06 0:37 ` Mark Brown
2011-01-06 12:15 ` Mark Brown
2011-01-07 1:15 ` Dmitry Torokhov
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).