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

iio:temperature:tmp007: 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.

Acked-by: Manivannan Sadhasivam <mani@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Paul Cercueil <paul@crapouillou.net>
Link: https://lore.kernel.org/r/20220130193147.279148-38-jic23@kernel.org

+2 -4
+2 -4
drivers/iio/temperature/tmp007.c
··· 537 537 return devm_iio_device_register(&client->dev, indio_dev); 538 538 } 539 539 540 - #ifdef CONFIG_PM_SLEEP 541 540 static int tmp007_suspend(struct device *dev) 542 541 { 543 542 struct tmp007_data *data = iio_priv(i2c_get_clientdata( ··· 553 554 return i2c_smbus_write_word_swapped(data->client, TMP007_CONFIG, 554 555 data->config | TMP007_CONFIG_CONV_EN); 555 556 } 556 - #endif 557 557 558 - static SIMPLE_DEV_PM_OPS(tmp007_pm_ops, tmp007_suspend, tmp007_resume); 558 + static DEFINE_SIMPLE_DEV_PM_OPS(tmp007_pm_ops, tmp007_suspend, tmp007_resume); 559 559 560 560 static const struct of_device_id tmp007_of_match[] = { 561 561 { .compatible = "ti,tmp007", }, ··· 572 574 .driver = { 573 575 .name = "tmp007", 574 576 .of_match_table = tmp007_of_match, 575 - .pm = &tmp007_pm_ops, 577 + .pm = pm_sleep_ptr(&tmp007_pm_ops), 576 578 }, 577 579 .probe = tmp007_probe, 578 580 .id_table = tmp007_id,