Message ID | 20200629073604.205478-4-vaibhavgupta40@gmail.com |
---|---|
State | New |
Headers | show |
Series | pci: use generic power management | expand |
On 29/06/2020 09:36, Vaibhav Gupta wrote: > 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@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, > }; Same question as for 2/6. Regards, Hans > > static int __init cx25821_init(void) >
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)
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@gmail.com> --- drivers/media/pci/cx25821/cx25821-core.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)