diff mbox series

[net] net: ethernet: ave: Remove duplicate suspend/resume calls for phy

Message ID 20221021174552.6828-1-hayashi.kunihiko@socionext.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series [net] net: ethernet: ave: Remove duplicate suspend/resume calls for phy | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net
netdev/fixes_present success Fixes tag present in non-next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 6 of 6 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 20 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Kunihiko Hayashi Oct. 21, 2022, 5:45 p.m. UTC
Since AVE has its own suspend/resume functions, there is no need to call
mdio_bus suspend/resume functions. Set phydev->mac_managed_pm to true
to avoid the calls.

In addition, ave_open() executes __phy_resume() via phy_start() in
ave_resume(), so no need to call phy_resume() explicitly. Remove it.

Suggested-by: Heiner Kallweit <hkallweit1@gmail.com>
Fixes: 0ba78b4a4989 ("net: ethernet: ave: Add suspend/resume support")
Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
---
 drivers/net/ethernet/socionext/sni_ave.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

Comments

Heiner Kallweit Oct. 21, 2022, 8:55 p.m. UTC | #1
On 21.10.2022 19:45, Kunihiko Hayashi wrote:
> Since AVE has its own suspend/resume functions, there is no need to call
> mdio_bus suspend/resume functions. Set phydev->mac_managed_pm to true
> to avoid the calls.
> 
The commit description doesn't make clear (any longer) what the issue
is that you're fixing. You should mention the WARN_ON() dump here
like in your first attempt.

> In addition, ave_open() executes __phy_resume() via phy_start() in
> ave_resume(), so no need to call phy_resume() explicitly. Remove it.
> 
This sounds like an improvement, being independent of the actual fix.
The preferred approach would be:
- submit the fix to net
- submit the improvement in a separate patch to net-next

> Suggested-by: Heiner Kallweit <hkallweit1@gmail.com>
> Fixes: 0ba78b4a4989 ("net: ethernet: ave: Add suspend/resume support")
> Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
> ---
>  drivers/net/ethernet/socionext/sni_ave.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/ethernet/socionext/sni_ave.c b/drivers/net/ethernet/socionext/sni_ave.c
> index 14cdd2e8373c..b4e0c57af7c3 100644
> --- a/drivers/net/ethernet/socionext/sni_ave.c
> +++ b/drivers/net/ethernet/socionext/sni_ave.c
> @@ -1271,6 +1271,8 @@ static int ave_init(struct net_device *ndev)
>  
>  	phy_support_asym_pause(phydev);
>  
> +	phydev->mac_managed_pm = true;
> +
>  	phy_attached_info(phydev);
>  
>  	return 0;
> @@ -1806,12 +1808,6 @@ static int ave_resume(struct device *dev)
>  	wol.wolopts = priv->wolopts;
>  	__ave_ethtool_set_wol(ndev, &wol);
>  
> -	if (ndev->phydev) {
> -		ret = phy_resume(ndev->phydev);
> -		if (ret)
> -			return ret;
> -	}
> -
>  	if (netif_running(ndev)) {
>  		ret = ave_open(ndev);
>  		netif_device_attach(ndev);
Kunihiko Hayashi Oct. 22, 2022, 5:29 p.m. UTC | #2
Hi,

On 2022/10/22 5:55, Heiner Kallweit wrote:
> On 21.10.2022 19:45, Kunihiko Hayashi wrote:
>> Since AVE has its own suspend/resume functions, there is no need to call
>> mdio_bus suspend/resume functions. Set phydev->mac_managed_pm to true
>> to avoid the calls.
>>
> The commit description doesn't make clear (any longer) what the issue
> is that you're fixing. You should mention the WARN_ON() dump here
> like in your first attempt.

Indeed, I forgot to mention the WARN_ON() dump issue.

>> In addition, ave_open() executes __phy_resume() via phy_start() in
>> ave_resume(), so no need to call phy_resume() explicitly. Remove it.
>>
> This sounds like an improvement, being independent of the actual fix.
> The preferred approach would be:
> - submit the fix to net
> - submit the improvement in a separate patch to net-next

Ah, I see.
The one is for fixing WARN_ON() dump, and the other isn't affected
by the behavior, but it should be duplicate removal.

I'll separate it into two patches.

Thank you,

---
Best Regards
Kunihiko Hayashi
diff mbox series

Patch

diff --git a/drivers/net/ethernet/socionext/sni_ave.c b/drivers/net/ethernet/socionext/sni_ave.c
index 14cdd2e8373c..b4e0c57af7c3 100644
--- a/drivers/net/ethernet/socionext/sni_ave.c
+++ b/drivers/net/ethernet/socionext/sni_ave.c
@@ -1271,6 +1271,8 @@  static int ave_init(struct net_device *ndev)
 
 	phy_support_asym_pause(phydev);
 
+	phydev->mac_managed_pm = true;
+
 	phy_attached_info(phydev);
 
 	return 0;
@@ -1806,12 +1808,6 @@  static int ave_resume(struct device *dev)
 	wol.wolopts = priv->wolopts;
 	__ave_ethtool_set_wol(ndev, &wol);
 
-	if (ndev->phydev) {
-		ret = phy_resume(ndev->phydev);
-		if (ret)
-			return ret;
-	}
-
 	if (netif_running(ndev)) {
 		ret = ave_open(ndev);
 		netif_device_attach(ndev);