diff mbox series

net: stmmac: Do not enable/disable runtime PM for PCI devices

Message ID 20240321-stmmac-fix-v1-1-3aef470494c6@gmail.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series net: stmmac: Do not enable/disable runtime PM for PCI devices | expand

Checks

Context Check Description
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 939 this patch: 939
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 9 of 9 maintainers
netdev/build_clang success Errors and warnings before: 956 this patch: 956
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 956 this patch: 956
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 21 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-03-21--15-00 (tests: 909)

Commit Message

Mikhail Malyshev March 21, 2024, 1:54 p.m. UTC
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(-)


---
base-commit: 23956900041d968f9ad0f30db6dede4daccd7aa9
change-id: 20240321-stmmac-fix-f506d52882d2

Best regards,

Comments

Jiri Pirko March 21, 2024, 3:04 p.m. UTC | #1
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>
>
>
diff mbox series

Patch

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);