iio: imu: inv_mpu: Move exports to IIO_MPU6050 namespace
authorJonathan Cameron <Jonathan.Cameron@huawei.com>
Sun, 25 Sep 2022 15:57:19 +0000 (16:57 +0100)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Wed, 23 Nov 2022 19:44:00 +0000 (19:44 +0000)
As these exports are only relevant to core module and users in the
bus specific modules, move them out of the main kernel namespace.

Includes using EXPORT_NS_GPL_DEV_PM_OPS() and the simplifications that
brings by allowing the compiler to remove unused struct dev_pm_ops
and callbacks without needing explicit __maybe_unused markings.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
--
Dropped Linus' tag as the new patch is significantly different.

v2: Switch to more flexible version of EXPORT* macro from Paul.
Acked-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Link: https://lore.kernel.org/r/20220925155719.3316280-6-jic23@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c
drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c

index 86fbbe9..8a12912 100644 (file)
@@ -1653,9 +1653,9 @@ error_power_off:
        inv_mpu6050_set_power_itg(st, false);
        return result;
 }
-EXPORT_SYMBOL_GPL(inv_mpu_core_probe);
+EXPORT_SYMBOL_NS_GPL(inv_mpu_core_probe, IIO_MPU6050);
 
-static int __maybe_unused inv_mpu_resume(struct device *dev)
+static int inv_mpu_resume(struct device *dev)
 {
        struct iio_dev *indio_dev = dev_get_drvdata(dev);
        struct inv_mpu6050_state *st = iio_priv(indio_dev);
@@ -1687,7 +1687,7 @@ out_unlock:
        return result;
 }
 
-static int __maybe_unused inv_mpu_suspend(struct device *dev)
+static int inv_mpu_suspend(struct device *dev)
 {
        struct iio_dev *indio_dev = dev_get_drvdata(dev);
        struct inv_mpu6050_state *st = iio_priv(indio_dev);
@@ -1730,7 +1730,7 @@ out_unlock:
        return result;
 }
 
-static int __maybe_unused inv_mpu_runtime_suspend(struct device *dev)
+static int inv_mpu_runtime_suspend(struct device *dev)
 {
        struct inv_mpu6050_state *st = iio_priv(dev_get_drvdata(dev));
        unsigned int sensors;
@@ -1755,7 +1755,7 @@ out_unlock:
        return ret;
 }
 
-static int __maybe_unused inv_mpu_runtime_resume(struct device *dev)
+static int inv_mpu_runtime_resume(struct device *dev)
 {
        struct inv_mpu6050_state *st = iio_priv(dev_get_drvdata(dev));
        int ret;
@@ -1767,11 +1767,10 @@ static int __maybe_unused inv_mpu_runtime_resume(struct device *dev)
        return inv_mpu6050_set_power_itg(st, true);
 }
 
-const struct dev_pm_ops inv_mpu_pmops = {
-       SET_SYSTEM_SLEEP_PM_OPS(inv_mpu_suspend, inv_mpu_resume)
-       SET_RUNTIME_PM_OPS(inv_mpu_runtime_suspend, inv_mpu_runtime_resume, NULL)
+EXPORT_NS_GPL_DEV_PM_OPS(inv_mpu_pmops, IIO_MPU6050) = {
+       SYSTEM_SLEEP_PM_OPS(inv_mpu_suspend, inv_mpu_resume)
+       RUNTIME_PM_OPS(inv_mpu_runtime_suspend, inv_mpu_runtime_resume, NULL)
 };
-EXPORT_SYMBOL_GPL(inv_mpu_pmops);
 
 MODULE_AUTHOR("Invensense Corporation");
 MODULE_DESCRIPTION("Invensense device MPU6050 driver");
index 14255a9..7a8d60a 100644 (file)
@@ -267,7 +267,7 @@ static struct i2c_driver inv_mpu_driver = {
                .of_match_table = inv_of_match,
                .acpi_match_table = inv_acpi_match,
                .name   =       "inv-mpu6050-i2c",
-               .pm     =       &inv_mpu_pmops,
+               .pm     =       pm_ptr(&inv_mpu_pmops),
        },
 };
 
@@ -276,3 +276,4 @@ module_i2c_driver(inv_mpu_driver);
 MODULE_AUTHOR("Invensense Corporation");
 MODULE_DESCRIPTION("Invensense device MPU6050 driver");
 MODULE_LICENSE("GPL");
+MODULE_IMPORT_NS(IIO_MPU6050);
index e6107b0..89f46c2 100644 (file)
@@ -154,7 +154,7 @@ static struct spi_driver inv_mpu_driver = {
                .of_match_table = inv_of_match,
                .acpi_match_table = inv_acpi_match,
                .name   =       "inv-mpu6000-spi",
-               .pm     =       &inv_mpu_pmops,
+               .pm     =       pm_ptr(&inv_mpu_pmops),
        },
 };
 
@@ -163,3 +163,4 @@ module_spi_driver(inv_mpu_driver);
 MODULE_AUTHOR("Adriana Reus <adriana.reus@intel.com>");
 MODULE_DESCRIPTION("Invensense device MPU6000 driver");
 MODULE_LICENSE("GPL");
+MODULE_IMPORT_NS(IIO_MPU6050);