iio: humidity: hts221: Move symbol exports into IIO_HTS221 namespace
authorJonathan Cameron <Jonathan.Cameron@huawei.com>
Sat, 4 Jun 2022 16:12:21 +0000 (17:12 +0100)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Wed, 15 Jun 2022 21:07:09 +0000 (22:07 +0100)
Avoid unnecessary pollution of the global symbol namespace by
moving library functions in to a specific namespace and import
that into the drivers that make use of the functions.

For more info: https://lwn.net/Articles/760045/

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://lore.kernel.org/r/20220220181522.541718-7-jic23@kernel.org
Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://lore.kernel.org/r/20220604161223.461847-4-jic23@kernel.org
drivers/iio/humidity/hts221_core.c
drivers/iio/humidity/hts221_i2c.c
drivers/iio/humidity/hts221_spi.c

index da9c08432ef2a2ff1245fa0ec02592984fb62ed1..517158307d8c22ca129e1b5a4c060487c30e43cd 100644 (file)
@@ -668,7 +668,7 @@ int hts221_probe(struct device *dev, int irq, const char *name,
 
        return devm_iio_device_register(hw->dev, iio_dev);
 }
-EXPORT_SYMBOL(hts221_probe);
+EXPORT_SYMBOL_NS(hts221_probe, IIO_HTS221);
 
 static int hts221_suspend(struct device *dev)
 {
@@ -694,7 +694,8 @@ static int hts221_resume(struct device *dev)
        return err;
 }
 
-EXPORT_SIMPLE_DEV_PM_OPS(hts221_pm_ops, hts221_suspend, hts221_resume);
+EXPORT_NS_SIMPLE_DEV_PM_OPS(hts221_pm_ops, hts221_suspend, hts221_resume,
+                           IIO_HTS221);
 
 MODULE_AUTHOR("Lorenzo Bianconi <lorenzo.bianconi@st.com>");
 MODULE_DESCRIPTION("STMicroelectronics hts221 sensor driver");
index 933b05e4d9725e73a6230cd19f41dfb8ca1d7e1e..afbc611f7712f53bbe08c3a8bc75ee8fadbce4de 100644 (file)
@@ -74,3 +74,4 @@ module_i2c_driver(hts221_driver);
 MODULE_AUTHOR("Lorenzo Bianconi <lorenzo.bianconi@st.com>");
 MODULE_DESCRIPTION("STMicroelectronics hts221 i2c driver");
 MODULE_LICENSE("GPL v2");
+MODULE_IMPORT_NS(IIO_HTS221);
index 888c5eab944c21b7f7b3346f68547bae7b171df4..fc4adb68faf6cf0105584714873590bbbfbe07ca 100644 (file)
@@ -66,3 +66,4 @@ module_spi_driver(hts221_driver);
 MODULE_AUTHOR("Lorenzo Bianconi <lorenzo.bianconi@st.com>");
 MODULE_DESCRIPTION("STMicroelectronics hts221 spi driver");
 MODULE_LICENSE("GPL v2");
+MODULE_IMPORT_NS(IIO_HTS221);