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

iio: magn: hmc5843: Move struct dev_pm_ops out of header

Having this structure defined static in the header lead to
unnecessary duplication and required additional symbol exports.
Use the EXPORT_NS_SIMPLE_DEV_PM_OPS() to clean this up in the same
fashion as many other drivers do this.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220807184534.1037363-3-jic23@kernel.org

+7 -18
+1 -12
drivers/iio/magnetometer/hmc5843.h
··· 52 52 enum hmc5843_ids id, const char *name); 53 53 void hmc5843_common_remove(struct device *dev); 54 54 55 - int hmc5843_common_suspend(struct device *dev); 56 - int hmc5843_common_resume(struct device *dev); 57 - 58 - #ifdef CONFIG_PM_SLEEP 59 - static __maybe_unused SIMPLE_DEV_PM_OPS(hmc5843_pm_ops, 60 - hmc5843_common_suspend, 61 - hmc5843_common_resume); 62 - #define HMC5843_PM_OPS (&hmc5843_pm_ops) 63 - #else 64 - #define HMC5843_PM_OPS NULL 65 - #endif 66 - 55 + extern const struct dev_pm_ops hmc5843_pm_ops; 67 56 #endif /* HMC5843_CORE_H */
+4 -4
drivers/iio/magnetometer/hmc5843_core.c
··· 603 603 604 604 static const unsigned long hmc5843_scan_masks[] = {0x7, 0}; 605 605 606 - int hmc5843_common_suspend(struct device *dev) 606 + static int hmc5843_common_suspend(struct device *dev) 607 607 { 608 608 return hmc5843_set_mode(iio_priv(dev_get_drvdata(dev)), 609 609 HMC5843_MODE_SLEEP); 610 610 } 611 - EXPORT_SYMBOL_NS(hmc5843_common_suspend, IIO_HMC5843); 612 611 613 - int hmc5843_common_resume(struct device *dev) 612 + static int hmc5843_common_resume(struct device *dev) 614 613 { 615 614 return hmc5843_set_mode(iio_priv(dev_get_drvdata(dev)), 616 615 HMC5843_MODE_CONVERSION_CONTINUOUS); 617 616 } 618 - EXPORT_SYMBOL_NS(hmc5843_common_resume, IIO_HMC5843); 617 + EXPORT_NS_SIMPLE_DEV_PM_OPS(hmc5843_pm_ops, hmc5843_common_suspend, 618 + hmc5843_common_resume, IIO_HMC5843); 619 619 620 620 int hmc5843_common_probe(struct device *dev, struct regmap *regmap, 621 621 enum hmc5843_ids id, const char *name)
+1 -1
drivers/iio/magnetometer/hmc5843_i2c.c
··· 93 93 static struct i2c_driver hmc5843_driver = { 94 94 .driver = { 95 95 .name = "hmc5843", 96 - .pm = HMC5843_PM_OPS, 96 + .pm = pm_sleep_ptr(&hmc5843_pm_ops), 97 97 .of_match_table = hmc5843_of_match, 98 98 }, 99 99 .id_table = hmc5843_id,
+1 -1
drivers/iio/magnetometer/hmc5843_spi.c
··· 88 88 static struct spi_driver hmc5843_driver = { 89 89 .driver = { 90 90 .name = "hmc5843", 91 - .pm = HMC5843_PM_OPS, 91 + .pm = pm_sleep_ptr(&hmc5843_pm_ops), 92 92 }, 93 93 .id_table = hmc5843_id, 94 94 .probe = hmc5843_spi_probe,