From: Danilo Krummrich <dakr@kernel.org>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: rafael@kernel.org, ojeda@kernel.org, alex.gaynor@gmail.com,
boqun.feng@gmail.com, gary@garyguo.net, bjorn3_gh@protonmail.com,
lossin@kernel.org, a.hindborg@kernel.org, aliceryhl@google.com,
tmgross@umich.edu, daniel.almeida@collabora.com,
m.wilczynski@samsung.com, rust-for-linux@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] rust: device: implement Device::as_bound()
Date: Mon, 14 Jul 2025 15:26:58 +0200 [thread overview]
Message-ID: <9f6d7e29-71d2-4f1b-b672-46acc8de8b6f@kernel.org> (raw)
In-Reply-To: <2025071405-scorecard-cling-2cf5@gregkh>
On 7/14/25 3:24 PM, Greg KH wrote:
> 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!
Yup, gonna pick it up soon (with the casts fixed up as noted in a previous
reply). :)
next prev parent reply other threads:[~2025-07-14 13:27 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-13 18:26 [PATCH 1/2] rust: devres: provide an accessor for the device Danilo Krummrich
2025-07-13 18:26 ` [PATCH 2/2] rust: device: implement Device::as_bound() Danilo Krummrich
2025-07-13 19:37 ` Danilo Krummrich
2025-07-13 19:39 ` Benno Lossin
2025-07-14 5:30 ` Greg KH
2025-07-14 9:49 ` Danilo Krummrich
2025-07-14 13:24 ` Greg KH
2025-07-14 13:26 ` Danilo Krummrich [this message]
2025-07-15 20:30 ` Danilo Krummrich
2025-07-13 19:39 ` [PATCH 1/2] rust: devres: provide an accessor for the device Benno Lossin
2025-07-14 5:30 ` Greg KH
2025-07-15 20:29 ` Danilo Krummrich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9f6d7e29-71d2-4f1b-b672-46acc8de8b6f@kernel.org \
--to=dakr@kernel.org \
--cc=a.hindborg@kernel.org \
--cc=alex.gaynor@gmail.com \
--cc=aliceryhl@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=daniel.almeida@collabora.com \
--cc=gary@garyguo.net \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=m.wilczynski@samsung.com \
--cc=ojeda@kernel.org \
--cc=rafael@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=tmgross@umich.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®