[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250916070700.qxhnjwy4r3brvdys@DEN-DL-M31836.microchip.com>
Date: Tue, 16 Sep 2025 09:07:00 +0200
From: Horatiu Vultur <horatiu.vultur@...rochip.com>
To: "Russell King (Oracle)" <linux@...linux.org.uk>
CC: <andrew@...n.ch>, <hkallweit1@...il.com>, <davem@...emloft.net>,
<edumazet@...gle.com>, <kuba@...nel.org>, <pabeni@...hat.com>,
<netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH net-next] net: phy: micrel: Add Fast link failure support
for lan8842
The 09/15/2025 13:01, Russell King (Oracle) wrote:
Hi Russell,
>
> On Mon, Sep 15, 2025 at 11:11:49AM +0200, Horatiu Vultur wrote:
> > +static int lan8842_set_fast_down(struct phy_device *phydev, const u8 *msecs)
> > +{
> > + if (*msecs == ETHTOOL_PHY_FAST_LINK_DOWN_ON)
> > + return lanphy_modify_page_reg(phydev, LAN8814_PAGE_PCS,
> > + LAN8842_FLF,
> > + LAN8842_FLF_ENA |
> > + LAN8842_FLF_ENA_LINK_DOWN,
> > + LAN8842_FLF_ENA |
> > + LAN8842_FLF_ENA_LINK_DOWN);
> > +
> > + if (*msecs == ETHTOOL_PHY_FAST_LINK_DOWN_OFF)
> > + return lanphy_modify_page_reg(phydev, LAN8814_PAGE_PCS,
> > + LAN8842_FLF,
> > + LAN8842_FLF_ENA |
> > + LAN8842_FLF_ENA_LINK_DOWN, 0);
>
> Would this be more readable?
>
> u16 flf;
>
> switch (*msecs) {
> case ETHTOOL_PHY_FAST_LINK_DOWN_OFF:
> flf = 0;
> break;
>
> case ETHTOOL_PHY_FAST_LINK_DOWN_ON:
> flf = LAN8842_FLF_ENA | LAN8842_FLF_ENA_LINK_DOWN;
> break;
>
> default:
> return -EINVAL;
> }
>
> return lanphy_modify_page_reg(phydev, LAN8814_PAGE_PCS,
> LAN8842_FLF,
> LAN8842_FLF_ENA |
> LAN8842_FLF_ENA_LINK_DOWN, flf);
Yes, I think it looks nicer.
I will update this in the next version.
>
> --
> RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
> FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
--
/Horatiu
Powered by blists - more mailing lists