[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8fde6a54-8b15-4b0f-bf09-b54bd21eb9df@lunn.ch>
Date: Sat, 28 Oct 2023 00:36:35 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Boqun Feng <boqun.feng@...il.com>
Cc: Benno Lossin <benno.lossin@...ton.me>,
FUJITA Tomonori <fujita.tomonori@...il.com>, netdev@...r.kernel.org,
rust-for-linux@...r.kernel.org, tmgross@...ch.edu,
miguel.ojeda.sandonis@...il.com, wedsonaf@...il.com
Subject: Re: [PATCH net-next v7 1/5] rust: core abstractions for network PHY
drivers
> Hmm... but does it mean even `set_speed()` has the similar issue?
>
> let phydev: *mut phy_device = self.0.get();
> unsafe { (*phydev).speed = ...; }
>
> The `(*phydev)` creates a `&mut` IIUC. So we need the following maybe?
>
> let phydev: *mut phy_device = self.0.get();
> unsafe { *addr_mut_of!((*phydev).speed) = ...; }
>
> because at least from phylib core guarantee, we know no one accessing
> `speed` in the same time. However, yes, bit fields are tricky...
Speed is not a bitfield. Its a plain boring int. link is however a bit
field.
Andrew
Powered by blists - more mailing lists