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

iio:proximity:sx9500: 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.

Reviewed-by: Gwendal Grignou <gwendal@chromium.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-36-jic23@kernel.org

+2 -6
+2 -6
drivers/iio/proximity/sx9500.c
··· 993 993 return 0; 994 994 } 995 995 996 - #ifdef CONFIG_PM_SLEEP 997 996 static int sx9500_suspend(struct device *dev) 998 997 { 999 998 struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); ··· 1029 1030 1030 1031 return ret; 1031 1032 } 1032 - #endif /* CONFIG_PM_SLEEP */ 1033 1033 1034 - static const struct dev_pm_ops sx9500_pm_ops = { 1035 - SET_SYSTEM_SLEEP_PM_OPS(sx9500_suspend, sx9500_resume) 1036 - }; 1034 + static DEFINE_SIMPLE_DEV_PM_OPS(sx9500_pm_ops, sx9500_suspend, sx9500_resume); 1037 1035 1038 1036 static const struct acpi_device_id sx9500_acpi_match[] = { 1039 1037 {"SSX9500", 0}, ··· 1056 1060 .name = SX9500_DRIVER_NAME, 1057 1061 .acpi_match_table = ACPI_PTR(sx9500_acpi_match), 1058 1062 .of_match_table = of_match_ptr(sx9500_of_match), 1059 - .pm = &sx9500_pm_ops, 1063 + .pm = pm_sleep_ptr(&sx9500_pm_ops), 1060 1064 }, 1061 1065 .probe = sx9500_probe, 1062 1066 .remove = sx9500_remove,