[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <81b74ddc-58dc-78e7-e647-8f90933d6a88@gmail.com>
Date: Tue, 30 May 2023 11:03:31 +0200
From: Heiner Kallweit <hkallweit1@...il.com>
To: Lu Hongfei <luhongfei@...o.com>, Andrew Lunn <andrew@...n.ch>,
Russell King <linux@...linux.org.uk>, "David S. Miller"
<davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
"open list:ETHERNET PHY LIBRARY" <netdev@...r.kernel.org>,
open list <linux-kernel@...r.kernel.org>
Cc: opensource.kernel@...o.com
Subject: Re: [PATCH] net: Replace the ternary conditional operator with min()
On 30.05.2023 10:45, Lu Hongfei wrote:
> It would be better to replace the traditional ternary conditional
> operator with min()
>
No. If you say something is better you should explain the benefit.
> Signed-off-by: Lu Hongfei <luhongfei@...o.com>
> ---
> drivers/net/phy/phy.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
> mode change 100644 => 100755 drivers/net/phy/phy.c
>
> diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
> index 0c0df38cd1ab..a8beb4ab8451
> --- a/drivers/net/phy/phy.c
> +++ b/drivers/net/phy/phy.c
> @@ -1002,7 +1002,7 @@ static int phy_poll_aneg_done(struct phy_device *phydev)
> if (!ret)
> return -ETIMEDOUT;
>
> - return ret < 0 ? ret : 0;
> + return min(ret, 0);
ret < 0 stands for is_err(ret), therefore an arithmetic operator isn't
appropriate here.
> }
>
> int phy_ethtool_ksettings_set(struct phy_device *phydev,
> @@ -1526,7 +1526,7 @@ int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable)
> ret = phy_set_bits_mmd(phydev, MDIO_MMD_PCS, MDIO_CTRL1,
> MDIO_PCS_CTRL1_CLKSTOP_EN);
>
> - return ret < 0 ? ret : 0;
> + return min(ret, 0);
> }
> EXPORT_SYMBOL(phy_init_eee);
>
Powered by blists - more mailing lists