From: Christian Marangi <ansuelsmth@gmail.com>
To: Andrew Lunn <andrew@lunn.ch>
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: [net-next PATCH v2] net: phy: Validate PHY LED OPs presence before registering
Date: Tue, 8 Oct 2024 19:04:54 +0200 [thread overview]
Message-ID: <67056638.050a0220.179d84.0dc1@mx.google.com> (raw)
In-Reply-To: <9ed5fd73-b4e8-4be1-9642-9dbeb8bfd892@lunn.ch>
On Tue, Oct 08, 2024 at 07:02:18PM +0200, Andrew Lunn wrote:
> On Tue, Oct 08, 2024 at 03:13:34PM +0200, Christian Marangi wrote:
> > On Tue, Oct 08, 2024 at 03:08:32PM +0200, Andrew Lunn wrote:
> > > > + /* Check if the PHY driver have at least an OP to
> > > > + * set the LEDs.
> > > > + */
> > > > + if (!phydev->drv->led_brightness_set &&
> > > > + !phydev->drv->led_blink_set &&
> > > > + !phydev->drv->led_hw_control_set) {
> > >
> > > I think this condition is too strong. All that should be required is
> > > led_brightness_set(). The rest can be done in software.
> > >
> >
> > Mhh the idea was really to check if one of the 3 is declared. Ideally to
> > future proof case where some led will only expose led_hw_control_set or
> > only led_blink_set?
>
> Ah, i read it wrong. Sorry.
>
> Maybe apply De Morgan's laws to make it more readable?
>
> + if (!(phydev->drv->led_brightness_set ||
> + phydev->drv->led_blink_set ||
> + phydev->drv->led_hw_control_set)) {
>
> However, it is correct as is.
>
Happy to send v3. Np!
--
Ansuel
prev parent reply other threads:[~2024-10-08 17:04 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-04 18:33 [net-next PATCH v2] net: phy: Validate PHY LED OPs presence before registering Christian Marangi
2024-10-08 13:08 ` Andrew Lunn
2024-10-08 13:12 ` Daniel Golle
2024-10-08 13:13 ` Christian Marangi
2024-10-08 17:02 ` Andrew Lunn
2024-10-08 17:04 ` Christian Marangi [this message]
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=67056638.050a0220.179d84.0dc1@mx.google.com \
--to=ansuelsmth@gmail.com \
--cc=andrew@lunn.ch \
--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).