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

iio:common:ssp: 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. Also switch to SIMPLE_DEV_PM_OPS
rather than open coding the structure.

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-17-jic23@kernel.org

+2 -6
+2 -6
drivers/iio/common/ssp_sensors/ssp_dev.c
··· 600 600 return 0; 601 601 } 602 602 603 - #ifdef CONFIG_PM_SLEEP 604 603 static int ssp_suspend(struct device *dev) 605 604 { 606 605 int ret; ··· 648 649 649 650 return 0; 650 651 } 651 - #endif /* CONFIG_PM_SLEEP */ 652 652 653 - static const struct dev_pm_ops ssp_pm_ops = { 654 - SET_SYSTEM_SLEEP_PM_OPS(ssp_suspend, ssp_resume) 655 - }; 653 + static DEFINE_SIMPLE_DEV_PM_OPS(ssp_pm_ops, ssp_suspend, ssp_resume); 656 654 657 655 static struct spi_driver ssp_driver = { 658 656 .probe = ssp_probe, 659 657 .remove = ssp_remove, 660 658 .driver = { 661 - .pm = &ssp_pm_ops, 659 + .pm = pm_sleep_ptr(&ssp_pm_ops), 662 660 .of_match_table = ssp_of_match, 663 661 .name = "sensorhub" 664 662 },