diff mbox series

[net-next] net: dsa: b53: use genphy_c45_eee_is_active directly, instead of phy_init_eee

Message ID 1c1a5c49-8c9c-42a7-b087-4a84d3585e0d@gmail.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series [net-next] net: dsa: b53: use genphy_c45_eee_is_active directly, instead of phy_init_eee | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for 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: 0 this patch: 0
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 7 of 7 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
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: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 11 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-2025-03-11--12-00 (tests: 894)

Commit Message

Heiner Kallweit March 11, 2025, 6:39 a.m. UTC
Use genphy_c45_eee_is_active directly instead of phy_init_eee,
this prepares for removing phy_init_eee. With the second
argument being Null, phy_init_eee doesn't initialize anything.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/net/dsa/b53/b53_common.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

Andrew Lunn March 11, 2025, 12:41 p.m. UTC | #1
On Tue, Mar 11, 2025 at 07:39:33AM +0100, Heiner Kallweit wrote:
> Use genphy_c45_eee_is_active directly instead of phy_init_eee,
> this prepares for removing phy_init_eee. With the second
> argument being Null, phy_init_eee doesn't initialize anything.
> 
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> ---
>  drivers/net/dsa/b53/b53_common.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
> index 61d164ffb..17e3ead16 100644
> --- a/drivers/net/dsa/b53/b53_common.c
> +++ b/drivers/net/dsa/b53/b53_common.c
> @@ -2212,10 +2212,7 @@ EXPORT_SYMBOL(b53_mirror_del);
>   */
>  int b53_eee_init(struct dsa_switch *ds, int port, struct phy_device *phy)
>  {
> -	int ret;
> -
> -	ret = phy_init_eee(phy, false);
> -	if (ret)
> +	if (!phy->drv || genphy_c45_eee_is_active(phy, NULL) <= 0)
>  		return 0;

genphy_c45_eee_is_active() is a function which could be considered
phylib internal. At least, it currently has no users outside of the
phylib core.

b53 uses phylink not phylib, so i actually think it would be better to
convert it to the phylink way to do EEE, rather than make use of a
phylib helper.

	Andrew
Heiner Kallweit March 11, 2025, 1:05 p.m. UTC | #2
On 11.03.2025 13:41, Andrew Lunn wrote:
> On Tue, Mar 11, 2025 at 07:39:33AM +0100, Heiner Kallweit wrote:
>> Use genphy_c45_eee_is_active directly instead of phy_init_eee,
>> this prepares for removing phy_init_eee. With the second
>> argument being Null, phy_init_eee doesn't initialize anything.
>>
>> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
>> ---
>>  drivers/net/dsa/b53/b53_common.c | 5 +----
>>  1 file changed, 1 insertion(+), 4 deletions(-)
>>
>> diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
>> index 61d164ffb..17e3ead16 100644
>> --- a/drivers/net/dsa/b53/b53_common.c
>> +++ b/drivers/net/dsa/b53/b53_common.c
>> @@ -2212,10 +2212,7 @@ EXPORT_SYMBOL(b53_mirror_del);
>>   */
>>  int b53_eee_init(struct dsa_switch *ds, int port, struct phy_device *phy)
>>  {
>> -	int ret;
>> -
>> -	ret = phy_init_eee(phy, false);
>> -	if (ret)
>> +	if (!phy->drv || genphy_c45_eee_is_active(phy, NULL) <= 0)
>>  		return 0;
> 
> genphy_c45_eee_is_active() is a function which could be considered
> phylib internal. At least, it currently has no users outside of the
> phylib core.
> 
> b53 uses phylink not phylib, so i actually think it would be better to
> convert it to the phylink way to do EEE, rather than make use of a
> phylib helper.
> 
Right, this would be a more comprehensive approach.

> 	Andrew
> 
> 	

--
pw-bot: cr
diff mbox series

Patch

diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
index 61d164ffb..17e3ead16 100644
--- a/drivers/net/dsa/b53/b53_common.c
+++ b/drivers/net/dsa/b53/b53_common.c
@@ -2212,10 +2212,7 @@  EXPORT_SYMBOL(b53_mirror_del);
  */
 int b53_eee_init(struct dsa_switch *ds, int port, struct phy_device *phy)
 {
-	int ret;
-
-	ret = phy_init_eee(phy, false);
-	if (ret)
+	if (!phy->drv || genphy_c45_eee_is_active(phy, NULL) <= 0)
 		return 0;
 
 	b53_eee_enable_set(ds, port, true);