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 <[email protected]>
Sent: 2026年8月23日 23:27
To: springbreeze <[email protected]>
Cc: Miguel Ojeda <[email protected]>;
[email protected]; [email protected]; FUJITA Tomonori
<[email protected]>; Miguel Ojeda <[email protected]>; Boqun Feng
<[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.