Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

iio:temperature:tmp006: 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-37-jic23@kernel.org

+2 -4
+2 -4
drivers/iio/temperature/tmp006.c
··· 261 261 return devm_iio_device_register(&client->dev, indio_dev); 262 262 } 263 263 264 - #ifdef CONFIG_PM_SLEEP 265 264 static int tmp006_suspend(struct device *dev) 266 265 { 267 266 return tmp006_power(dev, false); ··· 270 271 { 271 272 return tmp006_power(dev, true); 272 273 } 273 - #endif 274 274 275 - static SIMPLE_DEV_PM_OPS(tmp006_pm_ops, tmp006_suspend, tmp006_resume); 275 + static DEFINE_SIMPLE_DEV_PM_OPS(tmp006_pm_ops, tmp006_suspend, tmp006_resume); 276 276 277 277 static const struct i2c_device_id tmp006_id[] = { 278 278 { "tmp006", 0 }, ··· 282 284 static struct i2c_driver tmp006_driver = { 283 285 .driver = { 284 286 .name = "tmp006", 285 - .pm = &tmp006_pm_ops, 287 + .pm = pm_sleep_ptr(&tmp006_pm_ops), 286 288 }, 287 289 .probe = tmp006_probe, 288 290 .id_table = tmp006_id,