summaryrefslogtreecommitdiff
path: root/drivers/staging/vt6655
diff options
context:
space:
mode:
authorVaibhav Gupta <vaibhavgupta40@gmail.com>2020-06-29 13:58:19 +0530
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-07-01 15:39:21 +0200
commit7a46931ba9a25ce73761f4015f004229df44ef13 (patch)
tree3271fd67bd2f43ef754c54df20d78f6b4ff29bc7 /drivers/staging/vt6655
parentb21204b60d0149859f2d285b8c2371f40e9bb0e7 (diff)
staging: vt6655/device_main.c: use generic power management
Drivers should not use legacy power management as they have to manage power states and related operations, for the device, themselves. This driver was handling them with the help of PCI helper functions like pci_save/restore_state(), pci_enable/disable_device(), etc. With generic PM, all essentials will be handled by the PCI core. Driver needs to do only device-specific operations. The driver was also using pci_enable_wake(...,..., 0) to disable wake. Use device_wakeup_disable() instead. Compile-tested only. Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com> Link: https://lore.kernel.org/r/20200629082819.216405-5-vaibhavgupta40@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/vt6655')
-rw-r--r--drivers/staging/vt6655/device_main.c25
1 files changed, 7 insertions, 18 deletions
diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c
index 41cbec4134b0..76de1fd568eb 100644
--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@ -1766,48 +1766,37 @@ vt6655_probe(struct pci_dev *pcid, const struct pci_device_id *ent)
/*------------------------------------------------------------------*/
-#ifdef CONFIG_PM
-static int vt6655_suspend(struct pci_dev *pcid, pm_message_t state)
+static int __maybe_unused vt6655_suspend(struct device *dev_d)
{
- struct vnt_private *priv = pci_get_drvdata(pcid);
+ struct vnt_private *priv = dev_get_drvdata(dev_d);
unsigned long flags;
spin_lock_irqsave(&priv->lock, flags);
- pci_save_state(pcid);
-
MACbShutdown(priv);
- pci_disable_device(pcid);
-
spin_unlock_irqrestore(&priv->lock, flags);
- pci_set_power_state(pcid, pci_choose_state(pcid, state));
-
return 0;
}
-static int vt6655_resume(struct pci_dev *pcid)
+static int __maybe_unused vt6655_resume(struct device *dev_d)
{
- pci_set_power_state(pcid, PCI_D0);
- pci_enable_wake(pcid, PCI_D0, 0);
- pci_restore_state(pcid);
+ device_wakeup_disable(dev_d);
return 0;
}
-#endif
MODULE_DEVICE_TABLE(pci, vt6655_pci_id_table);
+static SIMPLE_DEV_PM_OPS(vt6655_pm_ops, vt6655_suspend, vt6655_resume);
+
static struct pci_driver device_driver = {
.name = DEVICE_NAME,
.id_table = vt6655_pci_id_table,
.probe = vt6655_probe,
.remove = vt6655_remove,
-#ifdef CONFIG_PM
- .suspend = vt6655_suspend,
- .resume = vt6655_resume,
-#endif
+ .driver.pm = &vt6655_pm_ops,
};
module_pci_driver(device_driver);