public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Danilo Krummrich" <dakr@kernel.org>
To: "Gary Guo" <gary@garyguo.net>
Cc: <gregkh@linuxfoundation.org>, <rafael@kernel.org>,
	<acourbot@nvidia.com>, <aliceryhl@google.com>,
	<david.m.ertman@intel.com>, <ira.weiny@intel.com>,
	<leon@kernel.org>, <ojeda@kernel.org>, <boqun@kernel.org>,
	<bjorn3_gh@protonmail.com>, <lossin@kernel.org>,
	<a.hindborg@kernel.org>, <tmgross@umich.edu>,
	<driver-core@lists.linux.dev>, <linux-kernel@vger.kernel.org>,
	<nova-gpu@lists.linux.dev>, <dri-devel@lists.freedesktop.org>,
	<rust-for-linux@vger.kernel.org>
Subject: Re: [PATCH 1/2] rust: auxiliary: add registration data to auxiliary devices
Date: Thu, 30 Apr 2026 18:05:26 +0200	[thread overview]
Message-ID: <DI6M8XMJUG33.2NYL9UVC0LLRM@kernel.org> (raw)
In-Reply-To: <DI6L13A5LMOW.DU7ZTHXZYB0K@garyguo.net>

On Thu Apr 30, 2026 at 5:08 PM CEST, Gary Guo wrote:
> I wonder if we could require auxillary drivers to specify a type, and then the
> abstraction would check if the type matches; if it matches, it create a
> `&Device<Core, T>` and `probe`, otherwise it skips over the driver completely.

The choice not to type auxiliary::Device over the registration data is
intentional.

The registration data is not intended for the child driver to use, but for the
parent driver to retrieve when the child passes its device back to the parent.

By typing the Device over the parent's registration data we force the parent
driver to expose its registration data to the child driver.

>> +    /// Returns a pinned reference to the registration data set by the registering (parent) driver.
>> +    ///
>> +    /// Returns [`EINVAL`] if `T` does not match the type used by the parent driver when calling
>> +    /// [`Registration::new()`].
>> +    ///
>> +    /// Returns [`ENOENT`] if no registration data has been set, e.g. when the device was
>> +    /// registered by a C driver.
>> +    pub fn registration_data<T: 'static>(&self) -> Result<Pin<&T>> {
>
> Any reason that this is not just `Result<&T>`?

Mainly consistency with other APIs, but I'm not really opinionated about it.

  reply	other threads:[~2026-04-30 16:05 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-27 22:09 [PATCH 0/2] rust: auxiliary: replace drvdata() with registration data Danilo Krummrich
2026-04-27 22:09 ` [PATCH 1/2] rust: auxiliary: add registration data to auxiliary devices Danilo Krummrich
2026-04-28 10:18   ` Danilo Krummrich
2026-04-29 11:21   ` Alexandre Courbot
2026-04-29 13:58     ` Danilo Krummrich
2026-04-30  8:59   ` Alice Ryhl
2026-04-30 14:19     ` Danilo Krummrich
2026-04-30 14:31     ` Gary Guo
2026-04-30 15:08   ` Gary Guo
2026-04-30 16:05     ` Danilo Krummrich [this message]
2026-04-27 22:09 ` [PATCH 2/2] rust: driver core: remove drvdata() and driver_type Danilo Krummrich
2026-04-30  9:00   ` Alice Ryhl
2026-04-27 22:14 ` [PATCH 0/2] rust: auxiliary: replace drvdata() with registration data 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=DI6M8XMJUG33.2NYL9UVC0LLRM@kernel.org \
    --to=dakr@kernel.org \
    --cc=a.hindborg@kernel.org \
    --cc=acourbot@nvidia.com \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun@kernel.org \
    --cc=david.m.ertman@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=driver-core@lists.linux.dev \
    --cc=gary@garyguo.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=ira.weiny@intel.com \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=nova-gpu@lists.linux.dev \
    --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