Commit c6f0fb5d authored by Vaibhav Gupta's avatar Vaibhav Gupta Committed by David S. Miller

amd-xgbe: Convert to generic power management

Use dev_pm_ops structure to call generic suspend() and resume() callbacks.

Drivers should avoid saving device register and/or change power states
using PCI helper functions. With the generic approach, all these are handled
by PCI core.

Compile-tested only.
Signed-off-by: default avatarVaibhav Gupta <vaibhavgupta40@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2caf751f
...@@ -421,10 +421,9 @@ static void xgbe_pci_remove(struct pci_dev *pdev) ...@@ -421,10 +421,9 @@ static void xgbe_pci_remove(struct pci_dev *pdev)
xgbe_free_pdata(pdata); xgbe_free_pdata(pdata);
} }
#ifdef CONFIG_PM static int __maybe_unused xgbe_pci_suspend(struct device *dev)
static int xgbe_pci_suspend(struct pci_dev *pdev, pm_message_t state)
{ {
struct xgbe_prv_data *pdata = pci_get_drvdata(pdev); struct xgbe_prv_data *pdata = dev_get_drvdata(dev);
struct net_device *netdev = pdata->netdev; struct net_device *netdev = pdata->netdev;
int ret = 0; int ret = 0;
...@@ -438,9 +437,9 @@ static int xgbe_pci_suspend(struct pci_dev *pdev, pm_message_t state) ...@@ -438,9 +437,9 @@ static int xgbe_pci_suspend(struct pci_dev *pdev, pm_message_t state)
return ret; return ret;
} }
static int xgbe_pci_resume(struct pci_dev *pdev) static int __maybe_unused xgbe_pci_resume(struct device *dev)
{ {
struct xgbe_prv_data *pdata = pci_get_drvdata(pdev); struct xgbe_prv_data *pdata = dev_get_drvdata(dev);
struct net_device *netdev = pdata->netdev; struct net_device *netdev = pdata->netdev;
int ret = 0; int ret = 0;
...@@ -460,7 +459,6 @@ static int xgbe_pci_resume(struct pci_dev *pdev) ...@@ -460,7 +459,6 @@ static int xgbe_pci_resume(struct pci_dev *pdev)
return ret; return ret;
} }
#endif /* CONFIG_PM */
static const struct xgbe_version_data xgbe_v2a = { static const struct xgbe_version_data xgbe_v2a = {
.init_function_ptrs_phy_impl = xgbe_init_function_ptrs_phy_v2, .init_function_ptrs_phy_impl = xgbe_init_function_ptrs_phy_v2,
...@@ -502,15 +500,16 @@ static const struct pci_device_id xgbe_pci_table[] = { ...@@ -502,15 +500,16 @@ static const struct pci_device_id xgbe_pci_table[] = {
}; };
MODULE_DEVICE_TABLE(pci, xgbe_pci_table); MODULE_DEVICE_TABLE(pci, xgbe_pci_table);
static SIMPLE_DEV_PM_OPS(xgbe_pci_pm_ops, xgbe_pci_suspend, xgbe_pci_resume);
static struct pci_driver xgbe_driver = { static struct pci_driver xgbe_driver = {
.name = XGBE_DRV_NAME, .name = XGBE_DRV_NAME,
.id_table = xgbe_pci_table, .id_table = xgbe_pci_table,
.probe = xgbe_pci_probe, .probe = xgbe_pci_probe,
.remove = xgbe_pci_remove, .remove = xgbe_pci_remove,
#ifdef CONFIG_PM .driver = {
.suspend = xgbe_pci_suspend, .pm = &xgbe_pci_pm_ops,
.resume = xgbe_pci_resume, }
#endif
}; };
int xgbe_pci_init(void) int xgbe_pci_init(void)
......
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