From: "Gary Guo" <gary@garyguo.net>
To: "Markus Probst" <markus.probst@posteo.de>,
"Gary Guo" <gary@garyguo.net>,
"Danilo Krummrich" <dakr@kernel.org>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
"Len Brown" <lenb@kernel.org>, "Miguel Ojeda" <ojeda@kernel.org>,
"Boqun Feng" <boqun@kernel.org>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <lossin@kernel.org>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Alice Ryhl" <aliceryhl@google.com>,
"Trevor Gross" <tmgross@umich.edu>,
linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org,
rust-for-linux@vger.kernel.org, driver-core@lists.linux.dev
Subject: Re: [PATCH] rust: ACPI: fix missing match data for PRP0001
Date: Sat, 04 Apr 2026 23:08:23 +0100 [thread overview]
Message-ID: <DHKPOO58D4U3.TYXAM7ANQ4UO@garyguo.net> (raw)
In-Reply-To: <398ba2627148b9224ed41d383c906ca23427986f.camel@posteo.de>
On Sat Apr 4, 2026 at 10:33 PM BST, Markus Probst wrote:
> On Sat, 2026-04-04 at 22:23 +0100, Gary Guo wrote:
>> BTW, if most drivers use driver_data of ID as pointers, why is it defined as
>> kernel_ulong_t instead of just `void*`?
>
> The return type of `device_get_match_data` is `const void *`.
> `of_device_id->data` has type `const void *`.
> `acpi_device_id->driver_data` and `pci_device_id->driver_data` has type
> kernel_ulong_t.
>
> Kernel doc of pci_device_id:
> "
> Data private to the driver.
> Most drivers don't need to use driver_data field.
> Best practice is to use driver_data as an index
> into a static list of equivalent device types,
> instead of using it as a pointer.
> "
> suggests it was intended for use as index in the first place.
>
> Thanks
> - Markus Probst
I would have believed it if I haven't seen a huge number of drivers just using
pointers and do a cast :)
of_device_id/dmi_system_id is also just using void* for its driver_data.
I mean, blaming through git history it looks like this documentation predates
git, so I'm not really sure how relevant this still is.
Best,
Gary
next prev parent reply other threads:[~2026-04-04 22:08 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-01 14:06 [PATCH] rust: ACPI: fix missing match data for PRP0001 Markus Probst
2026-04-01 18:32 ` Greg Kroah-Hartman
2026-04-01 18:46 ` Markus Probst
2026-04-01 22:15 ` Danilo Krummrich
2026-04-02 12:31 ` Greg Kroah-Hartman
2026-04-04 21:23 ` Gary Guo
2026-04-04 21:32 ` Danilo Krummrich
2026-04-05 5:47 ` Greg Kroah-Hartman
2026-04-04 21:33 ` Markus Probst
2026-04-04 21:38 ` Danilo Krummrich
2026-04-04 22:08 ` Gary Guo [this message]
2026-04-04 22:07 ` 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=DHKPOO58D4U3.TYXAM7ANQ4UO@garyguo.net \
--to=gary@garyguo.net \
--cc=a.hindborg@kernel.org \
--cc=aliceryhl@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun@kernel.org \
--cc=dakr@kernel.org \
--cc=driver-core@lists.linux.dev \
--cc=gregkh@linuxfoundation.org \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=markus.probst@posteo.de \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.