diff mbox

net: phy: Log only PHY state transitions

Message ID 8fc7eb8f-9d64-04c3-a1ca-0cc8eec1ee30@sigmadesigns.com
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Marc Gonzalez July 25, 2017, 9:31 a.m. UTC
In the current code, old and new PHY states are always logged.
From now on, log only PHY state transitions.

Signed-off-by: Marc Gonzalez <marc_gonzalez@sigmadesigns.com>
---
 drivers/net/phy/phy.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

David Miller July 25, 2017, 7:33 p.m. UTC | #1
From: Marc Gonzalez <marc_gonzalez@sigmadesigns.com>
Date: Tue, 25 Jul 2017 11:31:46 +0200

> In the current code, old and new PHY states are always logged.
> From now on, log only PHY state transitions.
> 
> Signed-off-by: Marc Gonzalez <marc_gonzalez@sigmadesigns.com>
> ---
>  drivers/net/phy/phy.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
> index d0626bf5c540..6bb764e716fc 100644
> --- a/drivers/net/phy/phy.c
> +++ b/drivers/net/phy/phy.c
> @@ -1226,7 +1226,8 @@ void phy_state_machine(struct work_struct *work)
>  	if (err < 0)
>  		phy_error(phydev);
>  
> -	phydev_dbg(phydev, "PHY state change %s -> %s\n",
> +	if (old_state != phydev->state)
> +		phydev_dbg(phydev, "PHY state change %s -> %s\n",
>  		   phy_state_to_str(old_state),
>  		   phy_state_to_str(phydev->state));

Something is not kosher with this indentation at all.
Florian Fainelli July 26, 2017, 5:24 p.m. UTC | #2
On 07/25/2017 12:33 PM, David Miller wrote:
> From: Marc Gonzalez <marc_gonzalez@sigmadesigns.com>
> Date: Tue, 25 Jul 2017 11:31:46 +0200
> 
>> In the current code, old and new PHY states are always logged.
>> From now on, log only PHY state transitions.
>>
>> Signed-off-by: Marc Gonzalez <marc_gonzalez@sigmadesigns.com>
>> ---
>>  drivers/net/phy/phy.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
>> index d0626bf5c540..6bb764e716fc 100644
>> --- a/drivers/net/phy/phy.c
>> +++ b/drivers/net/phy/phy.c
>> @@ -1226,7 +1226,8 @@ void phy_state_machine(struct work_struct *work)
>>  	if (err < 0)
>>  		phy_error(phydev);
>>  
>> -	phydev_dbg(phydev, "PHY state change %s -> %s\n",
>> +	if (old_state != phydev->state)
>> +		phydev_dbg(phydev, "PHY state change %s -> %s\n",
>>  		   phy_state_to_str(old_state),
>>  		   phy_state_to_str(phydev->state));
> 
> Something is not kosher with this indentation at all.

Indeed, please align the two phy_state_to_str() where the opening
parenthesis for phydev_dbg() starts, such this visually looks like:

if (old_state != phydev->state)
	phydev_dbg(phydev, "PHY state change %s -> %s\n",
		   phy_state_to_str(old_state),
		   phy_state_to_str(phydev->state));

Thanks!
diff mbox

Patch

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index d0626bf5c540..6bb764e716fc 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -1226,7 +1226,8 @@  void phy_state_machine(struct work_struct *work)
 	if (err < 0)
 		phy_error(phydev);
 
-	phydev_dbg(phydev, "PHY state change %s -> %s\n",
+	if (old_state != phydev->state)
+		phydev_dbg(phydev, "PHY state change %s -> %s\n",
 		   phy_state_to_str(old_state),
 		   phy_state_to_str(phydev->state));