[PATCH] staging: nvec: convert to DEFINE_SIMPLE_DEV_PM_OPS()

From: DelaySystem

Date: Sat Nov 07 2026 - 20:09:56 EST



Convert the deprecated SIMPLE_DEV_PM_OPS() to DEFINE_SIMPLE_DEV_PM_OPS()
and pm_sleep_ptr() in the nvec core and nvec-mouse drivers.

This lets us drop the CONFIG_PM_SLEEP guards around the suspend and
resume callbacks, and reduces kernel size when CONFIG_PM_SLEEP is
disabled. No functional change.

Signed-off-by: DelaySystem <DelaySystem@xxxxxxxxx>
---
v2: resend in plain text via git send-email; v1 was corrupted by the
webmail send path (HTML part rejected by vger, tabs expanded to spaces).

Build-tested: arm64 defconfig with MFD_NVEC=m and SERIO_NVEC_PS2=m,
under both CONFIG_PM_SLEEP=y and =n; both build with zero warnings.

drivers/staging/nvec/nvec.c | 8 ++------
drivers/staging/nvec/nvec_ps2.c | 6 ++----
2 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c
index 41cbdfdc1da6..afe384cbd960 100644
--- a/drivers/staging/nvec/nvec.c
+++ b/drivers/staging/nvec/nvec.c
@@ -763,14 +763,12 @@ static void tegra_init_i2c_slave(struct nvec_chip *nvec)
enable_irq(nvec->irq);
}

-#ifdef CONFIG_PM_SLEEP
static void nvec_disable_i2c_slave(struct nvec_chip *nvec)
{
disable_irq(nvec->irq);
tegra_i2c_writel(I2C_SL_NEWSL | I2C_SL_NACK, nvec->base + I2C_SL_CNFG);
clk_disable_unprepare(nvec->i2c_clk);
}
-#endif

static void nvec_power_off(void)
{
@@ -910,7 +908,6 @@ static void tegra_nvec_remove(struct platform_device *pdev)
pm_power_off = NULL;
}

-#ifdef CONFIG_PM_SLEEP
static int nvec_suspend(struct device *dev)
{
int err;
@@ -942,9 +939,8 @@ static int nvec_resume(struct device *dev)

return 0;
}
-#endif

-static SIMPLE_DEV_PM_OPS(nvec_pm_ops, nvec_suspend, nvec_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(nvec_pm_ops, nvec_suspend, nvec_resume);

/* Match table for of_platform binding */
static const struct of_device_id nvidia_nvec_of_match[] = {
@@ -958,7 +954,7 @@ static struct platform_driver nvec_device_driver = {
.remove = tegra_nvec_remove,
.driver = {
.name = "nvec",
- .pm = &nvec_pm_ops,
+ .pm = pm_sleep_ptr(&nvec_pm_ops),
.of_match_table = nvidia_nvec_of_match,
}
};
diff --git a/drivers/staging/nvec/nvec_ps2.c b/drivers/staging/nvec/nvec_ps2.c
index e6234d29e264..2fb34f0d0dca 100644
--- a/drivers/staging/nvec/nvec_ps2.c
+++ b/drivers/staging/nvec/nvec_ps2.c
@@ -134,7 +134,6 @@ static void nvec_mouse_remove(struct platform_device *pdev)
serio_unregister_port(ps2_dev.ser_dev);
}

-#ifdef CONFIG_PM_SLEEP
static int nvec_mouse_suspend(struct device *dev)
{
/* disable mouse */
@@ -156,9 +155,8 @@ static int nvec_mouse_resume(struct device *dev)

return 0;
}
-#endif

-static SIMPLE_DEV_PM_OPS(nvec_mouse_pm_ops, nvec_mouse_suspend,
+static DEFINE_SIMPLE_DEV_PM_OPS(nvec_mouse_pm_ops, nvec_mouse_suspend,
nvec_mouse_resume);

static struct platform_driver nvec_mouse_driver = {
@@ -166,7 +164,7 @@ static struct platform_driver nvec_mouse_driver = {
.remove = nvec_mouse_remove,
.driver = {
.name = "nvec-mouse",
- .pm = &nvec_mouse_pm_ops,
+ .pm = pm_sleep_ptr(&nvec_mouse_pm_ops),
},
};

--
2.34.1