[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALNs47s6oscYosRT-xgdTtC_4SG7W2iwEzrB+7w0Bc=P4G6tPw@mail.gmail.com>
Date: Mon, 19 Aug 2024 02:21:03 -0500
From: Trevor Gross <tmgross@...ch.edu>
To: FUJITA Tomonori <fujita.tomonori@...il.com>
Cc: netdev@...r.kernel.org, rust-for-linux@...r.kernel.org, andrew@...n.ch,
miguel.ojeda.sandonis@...il.com, benno.lossin@...ton.me, aliceryhl@...gle.com
Subject: Re: [PATCH net-next v5 3/6] rust: net::phy implement
AsRef<kernel::device::Device> trait
On Sun, Aug 18, 2024 at 8:00 PM FUJITA Tomonori
<fujita.tomonori@...il.com> wrote:
>
> Implement AsRef<kernel::device::Device> trait for Device. A PHY driver
> needs a reference to device::Device to call the firmware API.
>
> Reviewed-by: Alice Ryhl <aliceryhl@...gle.com>
> Reviewed-by: Andrew Lunn <andrew@...n.ch>
> Reviewed-by: Benno Lossin <benno.lossin@...ton.me>
> Signed-off-by: FUJITA Tomonori <fujita.tomonori@...il.com>
> ---
> rust/kernel/net/phy.rs | 24 +++++++++++++++++-------
> 1 file changed, 17 insertions(+), 7 deletions(-)
>
> diff --git a/rust/kernel/net/phy.rs b/rust/kernel/net/phy.rs
> index 5e8137a1972f..ec337cbd391b 100644
> --- a/rust/kernel/net/phy.rs
> +++ b/rust/kernel/net/phy.rs
> @@ -76,9 +76,11 @@ impl Device {
> ///
> /// # Safety
> ///
> - /// For the duration of 'a, the pointer must point at a valid `phy_device`,
> - /// and the caller must be in a context where all methods defined on this struct
> - /// are safe to call.
> + /// For the duration of 'a,
Nit, backticks around `'a`
> + /// - the pointer must point at a valid `phy_device`, and the caller
> + /// must be in a context where all methods defined on this struct
> + /// are safe to call.
> + /// - `(*ptr).mdio.dev` must be a valid.
> unsafe fn from_raw<'a>(ptr: *mut bindings::phy_device) -> &'a mut Self {
> // CAST: `Self` is a `repr(transparent)` wrapper around `bindings::phy_device`.
> let ptr = ptr.cast::<Self>();
Reviewed-by: Trevor Gross <tmgross@...ch.edu>
Powered by blists - more mailing lists