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

iio:accel:mc3230: 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: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Paul Cercueil <paul@crapouillou.net>
Link: https://lore.kernel.org/r/20220130193147.279148-6-jic23@kernel.org

+2 -4
+2 -4
drivers/iio/accel/mc3230.c
··· 160 160 return mc3230_set_opcon(iio_priv(indio_dev), MC3230_MODE_OPCON_STANDBY); 161 161 } 162 162 163 - #ifdef CONFIG_PM_SLEEP 164 163 static int mc3230_suspend(struct device *dev) 165 164 { 166 165 struct mc3230_data *data; ··· 177 178 178 179 return mc3230_set_opcon(data, MC3230_MODE_OPCON_WAKE); 179 180 } 180 - #endif 181 181 182 - static SIMPLE_DEV_PM_OPS(mc3230_pm_ops, mc3230_suspend, mc3230_resume); 182 + static DEFINE_SIMPLE_DEV_PM_OPS(mc3230_pm_ops, mc3230_suspend, mc3230_resume); 183 183 184 184 static const struct i2c_device_id mc3230_i2c_id[] = { 185 185 {"mc3230", 0}, ··· 189 191 static struct i2c_driver mc3230_driver = { 190 192 .driver = { 191 193 .name = "mc3230", 192 - .pm = &mc3230_pm_ops, 194 + .pm = pm_sleep_ptr(&mc3230_pm_ops), 193 195 }, 194 196 .probe = mc3230_probe, 195 197 .remove = mc3230_remove,