Skip to contentSkip to conversation

wifi: mt76: mt7921s: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()

PATCH In review Deren Wu 2 participants 2 messages Sep 15, 2022

Subsystems (2)
lore
Share & tools
lore

Deren Wu

author
#0 lore raw

PATCH 1/1 wifi: mt76: mt7921s: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()

From: Deren Wu <[email protected]>

Use the new DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros to handle the .suspend/.resume callbacks. The new macros allow suspend and resume functions to be automatically dropped without any #ifdef guards.

---
 drivers/net/wireless/mediatek/mt76/mt7921/sdio.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7921/sdio.c +3 -12
index 487acd6e2be8..545577eff8ae 100644
@@ -194,7 +194,6 @@ static void mt7921s_remove(struct sdio_func *func)
 	mt7921s_unregister_device(dev);
 }
 
-#ifdef CONFIG_PM
 static int mt7921s_suspend(struct device *__dev)
 {
 	struct sdio_func *func = dev_to_sdio_func(__dev);
@@ -296,26 +295,18 @@ static int mt7921s_resume(struct device *__dev)
 	return err;
 }
 
-static const struct dev_pm_ops mt7921s_pm_ops = {
-	.suspend = mt7921s_suspend,
-	.resume = mt7921s_resume,
-};
-#endif
-
 MODULE_DEVICE_TABLE(sdio, mt7921s_table);
 MODULE_FIRMWARE(MT7921_FIRMWARE_WM);
 MODULE_FIRMWARE(MT7921_ROM_PATCH);
 
+static DEFINE_SIMPLE_DEV_PM_OPS(mt7921s_pm_ops, mt7921s_suspend, mt7921s_resume);
+
 static struct sdio_driver mt7921s_driver = {
 	.name		= KBUILD_MODNAME,
 	.probe		= mt7921s_probe,
 	.remove		= mt7921s_remove,
 	.id_table	= mt7921s_table,
-#ifdef CONFIG_PM
-	.drv = {
-		.pm = &mt7921s_pm_ops,
-	}
-#endif
+	.drv.pm		= pm_sleep_ptr(&mt7921s_pm_ops),
 };
 module_sdio_driver(mt7921s_driver);
 MODULE_AUTHOR("Sean Wang <[email protected]>");
Signature · 1 line
2.18.0
maintainer Reviewed-by on v1 1/1
#1 lore raw

Il 15/09/22 10:36, Deren Wu ha scritto:

Quoted 9 lines

From: Deren Wu <[email protected]>

Use the new DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros to handle the .suspend/.resume callbacks. The new macros allow suspend and resume functions to be automatically dropped without any #ifdef guards.