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

iio: dac: ltc1660: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()

Using these newer macros allows the compiler to remove the unused
structure and functions when !CONFIG_PM_SLEEP + removes the need to
mark pm functions __maybe_unused.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Marcus Folkesson <marcus.folkesson@gmail.com>
Reviewed-by: Marcus Folkesson <marcus.folkesson@gmail.com>
Reviewed-by: Paul Cercueil <paul@crapouillou.net>
Link: https://lore.kernel.org/r/20220621202719.13644-13-jic23@kernel.org

+5 -4
+5 -4
drivers/iio/dac/ltc1660.c
··· 137 137 .write_raw = &ltc1660_write_raw, 138 138 }; 139 139 140 - static int __maybe_unused ltc1660_suspend(struct device *dev) 140 + static int ltc1660_suspend(struct device *dev) 141 141 { 142 142 struct ltc1660_priv *priv = iio_priv(spi_get_drvdata( 143 143 to_spi_device(dev))); 144 144 return regmap_write(priv->regmap, LTC1660_REG_SLEEP, 0x00); 145 145 } 146 146 147 - static int __maybe_unused ltc1660_resume(struct device *dev) 147 + static int ltc1660_resume(struct device *dev) 148 148 { 149 149 struct ltc1660_priv *priv = iio_priv(spi_get_drvdata( 150 150 to_spi_device(dev))); 151 151 return regmap_write(priv->regmap, LTC1660_REG_WAKE, 0x00); 152 152 } 153 - static SIMPLE_DEV_PM_OPS(ltc1660_pm_ops, ltc1660_suspend, ltc1660_resume); 153 + static DEFINE_SIMPLE_DEV_PM_OPS(ltc1660_pm_ops, ltc1660_suspend, 154 + ltc1660_resume); 154 155 155 156 static int ltc1660_probe(struct spi_device *spi) 156 157 { ··· 234 233 .driver = { 235 234 .name = "ltc1660", 236 235 .of_match_table = ltc1660_dt_ids, 237 - .pm = &ltc1660_pm_ops, 236 + .pm = pm_sleep_ptr(&ltc1660_pm_ops), 238 237 }, 239 238 .probe = ltc1660_probe, 240 239 .remove = ltc1660_remove,