mirror of https://gitee.com/openkylin/linux.git
ena_netdev: 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. Compile-tested only. Signed-off-by: Vaibhav Gupta <vaibhavgupta40@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
a7c48c7211
commit
817a89ae10
|
@ -4420,13 +4420,12 @@ static void ena_shutdown(struct pci_dev *pdev)
|
||||||
__ena_shutoff(pdev, true);
|
__ena_shutoff(pdev, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_PM
|
|
||||||
/* ena_suspend - PM suspend callback
|
/* ena_suspend - PM suspend callback
|
||||||
* @pdev: PCI device information struct
|
* @dev_d: Device information struct
|
||||||
* @state:power state
|
|
||||||
*/
|
*/
|
||||||
static int ena_suspend(struct pci_dev *pdev, pm_message_t state)
|
static int __maybe_unused ena_suspend(struct device *dev_d)
|
||||||
{
|
{
|
||||||
|
struct pci_dev *pdev = to_pci_dev(dev_d);
|
||||||
struct ena_adapter *adapter = pci_get_drvdata(pdev);
|
struct ena_adapter *adapter = pci_get_drvdata(pdev);
|
||||||
|
|
||||||
u64_stats_update_begin(&adapter->syncp);
|
u64_stats_update_begin(&adapter->syncp);
|
||||||
|
@ -4445,12 +4444,11 @@ static int ena_suspend(struct pci_dev *pdev, pm_message_t state)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ena_resume - PM resume callback
|
/* ena_resume - PM resume callback
|
||||||
* @pdev: PCI device information struct
|
* @dev_d: Device information struct
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
static int ena_resume(struct pci_dev *pdev)
|
static int __maybe_unused ena_resume(struct device *dev_d)
|
||||||
{
|
{
|
||||||
struct ena_adapter *adapter = pci_get_drvdata(pdev);
|
struct ena_adapter *adapter = dev_get_drvdata(dev_d);
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
u64_stats_update_begin(&adapter->syncp);
|
u64_stats_update_begin(&adapter->syncp);
|
||||||
|
@ -4462,7 +4460,8 @@ static int ena_resume(struct pci_dev *pdev)
|
||||||
rtnl_unlock();
|
rtnl_unlock();
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
static SIMPLE_DEV_PM_OPS(ena_pm_ops, ena_suspend, ena_resume);
|
||||||
|
|
||||||
static struct pci_driver ena_pci_driver = {
|
static struct pci_driver ena_pci_driver = {
|
||||||
.name = DRV_MODULE_NAME,
|
.name = DRV_MODULE_NAME,
|
||||||
|
@ -4470,10 +4469,7 @@ static struct pci_driver ena_pci_driver = {
|
||||||
.probe = ena_probe,
|
.probe = ena_probe,
|
||||||
.remove = ena_remove,
|
.remove = ena_remove,
|
||||||
.shutdown = ena_shutdown,
|
.shutdown = ena_shutdown,
|
||||||
#ifdef CONFIG_PM
|
.driver.pm = &ena_pm_ops,
|
||||||
.suspend = ena_suspend,
|
|
||||||
.resume = ena_resume,
|
|
||||||
#endif
|
|
||||||
.sriov_configure = pci_sriov_configure_simple,
|
.sriov_configure = pci_sriov_configure_simple,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue