All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: phy: broadcom: drop brcm_phy_setbits() and use phy_set_bits() instead
@ 2023-06-22 12:37 Giulio Benetti
  2023-06-22 12:48 ` Giulio Benetti
  0 siblings, 1 reply; 8+ messages in thread
From: Giulio Benetti @ 2023-06-22 12:37 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: Broadcom internal kernel review list, Andrew Lunn,
	Heiner Kallweit, Russell King, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, netdev, linux-kernel,
	Giulio Benetti

Linux provides phy_set_bits() helper so let's drop brcm_phy_setbits() and
use phy_set_bits() in its place.

Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
---
 drivers/net/phy/broadcom.c | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c
index ad71c88c87e7..d684c5be529a 100644
--- a/drivers/net/phy/broadcom.c
+++ b/drivers/net/phy/broadcom.c
@@ -608,17 +608,6 @@ static int bcm54616s_read_status(struct phy_device *phydev)
 	return err;
 }
 
-static int brcm_phy_setbits(struct phy_device *phydev, int reg, int set)
-{
-	int val;
-
-	val = phy_read(phydev, reg);
-	if (val < 0)
-		return val;
-
-	return phy_write(phydev, reg, val | set);
-}
-
 static int brcm_fet_config_init(struct phy_device *phydev)
 {
 	int reg, err, err2, brcmtest;
@@ -689,14 +678,14 @@ static int brcm_fet_config_init(struct phy_device *phydev)
 		goto done;
 
 	/* Enable auto MDIX */
-	err = brcm_phy_setbits(phydev, MII_BRCM_FET_SHDW_MISCCTRL,
+	err = phy_set_bits(phydev, MII_BRCM_FET_SHDW_MISCCTRL,
 				       MII_BRCM_FET_SHDW_MC_FAME);
 	if (err < 0)
 		goto done;
 
 	if (phydev->dev_flags & PHY_BRCM_AUTO_PWRDWN_ENABLE) {
 		/* Enable auto power down */
-		err = brcm_phy_setbits(phydev, MII_BRCM_FET_SHDW_AUXSTAT2,
+		err = phy_set_bits(phydev, MII_BRCM_FET_SHDW_AUXSTAT2,
 					       MII_BRCM_FET_SHDW_AS2_APDE);
 	}
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] net: phy: broadcom: drop brcm_phy_setbits() and use phy_set_bits() instead
  2023-06-22 12:37 [PATCH] net: phy: broadcom: drop brcm_phy_setbits() and use phy_set_bits() instead Giulio Benetti
@ 2023-06-22 12:48 ` Giulio Benetti
  2023-06-22 15:35   ` Simon Horman
  0 siblings, 1 reply; 8+ messages in thread
From: Giulio Benetti @ 2023-06-22 12:48 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: Broadcom internal kernel review list, Andrew Lunn,
	Heiner Kallweit, Russell King, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, netdev, linux-kernel

Pardon,

On 22/06/23 14:37, Giulio Benetti wrote:
> Linux provides phy_set_bits() helper so let's drop brcm_phy_setbits() and
> use phy_set_bits() in its place.
> 
> Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
> ---
>   drivers/net/phy/broadcom.c | 15 ++-------------
>   1 file changed, 2 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c
> index ad71c88c87e7..d684c5be529a 100644
> --- a/drivers/net/phy/broadcom.c
> +++ b/drivers/net/phy/broadcom.c
> @@ -608,17 +608,6 @@ static int bcm54616s_read_status(struct phy_device *phydev)
>   	return err;
>   }
>   
> -static int brcm_phy_setbits(struct phy_device *phydev, int reg, int set)
> -{
> -	int val;
> -
> -	val = phy_read(phydev, reg);
> -	if (val < 0)
> -		return val;
> -
> -	return phy_write(phydev, reg, val | set);
> -}
> -
>   static int brcm_fet_config_init(struct phy_device *phydev)
>   {
>   	int reg, err, err2, brcmtest;
> @@ -689,14 +678,14 @@ static int brcm_fet_config_init(struct phy_device *phydev)
>   		goto done;
>   
>   	/* Enable auto MDIX */
> -	err = brcm_phy_setbits(phydev, MII_BRCM_FET_SHDW_MISCCTRL,
> +	err = phy_set_bits(phydev, MII_BRCM_FET_SHDW_MISCCTRL,
>   				       MII_BRCM_FET_SHDW_MC_FAME);

I've missed to checkpatch.pl and there is a style error ^^^

>   	if (err < 0)
>   		goto done;
>   
>   	if (phydev->dev_flags & PHY_BRCM_AUTO_PWRDWN_ENABLE) {
>   		/* Enable auto power down */
> -		err = brcm_phy_setbits(phydev, MII_BRCM_FET_SHDW_AUXSTAT2,
> +		err = phy_set_bits(phydev, MII_BRCM_FET_SHDW_AUXSTAT2,
>   					       MII_BRCM_FET_SHDW_AS2_APDE);

                                       and here ^^^

I wait some time for any feedback and then I send a V2.

Best regards
-- 
CEO/CTO@Benetti Engineering sas

>   	}
>   


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] net: phy: broadcom: drop brcm_phy_setbits() and use phy_set_bits() instead
  2023-06-22 12:48 ` Giulio Benetti
@ 2023-06-22 15:35   ` Simon Horman
  2023-06-22 18:47     ` [PATCH net-next v2] " Giulio Benetti
  2023-06-22 18:50     ` [PATCH] " Giulio Benetti
  0 siblings, 2 replies; 8+ messages in thread
From: Simon Horman @ 2023-06-22 15:35 UTC (permalink / raw)
  To: Giulio Benetti
  Cc: Florian Fainelli, Broadcom internal kernel review list,
	Andrew Lunn, Heiner Kallweit, Russell King, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, netdev, linux-kernel

On Thu, Jun 22, 2023 at 02:48:46PM +0200, Giulio Benetti wrote:
> Pardon,
> 
> On 22/06/23 14:37, Giulio Benetti wrote:
> > Linux provides phy_set_bits() helper so let's drop brcm_phy_setbits() and
> > use phy_set_bits() in its place.
> > 
> > Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
> > ---
> >   drivers/net/phy/broadcom.c | 15 ++-------------
> >   1 file changed, 2 insertions(+), 13 deletions(-)
> > 
> > diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c
> > index ad71c88c87e7..d684c5be529a 100644
> > --- a/drivers/net/phy/broadcom.c
> > +++ b/drivers/net/phy/broadcom.c
> > @@ -608,17 +608,6 @@ static int bcm54616s_read_status(struct phy_device *phydev)
> >   	return err;
> >   }
> > -static int brcm_phy_setbits(struct phy_device *phydev, int reg, int set)
> > -{
> > -	int val;
> > -
> > -	val = phy_read(phydev, reg);
> > -	if (val < 0)
> > -		return val;
> > -
> > -	return phy_write(phydev, reg, val | set);
> > -}
> > -
> >   static int brcm_fet_config_init(struct phy_device *phydev)
> >   {
> >   	int reg, err, err2, brcmtest;
> > @@ -689,14 +678,14 @@ static int brcm_fet_config_init(struct phy_device *phydev)
> >   		goto done;
> >   	/* Enable auto MDIX */
> > -	err = brcm_phy_setbits(phydev, MII_BRCM_FET_SHDW_MISCCTRL,
> > +	err = phy_set_bits(phydev, MII_BRCM_FET_SHDW_MISCCTRL,
> >   				       MII_BRCM_FET_SHDW_MC_FAME);
> 
> I've missed to checkpatch.pl and there is a style error ^^^
> 
> >   	if (err < 0)
> >   		goto done;
> >   	if (phydev->dev_flags & PHY_BRCM_AUTO_PWRDWN_ENABLE) {
> >   		/* Enable auto power down */
> > -		err = brcm_phy_setbits(phydev, MII_BRCM_FET_SHDW_AUXSTAT2,
> > +		err = phy_set_bits(phydev, MII_BRCM_FET_SHDW_AUXSTAT2,
> >   					       MII_BRCM_FET_SHDW_AS2_APDE);
> 
>                                       and here ^^^
> 
> I wait some time for any feedback and then I send a V2.

Hi Giulio,

Please include the target tree, net-next, when you send v2:

	Subject: [PATCH net-next v2] ...

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH net-next v2] net: phy: broadcom: drop brcm_phy_setbits() and use phy_set_bits() instead
  2023-06-22 15:35   ` Simon Horman
@ 2023-06-22 18:47     ` Giulio Benetti
  2023-06-23  7:31       ` Simon Horman
                         ` (2 more replies)
  2023-06-22 18:50     ` [PATCH] " Giulio Benetti
  1 sibling, 3 replies; 8+ messages in thread
From: Giulio Benetti @ 2023-06-22 18:47 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: Broadcom internal kernel review list, Andrew Lunn,
	Heiner Kallweit, Russell King, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, netdev, linux-kernel, Simon Horman,
	Giulio Benetti

Linux provides phy_set_bits() helper so let's drop brcm_phy_setbits() and
use phy_set_bits() in its place.

Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
---
V1->V2:
* fix code style and add branch net-next to subject as suggested by Simon
  Horman
---
 drivers/net/phy/broadcom.c | 19 ++++---------------
 1 file changed, 4 insertions(+), 15 deletions(-)

diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c
index e81868d1830b..38a6615deaf7 100644
--- a/drivers/net/phy/broadcom.c
+++ b/drivers/net/phy/broadcom.c
@@ -608,17 +608,6 @@ static int bcm54616s_read_status(struct phy_device *phydev)
 	return err;
 }
 
-static int brcm_phy_setbits(struct phy_device *phydev, int reg, int set)
-{
-	int val;
-
-	val = phy_read(phydev, reg);
-	if (val < 0)
-		return val;
-
-	return phy_write(phydev, reg, val | set);
-}
-
 static int brcm_fet_config_init(struct phy_device *phydev)
 {
 	int reg, err, err2, brcmtest;
@@ -689,15 +678,15 @@ static int brcm_fet_config_init(struct phy_device *phydev)
 		goto done;
 
 	/* Enable auto MDIX */
-	err = brcm_phy_setbits(phydev, MII_BRCM_FET_SHDW_MISCCTRL,
-				       MII_BRCM_FET_SHDW_MC_FAME);
+	err = phy_set_bits(phydev, MII_BRCM_FET_SHDW_MISCCTRL,
+			   MII_BRCM_FET_SHDW_MC_FAME);
 	if (err < 0)
 		goto done;
 
 	if (phydev->dev_flags & PHY_BRCM_AUTO_PWRDWN_ENABLE) {
 		/* Enable auto power down */
-		err = brcm_phy_setbits(phydev, MII_BRCM_FET_SHDW_AUXSTAT2,
-					       MII_BRCM_FET_SHDW_AS2_APDE);
+		err = phy_set_bits(phydev, MII_BRCM_FET_SHDW_AUXSTAT2,
+				   MII_BRCM_FET_SHDW_AS2_APDE);
 	}
 
 done:
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] net: phy: broadcom: drop brcm_phy_setbits() and use phy_set_bits() instead
  2023-06-22 15:35   ` Simon Horman
  2023-06-22 18:47     ` [PATCH net-next v2] " Giulio Benetti
@ 2023-06-22 18:50     ` Giulio Benetti
  1 sibling, 0 replies; 8+ messages in thread
From: Giulio Benetti @ 2023-06-22 18:50 UTC (permalink / raw)
  To: Simon Horman
  Cc: Florian Fainelli, Broadcom internal kernel review list,
	Andrew Lunn, Heiner Kallweit, Russell King, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, netdev, linux-kernel

Hi Simon,

On 22/06/23 17:35, Simon Horman wrote:
> On Thu, Jun 22, 2023 at 02:48:46PM +0200, Giulio Benetti wrote:
>> Pardon,
>>
>> On 22/06/23 14:37, Giulio Benetti wrote:
>>> Linux provides phy_set_bits() helper so let's drop brcm_phy_setbits() and
>>> use phy_set_bits() in its place.
>>>
>>> Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
>>> ---
>>>    drivers/net/phy/broadcom.c | 15 ++-------------
>>>    1 file changed, 2 insertions(+), 13 deletions(-)
>>>
>>> diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c
>>> index ad71c88c87e7..d684c5be529a 100644
>>> --- a/drivers/net/phy/broadcom.c
>>> +++ b/drivers/net/phy/broadcom.c
>>> @@ -608,17 +608,6 @@ static int bcm54616s_read_status(struct phy_device *phydev)
>>>    	return err;
>>>    }
>>> -static int brcm_phy_setbits(struct phy_device *phydev, int reg, int set)
>>> -{
>>> -	int val;
>>> -
>>> -	val = phy_read(phydev, reg);
>>> -	if (val < 0)
>>> -		return val;
>>> -
>>> -	return phy_write(phydev, reg, val | set);
>>> -}
>>> -
>>>    static int brcm_fet_config_init(struct phy_device *phydev)
>>>    {
>>>    	int reg, err, err2, brcmtest;
>>> @@ -689,14 +678,14 @@ static int brcm_fet_config_init(struct phy_device *phydev)
>>>    		goto done;
>>>    	/* Enable auto MDIX */
>>> -	err = brcm_phy_setbits(phydev, MII_BRCM_FET_SHDW_MISCCTRL,
>>> +	err = phy_set_bits(phydev, MII_BRCM_FET_SHDW_MISCCTRL,
>>>    				       MII_BRCM_FET_SHDW_MC_FAME);
>>
>> I've missed to checkpatch.pl and there is a style error ^^^
>>
>>>    	if (err < 0)
>>>    		goto done;
>>>    	if (phydev->dev_flags & PHY_BRCM_AUTO_PWRDWN_ENABLE) {
>>>    		/* Enable auto power down */
>>> -		err = brcm_phy_setbits(phydev, MII_BRCM_FET_SHDW_AUXSTAT2,
>>> +		err = phy_set_bits(phydev, MII_BRCM_FET_SHDW_AUXSTAT2,
>>>    					       MII_BRCM_FET_SHDW_AS2_APDE);
>>
>>                                        and here ^^^
>>
>> I wait some time for any feedback and then I send a V2.
> 
> Hi Giulio,
> 
> Please include the target tree, net-next, when you send v2:
> 
> 	Subject: [PATCH net-next v2] ...

Thank you,

I've just sent the v2 in reply to this.

Best regards
-- 
Giulio Benetti
CEO&CTO@Benetti Engineering sas

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH net-next v2] net: phy: broadcom: drop brcm_phy_setbits() and use phy_set_bits() instead
  2023-06-22 18:47     ` [PATCH net-next v2] " Giulio Benetti
@ 2023-06-23  7:31       ` Simon Horman
  2023-06-23  9:25       ` Florian Fainelli
  2023-06-24 22:10       ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 8+ messages in thread
From: Simon Horman @ 2023-06-23  7:31 UTC (permalink / raw)
  To: Giulio Benetti
  Cc: Florian Fainelli, Broadcom internal kernel review list,
	Andrew Lunn, Heiner Kallweit, Russell King, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, netdev, linux-kernel

On Thu, Jun 22, 2023 at 08:47:21PM +0200, Giulio Benetti wrote:
> Linux provides phy_set_bits() helper so let's drop brcm_phy_setbits() and
> use phy_set_bits() in its place.
> 
> Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
> ---
> V1->V2:
> * fix code style and add branch net-next to subject as suggested by Simon
>   Horman
> ---
>  drivers/net/phy/broadcom.c | 19 ++++---------------
>  1 file changed, 4 insertions(+), 15 deletions(-)

Reviewed-by: Simon Horman <simon.horman@corigine.com>


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH net-next v2] net: phy: broadcom: drop brcm_phy_setbits() and use phy_set_bits() instead
  2023-06-22 18:47     ` [PATCH net-next v2] " Giulio Benetti
  2023-06-23  7:31       ` Simon Horman
@ 2023-06-23  9:25       ` Florian Fainelli
  2023-06-24 22:10       ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 8+ messages in thread
From: Florian Fainelli @ 2023-06-23  9:25 UTC (permalink / raw)
  To: Giulio Benetti, Florian Fainelli
  Cc: Broadcom internal kernel review list, Andrew Lunn,
	Heiner Kallweit, Russell King, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, netdev, linux-kernel, Simon Horman

[-- Attachment #1: Type: text/plain, Size: 307 bytes --]



On 6/22/2023 7:47 PM, Giulio Benetti wrote:
> Linux provides phy_set_bits() helper so let's drop brcm_phy_setbits() and
> use phy_set_bits() in its place.
> 
> Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>

Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
-- 
Florian

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4221 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH net-next v2] net: phy: broadcom: drop brcm_phy_setbits() and use phy_set_bits() instead
  2023-06-22 18:47     ` [PATCH net-next v2] " Giulio Benetti
  2023-06-23  7:31       ` Simon Horman
  2023-06-23  9:25       ` Florian Fainelli
@ 2023-06-24 22:10       ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 8+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-06-24 22:10 UTC (permalink / raw)
  To: Giulio Benetti
  Cc: f.fainelli, bcm-kernel-feedback-list, andrew, hkallweit1, linux,
	davem, edumazet, kuba, pabeni, netdev, linux-kernel,
	simon.horman

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Thu, 22 Jun 2023 20:47:21 +0200 you wrote:
> Linux provides phy_set_bits() helper so let's drop brcm_phy_setbits() and
> use phy_set_bits() in its place.
> 
> Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
> ---
> V1->V2:
> * fix code style and add branch net-next to subject as suggested by Simon
>   Horman
> 
> [...]

Here is the summary with links:
  - [net-next,v2] net: phy: broadcom: drop brcm_phy_setbits() and use phy_set_bits() instead
    https://git.kernel.org/netdev/net-next/c/28e219aea0b9

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-06-24 22:10 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-22 12:37 [PATCH] net: phy: broadcom: drop brcm_phy_setbits() and use phy_set_bits() instead Giulio Benetti
2023-06-22 12:48 ` Giulio Benetti
2023-06-22 15:35   ` Simon Horman
2023-06-22 18:47     ` [PATCH net-next v2] " Giulio Benetti
2023-06-23  7:31       ` Simon Horman
2023-06-23  9:25       ` Florian Fainelli
2023-06-24 22:10       ` patchwork-bot+netdevbpf
2023-06-22 18:50     ` [PATCH] " Giulio Benetti

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.