Skip to content

Commit cd8247c

Browse files
nathanchancejic23
authored andcommitted
iio: bmi323: Drop CONFIG_PM guards around runtime functions
When building with clang and CONFIG_PM disabled (such as with s390), it warns: drivers/iio/imu/bmi323/bmi323_core.c:121:27: warning: variable 'bmi323_reg_savestate' is not needed and will not be emitted [-Wunneeded-internal-declaration] 121 | static const unsigned int bmi323_reg_savestate[] = { | ^~~~~~~~~~~~~~~~~~~~ drivers/iio/imu/bmi323/bmi323_core.c:133:27: warning: variable 'bmi323_ext_reg_savestate' is not needed and will not be emitted [-Wunneeded-internal-declaration] 133 | static const unsigned int bmi323_ext_reg_savestate[] = { | ^~~~~~~~~~~~~~~~~~~~~~~~ These arrays have no references outside of sizeof(), which will be evaluated at compile time. To avoid these warnings, remove the CONFIG_PM ifdef guard and use the RUNTIME_PM_OPS macro to ensure these functions always appear used to the compiler, which allows the references to the arrays to be visible as well. This results in no difference in runtime behavior because bmi323_core_pm_ops is only used when CONFIG_PM is set with the pm_ptr() macro. Fixes: b09999e ("iio: bmi323: suspend and resume triggering on relevant pm operations") Signed-off-by: Nathan Chancellor <[email protected]> Link: https://patch.msgid.link/20240910-iio-bmi323-remove-config_pm-guards-v1-1-0552249207af@kernel.org Signed-off-by: Jonathan Cameron <[email protected]>
1 parent 9de32f4 commit cd8247c

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

drivers/iio/imu/bmi323/bmi323_core.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2172,7 +2172,6 @@ int bmi323_core_probe(struct device *dev)
21722172
}
21732173
EXPORT_SYMBOL_NS_GPL(bmi323_core_probe, IIO_BMI323);
21742174

2175-
#if defined(CONFIG_PM)
21762175
static int bmi323_core_runtime_suspend(struct device *dev)
21772176
{
21782177
struct iio_dev *indio_dev = dev_get_drvdata(dev);
@@ -2293,11 +2292,9 @@ static int bmi323_core_runtime_resume(struct device *dev)
22932292
return iio_device_resume_triggering(indio_dev);
22942293
}
22952294

2296-
#endif
2297-
22982295
const struct dev_pm_ops bmi323_core_pm_ops = {
2299-
SET_RUNTIME_PM_OPS(bmi323_core_runtime_suspend,
2300-
bmi323_core_runtime_resume, NULL)
2296+
RUNTIME_PM_OPS(bmi323_core_runtime_suspend,
2297+
bmi323_core_runtime_resume, NULL)
23012298
};
23022299
EXPORT_SYMBOL_NS_GPL(bmi323_core_pm_ops, IIO_BMI323);
23032300

0 commit comments

Comments
 (0)