From: Triet Hoang <triet.hoang.dev@gmail.com>
To: arnd@arndb.de
Cc: gregkh@linuxfoundation.org, mirq-linux@rere.qmqm.pl,
eric.piel@tremplin-utc.net, jirislaby@kernel.org,
oakad@yahoo.com, triet.hoang.dev@gmail.com,
linux-kernel@vger.kernel.org
Subject: [PATCH] drivers: misc: Convert to DEFINE_SIMPLE_DEV_PM_OPS()
Date: Fri, 21 Aug 2026 12:13:15 +0000 [thread overview]
Message-ID: <20260821121315.23574-1-triet.hoang.dev@gmail.com> (raw)
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.
Also allow to remove #ifdef CONFIG_PM_SLEEP.
Signed-off-by: Triet Hoang <triet.hoang.dev@gmail.com>
---
drivers/misc/cardreader/alcor_pci.c | 6 ++----
drivers/misc/cb710/core.c | 8 ++++----
drivers/misc/isl29003.c | 10 ++--------
drivers/misc/lis3lv02d/lis3lv02d_spi.c | 6 ++----
drivers/misc/pch_phub.c | 8 ++++----
drivers/misc/phantom.c | 8 ++++----
drivers/misc/tifm_7xx1.c | 8 ++++----
drivers/misc/tsl2550.c | 13 ++-----------
8 files changed, 24 insertions(+), 43 deletions(-)
diff --git a/drivers/misc/cardreader/alcor_pci.c b/drivers/misc/cardreader/alcor_pci.c
index 8e7ea2c9142d..f417ee8229f6 100644
--- a/drivers/misc/cardreader/alcor_pci.c
+++ b/drivers/misc/cardreader/alcor_pci.c
@@ -188,7 +188,6 @@ static void alcor_pci_remove(struct pci_dev *pdev)
pci_set_drvdata(pdev, NULL);
}
-#ifdef CONFIG_PM_SLEEP
static int alcor_suspend(struct device *dev)
{
return 0;
@@ -203,9 +202,8 @@ static int alcor_resume(struct device *dev)
return 0;
}
-#endif /* CONFIG_PM_SLEEP */
-static SIMPLE_DEV_PM_OPS(alcor_pci_pm_ops, alcor_suspend, alcor_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(alcor_pci_pm_ops, alcor_suspend, alcor_resume);
static struct pci_driver alcor_driver = {
.name = DRV_NAME_ALCOR_PCI,
@@ -213,7 +211,7 @@ static struct pci_driver alcor_driver = {
.probe = alcor_pci_probe,
.remove = alcor_pci_remove,
.driver = {
- .pm = &alcor_pci_pm_ops
+ .pm = pm_sleep_ptr(&alcor_pci_pm_ops)
},
};
diff --git a/drivers/misc/cb710/core.c b/drivers/misc/cb710/core.c
index 2dd212f04fed..955c41b6d74d 100644
--- a/drivers/misc/cb710/core.c
+++ b/drivers/misc/cb710/core.c
@@ -166,7 +166,7 @@ void cb710_set_irq_handler(struct cb710_slot *slot,
}
EXPORT_SYMBOL_GPL(cb710_set_irq_handler);
-static int __maybe_unused cb710_suspend(struct device *dev_d)
+static int cb710_suspend(struct device *dev_d)
{
struct pci_dev *pdev = to_pci_dev(dev_d);
struct cb710_chip *chip = pci_get_drvdata(pdev);
@@ -175,7 +175,7 @@ static int __maybe_unused cb710_suspend(struct device *dev_d)
return 0;
}
-static int __maybe_unused cb710_resume(struct device *dev_d)
+static int cb710_resume(struct device *dev_d)
{
struct pci_dev *pdev = to_pci_dev(dev_d);
struct cb710_chip *chip = pci_get_drvdata(pdev);
@@ -297,14 +297,14 @@ static const struct pci_device_id cb710_pci_tbl[] = {
{ 0, }
};
-static SIMPLE_DEV_PM_OPS(cb710_pm_ops, cb710_suspend, cb710_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(cb710_pm_ops, cb710_suspend, cb710_resume);
static struct pci_driver cb710_driver = {
.name = KBUILD_MODNAME,
.id_table = cb710_pci_tbl,
.probe = cb710_probe,
.remove = cb710_remove_one,
- .driver.pm = &cb710_pm_ops,
+ .driver.pm = pm_sleep_ptr(&cb710_pm_ops),
};
static int __init cb710_init_module(void)
diff --git a/drivers/misc/isl29003.c b/drivers/misc/isl29003.c
index 95480e16ae5f..646eda7f22ea 100644
--- a/drivers/misc/isl29003.c
+++ b/drivers/misc/isl29003.c
@@ -416,7 +416,6 @@ static void isl29003_remove(struct i2c_client *client)
kfree(i2c_get_clientdata(client));
}
-#ifdef CONFIG_PM_SLEEP
static int isl29003_suspend(struct device *dev)
{
struct i2c_client *client = to_i2c_client(dev);
@@ -441,12 +440,7 @@ static int isl29003_resume(struct device *dev)
data->power_state_before_suspend);
}
-static SIMPLE_DEV_PM_OPS(isl29003_pm_ops, isl29003_suspend, isl29003_resume);
-#define ISL29003_PM_OPS (&isl29003_pm_ops)
-
-#else
-#define ISL29003_PM_OPS NULL
-#endif /* CONFIG_PM_SLEEP */
+static DEFINE_SIMPLE_DEV_PM_OPS(isl29003_pm_ops, isl29003_suspend, isl29003_resume);
static const struct i2c_device_id isl29003_id[] = {
{ "isl29003" },
@@ -457,7 +451,7 @@ MODULE_DEVICE_TABLE(i2c, isl29003_id);
static struct i2c_driver isl29003_driver = {
.driver = {
.name = ISL29003_DRV_NAME,
- .pm = ISL29003_PM_OPS,
+ .pm = pm_sleep_ptr(&isl29003_pm_ops),
},
.probe = isl29003_probe,
.remove = isl29003_remove,
diff --git a/drivers/misc/lis3lv02d/lis3lv02d_spi.c b/drivers/misc/lis3lv02d/lis3lv02d_spi.c
index 203a108b8883..f36bf160a3f8 100644
--- a/drivers/misc/lis3lv02d/lis3lv02d_spi.c
+++ b/drivers/misc/lis3lv02d/lis3lv02d_spi.c
@@ -105,7 +105,6 @@ static void lis302dl_spi_remove(struct spi_device *spi)
lis3lv02d_remove_fs(&lis3_dev);
}
-#ifdef CONFIG_PM_SLEEP
static int lis3lv02d_spi_suspend(struct device *dev)
{
struct spi_device *spi = to_spi_device(dev);
@@ -127,15 +126,14 @@ static int lis3lv02d_spi_resume(struct device *dev)
return 0;
}
-#endif
-static SIMPLE_DEV_PM_OPS(lis3lv02d_spi_pm, lis3lv02d_spi_suspend,
+static DEFINE_SIMPLE_DEV_PM_OPS(lis3lv02d_spi_pm, lis3lv02d_spi_suspend,
lis3lv02d_spi_resume);
static struct spi_driver lis302dl_spi_driver = {
.driver = {
.name = DRV_NAME,
- .pm = &lis3lv02d_spi_pm,
+ .pm = pm_sleep_ptr(&lis3lv02d_spi_pm),
.of_match_table = of_match_ptr(lis302dl_spi_dt_ids),
},
.probe = lis302dl_spi_probe,
diff --git a/drivers/misc/pch_phub.c b/drivers/misc/pch_phub.c
index 19c4fa017f24..937efb367423 100644
--- a/drivers/misc/pch_phub.c
+++ b/drivers/misc/pch_phub.c
@@ -724,14 +724,14 @@ static void pch_phub_remove(struct pci_dev *pdev)
kfree(chip);
}
-static int __maybe_unused pch_phub_suspend(struct device *dev_d)
+static int pch_phub_suspend(struct device *dev_d)
{
device_wakeup_disable(dev_d);
return 0;
}
-static int __maybe_unused pch_phub_resume(struct device *dev_d)
+static int pch_phub_resume(struct device *dev_d)
{
device_wakeup_disable(dev_d);
@@ -748,14 +748,14 @@ static const struct pci_device_id pch_phub_pcidev_id[] = {
};
MODULE_DEVICE_TABLE(pci, pch_phub_pcidev_id);
-static SIMPLE_DEV_PM_OPS(pch_phub_pm_ops, pch_phub_suspend, pch_phub_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(pch_phub_pm_ops, pch_phub_suspend, pch_phub_resume);
static struct pci_driver pch_phub_driver = {
.name = "pch_phub",
.id_table = pch_phub_pcidev_id,
.probe = pch_phub_probe,
.remove = pch_phub_remove,
- .driver.pm = &pch_phub_pm_ops,
+ .driver.pm = pm_sleep_ptr(&pch_phub_pm_ops),
};
module_pci_driver(pch_phub_driver);
diff --git a/drivers/misc/phantom.c b/drivers/misc/phantom.c
index 34a5054a6b40..834792a2a3a8 100644
--- a/drivers/misc/phantom.c
+++ b/drivers/misc/phantom.c
@@ -459,7 +459,7 @@ static void phantom_remove(struct pci_dev *pdev)
pci_disable_device(pdev);
}
-static int __maybe_unused phantom_suspend(struct device *dev_d)
+static int phantom_suspend(struct device *dev_d)
{
struct phantom_device *dev = dev_get_drvdata(dev_d);
@@ -471,7 +471,7 @@ static int __maybe_unused phantom_suspend(struct device *dev_d)
return 0;
}
-static int __maybe_unused phantom_resume(struct device *dev_d)
+static int phantom_resume(struct device *dev_d)
{
struct phantom_device *dev = dev_get_drvdata(dev_d);
@@ -488,14 +488,14 @@ static struct pci_device_id phantom_pci_tbl[] = {
};
MODULE_DEVICE_TABLE(pci, phantom_pci_tbl);
-static SIMPLE_DEV_PM_OPS(phantom_pm_ops, phantom_suspend, phantom_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(phantom_pm_ops, phantom_suspend, phantom_resume);
static struct pci_driver phantom_pci_driver = {
.name = "phantom",
.id_table = phantom_pci_tbl,
.probe = phantom_probe,
.remove = phantom_remove,
- .driver.pm = &phantom_pm_ops,
+ .driver.pm = pm_sleep_ptr(&phantom_pm_ops),
};
static CLASS_ATTR_STRING(version, 0444, PHANTOM_VERSION);
diff --git a/drivers/misc/tifm_7xx1.c b/drivers/misc/tifm_7xx1.c
index 4677d5a30941..50e7dc502f16 100644
--- a/drivers/misc/tifm_7xx1.c
+++ b/drivers/misc/tifm_7xx1.c
@@ -207,7 +207,7 @@ static void tifm_7xx1_switch_media(struct work_struct *work)
spin_unlock_irqrestore(&fm->lock, flags);
}
-static int __maybe_unused tifm_7xx1_suspend(struct device *dev_d)
+static int tifm_7xx1_suspend(struct device *dev_d)
{
struct pci_dev *dev = to_pci_dev(dev_d);
struct tifm_adapter *fm = pci_get_drvdata(dev);
@@ -224,7 +224,7 @@ static int __maybe_unused tifm_7xx1_suspend(struct device *dev_d)
return 0;
}
-static int __maybe_unused tifm_7xx1_resume(struct device *dev_d)
+static int tifm_7xx1_resume(struct device *dev_d)
{
struct pci_dev *dev = to_pci_dev(dev_d);
struct tifm_adapter *fm = pci_get_drvdata(dev);
@@ -406,14 +406,14 @@ static const struct pci_device_id tifm_7xx1_pci_tbl[] = {
{ }
};
-static SIMPLE_DEV_PM_OPS(tifm_7xx1_pm_ops, tifm_7xx1_suspend, tifm_7xx1_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(tifm_7xx1_pm_ops, tifm_7xx1_suspend, tifm_7xx1_resume);
static struct pci_driver tifm_7xx1_driver = {
.name = DRIVER_NAME,
.id_table = tifm_7xx1_pci_tbl,
.probe = tifm_7xx1_probe,
.remove = tifm_7xx1_remove,
- .driver.pm = &tifm_7xx1_pm_ops,
+ .driver.pm = pm_sleep_ptr(&tifm_7xx1_pm_ops),
};
module_pci_driver(tifm_7xx1_driver);
diff --git a/drivers/misc/tsl2550.c b/drivers/misc/tsl2550.c
index 03f19eda641e..9ee720e3e81a 100644
--- a/drivers/misc/tsl2550.c
+++ b/drivers/misc/tsl2550.c
@@ -398,8 +398,6 @@ static void tsl2550_remove(struct i2c_client *client)
kfree(i2c_get_clientdata(client));
}
-#ifdef CONFIG_PM_SLEEP
-
static int tsl2550_suspend(struct device *dev)
{
return tsl2550_set_power_state(to_i2c_client(dev), 0);
@@ -410,14 +408,7 @@ static int tsl2550_resume(struct device *dev)
return tsl2550_set_power_state(to_i2c_client(dev), 1);
}
-static SIMPLE_DEV_PM_OPS(tsl2550_pm_ops, tsl2550_suspend, tsl2550_resume);
-#define TSL2550_PM_OPS (&tsl2550_pm_ops)
-
-#else
-
-#define TSL2550_PM_OPS NULL
-
-#endif /* CONFIG_PM_SLEEP */
+static DEFINE_SIMPLE_DEV_PM_OPS(tsl2550_pm_ops, tsl2550_suspend, tsl2550_resume);
static const struct i2c_device_id tsl2550_id[] = {
{ "tsl2550" },
@@ -435,7 +426,7 @@ static struct i2c_driver tsl2550_driver = {
.driver = {
.name = TSL2550_DRV_NAME,
.of_match_table = tsl2550_of_match,
- .pm = TSL2550_PM_OPS,
+ .pm = pm_sleep_ptr(&tsl2550_pm_ops),
},
.probe = tsl2550_probe,
.remove = tsl2550_remove,
--
2.53.0
next reply other threads:[~2026-08-21 12:14 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-21 12:13 Triet Hoang [this message]
2026-08-22 10:14 ` [PATCH] drivers: misc: Convert to DEFINE_SIMPLE_DEV_PM_OPS() Michał Mirosław
2026-08-22 10:19 ` Arnd Bergmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260821121315.23574-1-triet.hoang.dev@gmail.com \
--to=triet.hoang.dev@gmail.com \
--cc=arnd@arndb.de \
--cc=eric.piel@tremplin-utc.net \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mirq-linux@rere.qmqm.pl \
--cc=oakad@yahoo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.