iio: light: al3010: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
Using these newer macros allows the compiler to remove the unused structure and functions when !CONFIG_PM_SLEEP + removes the need to mark pm functions __maybe_unused. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Cc: David Heidelberg <david@ixit.cz> Reviewed-by: David Heidelberg <david@ixit.cz> Reviewed-by: Paul Cercueil <paul@crapouillou.net> Link: https://lore.kernel.org/r/20220621202719.13644-20-jic23@kernel.org
This commit is contained in:
parent
b220558c0f
commit
dc064f21ea
|
@ -200,17 +200,17 @@ static int al3010_probe(struct i2c_client *client,
|
||||||
return devm_iio_device_register(&client->dev, indio_dev);
|
return devm_iio_device_register(&client->dev, indio_dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __maybe_unused al3010_suspend(struct device *dev)
|
static int al3010_suspend(struct device *dev)
|
||||||
{
|
{
|
||||||
return al3010_set_pwr(to_i2c_client(dev), false);
|
return al3010_set_pwr(to_i2c_client(dev), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __maybe_unused al3010_resume(struct device *dev)
|
static int al3010_resume(struct device *dev)
|
||||||
{
|
{
|
||||||
return al3010_set_pwr(to_i2c_client(dev), true);
|
return al3010_set_pwr(to_i2c_client(dev), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static SIMPLE_DEV_PM_OPS(al3010_pm_ops, al3010_suspend, al3010_resume);
|
static DEFINE_SIMPLE_DEV_PM_OPS(al3010_pm_ops, al3010_suspend, al3010_resume);
|
||||||
|
|
||||||
static const struct i2c_device_id al3010_id[] = {
|
static const struct i2c_device_id al3010_id[] = {
|
||||||
{"al3010", },
|
{"al3010", },
|
||||||
|
@ -228,7 +228,7 @@ static struct i2c_driver al3010_driver = {
|
||||||
.driver = {
|
.driver = {
|
||||||
.name = AL3010_DRV_NAME,
|
.name = AL3010_DRV_NAME,
|
||||||
.of_match_table = al3010_of_match,
|
.of_match_table = al3010_of_match,
|
||||||
.pm = &al3010_pm_ops,
|
.pm = pm_sleep_ptr(&al3010_pm_ops),
|
||||||
},
|
},
|
||||||
.probe = al3010_probe,
|
.probe = al3010_probe,
|
||||||
.id_table = al3010_id,
|
.id_table = al3010_id,
|
||||||
|
|
Loading…
Reference in New Issue