Re: [PATCH v2 00/10] Device / Driver and PCI Rust abstractions

Greg KH
2024-06-19T12:18:01Z

On Wed, Jun 19, 2024 at 05:34:07PM +0530, Viresh Kumar wrote:
> On 19-06-24, 01:39, Danilo Krummrich wrote:
> > - move base device ID abstractions to a separate source file (Greg)
> > - remove `DeviceRemoval` trait in favor of using a `Devres` callback to
> > unregister drivers
> > - remove `device::Data`, we don't need this abstraction anymore now that we
> > `Devres` to revoke resources and registrations
>
> Hi Danilo,
>
> I am working on writing bindings for CPUFreq drivers [1] and was
> looking to rebase over staging/rust-device, and I am not sure how to
> proceed after device::Data is dropped now.

As it should be dropped :)

A struct device does not have a "data" pointer, it has specific other
pointers to hold data in, but they better be accessed by their proper
name if you want rust code to be reviewable by anyone.

Also, you shouldn't be accessing that field directly anyway, that's what
the existing dev_set_drvdata/dev_get_drvdata() calls are for. Just use
them please.

thanks,

greg k-h