[Linux-kernel-mentees] [PATCH v1 3/6] [media] cx25821: use generic power management

Vaibhav Gupta vaibhavgupta40 at gmail.com
Mon Jun 29 07:36:01 UTC 2020


The .suspend() and .resume() callbacks are not defined for this driver.
Still, their power managemgement stucture can be easily upgraded to
gemeric, without affecting its normal behaviour.

Hence, define them NULL and use struct dev_pm_ops type to bind them.

Compile-tested only.

Signed-off-by: Vaibhav Gupta <vaibhavgupta40 at gmail.com>
---
 drivers/media/pci/cx25821/cx25821-core.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/media/pci/cx25821/cx25821-core.c b/drivers/media/pci/cx25821/cx25821-core.c
index 41be22ce66f3..59501939d741 100644
--- a/drivers/media/pci/cx25821/cx25821-core.c
+++ b/drivers/media/pci/cx25821/cx25821-core.c
@@ -1369,14 +1369,18 @@ static const struct pci_device_id cx25821_pci_tbl[] = {
 
 MODULE_DEVICE_TABLE(pci, cx25821_pci_tbl);
 
+#define cx25821_suspend NULL
+#define cx25821_resume NULL
+
+static SIMPLE_DEV_PM_OPS(cx25821_pm_ops, cx25821_suspend, cx25821_resume);
+
 static struct pci_driver cx25821_pci_driver = {
 	.name = "cx25821",
 	.id_table = cx25821_pci_tbl,
 	.probe = cx25821_initdev,
 	.remove = cx25821_finidev,
 	/* TODO */
-	.suspend = NULL,
-	.resume = NULL,
+	.driver.pm = &cx25821_pm_ops,
 };
 
 static int __init cx25821_init(void)
-- 
2.27.0



More information about the Linux-kernel-mentees mailing list