From: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx> Letting the compiler remove these functions when the kernel is built without CONFIG_PM 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@xxxxxxxxxx> Cc: Fabrice Gasnier <fabrice.gasnier@xxxxxxxxxxx> Cc: Olivier Moysan <olivier.moysan@xxxxxxxxxxx> --- drivers/iio/adc/stm32-adc-core.c | 12 +++++------- drivers/iio/adc/stm32-adc.c | 16 ++++++---------- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/drivers/iio/adc/stm32-adc-core.c b/drivers/iio/adc/stm32-adc-core.c index b6e18eb101f7..316ae84ab961 100644 --- a/drivers/iio/adc/stm32-adc-core.c +++ b/drivers/iio/adc/stm32-adc-core.c @@ -763,28 +763,26 @@ static int stm32_adc_remove(struct platform_device *pdev) return 0; } -#if defined(CONFIG_PM) -static int stm32_adc_core_runtime_suspend(struct device *dev) +static __maybe_unused int stm32_adc_core_runtime_suspend(struct device *dev) { stm32_adc_core_hw_stop(dev); return 0; } -static int stm32_adc_core_runtime_resume(struct device *dev) +static __maybe_unused int stm32_adc_core_runtime_resume(struct device *dev) { return stm32_adc_core_hw_start(dev); } -static int stm32_adc_core_runtime_idle(struct device *dev) +static __maybe_unused int stm32_adc_core_runtime_idle(struct device *dev) { pm_runtime_mark_last_busy(dev); return 0; } -#endif -static const struct dev_pm_ops stm32_adc_core_pm_ops = { +static __maybe_unused const struct dev_pm_ops stm32_adc_core_pm_ops = { SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume) SET_RUNTIME_PM_OPS(stm32_adc_core_runtime_suspend, @@ -836,7 +834,7 @@ static struct platform_driver stm32_adc_driver = { .driver = { .name = "stm32-adc-core", .of_match_table = stm32_adc_of_match, - .pm = &stm32_adc_core_pm_ops, + .pm = pm_ptr(&stm32_adc_core_pm_ops), }, }; module_platform_driver(stm32_adc_driver); diff --git a/drivers/iio/adc/stm32-adc.c b/drivers/iio/adc/stm32-adc.c index 7f1fb36c747c..2d94de6de848 100644 --- a/drivers/iio/adc/stm32-adc.c +++ b/drivers/iio/adc/stm32-adc.c @@ -2351,8 +2351,7 @@ static int stm32_adc_remove(struct platform_device *pdev) return 0; } -#if defined(CONFIG_PM_SLEEP) -static int stm32_adc_suspend(struct device *dev) +static __maybe_unused int stm32_adc_suspend(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); @@ -2362,7 +2361,7 @@ static int stm32_adc_suspend(struct device *dev) return pm_runtime_force_suspend(dev); } -static int stm32_adc_resume(struct device *dev) +static __maybe_unused int stm32_adc_resume(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); int ret; @@ -2381,21 +2380,18 @@ static int stm32_adc_resume(struct device *dev) return stm32_adc_buffer_postenable(indio_dev); } -#endif -#if defined(CONFIG_PM) -static int stm32_adc_runtime_suspend(struct device *dev) +static __maybe_unused int stm32_adc_runtime_suspend(struct device *dev) { return stm32_adc_hw_stop(dev); } -static int stm32_adc_runtime_resume(struct device *dev) +static __maybe_unused int stm32_adc_runtime_resume(struct device *dev) { return stm32_adc_hw_start(dev); } -#endif -static const struct dev_pm_ops stm32_adc_pm_ops = { +static __maybe_unused const struct dev_pm_ops stm32_adc_pm_ops = { SET_SYSTEM_SLEEP_PM_OPS(stm32_adc_suspend, stm32_adc_resume) SET_RUNTIME_PM_OPS(stm32_adc_runtime_suspend, stm32_adc_runtime_resume, NULL) @@ -2452,7 +2448,7 @@ static struct platform_driver stm32_adc_driver = { .driver = { .name = "stm32-adc", .of_match_table = stm32_adc_of_match, - .pm = &stm32_adc_pm_ops, + .pm = pm_ptr(&stm32_adc_pm_ops), }, }; module_platform_driver(stm32_adc_driver); -- 2.34.0