[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d66d8163-76f2-4a34-9e7f-b735a6774156@lunn.ch>
Date: Tue, 15 Apr 2025 14:33:43 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Christian Marangi <ansuelsmth@...il.com>
Cc: "Russell King (Oracle)" <linux@...linux.org.uk>,
Andrew Lunn <andrew+netdev@...n.ch>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>,
Heiner Kallweit <hkallweit1@...il.com>,
Florian Fainelli <florian.fainelli@...adcom.com>,
Broadcom internal kernel review list <bcm-kernel-feedback-list@...adcom.com>,
Marek BehĂșn <kabel@...nel.org>,
Andrei Botila <andrei.botila@....nxp.com>,
Sabrina Dubroca <sd@...asysnail.net>,
Eric Woudstra <ericwouds@...il.com>,
Daniel Golle <daniel@...rotopia.org>, netdev@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.or
Subject: Re: [net-next PATCH v7 5/6] net: phy: Add support for Aeonsemi
AS21xxx PHYs
> > static bool aeon_ipc_ready(u16 val, bool parity_status)
> > {
> > u16 status;
> >
> > if (FIELD_GET(AEON_IPC_STS_PARITY, val) != parity_status)
> > return false;
> >
> > status = val & AEON_IPC_STS_STATUS;
> >
> > return status != AEON_IPC_STS_STATUS_RCVD &&
> > status != AEON_IPC_STS_STATUS_PROCESS &&
> > status != AEON_IPC_STS_STATUS_BUSY;
> > }
> >
> > would be better, and then maybe you can fit the code into less than 80
> > columns. I'm not a fan of FIELD_PREP_CONST() when it causes differing
> > usage patterns like the above (FIELD_GET(AEON_IPC_STS_STATUS, val)
> > would match the coding style, and probably makes no difference to the
> > code emitted.)
> >
>
> You are suggesting to use a generic readx function or use a while +
> sleep to use the suggested _ready function?
#define phy_read_mmd_poll_timeout(phydev, devaddr, regnum, val, cond, \
sleep_us, timeout_us, sleep_before_read) \
({ \
int __ret, __val; \
__ret = read_poll_timeout(__val = phy_read_mmd, val, \
__val < 0 || (cond), \
The macro magic probably allows you to make cond a function call.
Andrew
Powered by blists - more mailing lists