[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1afb6d69-f850-455f-97e2-361d490a2637@lunn.ch>
Date: Sun, 18 Aug 2024 17:38:01 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Benno Lossin <benno.lossin@...ton.me>
Cc: FUJITA Tomonori <fujita.tomonori@...il.com>, netdev@...r.kernel.org,
rust-for-linux@...r.kernel.org, tmgross@...ch.edu,
miguel.ojeda.sandonis@...il.com, aliceryhl@...gle.com
Subject: Re: [PATCH net-next v4 3/6] rust: net::phy implement
AsRef<kernel::device::Device> trait
> Just to be sure: the `phydev.mdio.dev` struct is refcounted and
> incrementing the refcount is fine, right?
There is nothing special here. PHY devices are just normal Linux
devices. The device core is responsible for calling .probe() and
.remove() on a device, and these should be the first and last
operation on a device. The device core provides refcounting of the
struct device, so it should always be valid.
So i have to wounder if you are solving this at the correct
level. This should be generic to any device, so the Rust concept of a
device should be stating these guarantees, not each specific type of
device.
Andrew
Powered by blists - more mailing lists