iio:magnetometer:bmc150: Move exports to IIO_BMC150_MAGN namespace
authorJonathan Cameron <Jonathan.Cameron@huawei.com>
Sun, 30 Jan 2022 20:56:58 +0000 (20:56 +0000)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Fri, 18 Feb 2022 11:42:27 +0000 (11:42 +0000)
In order to avoid unnecessary pollution of the global symbol namespace
move the common/library functions into a specific namespace and import
that into the bus specific device drivers that use them.

Note the MAGN postfix here is reflecting that this driver is only
responsible for part of the BMC150 device.

For more information see https://lwn.net/Articles/760045/

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20220130205701.334592-14-jic23@kernel.org
drivers/iio/magnetometer/bmc150_magn.c
drivers/iio/magnetometer/bmc150_magn_i2c.c
drivers/iio/magnetometer/bmc150_magn_spi.c

index f96f531753495f9029b34fb6abf20f28f41781ef..85f8bbf4b7933f80f664085749e3c785f7b292fd 100644 (file)
@@ -226,7 +226,7 @@ const struct regmap_config bmc150_magn_regmap_config = {
        .writeable_reg = bmc150_magn_is_writeable_reg,
        .volatile_reg = bmc150_magn_is_volatile_reg,
 };
-EXPORT_SYMBOL(bmc150_magn_regmap_config);
+EXPORT_SYMBOL_NS(bmc150_magn_regmap_config, IIO_BMC150_MAGN);
 
 static int bmc150_magn_set_power_mode(struct bmc150_magn_data *data,
                                      enum bmc150_magn_power_modes mode,
@@ -982,7 +982,7 @@ err_poweroff:
        bmc150_magn_set_power_mode(data, BMC150_MAGN_POWER_MODE_SUSPEND, true);
        return ret;
 }
-EXPORT_SYMBOL(bmc150_magn_probe);
+EXPORT_SYMBOL_NS(bmc150_magn_probe, IIO_BMC150_MAGN);
 
 int bmc150_magn_remove(struct device *dev)
 {
@@ -1009,7 +1009,7 @@ int bmc150_magn_remove(struct device *dev)
        regulator_bulk_disable(ARRAY_SIZE(data->regulators), data->regulators);
        return 0;
 }
-EXPORT_SYMBOL(bmc150_magn_remove);
+EXPORT_SYMBOL_NS(bmc150_magn_remove, IIO_BMC150_MAGN);
 
 #ifdef CONFIG_PM
 static int bmc150_magn_runtime_suspend(struct device *dev)
@@ -1077,7 +1077,7 @@ const struct dev_pm_ops bmc150_magn_pm_ops = {
        SET_RUNTIME_PM_OPS(bmc150_magn_runtime_suspend,
                           bmc150_magn_runtime_resume, NULL)
 };
-EXPORT_SYMBOL(bmc150_magn_pm_ops);
+EXPORT_SYMBOL_NS(bmc150_magn_pm_ops, IIO_BMC150_MAGN);
 
 MODULE_AUTHOR("Irina Tirdea <irina.tirdea@intel.com>");
 MODULE_LICENSE("GPL v2");
index 876e96005e33dc9aa42bee47fdd50138d6cd450a..e39b89661ad1a5869fea715734f14e7df9b61562 100644 (file)
@@ -80,3 +80,4 @@ module_i2c_driver(bmc150_magn_driver);
 MODULE_AUTHOR("Daniel Baluta <daniel.baluta@intel.com");
 MODULE_LICENSE("GPL v2");
 MODULE_DESCRIPTION("BMC150 I2C magnetometer driver");
+MODULE_IMPORT_NS(IIO_BMC150_MAGN);
index c6ed3ea8460ae42156b094f71fbe69fe7a9e7426..0db363ffc462f85a08046df7b08cfddc0b3ee225 100644 (file)
@@ -66,3 +66,4 @@ module_spi_driver(bmc150_magn_spi_driver);
 MODULE_AUTHOR("Daniel Baluta <daniel.baluta@intel.com");
 MODULE_DESCRIPTION("BMC150 magnetometer SPI driver");
 MODULE_LICENSE("GPL v2");
+MODULE_IMPORT_NS(IIO_BMC150_MAGN);