Commit 62bfa12c authored by Jonathan Cameron's avatar Jonathan Cameron

iio: imu: inv_mpu: Move exports to IIO_MPU6050 namespace

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: default avatarJonathan 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: default avatarJean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Link: https://lore.kernel.org/r/20220925155719.3316280-6-jic23@kernel.orgSigned-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent ef5a5ef2
...@@ -1653,9 +1653,9 @@ int inv_mpu_core_probe(struct regmap *regmap, int irq, const char *name, ...@@ -1653,9 +1653,9 @@ int inv_mpu_core_probe(struct regmap *regmap, int irq, const char *name,
inv_mpu6050_set_power_itg(st, false); inv_mpu6050_set_power_itg(st, false);
return result; 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 iio_dev *indio_dev = dev_get_drvdata(dev);
struct inv_mpu6050_state *st = iio_priv(indio_dev); struct inv_mpu6050_state *st = iio_priv(indio_dev);
...@@ -1687,7 +1687,7 @@ static int __maybe_unused inv_mpu_resume(struct device *dev) ...@@ -1687,7 +1687,7 @@ static int __maybe_unused inv_mpu_resume(struct device *dev)
return result; 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 iio_dev *indio_dev = dev_get_drvdata(dev);
struct inv_mpu6050_state *st = iio_priv(indio_dev); struct inv_mpu6050_state *st = iio_priv(indio_dev);
...@@ -1730,7 +1730,7 @@ static int __maybe_unused inv_mpu_suspend(struct device *dev) ...@@ -1730,7 +1730,7 @@ static int __maybe_unused inv_mpu_suspend(struct device *dev)
return result; 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)); struct inv_mpu6050_state *st = iio_priv(dev_get_drvdata(dev));
unsigned int sensors; unsigned int sensors;
...@@ -1755,7 +1755,7 @@ static int __maybe_unused inv_mpu_runtime_suspend(struct device *dev) ...@@ -1755,7 +1755,7 @@ static int __maybe_unused inv_mpu_runtime_suspend(struct device *dev)
return ret; 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)); struct inv_mpu6050_state *st = iio_priv(dev_get_drvdata(dev));
int ret; int ret;
...@@ -1767,11 +1767,10 @@ static int __maybe_unused inv_mpu_runtime_resume(struct device *dev) ...@@ -1767,11 +1767,10 @@ static int __maybe_unused inv_mpu_runtime_resume(struct device *dev)
return inv_mpu6050_set_power_itg(st, true); return inv_mpu6050_set_power_itg(st, true);
} }
const struct dev_pm_ops inv_mpu_pmops = { EXPORT_NS_GPL_DEV_PM_OPS(inv_mpu_pmops, IIO_MPU6050) = {
SET_SYSTEM_SLEEP_PM_OPS(inv_mpu_suspend, inv_mpu_resume) SYSTEM_SLEEP_PM_OPS(inv_mpu_suspend, inv_mpu_resume)
SET_RUNTIME_PM_OPS(inv_mpu_runtime_suspend, inv_mpu_runtime_resume, NULL) RUNTIME_PM_OPS(inv_mpu_runtime_suspend, inv_mpu_runtime_resume, NULL)
}; };
EXPORT_SYMBOL_GPL(inv_mpu_pmops);
MODULE_AUTHOR("Invensense Corporation"); MODULE_AUTHOR("Invensense Corporation");
MODULE_DESCRIPTION("Invensense device MPU6050 driver"); MODULE_DESCRIPTION("Invensense device MPU6050 driver");
......
...@@ -267,7 +267,7 @@ static struct i2c_driver inv_mpu_driver = { ...@@ -267,7 +267,7 @@ static struct i2c_driver inv_mpu_driver = {
.of_match_table = inv_of_match, .of_match_table = inv_of_match,
.acpi_match_table = inv_acpi_match, .acpi_match_table = inv_acpi_match,
.name = "inv-mpu6050-i2c", .name = "inv-mpu6050-i2c",
.pm = &inv_mpu_pmops, .pm = pm_ptr(&inv_mpu_pmops),
}, },
}; };
...@@ -276,3 +276,4 @@ module_i2c_driver(inv_mpu_driver); ...@@ -276,3 +276,4 @@ module_i2c_driver(inv_mpu_driver);
MODULE_AUTHOR("Invensense Corporation"); MODULE_AUTHOR("Invensense Corporation");
MODULE_DESCRIPTION("Invensense device MPU6050 driver"); MODULE_DESCRIPTION("Invensense device MPU6050 driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_IMPORT_NS(IIO_MPU6050);
...@@ -154,7 +154,7 @@ static struct spi_driver inv_mpu_driver = { ...@@ -154,7 +154,7 @@ static struct spi_driver inv_mpu_driver = {
.of_match_table = inv_of_match, .of_match_table = inv_of_match,
.acpi_match_table = inv_acpi_match, .acpi_match_table = inv_acpi_match,
.name = "inv-mpu6000-spi", .name = "inv-mpu6000-spi",
.pm = &inv_mpu_pmops, .pm = pm_ptr(&inv_mpu_pmops),
}, },
}; };
...@@ -163,3 +163,4 @@ module_spi_driver(inv_mpu_driver); ...@@ -163,3 +163,4 @@ module_spi_driver(inv_mpu_driver);
MODULE_AUTHOR("Adriana Reus <adriana.reus@intel.com>"); MODULE_AUTHOR("Adriana Reus <adriana.reus@intel.com>");
MODULE_DESCRIPTION("Invensense device MPU6000 driver"); MODULE_DESCRIPTION("Invensense device MPU6000 driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_IMPORT_NS(IIO_MPU6050);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment