Skip to contentSkip to conversation

net: phy: broadcom: drop brcm_phy_setbits() and use phy_set_bits() instead

PATCH Superseded Giulio Benetti 4 participants 8 messages Jun 22, 2023 – Jun 24, 2023

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: phy: broadcom: drop brcm_phy_setbits() and use phy_set_bits() instead

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

---
 drivers/net/phy/broadcom.c | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)
drivers/net/phy/broadcom.c +2 -13
index ad71c88c87e7..d684c5be529a 100644
@@ -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);
 	}
 
Signature · 1 line
2.34.1
#1 lore raw

Pardon,

Quoted 31 lines · Giulio Benetti

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

---
  drivers/net/phy/broadcom.c | 15 ++-------------
  1 file changed, 2 insertions(+), 13 deletions(-)
drivers/net/phy/broadcom.c +0 -11
index ad71c88c87e7..d684c5be529a 100644
@@ -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;

drivers/net/phy/broadcom.c static int brcm_fet_config_init(struct phy_device *phydev) · line 682

Quoted 6 lines
drivers/net/phy/broadcom.c +1 -1
@@ -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 ^^^

drivers/net/phy/broadcom.c static int brcm_fet_config_init(struct phy_device *phydev) · line 689

Quoted 8 lines
drivers/net/phy/broadcom.c +1 -1
  	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

Signature · 1 line
CEO/CTO@Benetti Engineering sas
Quoted 2 lines
drivers/net/phy/broadcom.c +0 -0
  	}
 
#2 lore raw
Quoted 51 lines · Giulio Benetti

Pardon,

Quoted 30 lines · Giulio Benetti

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

---
  drivers/net/phy/broadcom.c | 15 ++-------------
  1 file changed, 2 insertions(+), 13 deletions(-)
drivers/net/phy/broadcom.c +0 -11
index ad71c88c87e7..d684c5be529a 100644
@@ -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;

drivers/net/phy/broadcom.c static int brcm_fet_config_init(struct phy_device *phydev) · line 681

Quoted 5 lines
drivers/net/phy/broadcom.c +1 -1
@@ -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 ^^^

drivers/net/phy/broadcom.c static int brcm_fet_config_init(struct phy_device *phydev) · line 689

Quoted 7 lines
drivers/net/phy/broadcom.c +1 -1
  	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 ^^^

Quoted 1 line

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] ...

#3 lore raw

PATCH v2 1/1 net: phy: broadcom: drop brcm_phy_setbits() and use phy_set_bits() instead

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

---
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(-)
drivers/net/phy/broadcom.c +4 -15
index e81868d1830b..38a6615deaf7 100644
@@ -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:
Signature · 1 line
2.34.1
#7 lore raw
In reply to Simon Horman

Hi Simon,

Quoted 52 lines · Simon Horman
Quoted 51 lines · Giulio Benetti

Pardon,

Quoted 30 lines · Giulio Benetti

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

---
   drivers/net/phy/broadcom.c | 15 ++-------------
   1 file changed, 2 insertions(+), 13 deletions(-)
drivers/net/phy/broadcom.c +0 -11
index ad71c88c87e7..d684c5be529a 100644
@@ -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;

drivers/net/phy/broadcom.c static int brcm_fet_config_init(struct phy_device *phydev) · line 681

Quoted 5 lines
drivers/net/phy/broadcom.c +1 -1
@@ -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 ^^^

drivers/net/phy/broadcom.c static int brcm_fet_config_init(struct phy_device *phydev) · line 689

Quoted 7 lines
drivers/net/phy/broadcom.c +1 -1
   	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 ^^^

Quoted 7 lines
Quoted 1 line

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

Signature · 2 lines
Giulio Benetti
CEO&CTO@Benetti Engineering sas
Reviewed-by on v2 1/1
#4 lore raw
In reply to Giulio Benetti
Quoted 11 lines · Giulio Benetti

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

---
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(-)
#6 lore raw
In reply to Giulio Benetti
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 10 lines · 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.

---
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!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html