mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-02-15 09:44:21 -05:00
net: stmmac: intel: convert to suspend()/resume() methods
Convert intel to use the new suspend() and resume() methods rather than implementing these in custom wrappers around the main driver's suspend/resume methods. This allows this driver to use the stmmac simple PM ops structure. Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> Link: https://patch.msgid.link/E1ulXbm-008gqs-P9@rmk-PC.armlinux.org.uk Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
b51f34bc85
commit
062b428017
@@ -1231,6 +1231,37 @@ static int stmmac_config_multi_msi(struct pci_dev *pdev,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int intel_eth_pci_suspend(struct device *dev, void *bsp_priv)
|
||||
{
|
||||
struct pci_dev *pdev = to_pci_dev(dev);
|
||||
int ret;
|
||||
|
||||
ret = pci_save_state(pdev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
pci_wake_from_d3(pdev, true);
|
||||
pci_set_power_state(pdev, PCI_D3hot);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int intel_eth_pci_resume(struct device *dev, void *bsp_priv)
|
||||
{
|
||||
struct pci_dev *pdev = to_pci_dev(dev);
|
||||
int ret;
|
||||
|
||||
pci_restore_state(pdev);
|
||||
pci_set_power_state(pdev, PCI_D0);
|
||||
|
||||
ret = pcim_enable_device(pdev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
pci_set_master(pdev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* intel_eth_pci_probe
|
||||
*
|
||||
@@ -1292,6 +1323,9 @@ static int intel_eth_pci_probe(struct pci_dev *pdev,
|
||||
pci_set_master(pdev);
|
||||
|
||||
plat->bsp_priv = intel_priv;
|
||||
plat->suspend = intel_eth_pci_suspend;
|
||||
plat->resume = intel_eth_pci_resume;
|
||||
|
||||
intel_priv->mdio_adhoc_addr = INTEL_MGBE_ADHOC_ADDR;
|
||||
intel_priv->crossts_adj = 1;
|
||||
|
||||
@@ -1355,44 +1389,6 @@ static void intel_eth_pci_remove(struct pci_dev *pdev)
|
||||
clk_unregister_fixed_rate(priv->plat->stmmac_clk);
|
||||
}
|
||||
|
||||
static int __maybe_unused intel_eth_pci_suspend(struct device *dev)
|
||||
{
|
||||
struct pci_dev *pdev = to_pci_dev(dev);
|
||||
int ret;
|
||||
|
||||
ret = stmmac_suspend(dev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = pci_save_state(pdev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
pci_wake_from_d3(pdev, true);
|
||||
pci_set_power_state(pdev, PCI_D3hot);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __maybe_unused intel_eth_pci_resume(struct device *dev)
|
||||
{
|
||||
struct pci_dev *pdev = to_pci_dev(dev);
|
||||
int ret;
|
||||
|
||||
pci_restore_state(pdev);
|
||||
pci_set_power_state(pdev, PCI_D0);
|
||||
|
||||
ret = pcim_enable_device(pdev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
pci_set_master(pdev);
|
||||
|
||||
return stmmac_resume(dev);
|
||||
}
|
||||
|
||||
static SIMPLE_DEV_PM_OPS(intel_eth_pm_ops, intel_eth_pci_suspend,
|
||||
intel_eth_pci_resume);
|
||||
|
||||
#define PCI_DEVICE_ID_INTEL_QUARK 0x0937
|
||||
#define PCI_DEVICE_ID_INTEL_EHL_RGMII1G 0x4b30
|
||||
#define PCI_DEVICE_ID_INTEL_EHL_SGMII1G 0x4b31
|
||||
@@ -1442,7 +1438,7 @@ static struct pci_driver intel_eth_pci_driver = {
|
||||
.probe = intel_eth_pci_probe,
|
||||
.remove = intel_eth_pci_remove,
|
||||
.driver = {
|
||||
.pm = &intel_eth_pm_ops,
|
||||
.pm = &stmmac_simple_pm_ops,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user