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

iio:accel:bma180: 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.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Paul Cercueil <paul@crapouillou.net>
Link: https://lore.kernel.org/r/20220130193147.279148-40-jic23@kernel.org

+2 -7
+2 -7
drivers/iio/accel/bma180.c
··· 1065 1065 return 0; 1066 1066 } 1067 1067 1068 - #ifdef CONFIG_PM_SLEEP 1069 1068 static int bma180_suspend(struct device *dev) 1070 1069 { 1071 1070 struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); ··· 1091 1092 return ret; 1092 1093 } 1093 1094 1094 - static SIMPLE_DEV_PM_OPS(bma180_pm_ops, bma180_suspend, bma180_resume); 1095 - #define BMA180_PM_OPS (&bma180_pm_ops) 1096 - #else 1097 - #define BMA180_PM_OPS NULL 1098 - #endif 1095 + static DEFINE_SIMPLE_DEV_PM_OPS(bma180_pm_ops, bma180_suspend, bma180_resume); 1099 1096 1100 1097 static const struct i2c_device_id bma180_ids[] = { 1101 1098 { "bma023", BMA023 }, ··· 1132 1137 static struct i2c_driver bma180_driver = { 1133 1138 .driver = { 1134 1139 .name = "bma180", 1135 - .pm = BMA180_PM_OPS, 1140 + .pm = pm_sleep_ptr(&bma180_pm_ops), 1136 1141 .of_match_table = bma180_of_match, 1137 1142 }, 1138 1143 .probe = bma180_probe,