Re: [PATCH v2 1/2] rust: introduce abstractions for fwctl

Danilo Krummrich
2026-01-27T20:07:45Z

On Tue Jan 27, 2026 at 8:57 PM CET, Zhi Wang wrote:
> The fwctl_alloc_device() helper allocates a raw struct fwctl_device
> without private driver data here. The Rust driver object should be
> already allocated and initialized separately before reaching this
> point.
>
> We rely on the standard dev->parent chain to access the rust driver
> object from the fwctl callbacks.

(I will go for a thorough review soon, but for now a quick drive-by comment.)

IIUC, you are saying that the user is supposed to use the private data of the
parent device in fwctl callbacks. Let's not make this a design choice please.
Instead, allow the user pass in separate private data for the fwctl device as
well.

This serves the purpose of clear ownership and lifetime of the data. E.g. the
fwctl device does not necessarily exist as long as the parent device is bound.

It is a good thing if driver authors are forced to take a decision about which
object owns the data and what's the scope of the data.