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

iio: accel: fxls8962af: Use new EXPORT_NS_GPL_DEV_PM_OPS()

Using this macro allows the compiler to remove unused
structures and callbacks if we are not building with
CONFIG_PM* without needing __maybe_unused markings.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Sean Nyekjaer <sean@geanix.com>

--
Switched to Paul Cercueil's more flexible implementation fo the macro.
Dropped Sean's Ack given new form of macro being used.

Acked-by: Sean Nyekjaer <sean@geanix.com>
Link: https://lore.kernel.org/r/20220925155719.3316280-3-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

+9 -11
+7 -9
drivers/iio/accel/fxls8962af-core.c
··· 1241 1241 } 1242 1242 EXPORT_SYMBOL_NS_GPL(fxls8962af_core_probe, IIO_FXLS8962AF); 1243 1243 1244 - static int __maybe_unused fxls8962af_runtime_suspend(struct device *dev) 1244 + static int fxls8962af_runtime_suspend(struct device *dev) 1245 1245 { 1246 1246 struct fxls8962af_data *data = iio_priv(dev_get_drvdata(dev)); 1247 1247 int ret; ··· 1255 1255 return 0; 1256 1256 } 1257 1257 1258 - static int __maybe_unused fxls8962af_runtime_resume(struct device *dev) 1258 + static int fxls8962af_runtime_resume(struct device *dev) 1259 1259 { 1260 1260 struct fxls8962af_data *data = iio_priv(dev_get_drvdata(dev)); 1261 1261 1262 1262 return fxls8962af_active(data); 1263 1263 } 1264 1264 1265 - static int __maybe_unused fxls8962af_suspend(struct device *dev) 1265 + static int fxls8962af_suspend(struct device *dev) 1266 1266 { 1267 1267 struct iio_dev *indio_dev = dev_get_drvdata(dev); 1268 1268 struct fxls8962af_data *data = iio_priv(indio_dev); ··· 1283 1283 return 0; 1284 1284 } 1285 1285 1286 - static int __maybe_unused fxls8962af_resume(struct device *dev) 1286 + static int fxls8962af_resume(struct device *dev) 1287 1287 { 1288 1288 struct iio_dev *indio_dev = dev_get_drvdata(dev); 1289 1289 struct fxls8962af_data *data = iio_priv(indio_dev); ··· 1300 1300 return 0; 1301 1301 } 1302 1302 1303 - const struct dev_pm_ops fxls8962af_pm_ops = { 1304 - SET_SYSTEM_SLEEP_PM_OPS(fxls8962af_suspend, fxls8962af_resume) 1305 - SET_RUNTIME_PM_OPS(fxls8962af_runtime_suspend, 1306 - fxls8962af_runtime_resume, NULL) 1303 + EXPORT_NS_GPL_DEV_PM_OPS(fxls8962af_pm_ops, IIO_FXLS8962AF) = { 1304 + SYSTEM_SLEEP_PM_OPS(fxls8962af_suspend, fxls8962af_resume) 1305 + RUNTIME_PM_OPS(fxls8962af_runtime_suspend, fxls8962af_runtime_resume, NULL) 1307 1306 }; 1308 - EXPORT_SYMBOL_NS_GPL(fxls8962af_pm_ops, IIO_FXLS8962AF); 1309 1307 1310 1308 MODULE_AUTHOR("Sean Nyekjaer <sean@geanix.com>"); 1311 1309 MODULE_DESCRIPTION("NXP FXLS8962AF/FXLS8964AF accelerometer driver");
+1 -1
drivers/iio/accel/fxls8962af-i2c.c
··· 45 45 .driver = { 46 46 .name = "fxls8962af_i2c", 47 47 .of_match_table = fxls8962af_of_match, 48 - .pm = &fxls8962af_pm_ops, 48 + .pm = pm_ptr(&fxls8962af_pm_ops), 49 49 }, 50 50 .probe_new = fxls8962af_probe, 51 51 .id_table = fxls8962af_id,
+1 -1
drivers/iio/accel/fxls8962af-spi.c
··· 44 44 static struct spi_driver fxls8962af_driver = { 45 45 .driver = { 46 46 .name = "fxls8962af_spi", 47 - .pm = &fxls8962af_pm_ops, 47 + .pm = pm_ptr(&fxls8962af_pm_ops), 48 48 .of_match_table = fxls8962af_spi_of_match, 49 49 }, 50 50 .probe = fxls8962af_probe,