All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: phy: Log only PHY state transitions
@ 2017-07-25  9:31 Marc Gonzalez
  2017-07-25 19:33 ` David Miller
  2017-07-28 11:18 ` [PATCH v2] " Marc Gonzalez
  0 siblings, 2 replies; 5+ messages in thread
From: Marc Gonzalez @ 2017-07-25  9:31 UTC (permalink / raw)
  To: Andrew Lunn, Florian Fainelli; +Cc: netdev, Mason

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));
 
-- 
2.11.0

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

* Re: [PATCH] net: phy: Log only PHY state transitions
  2017-07-25  9:31 [PATCH] net: phy: Log only PHY state transitions Marc Gonzalez
@ 2017-07-25 19:33 ` David Miller
  2017-07-26 17:24   ` Florian Fainelli
  2017-07-28 11:18 ` [PATCH v2] " Marc Gonzalez
  1 sibling, 1 reply; 5+ messages in thread
From: David Miller @ 2017-07-25 19:33 UTC (permalink / raw)
  To: marc_gonzalez; +Cc: andrew, f.fainelli, netdev, slash.tmp

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.

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

* Re: [PATCH] net: phy: Log only PHY state transitions
  2017-07-25 19:33 ` David Miller
@ 2017-07-26 17:24   ` Florian Fainelli
  0 siblings, 0 replies; 5+ messages in thread
From: Florian Fainelli @ 2017-07-26 17:24 UTC (permalink / raw)
  To: David Miller, marc_gonzalez; +Cc: andrew, netdev, slash.tmp

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

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

* [PATCH v2] net: phy: Log only PHY state transitions
  2017-07-25  9:31 [PATCH] net: phy: Log only PHY state transitions Marc Gonzalez
  2017-07-25 19:33 ` David Miller
@ 2017-07-28 11:18 ` Marc Gonzalez
  2017-07-31 23:21   ` David Miller
  1 sibling, 1 reply; 5+ messages in thread
From: Marc Gonzalez @ 2017-07-28 11:18 UTC (permalink / raw)
  To: Andrew Lunn, Florian Fainelli, David S. Miller; +Cc: netdev, Mason

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>
---
Fix indentation. I was trying to minimize the diff.
I also considered using a goto to jump over the phydev_dbg() call,
but that didn't feel right.
---
 drivers/net/phy/phy.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index d0626bf5c540..3ff79c3d90f0 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -1226,9 +1226,10 @@ void phy_state_machine(struct work_struct *work)
 	if (err < 0)
 		phy_error(phydev);
 
-	phydev_dbg(phydev, "PHY state change %s -> %s\n",
-		   phy_state_to_str(old_state),
-		   phy_state_to_str(phydev->state));
+	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));
 
 	/* Only re-schedule a PHY state machine change if we are polling the
 	 * PHY, if PHY_IGNORE_INTERRUPT is set, then we will be moving
-- 
2.11.0

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

* Re: [PATCH v2] net: phy: Log only PHY state transitions
  2017-07-28 11:18 ` [PATCH v2] " Marc Gonzalez
@ 2017-07-31 23:21   ` David Miller
  0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2017-07-31 23:21 UTC (permalink / raw)
  To: marc_gonzalez; +Cc: andrew, f.fainelli, netdev, slash.tmp

From: Marc Gonzalez <marc_gonzalez@sigmadesigns.com>
Date: Fri, 28 Jul 2017 13:18:30 +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>

Applied to net-next, thanks.

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

end of thread, other threads:[~2017-07-31 23:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-25  9:31 [PATCH] net: phy: Log only PHY state transitions Marc Gonzalez
2017-07-25 19:33 ` David Miller
2017-07-26 17:24   ` Florian Fainelli
2017-07-28 11:18 ` [PATCH v2] " Marc Gonzalez
2017-07-31 23:21   ` David Miller

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.