lkml.org 
[lkml]   [2024]   [Mar]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Date
Subject[PATCH] net: stmmac: Do not enable/disable runtime PM for PCI devices
Common function stmmac_dvr_probe is called for both PCI and non-PCI
device. For PCI devices pm_runtime_enable/disable are called by framework
and should not be called by the driver.

For PCI devices plat->pdev != NULL. Use this fact to detect PCI devices

Signed-off-by: Mikhail Malyshev <mike.malyshev@gmail.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 24cd80490d19..db45d8dbc1eb 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -7743,7 +7743,9 @@ int stmmac_dvr_probe(struct device *device,

pm_runtime_get_noresume(device);
pm_runtime_set_active(device);
- if (!pm_runtime_enabled(device))
+
+ /* For PCI devices PM is disabled/enabled by the framework */
+ if (!priv->plat->pdev)
pm_runtime_enable(device);

if (priv->hw->pcs != STMMAC_PCS_TBI &&
@@ -7846,7 +7848,10 @@ void stmmac_dvr_remove(struct device *dev)
mutex_destroy(&priv->lock);
bitmap_free(priv->af_xdp_zc_qps);

- pm_runtime_disable(dev);
+ /* For PCI devices PM is disabled/enabled by the framework */
+ if (!priv->plat->pdev)
+ pm_runtime_disable(dev);
+
pm_runtime_put_noidle(dev);
}
EXPORT_SYMBOL_GPL(stmmac_dvr_remove);
---
base-commit: 23956900041d968f9ad0f30db6dede4daccd7aa9
change-id: 20240321-stmmac-fix-f506d52882d2
Best regards,
--
Mikhail Malyshev <mike.malyshev@gmail.com>


\
 
 \ /
  Last update: 2024-05-27 15:58    [W:1.228 / U:0.000 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site