Skip to content

Commit 9c4a848

Browse files
VARoDeKmchehab
authored andcommitted
media: meye: use generic power management
With legacy PM, drivers themselves were responsible for managing the device's power states and takes care of register states. After upgrading to the generic structure, PCI core will take care of required tasks and drivers should do only device-specific operations. The driver was invoking PCI helper functions like pci_save/restore_state() which is not recommended. Compile-tested only. Signed-off-by: Vaibhav Gupta <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
1 parent a28b2ed commit 9c4a848

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

drivers/media/pci/meye/meye.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1528,19 +1528,16 @@ static const struct v4l2_ctrl_ops meye_ctrl_ops = {
15281528
.s_ctrl = meye_s_ctrl,
15291529
};
15301530

1531-
#ifdef CONFIG_PM
1532-
static int meye_suspend(struct pci_dev *pdev, pm_message_t state)
1531+
static int __maybe_unused meye_suspend(struct device *dev)
15331532
{
1534-
pci_save_state(pdev);
15351533
meye.pm_mchip_mode = meye.mchip_mode;
15361534
mchip_hic_stop();
15371535
mchip_set(MCHIP_MM_INTA, 0x0);
15381536
return 0;
15391537
}
15401538

1541-
static int meye_resume(struct pci_dev *pdev)
1539+
static int __maybe_unused meye_resume(struct device *dev)
15421540
{
1543-
pci_restore_state(pdev);
15441541
pci_write_config_word(meye.mchip_dev, MCHIP_PCI_SOFTRESET_SET, 1);
15451542

15461543
mchip_delay(MCHIP_HIC_CMD, 0);
@@ -1562,7 +1559,6 @@ static int meye_resume(struct pci_dev *pdev)
15621559
}
15631560
return 0;
15641561
}
1565-
#endif
15661562

15671563
static int meye_probe(struct pci_dev *pcidev, const struct pci_device_id *ent)
15681564
{
@@ -1788,15 +1784,14 @@ static const struct pci_device_id meye_pci_tbl[] = {
17881784

17891785
MODULE_DEVICE_TABLE(pci, meye_pci_tbl);
17901786

1787+
static SIMPLE_DEV_PM_OPS(meye_pm_ops, meye_suspend, meye_resume);
1788+
17911789
static struct pci_driver meye_driver = {
17921790
.name = "meye",
17931791
.id_table = meye_pci_tbl,
17941792
.probe = meye_probe,
17951793
.remove = meye_remove,
1796-
#ifdef CONFIG_PM
1797-
.suspend = meye_suspend,
1798-
.resume = meye_resume,
1799-
#endif
1794+
.driver.pm = &meye_pm_ops,
18001795
};
18011796

18021797
static int __init meye_init(void)

0 commit comments

Comments
 (0)