[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2025071405-scorecard-cling-2cf5@gregkh>
Date: Mon, 14 Jul 2025 15:24:31 +0200
From: Greg KH <gregkh@...uxfoundation.org>
To: Danilo Krummrich <dakr@...nel.org>
Cc: rafael@...nel.org, ojeda@...nel.org, alex.gaynor@...il.com,
boqun.feng@...il.com, gary@...yguo.net, bjorn3_gh@...tonmail.com,
lossin@...nel.org, a.hindborg@...nel.org, aliceryhl@...gle.com,
tmgross@...ch.edu, daniel.almeida@...labora.com,
m.wilczynski@...sung.com, rust-for-linux@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] rust: device: implement Device::as_bound()
On Mon, Jul 14, 2025 at 11:49:44AM +0200, Danilo Krummrich wrote:
> On Mon Jul 14, 2025 at 7:30 AM CEST, Greg KH wrote:
> > On Sun, Jul 13, 2025 at 08:26:54PM +0200, Danilo Krummrich wrote:
> >> Provide an unsafe functions for abstractions to convert a regular
> >> &Device to a &Device<Bound>.
> >>
> >> This is useful for registrations that provide certain guarantees for the
> >> scope of their callbacks, such as IRQs or certain class device
> >> registrations (e.g. PWM, miscdevice).
> >
> > Do we have an example where this can be used today in the tree, or is
> > this only for new stuff going forward that would use it?
>
> There's miscdevice in tree, but to be fair, miscdevice doesn't need it without
> my patch series [1] adding driver support for the existing miscdevice
> abstractions; the patch in [2] out of this series would use it within
> args_from_registration().
>
> The PWM abstractions [3] need it in bound_parent_device(). The use-case is the
> same as everywhere else, PWM chips never out-live driver unbind, hence they can
> provide the corresponding bus device as &Device<Bound>.
>
> The same is true for IRQ registrations [4]. free_irq() is guaranteed to be
> called before driver unbind, hence we can provide a &Device<Bound> in the IRQ
> callbacks.
>
> Ultimately, we want to provide this "cookie" in any driver scope that can be
> proven to be lifetime wise limited to device / driver unbind, so there'll be
> much more users.
Ok, so we should probably merge it now for 6.17-rc1, no objection from
me!
thanks,
greg k-h
Powered by blists - more mailing lists