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

iio: magn: yas530: Use DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr() macros

Using these new macros allows the compiler to remove the unused dev_pm_ops
structure and related functions if !CONFIG_PM without the need to mark
the functions __maybe_unused.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Paul Cercueil <paul@crapouillou.net>
Link: https://lore.kernel.org/r/20220621202719.13644-37-jic23@kernel.org

+5 -9
+5 -9
drivers/iio/magnetometer/yamaha-yas530.c
··· 965 965 return 0; 966 966 } 967 967 968 - static int __maybe_unused yas5xx_runtime_suspend(struct device *dev) 968 + static int yas5xx_runtime_suspend(struct device *dev) 969 969 { 970 970 struct iio_dev *indio_dev = dev_get_drvdata(dev); 971 971 struct yas5xx *yas5xx = iio_priv(indio_dev); ··· 976 976 return 0; 977 977 } 978 978 979 - static int __maybe_unused yas5xx_runtime_resume(struct device *dev) 979 + static int yas5xx_runtime_resume(struct device *dev) 980 980 { 981 981 struct iio_dev *indio_dev = dev_get_drvdata(dev); 982 982 struct yas5xx *yas5xx = iio_priv(indio_dev); ··· 1011 1011 return ret; 1012 1012 } 1013 1013 1014 - static const struct dev_pm_ops yas5xx_dev_pm_ops = { 1015 - SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, 1016 - pm_runtime_force_resume) 1017 - SET_RUNTIME_PM_OPS(yas5xx_runtime_suspend, 1018 - yas5xx_runtime_resume, NULL) 1019 - }; 1014 + static DEFINE_RUNTIME_DEV_PM_OPS(yas5xx_dev_pm_ops, yas5xx_runtime_suspend, 1015 + yas5xx_runtime_resume, NULL); 1020 1016 1021 1017 static const struct i2c_device_id yas5xx_id[] = { 1022 1018 {"yas530", }, ··· 1034 1038 .driver = { 1035 1039 .name = "yas5xx", 1036 1040 .of_match_table = yas5xx_of_match, 1037 - .pm = &yas5xx_dev_pm_ops, 1041 + .pm = pm_ptr(&yas5xx_dev_pm_ops), 1038 1042 }, 1039 1043 .probe = yas5xx_probe, 1040 1044 .remove = yas5xx_remove,