[PATCH net-next 23/37] can: Convert to DEFINE_SIMPLE_DEV_PM_OPS()
flat view
WARM3d
From: Marc Kleine-Budde <mkl@pengutronix.de>
Date: 2026-10-09 13:43:41
Also in:
linux-can
Subsystem:
bxcan can network driver, can network drivers, ctu can fd driver, mcan device driver, the rest · Maintainers:
Dario Binacchi, Marc Kleine-Budde, Vincent Mailhol, Pavel Pisa, Ondrej Ille, Markus Schneider-Pargmann, Linus Torvalds
From: Triet Hoang <redacted> Convert the deprecated SIMPLE_DEV_PM_OPS to DEFINE_SIMPLE_DEV_PM_OPS and pm_sleep_ptr(). This lets us drop the __maybe_unused annotations from the suspend and resume callbacks, also reduces kernel size in case CONFIG_PM or CONFIG_PM_SLEEP is disabled. Signed-off-by: Triet Hoang <redacted> Link: https://patch.msgid.link/20260822074701.22856-1-triet.hoang.dev@gmail.com (local) Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> --- drivers/net/can/bxcan.c | 8 ++++---- drivers/net/can/ctucanfd/ctucanfd.h | 4 ++-- drivers/net/can/ctucanfd/ctucanfd_pci.c | 4 ++-- drivers/net/can/ctucanfd/ctucanfd_platform.c | 4 ++-- drivers/net/can/m_can/m_can_pci.c | 8 ++++---- drivers/net/can/spi/hi311x.c | 8 ++++---- drivers/net/can/spi/mcp251x.c | 8 ++++---- 7 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/drivers/net/can/bxcan.c b/drivers/net/can/bxcan.c
index 4bddd015775b..622c5d73e33a 100644
--- a/drivers/net/can/bxcan.c
+++ b/drivers/net/can/bxcan.c@@ -1042,7 +1042,7 @@ static void bxcan_remove(struct platform_device *pdev) free_candev(ndev); } -static int __maybe_unused bxcan_suspend(struct device *dev) +static int bxcan_suspend(struct device *dev) { struct net_device *ndev = dev_get_drvdata(dev); struct bxcan_priv *priv = netdev_priv(ndev);
@@ -1059,7 +1059,7 @@ static int __maybe_unused bxcan_suspend(struct device *dev) return 0; } -static int __maybe_unused bxcan_resume(struct device *dev) +static int bxcan_resume(struct device *dev) { struct net_device *ndev = dev_get_drvdata(dev); struct bxcan_priv *priv = netdev_priv(ndev);
@@ -1076,7 +1076,7 @@ static int __maybe_unused bxcan_resume(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(bxcan_pm_ops, bxcan_suspend, bxcan_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(bxcan_pm_ops, bxcan_suspend, bxcan_resume); static const struct of_device_id bxcan_of_match[] = { {.compatible = "st,stm32f4-bxcan"},
@@ -1087,7 +1087,7 @@ MODULE_DEVICE_TABLE(of, bxcan_of_match); static struct platform_driver bxcan_driver = { .driver = { .name = KBUILD_MODNAME, - .pm = &bxcan_pm_ops, + .pm = pm_sleep_ptr(&bxcan_pm_ops), .of_match_table = bxcan_of_match, }, .probe = bxcan_probe,
diff --git a/drivers/net/can/ctucanfd/ctucanfd.h b/drivers/net/can/ctucanfd/ctucanfd.h
index 0e9904f6a05d..7dcd7dc507e4 100644
--- a/drivers/net/can/ctucanfd/ctucanfd.h
+++ b/drivers/net/can/ctucanfd/ctucanfd.h@@ -76,7 +76,7 @@ int ctucan_probe_common(struct device *dev, void __iomem *addr, void (*set_drvdata_fnc)(struct device *dev, struct net_device *ndev)); -int ctucan_suspend(struct device *dev) __maybe_unused; -int ctucan_resume(struct device *dev) __maybe_unused; +int ctucan_suspend(struct device *dev); +int ctucan_resume(struct device *dev); #endif /*__CTUCANFD__*/
diff --git a/drivers/net/can/ctucanfd/ctucanfd_pci.c b/drivers/net/can/ctucanfd/ctucanfd_pci.c
index 4b6db28f7b67..9c9c41c3058c 100644
--- a/drivers/net/can/ctucanfd/ctucanfd_pci.c
+++ b/drivers/net/can/ctucanfd/ctucanfd_pci.c@@ -259,7 +259,7 @@ static void ctucan_pci_remove(struct pci_dev *pdev) kfree(bdata); } -static SIMPLE_DEV_PM_OPS(ctucan_pci_pm_ops, ctucan_suspend, ctucan_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(ctucan_pci_pm_ops, ctucan_suspend, ctucan_resume); static const struct pci_device_id ctucan_pci_tbl[] = { {PCI_DEVICE_DATA(TEDIA, CTUCAN_VER21,
@@ -273,7 +273,7 @@ static struct pci_driver ctucan_pci_driver = { .id_table = ctucan_pci_tbl, .probe = ctucan_pci_probe, .remove = ctucan_pci_remove, - .driver.pm = &ctucan_pci_pm_ops, + .driver.pm = pm_sleep_ptr(&ctucan_pci_pm_ops), }; module_pci_driver(ctucan_pci_driver);
diff --git a/drivers/net/can/ctucanfd/ctucanfd_platform.c b/drivers/net/can/ctucanfd/ctucanfd_platform.c
index 70e2577c8541..4962b00ee8ac 100644
--- a/drivers/net/can/ctucanfd/ctucanfd_platform.c
+++ b/drivers/net/can/ctucanfd/ctucanfd_platform.c@@ -99,7 +99,7 @@ static void ctucan_platform_remove(struct platform_device *pdev) free_candev(ndev); } -static SIMPLE_DEV_PM_OPS(ctucan_platform_pm_ops, ctucan_suspend, ctucan_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(ctucan_platform_pm_ops, ctucan_suspend, ctucan_resume); /* Match table for OF platform binding */ static const struct of_device_id ctucan_of_match[] = {
@@ -114,7 +114,7 @@ static struct platform_driver ctucanfd_driver = { .remove = ctucan_platform_remove, .driver = { .name = DRV_NAME, - .pm = &ctucan_platform_pm_ops, + .pm = pm_sleep_ptr(&ctucan_platform_pm_ops), .of_match_table = ctucan_of_match, }, };
diff --git a/drivers/net/can/m_can/m_can_pci.c b/drivers/net/can/m_can/m_can_pci.c
index d11a7c88fc32..d31179312026 100644
--- a/drivers/net/can/m_can/m_can_pci.c
+++ b/drivers/net/can/m_can/m_can_pci.c@@ -169,17 +169,17 @@ static void m_can_pci_remove(struct pci_dev *pci) pci_free_irq_vectors(pci); } -static __maybe_unused int m_can_pci_suspend(struct device *dev) +static int m_can_pci_suspend(struct device *dev) { return m_can_class_suspend(dev); } -static __maybe_unused int m_can_pci_resume(struct device *dev) +static int m_can_pci_resume(struct device *dev) { return m_can_class_resume(dev); } -static SIMPLE_DEV_PM_OPS(m_can_pci_pm_ops, +static DEFINE_SIMPLE_DEV_PM_OPS(m_can_pci_pm_ops, m_can_pci_suspend, m_can_pci_resume); static const struct pci_device_id m_can_pci_id_table[] = {
@@ -195,7 +195,7 @@ static struct pci_driver m_can_pci_driver = { .remove = m_can_pci_remove, .id_table = m_can_pci_id_table, .driver = { - .pm = &m_can_pci_pm_ops, + .pm = pm_sleep_ptr(&m_can_pci_pm_ops), }, };
diff --git a/drivers/net/can/spi/hi311x.c b/drivers/net/can/spi/hi311x.c
index ae90e6716de5..076a3efa1bff 100644
--- a/drivers/net/can/spi/hi311x.c
+++ b/drivers/net/can/spi/hi311x.c@@ -972,7 +972,7 @@ static void hi3110_can_remove(struct spi_device *spi) free_candev(net); } -static int __maybe_unused hi3110_can_suspend(struct device *dev) +static int hi3110_can_suspend(struct device *dev) { struct spi_device *spi = to_spi_device(dev); struct hi3110_priv *priv = spi_get_drvdata(spi);
@@ -1002,7 +1002,7 @@ static int __maybe_unused hi3110_can_suspend(struct device *dev) return 0; } -static int __maybe_unused hi3110_can_resume(struct device *dev) +static int hi3110_can_resume(struct device *dev) { struct spi_device *spi = to_spi_device(dev); struct hi3110_priv *priv = spi_get_drvdata(spi);
@@ -1022,13 +1022,13 @@ static int __maybe_unused hi3110_can_resume(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(hi3110_can_pm_ops, hi3110_can_suspend, hi3110_can_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(hi3110_can_pm_ops, hi3110_can_suspend, hi3110_can_resume); static struct spi_driver hi3110_can_driver = { .driver = { .name = DEVICE_NAME, .of_match_table = hi3110_of_match, - .pm = &hi3110_can_pm_ops, + .pm = pm_sleep_ptr(&hi3110_can_pm_ops), }, .id_table = hi3110_id_table, .probe = hi3110_can_probe,
diff --git a/drivers/net/can/spi/mcp251x.c b/drivers/net/can/spi/mcp251x.c
index 0d0190ae094a..d971890487b6 100644
--- a/drivers/net/can/spi/mcp251x.c
+++ b/drivers/net/can/spi/mcp251x.c@@ -1490,7 +1490,7 @@ static void mcp251x_can_remove(struct spi_device *spi) free_candev(net); } -static int __maybe_unused mcp251x_can_suspend(struct device *dev) +static int mcp251x_can_suspend(struct device *dev) { struct spi_device *spi = to_spi_device(dev); struct mcp251x_priv *priv = spi_get_drvdata(spi);
@@ -1517,7 +1517,7 @@ static int __maybe_unused mcp251x_can_suspend(struct device *dev) return 0; } -static int __maybe_unused mcp251x_can_resume(struct device *dev) +static int mcp251x_can_resume(struct device *dev) { struct spi_device *spi = to_spi_device(dev); struct mcp251x_priv *priv = spi_get_drvdata(spi);
@@ -1551,14 +1551,14 @@ static int __maybe_unused mcp251x_can_resume(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(mcp251x_can_pm_ops, mcp251x_can_suspend, +static DEFINE_SIMPLE_DEV_PM_OPS(mcp251x_can_pm_ops, mcp251x_can_suspend, mcp251x_can_resume); static struct spi_driver mcp251x_can_driver = { .driver = { .name = DEVICE_NAME, .of_match_table = mcp251x_of_match, - .pm = &mcp251x_can_pm_ops, + .pm = pm_sleep_ptr(&mcp251x_can_pm_ops), }, .id_table = mcp251x_id_table, .probe = mcp251x_can_probe,
--
2.53.0