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

iio:accel:mma9553: Switch from CONFIG_PM guards to pm_ptr() etc

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@huawei.com>
Reviewed-by: Paul Cercueil <paul@crapouillou.net>
Link: https://lore.kernel.org/r/20220130193147.279148-9-jic23@kernel.org

+3 -8
+3 -8
drivers/iio/accel/mma9553.c
··· 1162 1162 return 0; 1163 1163 } 1164 1164 1165 - #ifdef CONFIG_PM 1166 1165 static int mma9553_runtime_suspend(struct device *dev) 1167 1166 { 1168 1167 struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); ··· 1193 1194 1194 1195 return 0; 1195 1196 } 1196 - #endif 1197 1197 1198 - #ifdef CONFIG_PM_SLEEP 1199 1198 static int mma9553_suspend(struct device *dev) 1200 1199 { 1201 1200 struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); ··· 1219 1222 1220 1223 return ret; 1221 1224 } 1222 - #endif 1223 1225 1224 1226 static const struct dev_pm_ops mma9553_pm_ops = { 1225 - SET_SYSTEM_SLEEP_PM_OPS(mma9553_suspend, mma9553_resume) 1226 - SET_RUNTIME_PM_OPS(mma9553_runtime_suspend, 1227 - mma9553_runtime_resume, NULL) 1227 + SYSTEM_SLEEP_PM_OPS(mma9553_suspend, mma9553_resume) 1228 + RUNTIME_PM_OPS(mma9553_runtime_suspend, mma9553_runtime_resume, NULL) 1228 1229 }; 1229 1230 1230 1231 static const struct acpi_device_id mma9553_acpi_match[] = { ··· 1243 1248 .driver = { 1244 1249 .name = MMA9553_DRV_NAME, 1245 1250 .acpi_match_table = ACPI_PTR(mma9553_acpi_match), 1246 - .pm = &mma9553_pm_ops, 1251 + .pm = pm_ptr(&mma9553_pm_ops), 1247 1252 }, 1248 1253 .probe = mma9553_probe, 1249 1254 .remove = mma9553_remove,