Thread (4 messages) flat view 4 messages, 3 authors, 28d ago

RE: [PATCH] rust: net: phy: fix off-by-one bit positions in device status accessors

From: <hidden>
Date: 2026-08-23 15:51:30
Also in: rust-for-linux

I checked the history: it was the latter. 

When the abstraction was merged (v6.8), autoneg, link, and autoneg_complete
were at bits 13, 14, and 15, and the hand-written numbers were correct. 

Commit 2796ff1e3dca ("net: phy: add flag is_genphy_driven to struct
phy_device", merged in v6.17) inserted is_genphy_driven just before autoneg,
shifting the three fields up by one, and the Rust accessors were not
updated.

The v2 will use the bindgen-generated accessors (link(), autoneg(),
autoneg_complete()) instead of the hard-coded numbers, which also removes
the TODO comment that marked them as a stopgap.

I'll send it once the 24-hour resend window for v1 has passed.

	Thanks,
	Chunfeng

-----Original Message-----
From: Andrew Lunn <andrew@lunn.ch> 
Sent: 2026年8月23日 23:27
To: springbreeze <redacted>
Cc: Miguel Ojeda <redacted>;
rust-for-linux@vger.kernel.org; netdev@vger.kernel.org; FUJITA Tomonori
[off-list ref]; Miguel Ojeda [off-list ref]; Boqun Feng
[off-list ref]
Subject: Re: [PATCH] rust: net: phy: fix off-by-one bit positions in device
status accessors

On Sun, Aug 23, 2026 at 07:56:53PM +0800, springbreeze wrote:
Thanks, that makes sense. I will keep v2 to the minimal bit-number fix 
(with
Cc: stable) and send the switch to the bindgen-generated accessors as 
a separate follow-up patch once the fix lands.
Did you look at the history. Was this always wrong? Or was a new bit added
at some point, moving them by one?

If it was always wrong, updating the hard coding is not so bad. But if a new
bit has been added, using bindgen would be a better fix, since it will
always be correct.

   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