Thread (3 messages) 3 messages, 3 authors, 29d ago
COLD29d

[PATCH v6] Bluetooth: pm: use DEFINE_SIMPLE_DEV_OPS for pm struct

From: Li Jun <hidden>
Date: 2026-08-31 01:47:03
Subsystem: bluetooth drivers, the rest · Maintainers: Marcel Holtmann, Luiz Augusto von Dentz, Linus Torvalds

use DEFINE_SIMPLE_DEV_PM_OPS for btmrvl_sdio_pm_ops, and add the value of
'.freeze, .thaw, .poweroff, .restore'. if these address are null,
may cause error in s4. pm_sleep_ptr() to safely drop the references without
triggering compiler warnings. This macro automatically handles
CONFIG_PM_SLEEP configuration and generates freeze/thaw/poweroff/restore
callbacks, reducing boilerplate code.

Signed-off-by: Li Jun <redacted>
---
Changes:
-Corrected grammar and spell errors in comment.
-Replace SIMPLE_DEV_OPS with DEFINE_SIMPLE_DEV_OPS.
-Add a description of pm_sleep_ptr().
-Add pm_sleep_ptr(&btmrvl_sdio_pm_ops) for bt_mrvl_sdio struct.
---
 drivers/bluetooth/btmrvl_sdio.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/bluetooth/btmrvl_sdio.c b/drivers/bluetooth/btmrvl_sdio.c
index b91fc63bc9fe..a250a83a031d 100644
--- a/drivers/bluetooth/btmrvl_sdio.c
+++ b/drivers/bluetooth/btmrvl_sdio.c
@@ -1726,10 +1726,7 @@ static int btmrvl_sdio_resume(struct device *dev)
 	return 0;
 }
 
-static const struct dev_pm_ops btmrvl_sdio_pm_ops = {
-	.suspend	= btmrvl_sdio_suspend,
-	.resume		= btmrvl_sdio_resume,
-};
+static DEFINE_SIMPLE_DEV_PM_OPS(btmrvl_sdio_pm_ops, btmrvl_sdio_suspend, btmrvl_sdio_resume);
 
 static struct sdio_driver bt_mrvl_sdio = {
 	.name		= "btmrvl_sdio",
@@ -1738,7 +1735,7 @@ static struct sdio_driver bt_mrvl_sdio = {
 	.remove		= btmrvl_sdio_remove,
 	.drv = {
 		.coredump = btmrvl_sdio_coredump,
-		.pm = &btmrvl_sdio_pm_ops,
+		.pm = pm_sleep_ptr(&btmrvl_sdio_pm_ops),
 	}
 };
 
-- 
2.25.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help