[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y7P/45Owf2IezIpO@shell.armlinux.org.uk>
Date: Tue, 3 Jan 2023 10:13:55 +0000
From: "Russell King (Oracle)" <linux@...linux.org.uk>
To: Michael Walle <michael@...le.cc>
Cc: Heiner Kallweit <hkallweit1@...il.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Jose Abreu <Jose.Abreu@...opsys.com>,
Sergey Shtylyov <s.shtylyov@....ru>,
Wei Fang <wei.fang@....com>,
Shenwei Wang <shenwei.wang@....com>,
Clark Wang <xiaoning.wang@....com>,
NXP Linux Team <linux-imx@....com>,
Sean Wang <sean.wang@...iatek.com>,
Landen Chao <Landen.Chao@...iatek.com>,
DENG Qingfang <dqfext@...il.com>,
Florian Fainelli <f.fainelli@...il.com>,
Vladimir Oltean <olteanv@...il.com>,
Matthias Brugger <matthias.bgg@...il.com>,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-renesas-soc@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org, Andrew Lunn <andrew@...n.ch>,
Geert Uytterhoeven <geert+renesas@...der.be>
Subject: Re: [PATCH RFC net-next v2 03/12] net: mdio: mdiobus_register:
update validation test
Hi Michael,
Thanks for picking this up!
On Wed, Dec 28, 2022 at 12:07:19AM +0100, Michael Walle wrote:
> + if (!bus || !bus->name)
> + return -EINVAL;
> +
> + /* An access method always needs both read and write operations */
> + if ((bus->read && !bus->write) ||
> + (!bus->read && bus->write) ||
> + (bus->read_c45 && !bus->write_c45) ||
> + (!bus->read_c45 && bus->write_c45))
I wonder whether the following would be even more readable:
if (!bus->read != !bus->write || !bus->read_c45 != !bus->write_c45)
which essentially asserts that the boolean of !method for the read and
write methods must match.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
Powered by blists - more mailing lists