[PATCH] iio: accel: mma8452: use pm_ptr() for dev_pm_ops
From: Sanjay Chitroda
Date: Tue Apr 14 2026 - 15:22:40 EST
From: Sanjay Chitroda <sanjayembeddedse@xxxxxxxxx>
Use pm_ptr() so the PM ops pointer is automatically set to
NULL when CONFIG_PM is disabled. This avoids unused-function warnings
and follows modern kernel power-management conventions.
Signed-off-by: Sanjay Chitroda <sanjayembeddedse@xxxxxxxxx>
---
drivers/iio/accel/mma8452.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c
index 15172ba2972c..f2b71077574b 100644
--- a/drivers/iio/accel/mma8452.c
+++ b/drivers/iio/accel/mma8452.c
@@ -1744,7 +1744,6 @@ static void mma8452_remove(struct i2c_client *client)
regulator_disable(data->vdd_reg);
}
-#ifdef CONFIG_PM
static int mma8452_runtime_suspend(struct device *dev)
{
struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
@@ -1812,7 +1811,6 @@ static int mma8452_runtime_resume(struct device *dev)
return ret;
}
-#endif
static const struct dev_pm_ops mma8452_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume)
@@ -1835,7 +1833,7 @@ static struct i2c_driver mma8452_driver = {
.driver = {
.name = "mma8452",
.of_match_table = mma8452_dt_ids,
- .pm = &mma8452_pm_ops,
+ .pm = pm_ptr(&mma8452_pm_ops),
},
.probe = mma8452_probe,
.remove = mma8452_remove,
--
2.34.1