* [PATCH] net: stmmac: Do not enable/disable runtime PM for PCI devices
@ 2024-03-21 13:54 Mikhail Malyshev
2024-03-21 15:04 ` Jiri Pirko
0 siblings, 1 reply; 2+ messages in thread
From: Mikhail Malyshev @ 2024-03-21 13:54 UTC (permalink / raw)
To: Alexandre Torgue, Jose Abreu, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Maxime Coquelin
Cc: netdev, linux-stm32, linux-arm-kernel, linux-kernel,
Mikhail Malyshev
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>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] net: stmmac: Do not enable/disable runtime PM for PCI devices
2024-03-21 13:54 [PATCH] net: stmmac: Do not enable/disable runtime PM for PCI devices Mikhail Malyshev
@ 2024-03-21 15:04 ` Jiri Pirko
0 siblings, 0 replies; 2+ messages in thread
From: Jiri Pirko @ 2024-03-21 15:04 UTC (permalink / raw)
To: Mikhail Malyshev
Cc: Alexandre Torgue, Jose Abreu, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Maxime Coquelin, netdev, linux-stm32,
linux-arm-kernel, linux-kernel
Thu, Mar 21, 2024 at 02:54:15PM CET, mike.malyshev@gmail.com wrote:
>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.
I don't follow. The rest of the pm_runtime* functions are okay to call,
but enable() is not. Why? You need to provide more reasoning.
>
>For PCI devices plat->pdev != NULL. Use this fact to detect PCI devices
Sentence ends with "."
I assume this is a bug fix. Do you have a trace or some other symptoms?
Please add it to the patch description. You also need to add "Fixes"
tag.
Make sure you read:
https://www.kernel.org/doc/html/next/process/maintainer-netdev.html?highlight=network#tl-dr
Thanks
pw-bot: cr
>
>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>
>
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-03-21 15:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-21 13:54 [PATCH] net: stmmac: Do not enable/disable runtime PM for PCI devices Mikhail Malyshev
2024-03-21 15:04 ` Jiri Pirko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox