netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Heiner Kallweit <hkallweit1@gmail.com>
To: Paolo Abeni <pabeni@redhat.com>,
	Eric Dumazet <edumazet@google.com>,
	David Miller <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	Russell King - ARM Linux <linux@armlinux.org.uk>,
	Andrew Lunn <andrew@lunn.ch>
Subject: Re: [PATCH net-next] net: phy: simplify a check in phy_check_link_status
Date: Mon, 11 Mar 2024 21:44:34 +0100	[thread overview]
Message-ID: <ef591e21-9865-492a-a0d7-3ae6dfff6508@gmail.com> (raw)
In-Reply-To: <de37bf30-61dd-49f9-b645-2d8ea11ddb5d@gmail.com>

On 07.03.2024 22:16, Heiner Kallweit wrote:
> Handling case err == 0 in the other branch allows to simplify the
> code. In addition I assume in "err & phydev->eee_cfg.tx_lpi_enabled"
> it should have been a logical and operator. It works as expected also
> with the bitwise and, but using a bitwise and with a bool value looks
> ugly to me.
> 
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> ---
>  drivers/net/phy/phy.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
> index c3a0a5ee5..c4236564c 100644
> --- a/drivers/net/phy/phy.c
> +++ b/drivers/net/phy/phy.c
> @@ -985,10 +985,10 @@ static int phy_check_link_status(struct phy_device *phydev)
>  		phydev->state = PHY_RUNNING;
>  		err = genphy_c45_eee_is_active(phydev,
>  					       NULL, NULL, NULL);
> -		if (err < 0)
> +		if (err <= 0)
>  			phydev->enable_tx_lpi = false;
>  		else
> -			phydev->enable_tx_lpi = (err & phydev->eee_cfg.tx_lpi_enabled);
> +			phydev->enable_tx_lpi = phydev->eee_cfg.tx_lpi_enabled;
>  
>  		phy_link_up(phydev);
>  	} else if (!phydev->link && phydev->state != PHY_NOLINK) {

This patch was set to "changes requested" in patchwork. The comment that this refers to
(make two patches a series) isn't applicable and I answered to it here:
https://lore.kernel.org/netdev/d6ee6353-5cb0-4751-9b69-255ab62e6b56@gmail.com/T/
Whatever is better for you: If it can still be applied, fine. Otherwise I'd resubmit
after the merge window.


  parent reply	other threads:[~2024-03-11 20:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-07 21:16 [PATCH net-next] net: phy: simplify a check in phy_check_link_status Heiner Kallweit
2024-03-08  4:50 ` [PATCH] " Ratheesh Kannoth
2024-03-08  7:09   ` Heiner Kallweit
2024-03-08  7:39 ` [EXTERNAL] [PATCH net-next] " Suman Ghosh
2024-03-11 20:44 ` Heiner Kallweit [this message]
2024-03-11 21:10 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ef591e21-9865-492a-a0d7-3ae6dfff6508@gmail.com \
    --to=hkallweit1@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).