mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-27 14:45:19 +00:00
iio:accel:dmard06: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc
Letting the compiler remove these functions when the kernel is built without CONFIG_PM_SLEEP support is simpler and less error prone than the use of #ifdef based config guards. Removing instances of this approach from IIO also stops them being copied into new drivers. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Paul Cercueil <paul@crapouillou.net> Link: https://lore.kernel.org/r/20220130193147.279148-4-jic23@kernel.org
This commit is contained in:
parent
ff9231c7eb
commit
8aa26e20cf
1 changed files with 3 additions and 7 deletions
|
@ -170,7 +170,6 @@ static int dmard06_probe(struct i2c_client *client,
|
||||||
return devm_iio_device_register(&client->dev, indio_dev);
|
return devm_iio_device_register(&client->dev, indio_dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_PM_SLEEP
|
|
||||||
static int dmard06_suspend(struct device *dev)
|
static int dmard06_suspend(struct device *dev)
|
||||||
{
|
{
|
||||||
struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
|
struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
|
||||||
|
@ -199,11 +198,8 @@ static int dmard06_resume(struct device *dev)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static SIMPLE_DEV_PM_OPS(dmard06_pm_ops, dmard06_suspend, dmard06_resume);
|
static DEFINE_SIMPLE_DEV_PM_OPS(dmard06_pm_ops, dmard06_suspend,
|
||||||
#define DMARD06_PM_OPS (&dmard06_pm_ops)
|
dmard06_resume);
|
||||||
#else
|
|
||||||
#define DMARD06_PM_OPS NULL
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static const struct i2c_device_id dmard06_id[] = {
|
static const struct i2c_device_id dmard06_id[] = {
|
||||||
{ "dmard05", 0 },
|
{ "dmard05", 0 },
|
||||||
|
@ -227,7 +223,7 @@ static struct i2c_driver dmard06_driver = {
|
||||||
.driver = {
|
.driver = {
|
||||||
.name = DMARD06_DRV_NAME,
|
.name = DMARD06_DRV_NAME,
|
||||||
.of_match_table = dmard06_of_match,
|
.of_match_table = dmard06_of_match,
|
||||||
.pm = DMARD06_PM_OPS,
|
.pm = pm_sleep_ptr(&dmard06_pm_ops),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
module_i2c_driver(dmard06_driver);
|
module_i2c_driver(dmard06_driver);
|
||||||
|
|
Loading…
Reference in a new issue