mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-10 07:00:48 +00:00
bh1780gli: convert to dev pm ops
Signed-off-by: Shubhrajyoti Datta <shubhrajyoti@ti.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
f3ccfcdaf3
commit
4a7de634f0
@ -196,10 +196,11 @@ static int __devexit bh1780_remove(struct i2c_client *client)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_PM
|
#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;
|
struct bh1780_data *ddata;
|
||||||
int state, ret;
|
int state, ret;
|
||||||
|
struct i2c_client *client = to_i2c_client(dev);
|
||||||
|
|
||||||
ddata = i2c_get_clientdata(client);
|
ddata = i2c_get_clientdata(client);
|
||||||
state = bh1780_read(ddata, BH1780_REG_CONTROL, "CONTROL");
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int bh1780_resume(struct i2c_client *client)
|
static int bh1780_resume(struct device *dev)
|
||||||
{
|
{
|
||||||
struct bh1780_data *ddata;
|
struct bh1780_data *ddata;
|
||||||
int state, ret;
|
int state, ret;
|
||||||
|
struct i2c_client *client = to_i2c_client(dev);
|
||||||
|
|
||||||
ddata = i2c_get_clientdata(client);
|
ddata = i2c_get_clientdata(client);
|
||||||
state = ddata->power_state;
|
state = ddata->power_state;
|
||||||
|
|
||||||
ret = bh1780_write(ddata, BH1780_REG_CONTROL, state,
|
ret = bh1780_write(ddata, BH1780_REG_CONTROL, state,
|
||||||
"CONTROL");
|
"CONTROL");
|
||||||
|
|
||||||
@ -233,9 +234,10 @@ static int bh1780_resume(struct i2c_client *client)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
static SIMPLE_DEV_PM_OPS(bh1780_pm, bh1780_suspend, bh1780_resume);
|
||||||
|
#define BH1780_PMOPS (&bh1780_pm)
|
||||||
#else
|
#else
|
||||||
#define bh1780_suspend NULL
|
#define BH1780_PMOPS NULL
|
||||||
#define bh1780_resume NULL
|
|
||||||
#endif /* CONFIG_PM */
|
#endif /* CONFIG_PM */
|
||||||
|
|
||||||
static const struct i2c_device_id bh1780_id[] = {
|
static const struct i2c_device_id bh1780_id[] = {
|
||||||
@ -247,11 +249,10 @@ static struct i2c_driver bh1780_driver = {
|
|||||||
.probe = bh1780_probe,
|
.probe = bh1780_probe,
|
||||||
.remove = bh1780_remove,
|
.remove = bh1780_remove,
|
||||||
.id_table = bh1780_id,
|
.id_table = bh1780_id,
|
||||||
.suspend = bh1780_suspend,
|
|
||||||
.resume = bh1780_resume,
|
|
||||||
.driver = {
|
.driver = {
|
||||||
.name = "bh1780"
|
.name = "bh1780",
|
||||||
},
|
.pm = BH1780_PMOPS,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
static int __init bh1780_init(void)
|
static int __init bh1780_init(void)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user