Commit 04bceecd authored by Vaibhav Gupta's avatar Vaibhav Gupta Committed by Kalle Valo

adm8211: 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.

In the case of adm8211, after removing PCI helper functions, .suspend()
and .resume() became empty-body functions. Hence, define them NULL and
use dev_pm_ops.

Compile-tested only.
Signed-off-by: default avatarVaibhav Gupta <vaibhavgupta40@gmail.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200629035031.169670-1-vaibhavgupta40@gmail.com
parent c689a62b
...@@ -1976,35 +1976,20 @@ static void adm8211_remove(struct pci_dev *pdev) ...@@ -1976,35 +1976,20 @@ static void adm8211_remove(struct pci_dev *pdev)
} }
#ifdef CONFIG_PM #define adm8211_suspend NULL
static int adm8211_suspend(struct pci_dev *pdev, pm_message_t state) #define adm8211_resume NULL
{
pci_save_state(pdev);
pci_set_power_state(pdev, pci_choose_state(pdev, state));
return 0;
}
static int adm8211_resume(struct pci_dev *pdev)
{
pci_set_power_state(pdev, PCI_D0);
pci_restore_state(pdev);
return 0;
}
#endif /* CONFIG_PM */
MODULE_DEVICE_TABLE(pci, adm8211_pci_id_table); MODULE_DEVICE_TABLE(pci, adm8211_pci_id_table);
static SIMPLE_DEV_PM_OPS(adm8211_pm_ops, adm8211_suspend, adm8211_resume);
/* TODO: implement enable_wake */ /* TODO: implement enable_wake */
static struct pci_driver adm8211_driver = { static struct pci_driver adm8211_driver = {
.name = "adm8211", .name = "adm8211",
.id_table = adm8211_pci_id_table, .id_table = adm8211_pci_id_table,
.probe = adm8211_probe, .probe = adm8211_probe,
.remove = adm8211_remove, .remove = adm8211_remove,
#ifdef CONFIG_PM .driver.pm = &adm8211_pm_ops,
.suspend = adm8211_suspend,
.resume = adm8211_resume,
#endif /* CONFIG_PM */
}; };
module_pci_driver(adm8211_driver); module_pci_driver(adm8211_driver);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment