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

iio:accel:da280: 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-3-jic23@kernel.org

+2 -4
+2 -4
drivers/iio/accel/da280.c
··· 153 153 return devm_iio_device_register(&client->dev, indio_dev); 154 154 } 155 155 156 - #ifdef CONFIG_PM_SLEEP 157 156 static int da280_suspend(struct device *dev) 158 157 { 159 158 return da280_enable(to_i2c_client(dev), false); ··· 162 163 { 163 164 return da280_enable(to_i2c_client(dev), true); 164 165 } 165 - #endif 166 166 167 - static SIMPLE_DEV_PM_OPS(da280_pm_ops, da280_suspend, da280_resume); 167 + static DEFINE_SIMPLE_DEV_PM_OPS(da280_pm_ops, da280_suspend, da280_resume); 168 168 169 169 static const struct acpi_device_id da280_acpi_match[] = { 170 170 {"MIRAACC", da280}, ··· 182 184 .driver = { 183 185 .name = "da280", 184 186 .acpi_match_table = ACPI_PTR(da280_acpi_match), 185 - .pm = &da280_pm_ops, 187 + .pm = pm_sleep_ptr(&da280_pm_ops), 186 188 }, 187 189 .probe = da280_probe, 188 190 .id_table = da280_i2c_id,