LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] bh1780gli : Convert to dev pm ops
@ 2011-01-18 10:22 shubhrajyoti
2011-01-25 0:38 ` Kevin Hilman
0 siblings, 1 reply; 4+ messages in thread
From: shubhrajyoti @ 2011-01-18 10:22 UTC (permalink / raw)
To: linux-kernel; +Cc: akpm, Shubhrajyoti Datta
From: Shubhrajyoti Datta <shubhrajyoti@ti.com>
Signed-off-by: Shubhrajyoti Datta <shubhrajyoti@ti.com>
---
drivers/misc/bh1780gli.c | 20 ++++++++++----------
1 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/drivers/misc/bh1780gli.c b/drivers/misc/bh1780gli.c
index d5f3a3f..07224ae 100644
--- a/drivers/misc/bh1780gli.c
+++ b/drivers/misc/bh1780gli.c
@@ -196,10 +196,11 @@ static int __devexit bh1780_remove(struct i2c_client *client)
}
#ifdef CONFIG_PM
-static int bh1780_suspend(struct i2c_client *client, pm_message_t mesg)
+static int bh1780_suspend(struct device *dev)
{
struct bh1780_data *ddata;
int state, ret;
+ struct i2c_client *client = to_i2c_client(dev);
ddata = i2c_get_clientdata(client);
state = bh1780_read(ddata, BH1780_REG_CONTROL, "CONTROL");
@@ -217,14 +218,14 @@ static int bh1780_suspend(struct i2c_client *client, pm_message_t mesg)
return 0;
}
-static int bh1780_resume(struct i2c_client *client)
+static int bh1780_resume(struct device *dev)
{
struct bh1780_data *ddata;
int state, ret;
+ struct i2c_client *client = to_i2c_client(dev);
ddata = i2c_get_clientdata(client);
state = ddata->power_state;
-
ret = bh1780_write(ddata, BH1780_REG_CONTROL, state,
"CONTROL");
@@ -233,9 +234,7 @@ static int bh1780_resume(struct i2c_client *client)
return 0;
}
-#else
-#define bh1780_suspend NULL
-#define bh1780_resume NULL
+static SIMPLE_DEV_PM_OPS(bh1780_pm, bh1780_suspend, bh1780_resume);
#endif /* CONFIG_PM */
static const struct i2c_device_id bh1780_id[] = {
@@ -247,11 +246,12 @@ static struct i2c_driver bh1780_driver = {
.probe = bh1780_probe,
.remove = bh1780_remove,
.id_table = bh1780_id,
- .suspend = bh1780_suspend,
- .resume = bh1780_resume,
.driver = {
- .name = "bh1780"
- },
+ .name = "bh1780",
+#ifdef CONFIG_PM
+ .pm = &bh1780_pm,
+#endif
+},
};
static int __init bh1780_init(void)
--
1.7.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] bh1780gli : Convert to dev pm ops
2011-01-18 10:22 [PATCH] bh1780gli : Convert to dev pm ops shubhrajyoti
@ 2011-01-25 0:38 ` Kevin Hilman
2011-02-28 11:50 ` Shubhrajyoti
0 siblings, 1 reply; 4+ messages in thread
From: Kevin Hilman @ 2011-01-25 0:38 UTC (permalink / raw)
To: shubhrajyoti; +Cc: linux-kernel, akpm
shubhrajyoti@ti.com writes:
> From: Shubhrajyoti Datta <shubhrajyoti@ti.com>
>
> Signed-off-by: Shubhrajyoti Datta <shubhrajyoti@ti.com>
> ---
> drivers/misc/bh1780gli.c | 20 ++++++++++----------
> 1 files changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/misc/bh1780gli.c b/drivers/misc/bh1780gli.c
> index d5f3a3f..07224ae 100644
> --- a/drivers/misc/bh1780gli.c
> +++ b/drivers/misc/bh1780gli.c
> @@ -196,10 +196,11 @@ static int __devexit bh1780_remove(struct i2c_client *client)
> }
>
> #ifdef CONFIG_PM
> -static int bh1780_suspend(struct i2c_client *client, pm_message_t mesg)
> +static int bh1780_suspend(struct device *dev)
> {
> struct bh1780_data *ddata;
> int state, ret;
> + struct i2c_client *client = to_i2c_client(dev);
>
> ddata = i2c_get_clientdata(client);
> state = bh1780_read(ddata, BH1780_REG_CONTROL, "CONTROL");
> @@ -217,14 +218,14 @@ static int bh1780_suspend(struct i2c_client *client, pm_message_t mesg)
> return 0;
> }
>
> -static int bh1780_resume(struct i2c_client *client)
> +static int bh1780_resume(struct device *dev)
> {
> struct bh1780_data *ddata;
> int state, ret;
> + struct i2c_client *client = to_i2c_client(dev);
>
> ddata = i2c_get_clientdata(client);
> state = ddata->power_state;
> -
> ret = bh1780_write(ddata, BH1780_REG_CONTROL, state,
> "CONTROL");
>
> @@ -233,9 +234,7 @@ static int bh1780_resume(struct i2c_client *client)
>
> return 0;
> }
> -#else
> -#define bh1780_suspend NULL
> -#define bh1780_resume NULL
> +static SIMPLE_DEV_PM_OPS(bh1780_pm, bh1780_suspend, bh1780_resume);
Rather, keep the #else here with a NULL pm_ops ptr so you don't need the
#ifdef below.
Kevin
> #endif /* CONFIG_PM */
>
> static const struct i2c_device_id bh1780_id[] = {
> @@ -247,11 +246,12 @@ static struct i2c_driver bh1780_driver = {
> .probe = bh1780_probe,
> .remove = bh1780_remove,
> .id_table = bh1780_id,
> - .suspend = bh1780_suspend,
> - .resume = bh1780_resume,
> .driver = {
> - .name = "bh1780"
> - },
> + .name = "bh1780",
> +#ifdef CONFIG_PM
> + .pm = &bh1780_pm,
> +#endif
> +},
> };
>
> static int __init bh1780_init(void)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] bh1780gli : Convert to dev pm ops
2011-01-25 0:38 ` Kevin Hilman
@ 2011-02-28 11:50 ` Shubhrajyoti
0 siblings, 0 replies; 4+ messages in thread
From: Shubhrajyoti @ 2011-02-28 11:50 UTC (permalink / raw)
To: Kevin Hilman; +Cc: linux-kernel, akpm
Hi Kevin,
On Tuesday 25 January 2011 06:08 AM, Kevin Hilman wrote:
> shubhrajyoti@ti.com writes:
>
>> From: Shubhrajyoti Datta<shubhrajyoti@ti.com>
>>
>> Signed-off-by: Shubhrajyoti Datta<shubhrajyoti@ti.com>
>> ---
>> drivers/misc/bh1780gli.c | 20 ++++++++++----------
>> 1 files changed, 10 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/misc/bh1780gli.c b/drivers/misc/bh1780gli.c
>> index d5f3a3f..07224ae 100644
>> --- a/drivers/misc/bh1780gli.c
>> +++ b/drivers/misc/bh1780gli.c
>> @@ -196,10 +196,11 @@ static int __devexit bh1780_remove(struct i2c_client *client)
>> }
>>
>> #ifdef CONFIG_PM
>> -static int bh1780_suspend(struct i2c_client *client, pm_message_t mesg)
>> +static int bh1780_suspend(struct device *dev)
>> {
>> struct bh1780_data *ddata;
>> int state, ret;
>> + struct i2c_client *client = to_i2c_client(dev);
>>
>> ddata = i2c_get_clientdata(client);
>> state = bh1780_read(ddata, BH1780_REG_CONTROL, "CONTROL");
>> @@ -217,14 +218,14 @@ static int bh1780_suspend(struct i2c_client *client, pm_message_t mesg)
>> return 0;
>> }
>>
>> -static int bh1780_resume(struct i2c_client *client)
>> +static int bh1780_resume(struct device *dev)
>> {
>> struct bh1780_data *ddata;
>> int state, ret;
>> + struct i2c_client *client = to_i2c_client(dev);
>>
>> ddata = i2c_get_clientdata(client);
>> state = ddata->power_state;
>> -
>> ret = bh1780_write(ddata, BH1780_REG_CONTROL, state,
>> "CONTROL");
>>
>> @@ -233,9 +234,7 @@ static int bh1780_resume(struct i2c_client *client)
>>
>> return 0;
>> }
>> -#else
>> -#define bh1780_suspend NULL
>> -#define bh1780_resume NULL
>> +static SIMPLE_DEV_PM_OPS(bh1780_pm, bh1780_suspend, bh1780_resume);
> Rather, keep the #else here with a NULL pm_ops ptr so you don't need the
> #ifdef below.
>
> Kevin
I agree with the comment. Just sent a patch trying to address it.
>> #endif /* CONFIG_PM */
>>
>> static const struct i2c_device_id bh1780_id[] = {
>> @@ -247,11 +246,12 @@ static struct i2c_driver bh1780_driver = {
>> .probe = bh1780_probe,
>> .remove = bh1780_remove,
>> .id_table = bh1780_id,
>> - .suspend = bh1780_suspend,
>> - .resume = bh1780_resume,
>> .driver = {
>> - .name = "bh1780"
>> - },
>> + .name = "bh1780",
>> +#ifdef CONFIG_PM
>> + .pm =&bh1780_pm,
>> +#endif
>> +},
>> };
>>
>> static int __init bh1780_init(void)
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] bh1780gli : Convert to dev pm ops
@ 2011-02-28 11:44 shubhrajyoti
0 siblings, 0 replies; 4+ messages in thread
From: shubhrajyoti @ 2011-02-28 11:44 UTC (permalink / raw)
To: linux-kernel; +Cc: akpm, Shubhrajyoti D
From: Shubhrajyoti D <shubhrajyoti@ti.com>
Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
---
drivers/misc/bh1780gli.c | 19 ++++++++++---------
1 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/drivers/misc/bh1780gli.c b/drivers/misc/bh1780gli.c
index d5f3a3f..d07cd67 100644
--- a/drivers/misc/bh1780gli.c
+++ b/drivers/misc/bh1780gli.c
@@ -196,10 +196,11 @@ static int __devexit bh1780_remove(struct i2c_client *client)
}
#ifdef CONFIG_PM
-static int bh1780_suspend(struct i2c_client *client, pm_message_t mesg)
+static int bh1780_suspend(struct device *dev)
{
struct bh1780_data *ddata;
int state, ret;
+ struct i2c_client *client = to_i2c_client(dev);
ddata = i2c_get_clientdata(client);
state = bh1780_read(ddata, BH1780_REG_CONTROL, "CONTROL");
@@ -217,14 +218,14 @@ static int bh1780_suspend(struct i2c_client *client, pm_message_t mesg)
return 0;
}
-static int bh1780_resume(struct i2c_client *client)
+static int bh1780_resume(struct device *dev)
{
struct bh1780_data *ddata;
int state, ret;
+ struct i2c_client *client = to_i2c_client(dev);
ddata = i2c_get_clientdata(client);
state = ddata->power_state;
-
ret = bh1780_write(ddata, BH1780_REG_CONTROL, state,
"CONTROL");
@@ -233,9 +234,10 @@ static int bh1780_resume(struct i2c_client *client)
return 0;
}
+static SIMPLE_DEV_PM_OPS(bh1780_pm, bh1780_suspend, bh1780_resume);
+#define BH1780_PMOPS (&bh1780_pm)
#else
-#define bh1780_suspend NULL
-#define bh1780_resume NULL
+#define BH1780_PMOPS NULL
#endif /* CONFIG_PM */
static const struct i2c_device_id bh1780_id[] = {
@@ -247,11 +249,10 @@ static struct i2c_driver bh1780_driver = {
.probe = bh1780_probe,
.remove = bh1780_remove,
.id_table = bh1780_id,
- .suspend = bh1780_suspend,
- .resume = bh1780_resume,
.driver = {
- .name = "bh1780"
- },
+ .name = "bh1780",
+ .pm = BH1780_PMOPS,
+},
};
static int __init bh1780_init(void)
--
1.7.1
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-02-28 11:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-18 10:22 [PATCH] bh1780gli : Convert to dev pm ops shubhrajyoti
2011-01-25 0:38 ` Kevin Hilman
2011-02-28 11:50 ` Shubhrajyoti
2011-02-28 11:44 shubhrajyoti
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).