Re: [PATCH net-next v2 1/3] net: phy: air_en8811h: factor out shareable code

2 messages, 2 authors, 2026-01-24 · open the first message on its own page

Re: [PATCH net-next v2 1/3] net: phy: air_en8811h: factor out shareable code

From: Bjørn Mork <bjorn@mork.no>
Date: 2026-01-24 16:55:35

Andrew Lunn [off-list ref] writes:
quoted
-static int en8811h_read_status(struct phy_device *phydev)
+static int en8811h_get_lpa(struct phy_device *phydev)
 {
-	struct en8811h_priv *priv = phydev->priv;
-	u32 pbus_value;
-	int ret, val;
+	int ret;
 
 	ret = genphy_update_link(phydev);
 	if (ret)
This call to genphy_update_link() means this function is doing more
than en8811h_get_lpa() would imply.

It is hard to see from just the patch, but it also seems to set the
state in phydev back to unknown defaults, and read the master/slave
status?

So i think it needs a better name.
Yes, that was my feeling too. Just couldn't think of any.  So I took the
lazy route.  You wouldn't happen to have a suggestion?

OK, I know it's my job.  I'll try to come up with something better.


Bjørn

Re: [PATCH net-next v2 1/3] net: phy: air_en8811h: factor out shareable code

From: Andrew Lunn <andrew@lunn.ch>
Date: 2026-01-24 18:39:06

On Sat, Jan 24, 2026 at 05:55:05PM +0100, Bjørn Mork wrote:
Andrew Lunn [off-list ref] writes:
quoted
quoted
-static int en8811h_read_status(struct phy_device *phydev)
+static int en8811h_get_lpa(struct phy_device *phydev)
 {
-	struct en8811h_priv *priv = phydev->priv;
-	u32 pbus_value;
-	int ret, val;
+	int ret;
 
 	ret = genphy_update_link(phydev);
 	if (ret)
This call to genphy_update_link() means this function is doing more
than en8811h_get_lpa() would imply.

It is hard to see from just the patch, but it also seems to set the
state in phydev back to unknown defaults, and read the master/slave
status?

So i think it needs a better name.
Yes, that was my feeling too. Just couldn't think of any.  So I took the
lazy route.  You wouldn't happen to have a suggestion?
Maybe a different strategy. Most of read_status is generic, it appears
just reading lpa is specific to the device. So have a generic
read_status() function, and then use phy_id_compare() to call the
needed device specific function.

       Andrew
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help