Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'net-stmmac-improbe-suspend-resume-architecture'

Russell King says:

====================
net: stmmac: improbe suspend/resume architecture

This series improves the stmmac suspend/resume architecture by
providing a couple of method hooks in struct plat_stmmacenet_data which
are called by core code, and thus are available for any of the
platform glue drivers, whether using a platform or PCI device.

As these methods are called by core code, we can also provide a simple
PM ops structure also in the core code for converted glue drivers to
use.

The remainder of the patches convert the various drivers.
====================

Link: https://patch.msgid.link/aJo7kvoub5voHOUQ@shell.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+195 -241
+35 -39
drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c
··· 1231 1231 return 0; 1232 1232 } 1233 1233 1234 + static int intel_eth_pci_suspend(struct device *dev, void *bsp_priv) 1235 + { 1236 + struct pci_dev *pdev = to_pci_dev(dev); 1237 + int ret; 1238 + 1239 + ret = pci_save_state(pdev); 1240 + if (ret) 1241 + return ret; 1242 + 1243 + pci_wake_from_d3(pdev, true); 1244 + pci_set_power_state(pdev, PCI_D3hot); 1245 + return 0; 1246 + } 1247 + 1248 + static int intel_eth_pci_resume(struct device *dev, void *bsp_priv) 1249 + { 1250 + struct pci_dev *pdev = to_pci_dev(dev); 1251 + int ret; 1252 + 1253 + pci_restore_state(pdev); 1254 + pci_set_power_state(pdev, PCI_D0); 1255 + 1256 + ret = pcim_enable_device(pdev); 1257 + if (ret) 1258 + return ret; 1259 + 1260 + pci_set_master(pdev); 1261 + 1262 + return 0; 1263 + } 1264 + 1234 1265 /** 1235 1266 * intel_eth_pci_probe 1236 1267 * ··· 1323 1292 pci_set_master(pdev); 1324 1293 1325 1294 plat->bsp_priv = intel_priv; 1295 + plat->suspend = intel_eth_pci_suspend; 1296 + plat->resume = intel_eth_pci_resume; 1297 + 1326 1298 intel_priv->mdio_adhoc_addr = INTEL_MGBE_ADHOC_ADDR; 1327 1299 intel_priv->crossts_adj = 1; 1328 1300 ··· 1389 1355 clk_unregister_fixed_rate(priv->plat->stmmac_clk); 1390 1356 } 1391 1357 1392 - static int __maybe_unused intel_eth_pci_suspend(struct device *dev) 1393 - { 1394 - struct pci_dev *pdev = to_pci_dev(dev); 1395 - int ret; 1396 - 1397 - ret = stmmac_suspend(dev); 1398 - if (ret) 1399 - return ret; 1400 - 1401 - ret = pci_save_state(pdev); 1402 - if (ret) 1403 - return ret; 1404 - 1405 - pci_wake_from_d3(pdev, true); 1406 - pci_set_power_state(pdev, PCI_D3hot); 1407 - return 0; 1408 - } 1409 - 1410 - static int __maybe_unused intel_eth_pci_resume(struct device *dev) 1411 - { 1412 - struct pci_dev *pdev = to_pci_dev(dev); 1413 - int ret; 1414 - 1415 - pci_restore_state(pdev); 1416 - pci_set_power_state(pdev, PCI_D0); 1417 - 1418 - ret = pcim_enable_device(pdev); 1419 - if (ret) 1420 - return ret; 1421 - 1422 - pci_set_master(pdev); 1423 - 1424 - return stmmac_resume(dev); 1425 - } 1426 - 1427 - static SIMPLE_DEV_PM_OPS(intel_eth_pm_ops, intel_eth_pci_suspend, 1428 - intel_eth_pci_resume); 1429 - 1430 1358 #define PCI_DEVICE_ID_INTEL_QUARK 0x0937 1431 1359 #define PCI_DEVICE_ID_INTEL_EHL_RGMII1G 0x4b30 1432 1360 #define PCI_DEVICE_ID_INTEL_EHL_SGMII1G 0x4b31 ··· 1438 1442 .probe = intel_eth_pci_probe, 1439 1443 .remove = intel_eth_pci_remove, 1440 1444 .driver = { 1441 - .pm = &intel_eth_pm_ops, 1445 + .pm = &stmmac_simple_pm_ops, 1442 1446 }, 1443 1447 }; 1444 1448
+34 -39
drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
··· 521 521 10000, 2000000); 522 522 } 523 523 524 + static int loongson_dwmac_suspend(struct device *dev, void *bsp_priv) 525 + { 526 + struct pci_dev *pdev = to_pci_dev(dev); 527 + int ret; 528 + 529 + ret = pci_save_state(pdev); 530 + if (ret) 531 + return ret; 532 + 533 + pci_disable_device(pdev); 534 + pci_wake_from_d3(pdev, true); 535 + return 0; 536 + } 537 + 538 + static int loongson_dwmac_resume(struct device *dev, void *bsp_priv) 539 + { 540 + struct pci_dev *pdev = to_pci_dev(dev); 541 + int ret; 542 + 543 + pci_restore_state(pdev); 544 + pci_set_power_state(pdev, PCI_D0); 545 + 546 + ret = pci_enable_device(pdev); 547 + if (ret) 548 + return ret; 549 + 550 + pci_set_master(pdev); 551 + 552 + return 0; 553 + } 554 + 524 555 static int loongson_dwmac_probe(struct pci_dev *pdev, const struct pci_device_id *id) 525 556 { 526 557 struct plat_stmmacenet_data *plat; ··· 596 565 plat->bsp_priv = ld; 597 566 plat->setup = loongson_dwmac_setup; 598 567 plat->fix_soc_reset = loongson_dwmac_fix_reset; 568 + plat->suspend = loongson_dwmac_suspend; 569 + plat->resume = loongson_dwmac_resume; 599 570 ld->dev = &pdev->dev; 600 571 ld->loongson_id = readl(res.addr + GMAC_VERSION) & 0xff; 601 572 ··· 654 621 pci_disable_device(pdev); 655 622 } 656 623 657 - static int __maybe_unused loongson_dwmac_suspend(struct device *dev) 658 - { 659 - struct pci_dev *pdev = to_pci_dev(dev); 660 - int ret; 661 - 662 - ret = stmmac_suspend(dev); 663 - if (ret) 664 - return ret; 665 - 666 - ret = pci_save_state(pdev); 667 - if (ret) 668 - return ret; 669 - 670 - pci_disable_device(pdev); 671 - pci_wake_from_d3(pdev, true); 672 - return 0; 673 - } 674 - 675 - static int __maybe_unused loongson_dwmac_resume(struct device *dev) 676 - { 677 - struct pci_dev *pdev = to_pci_dev(dev); 678 - int ret; 679 - 680 - pci_restore_state(pdev); 681 - pci_set_power_state(pdev, PCI_D0); 682 - 683 - ret = pci_enable_device(pdev); 684 - if (ret) 685 - return ret; 686 - 687 - pci_set_master(pdev); 688 - 689 - return stmmac_resume(dev); 690 - } 691 - 692 - static SIMPLE_DEV_PM_OPS(loongson_dwmac_pm_ops, loongson_dwmac_suspend, 693 - loongson_dwmac_resume); 694 - 695 624 static const struct pci_device_id loongson_dwmac_id_table[] = { 696 625 { PCI_DEVICE_DATA(LOONGSON, GMAC1, &loongson_gmac_pci_info) }, 697 626 { PCI_DEVICE_DATA(LOONGSON, GMAC2, &loongson_gmac_pci_info) }, ··· 668 673 .probe = loongson_dwmac_probe, 669 674 .remove = loongson_dwmac_remove, 670 675 .driver = { 671 - .pm = &loongson_dwmac_pm_ops, 676 + .pm = &stmmac_simple_pm_ops, 672 677 }, 673 678 }; 674 679
+5 -5
drivers/net/ethernet/stmicro/stmmac/dwmac-mediatek.c
··· 523 523 return ret; 524 524 } 525 525 526 - static int mediatek_dwmac_init(struct platform_device *pdev, void *priv) 526 + static int mediatek_dwmac_init(struct device *dev, void *priv) 527 527 { 528 528 struct mediatek_dwmac_plat_data *plat = priv; 529 529 const struct mediatek_dwmac_variant *variant = plat->variant; ··· 532 532 if (variant->dwmac_set_phy_interface) { 533 533 ret = variant->dwmac_set_phy_interface(plat); 534 534 if (ret) { 535 - dev_err(plat->dev, "failed to set phy interface, err = %d\n", ret); 535 + dev_err(dev, "failed to set phy interface, err = %d\n", ret); 536 536 return ret; 537 537 } 538 538 } ··· 540 540 if (variant->dwmac_set_delay) { 541 541 ret = variant->dwmac_set_delay(plat); 542 542 if (ret) { 543 - dev_err(plat->dev, "failed to set delay value, err = %d\n", ret); 543 + dev_err(dev, "failed to set delay value, err = %d\n", ret); 544 544 return ret; 545 545 } 546 546 } ··· 589 589 plat->maxmtu = ETH_DATA_LEN; 590 590 plat->host_dma_width = priv_plat->variant->dma_bit_mask; 591 591 plat->bsp_priv = priv_plat; 592 - plat->init = mediatek_dwmac_init; 592 + plat->resume = mediatek_dwmac_init; 593 593 plat->clks_config = mediatek_dwmac_clks_config; 594 594 595 595 plat->safety_feat_cfg = devm_kzalloc(&pdev->dev, ··· 654 654 return PTR_ERR(plat_dat); 655 655 656 656 mediatek_dwmac_common_data(pdev, plat_dat, priv_plat); 657 - mediatek_dwmac_init(pdev, priv_plat); 657 + mediatek_dwmac_init(&pdev->dev, priv_plat); 658 658 659 659 ret = mediatek_dwmac_clks_config(priv_plat, true); 660 660 if (ret)
+25 -33
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
··· 71 71 phy_interface_t phy_iface; 72 72 int id; 73 73 struct regulator *regulator; 74 - bool suspended; 75 74 const struct rk_gmac_ops *ops; 76 75 77 76 bool clk_enabled; ··· 1705 1706 return -EINVAL; 1706 1707 } 1707 1708 1709 + static int rk_gmac_suspend(struct device *dev, void *bsp_priv_) 1710 + { 1711 + struct rk_priv_data *bsp_priv = bsp_priv_; 1712 + 1713 + /* Keep the PHY up if we use Wake-on-Lan. */ 1714 + if (!device_may_wakeup(dev)) 1715 + rk_gmac_powerdown(bsp_priv); 1716 + 1717 + return 0; 1718 + } 1719 + 1720 + static int rk_gmac_resume(struct device *dev, void *bsp_priv_) 1721 + { 1722 + struct rk_priv_data *bsp_priv = bsp_priv_; 1723 + 1724 + /* The PHY was up for Wake-on-Lan. */ 1725 + if (!device_may_wakeup(dev)) 1726 + rk_gmac_powerup(bsp_priv); 1727 + 1728 + return 0; 1729 + } 1730 + 1708 1731 static int rk_gmac_probe(struct platform_device *pdev) 1709 1732 { 1710 1733 struct plat_stmmacenet_data *plat_dat; ··· 1759 1738 1760 1739 plat_dat->get_interfaces = rk_get_interfaces; 1761 1740 plat_dat->set_clk_tx_rate = rk_set_clk_tx_rate; 1741 + plat_dat->suspend = rk_gmac_suspend; 1742 + plat_dat->resume = rk_gmac_resume; 1762 1743 1763 1744 plat_dat->bsp_priv = rk_gmac_setup(pdev, plat_dat, data); 1764 1745 if (IS_ERR(plat_dat->bsp_priv)) ··· 1795 1772 rk_gmac_powerdown(bsp_priv); 1796 1773 } 1797 1774 1798 - #ifdef CONFIG_PM_SLEEP 1799 - static int rk_gmac_suspend(struct device *dev) 1800 - { 1801 - struct rk_priv_data *bsp_priv = get_stmmac_bsp_priv(dev); 1802 - int ret = stmmac_suspend(dev); 1803 - 1804 - /* Keep the PHY up if we use Wake-on-Lan. */ 1805 - if (!device_may_wakeup(dev)) { 1806 - rk_gmac_powerdown(bsp_priv); 1807 - bsp_priv->suspended = true; 1808 - } 1809 - 1810 - return ret; 1811 - } 1812 - 1813 - static int rk_gmac_resume(struct device *dev) 1814 - { 1815 - struct rk_priv_data *bsp_priv = get_stmmac_bsp_priv(dev); 1816 - 1817 - /* The PHY was up for Wake-on-Lan. */ 1818 - if (bsp_priv->suspended) { 1819 - rk_gmac_powerup(bsp_priv); 1820 - bsp_priv->suspended = false; 1821 - } 1822 - 1823 - return stmmac_resume(dev); 1824 - } 1825 - #endif /* CONFIG_PM_SLEEP */ 1826 - 1827 - static SIMPLE_DEV_PM_OPS(rk_gmac_pm_ops, rk_gmac_suspend, rk_gmac_resume); 1828 - 1829 1775 static const struct of_device_id rk_gmac_dwmac_match[] = { 1830 1776 { .compatible = "rockchip,px30-gmac", .data = &px30_ops }, 1831 1777 { .compatible = "rockchip,rk3128-gmac", .data = &rk3128_ops }, ··· 1820 1828 .remove = rk_gmac_remove, 1821 1829 .driver = { 1822 1830 .name = "rk_gmac-dwmac", 1823 - .pm = &rk_gmac_pm_ops, 1831 + .pm = &stmmac_simple_pm_ops, 1824 1832 .of_match_table = rk_gmac_dwmac_match, 1825 1833 }, 1826 1834 };
+23 -45
drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c
··· 498 498 return err; 499 499 } 500 500 501 + static int stm32_dwmac_suspend(struct device *dev, void *bsp_priv) 502 + { 503 + struct stm32_dwmac *dwmac = bsp_priv; 504 + 505 + stm32_dwmac_clk_disable(dwmac); 506 + 507 + return dwmac->ops->suspend ? dwmac->ops->suspend(dwmac) : 0; 508 + } 509 + 510 + static int stm32_dwmac_resume(struct device *dev, void *bsp_priv) 511 + { 512 + struct stmmac_priv *priv = netdev_priv(dev_get_drvdata(dev)); 513 + struct stm32_dwmac *dwmac = bsp_priv; 514 + 515 + if (dwmac->ops->resume) 516 + dwmac->ops->resume(dwmac); 517 + 518 + return stm32_dwmac_init(priv->plat); 519 + } 520 + 501 521 static int stm32_dwmac_probe(struct platform_device *pdev) 502 522 { 503 523 struct plat_stmmacenet_data *plat_dat; ··· 555 535 556 536 plat_dat->flags |= STMMAC_FLAG_EN_TX_LPI_CLK_PHY_CAP; 557 537 plat_dat->bsp_priv = dwmac; 538 + plat_dat->suspend = stm32_dwmac_suspend; 539 + plat_dat->resume = stm32_dwmac_resume; 558 540 559 541 ret = stm32_dwmac_init(plat_dat); 560 542 if (ret) ··· 622 600 clk_disable_unprepare(dwmac->clk_ethstp); 623 601 } 624 602 625 - #ifdef CONFIG_PM_SLEEP 626 - static int stm32_dwmac_suspend(struct device *dev) 627 - { 628 - struct net_device *ndev = dev_get_drvdata(dev); 629 - struct stmmac_priv *priv = netdev_priv(ndev); 630 - struct stm32_dwmac *dwmac = priv->plat->bsp_priv; 631 - 632 - int ret; 633 - 634 - ret = stmmac_suspend(dev); 635 - if (ret) 636 - return ret; 637 - 638 - stm32_dwmac_clk_disable(dwmac); 639 - 640 - if (dwmac->ops->suspend) 641 - ret = dwmac->ops->suspend(dwmac); 642 - 643 - return ret; 644 - } 645 - 646 - static int stm32_dwmac_resume(struct device *dev) 647 - { 648 - struct net_device *ndev = dev_get_drvdata(dev); 649 - struct stmmac_priv *priv = netdev_priv(ndev); 650 - struct stm32_dwmac *dwmac = priv->plat->bsp_priv; 651 - int ret; 652 - 653 - if (dwmac->ops->resume) 654 - dwmac->ops->resume(dwmac); 655 - 656 - ret = stm32_dwmac_init(priv->plat); 657 - if (ret) 658 - return ret; 659 - 660 - ret = stmmac_resume(dev); 661 - 662 - return ret; 663 - } 664 - #endif /* CONFIG_PM_SLEEP */ 665 - 666 - static SIMPLE_DEV_PM_OPS(stm32_dwmac_pm_ops, 667 - stm32_dwmac_suspend, stm32_dwmac_resume); 668 - 669 603 static struct stm32_ops stm32mcu_dwmac_data = { 670 604 .set_mode = stm32mcu_set_mode 671 605 }; ··· 669 691 .remove = stm32_dwmac_remove, 670 692 .driver = { 671 693 .name = "stm32-dwmac", 672 - .pm = &stm32_dwmac_pm_ops, 694 + .pm = &stmmac_simple_pm_ops, 673 695 .of_match_table = stm32_dwmac_match, 674 696 }, 675 697 };
+2
drivers/net/ethernet/stmicro/stmmac/stmmac.h
··· 374 374 STMMAC_SERVICE_SCHED, 375 375 }; 376 376 377 + extern const struct dev_pm_ops stmmac_simple_pm_ops; 378 + 377 379 int stmmac_mdio_unregister(struct net_device *ndev); 378 380 int stmmac_mdio_register(struct net_device *ndev); 379 381 int stmmac_mdio_reset(struct mii_bus *mii);
+12
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
··· 7879 7879 if (stmmac_fpe_supported(priv)) 7880 7880 ethtool_mmsv_stop(&priv->fpe_cfg.mmsv); 7881 7881 7882 + if (priv->plat->suspend) 7883 + return priv->plat->suspend(dev, priv->plat->bsp_priv); 7884 + 7882 7885 return 0; 7883 7886 } 7884 7887 EXPORT_SYMBOL_GPL(stmmac_suspend); ··· 7933 7930 struct net_device *ndev = dev_get_drvdata(dev); 7934 7931 struct stmmac_priv *priv = netdev_priv(ndev); 7935 7932 int ret; 7933 + 7934 + if (priv->plat->resume) { 7935 + ret = priv->plat->resume(dev, priv->plat->bsp_priv); 7936 + if (ret) 7937 + return ret; 7938 + } 7936 7939 7937 7940 if (!netif_running(ndev)) 7938 7941 return 0; ··· 8012 8003 return 0; 8013 8004 } 8014 8005 EXPORT_SYMBOL_GPL(stmmac_resume); 8006 + 8007 + EXPORT_GPL_SIMPLE_DEV_PM_OPS(stmmac_simple_pm_ops, stmmac_suspend, 8008 + stmmac_resume); 8015 8009 8016 8010 #ifndef MODULE 8017 8011 static int __init stmmac_cmdline_opt(char *str)
+35 -38
drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
··· 138 138 .setup = snps_gmac5_default_data, 139 139 }; 140 140 141 + static int stmmac_pci_suspend(struct device *dev, void *bsp_priv) 142 + { 143 + struct pci_dev *pdev = to_pci_dev(dev); 144 + int ret; 145 + 146 + ret = pci_save_state(pdev); 147 + if (ret) 148 + return ret; 149 + 150 + pci_disable_device(pdev); 151 + pci_wake_from_d3(pdev, true); 152 + return 0; 153 + } 154 + 155 + static int stmmac_pci_resume(struct device *dev, void *bsp_priv) 156 + { 157 + struct pci_dev *pdev = to_pci_dev(dev); 158 + int ret; 159 + 160 + pci_restore_state(pdev); 161 + pci_set_power_state(pdev, PCI_D0); 162 + 163 + ret = pci_enable_device(pdev); 164 + if (ret) 165 + return ret; 166 + 167 + pci_set_master(pdev); 168 + 169 + return 0; 170 + } 171 + 141 172 /** 142 173 * stmmac_pci_probe 143 174 * ··· 248 217 plat->safety_feat_cfg->prtyen = 1; 249 218 plat->safety_feat_cfg->tmouten = 1; 250 219 220 + plat->suspend = stmmac_pci_suspend; 221 + plat->resume = stmmac_pci_resume; 222 + 251 223 return stmmac_dvr_probe(&pdev->dev, plat, &res); 252 224 } 253 225 ··· 264 230 { 265 231 stmmac_dvr_remove(&pdev->dev); 266 232 } 267 - 268 - static int __maybe_unused stmmac_pci_suspend(struct device *dev) 269 - { 270 - struct pci_dev *pdev = to_pci_dev(dev); 271 - int ret; 272 - 273 - ret = stmmac_suspend(dev); 274 - if (ret) 275 - return ret; 276 - 277 - ret = pci_save_state(pdev); 278 - if (ret) 279 - return ret; 280 - 281 - pci_disable_device(pdev); 282 - pci_wake_from_d3(pdev, true); 283 - return 0; 284 - } 285 - 286 - static int __maybe_unused stmmac_pci_resume(struct device *dev) 287 - { 288 - struct pci_dev *pdev = to_pci_dev(dev); 289 - int ret; 290 - 291 - pci_restore_state(pdev); 292 - pci_set_power_state(pdev, PCI_D0); 293 - 294 - ret = pci_enable_device(pdev); 295 - if (ret) 296 - return ret; 297 - 298 - pci_set_master(pdev); 299 - 300 - return stmmac_resume(dev); 301 - } 302 - 303 - static SIMPLE_DEV_PM_OPS(stmmac_pm_ops, stmmac_pci_suspend, stmmac_pci_resume); 304 233 305 234 /* synthetic ID, no official vendor */ 306 235 #define PCI_VENDOR_ID_STMMAC 0x0700 ··· 286 289 .probe = stmmac_pci_probe, 287 290 .remove = stmmac_pci_remove, 288 291 .driver = { 289 - .pm = &stmmac_pm_ops, 292 + .pm = &stmmac_simple_pm_ops, 290 293 }, 291 294 }; 292 295
+22 -42
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
··· 811 811 plat->exit(pdev, plat->bsp_priv); 812 812 } 813 813 814 + static int stmmac_plat_suspend(struct device *dev, void *bsp_priv) 815 + { 816 + struct stmmac_priv *priv = netdev_priv(dev_get_drvdata(dev)); 817 + 818 + stmmac_pltfr_exit(to_platform_device(dev), priv->plat); 819 + 820 + return 0; 821 + } 822 + 823 + static int stmmac_plat_resume(struct device *dev, void *bsp_priv) 824 + { 825 + struct stmmac_priv *priv = netdev_priv(dev_get_drvdata(dev)); 826 + 827 + return stmmac_pltfr_init(to_platform_device(dev), priv->plat); 828 + } 829 + 814 830 /** 815 831 * stmmac_pltfr_probe 816 832 * @pdev: platform device pointer ··· 840 824 struct stmmac_resources *res) 841 825 { 842 826 int ret; 827 + 828 + if (!plat->suspend && plat->exit) 829 + plat->suspend = stmmac_plat_suspend; 830 + if (!plat->resume && plat->init) 831 + plat->resume = stmmac_plat_resume; 843 832 844 833 ret = stmmac_pltfr_init(pdev, plat); 845 834 if (ret) ··· 906 885 stmmac_pltfr_exit(pdev, plat); 907 886 } 908 887 EXPORT_SYMBOL_GPL(stmmac_pltfr_remove); 909 - 910 - /** 911 - * stmmac_pltfr_suspend 912 - * @dev: device pointer 913 - * Description: this function is invoked when suspend the driver and it direcly 914 - * call the main suspend function and then, if required, on some platform, it 915 - * can call an exit helper. 916 - */ 917 - static int __maybe_unused stmmac_pltfr_suspend(struct device *dev) 918 - { 919 - int ret; 920 - struct net_device *ndev = dev_get_drvdata(dev); 921 - struct stmmac_priv *priv = netdev_priv(ndev); 922 - struct platform_device *pdev = to_platform_device(dev); 923 - 924 - ret = stmmac_suspend(dev); 925 - stmmac_pltfr_exit(pdev, priv->plat); 926 - 927 - return ret; 928 - } 929 - 930 - /** 931 - * stmmac_pltfr_resume 932 - * @dev: device pointer 933 - * Description: this function is invoked when resume the driver before calling 934 - * the main resume function, on some platforms, it can call own init helper 935 - * if required. 936 - */ 937 - static int __maybe_unused stmmac_pltfr_resume(struct device *dev) 938 - { 939 - struct net_device *ndev = dev_get_drvdata(dev); 940 - struct stmmac_priv *priv = netdev_priv(ndev); 941 - struct platform_device *pdev = to_platform_device(dev); 942 - int ret; 943 - 944 - ret = stmmac_pltfr_init(pdev, priv->plat); 945 - if (ret) 946 - return ret; 947 - 948 - return stmmac_resume(dev); 949 - } 950 888 951 889 static int __maybe_unused stmmac_runtime_suspend(struct device *dev) 952 890 { ··· 974 994 } 975 995 976 996 const struct dev_pm_ops stmmac_pltfr_pm_ops = { 977 - SET_SYSTEM_SLEEP_PM_OPS(stmmac_pltfr_suspend, stmmac_pltfr_resume) 997 + SET_SYSTEM_SLEEP_PM_OPS(stmmac_suspend, stmmac_resume) 978 998 SET_RUNTIME_PM_OPS(stmmac_runtime_suspend, stmmac_runtime_resume, NULL) 979 999 SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(stmmac_pltfr_noirq_suspend, stmmac_pltfr_noirq_resume) 980 1000 };
+2
include/linux/stmmac.h
··· 248 248 void (*ptp_clk_freq_config)(struct stmmac_priv *priv); 249 249 int (*init)(struct platform_device *pdev, void *priv); 250 250 void (*exit)(struct platform_device *pdev, void *priv); 251 + int (*suspend)(struct device *dev, void *priv); 252 + int (*resume)(struct device *dev, void *priv); 251 253 struct mac_device_info *(*setup)(void *priv); 252 254 int (*clks_config)(void *priv, bool enabled); 253 255 int (*crosststamp)(ktime_t *device, struct system_counterval_t *system,