Skip to content

Commit

Permalink
media: meye: use generic power management
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
VARoDeK authored and sigmaris committed Aug 3, 2020
1 parent abb63ca commit 92c467a
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions drivers/media/pci/meye/meye.c
Original file line number Diff line number Diff line change
Expand Up @@ -1528,19 +1528,16 @@ static const struct v4l2_ctrl_ops meye_ctrl_ops = {
.s_ctrl = meye_s_ctrl,
};

#ifdef CONFIG_PM
static int meye_suspend(struct pci_dev *pdev, pm_message_t state)
static int __maybe_unused meye_suspend(struct device *dev)
{
pci_save_state(pdev);
meye.pm_mchip_mode = meye.mchip_mode;
mchip_hic_stop();
mchip_set(MCHIP_MM_INTA, 0x0);
return 0;
}

static int meye_resume(struct pci_dev *pdev)
static int __maybe_unused meye_resume(struct device *dev)
{
pci_restore_state(pdev);
pci_write_config_word(meye.mchip_dev, MCHIP_PCI_SOFTRESET_SET, 1);

mchip_delay(MCHIP_HIC_CMD, 0);
Expand All @@ -1562,7 +1559,6 @@ static int meye_resume(struct pci_dev *pdev)
}
return 0;
}
#endif

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

MODULE_DEVICE_TABLE(pci, meye_pci_tbl);

static SIMPLE_DEV_PM_OPS(meye_pm_ops, meye_suspend, meye_resume);

static struct pci_driver meye_driver = {
.name = "meye",
.id_table = meye_pci_tbl,
.probe = meye_probe,
.remove = meye_remove,
#ifdef CONFIG_PM
.suspend = meye_suspend,
.resume = meye_resume,
#endif
.driver.pm = &meye_pm_ops,
};

static int __init meye_init(void)
Expand Down

0 comments on commit 92c467a

Please sign in to comment.