Skip to contentSkip to conversation

media: tw68: Convert to DEFINE_SIMPLE_DEV_PM_OPS()

PATCH New Triet Hoang 1 participant 1 message Aug 21

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: tw68: Convert to DEFINE_SIMPLE_DEV_PM_OPS()

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 its suspend and resume callbacks,
also reduces kernel size in case CONFIG_PM or
CONFIG_PM_SLEEP is disabled.

---
 drivers/media/pci/tw68/tw68-core.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/media/pci/tw68/tw68-core.c +4 -4
index 509d7ddec150..a18107ddb0ac 100644
@@ -359,7 +359,7 @@ static void tw68_finidev(struct pci_dev *pci_dev)
 	v4l2_device_unregister(&dev->v4l2_dev);
 }
 
-static int __maybe_unused tw68_suspend(struct device *dev_d)
+static int tw68_suspend(struct device *dev_d)
 {
 	struct pci_dev *pci_dev = to_pci_dev(dev_d);
 	struct v4l2_device *v4l2_dev = pci_get_drvdata(pci_dev);
@@ -377,7 +377,7 @@ static int __maybe_unused tw68_suspend(struct device *dev_d)
 	return 0;
 }
 
-static int __maybe_unused tw68_resume(struct device *dev_d)
+static int tw68_resume(struct device *dev_d)
 {
 	struct v4l2_device *v4l2_dev = dev_get_drvdata(dev_d);
 	struct tw68_dev *dev = container_of(v4l2_dev,
@@ -405,14 +405,14 @@ static int __maybe_unused tw68_resume(struct device *dev_d)
 
 /* ----------------------------------------------------------- */
 
-static SIMPLE_DEV_PM_OPS(tw68_pm_ops, tw68_suspend, tw68_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(tw68_pm_ops, tw68_suspend, tw68_resume);
 
 static struct pci_driver tw68_pci_driver = {
 	.name	   = "tw68",
 	.id_table  = tw68_pci_tbl,
 	.probe	   = tw68_initdev,
 	.remove	   = tw68_finidev,
-	.driver.pm = &tw68_pm_ops,
+	.driver.pm = pm_sleep_ptr(&tw68_pm_ops),
 };
 
 module_pci_driver(tw68_pci_driver);
Signature · 1 line
2.53.0