public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Horatiu Vultur <horatiu.vultur@microchip.com>
Cc: andrew@lunn.ch, hkallweit1@gmail.com, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next] net: phy: micrel: Add Fast link failure support for lan8842
Date: Mon, 15 Sep 2025 13:01:44 +0100	[thread overview]
Message-ID: <aMgAKIn0YRyxK0Fn@shell.armlinux.org.uk> (raw)
In-Reply-To: <20250915091149.3539162-1-horatiu.vultur@microchip.com>

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

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

  reply	other threads:[~2025-09-15 12:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-15  9:11 [PATCH net-next] net: phy: micrel: Add Fast link failure support for lan8842 Horatiu Vultur
2025-09-15 12:01 ` Russell King (Oracle) [this message]
2025-09-16  7:07   ` Horatiu Vultur
2025-09-15 12:42 ` Andrew Lunn
2025-09-16  7:34   ` Horatiu Vultur
2025-09-16 12:53     ` Andrew Lunn
2025-09-17  7:05       ` Horatiu Vultur

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=aMgAKIn0YRyxK0Fn@shell.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=horatiu.vultur@microchip.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --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