netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Daniel Golle <daniel@makrotopia.org>
Cc: Heiner Kallweit <hkallweit1@gmail.com>,
	Russell King <linux@armlinux.org.uk>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next] net: phy: intel-xway: add support for PHY LEDs
Date: Wed, 9 Oct 2024 14:38:16 +0200	[thread overview]
Message-ID: <6f2cf2f0-08db-4b83-bfc9-0efab8324ac9@lunn.ch> (raw)
In-Reply-To: <ZwZ31IkwY-bum7T0@makrotopia.org>

On Wed, Oct 09, 2024 at 01:32:20PM +0100, Daniel Golle wrote:
> On Wed, Oct 09, 2024 at 02:16:29PM +0200, Andrew Lunn wrote:
> > > +static int xway_gphy_led_polarity_set(struct phy_device *phydev, int index,
> > > +				      unsigned long modes)
> > > +{
> > > +	bool active_low = false;
> > > +	u32 mode;
> > > +
> > > +	if (index >= XWAY_GPHY_MAX_LEDS)
> > > +		return -EINVAL;
> > > +
> > > +	for_each_set_bit(mode, &modes, __PHY_LED_MODES_NUM) {
> > > +		switch (mode) {
> > > +		case PHY_LED_ACTIVE_LOW:
> > > +			active_low = true;
> > > +			break;
> > > +		case PHY_LED_ACTIVE_HIGH:
> > > +			break;
> > > +		default:
> > > +			return -EINVAL;
> > > +		}
> > > +	}
> > > +
> > > +	return phy_modify(phydev, XWAY_MDIO_LED, XWAY_GPHY_LED_INV(index),
> > > +			  active_low ? XWAY_GPHY_LED_INV(index) : 0);
> > 
> > This does not appear to implement the 'leave it alone' option.
> 
> The framework already implements that. The function is never called with
> modes == 0.

I was wondering about that.

But if this ever gets extended to support other properties, like HI-Z,
it is a bit of a trap waiting for somebody to fall into.

It is correct, so: Reviewed-by: Andrew Lunn <andrew@lunn.ch> but it
would be nice if it was a bit more robust.

    Andrew

  reply	other threads:[~2024-10-09 12:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-09  2:28 [PATCH net-next] net: phy: intel-xway: add support for PHY LEDs Daniel Golle
2024-10-09 12:16 ` Andrew Lunn
2024-10-09 12:32   ` Daniel Golle
2024-10-09 12:38     ` Andrew Lunn [this message]
2024-10-10 13:23 ` kernel test robot
2024-10-10 15:38 ` kernel test robot

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=6f2cf2f0-08db-4b83-bfc9-0efab8324ac9@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=daniel@makrotopia.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.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).