From: Markus Probst <markus.probst@posteo.de>
To: Danilo Krummrich <dakr@kernel.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
"Len Brown" <lenb@kernel.org>, "Miguel Ojeda" <ojeda@kernel.org>,
"Boqun Feng" <boqun@kernel.org>, "Gary Guo" <gary@garyguo.net>,
"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>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Robert Moore" <robert.moore@intel.com>,
linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org,
rust-for-linux@vger.kernel.org, driver-core@lists.linux.dev,
acpica-devel@lists.linux.dev
Subject: Re: [PATCH v3] rust: ACPI: fix missing match data for PRP0001
Date: Wed, 08 Apr 2026 19:40:06 +0000 [thread overview]
Message-ID: <4d5cd9887e67007f4dabfed0986861a60e395ae6.camel@posteo.de> (raw)
In-Reply-To: <DHNWFFEB3HD9.1QM2XXNE6BANY@kernel.org>
[-- Attachment #1: Type: text/plain, Size: 2873 bytes --]
On Wed, 2026-04-08 at 18:03 +0200, Danilo Krummrich wrote:
> On Tue Apr 7, 2026 at 11:41 PM CEST, Markus Probst wrote:
> > diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
> > index aad1a95e6863..d0098f24346f 100644
> > --- a/include/acpi/acpi_bus.h
> > +++ b/include/acpi/acpi_bus.h
> > @@ -187,6 +187,10 @@ struct acpi_driver {
> > * -----------
> > */
> >
> > +bool acpi_of_match_device(const struct acpi_device *adev,
> > + const struct of_device_id *of_match_table,
> > + const struct of_device_id **of_id);
>
> This also has to be defined for !CONFIG_ACPI, otherwise we run into the
> following compatible error.
>
> error[E0425]: cannot find function `acpi_of_match_device` in crate `bindings`
> --> rust/kernel/driver.rs:295:24
> |
> 295 | unsafe { bindings::acpi_of_match_device(adev, of_match_table, of_id) }
> | ^^^^^^^^^^^^^^^^^^^^
> |
> ::: /mnt/nvme/work/projects/linux/driver-core/driver-core-testing/rust/bindings/bindings_generated.rs:118713:5
>
> There is an
>
> #else /* CONFIG_ACPI */
>
> block at the end of acpi_bus.h for this.
I don't think the function exists in that case and bindgen can't
generate inline functions, so I will just add a `#[cfg(CONFIG_ACPI)]`
condition on top of the function.
>
> > +
> > /* Status (_STA) */
> >
> > struct acpi_device_status {
> > diff --git a/rust/bindings/bindings_helper.h b/rust/bindings/bindings_helper.h
> > index 083cc44aa952..e47643ce8b50 100644
> > --- a/rust/bindings/bindings_helper.h
> > +++ b/rust/bindings/bindings_helper.h
> > @@ -96,6 +96,11 @@
> > */
> > #include <../../drivers/base/base.h>
> >
> > +/*
> > + * The driver-core Rust code needs to call `acpi_of_match_device`.
> > + */
>
> NIT: I'd drop this comment as such comments usually do not age very well. :)
>
> I assume you followed the above comment for
>
> #include <../../drivers/base/base.h>
>
> but this one is different as it justifies why we have to include an internal
> header in general (i.e. not for a specific function).
>
> > @@ -278,6 +283,18 @@ fn init(
> > }
> > }
> >
> > +#[inline(never)]
> > +#[allow(clippy::missing_safety_doc)]
> > +#[must_use]
> > +unsafe fn acpi_of_match_device(
>
> Maybe add a very brief comment similar to the one in devres.rs for this.
>
> > + adev: *const bindings::acpi_device,
> > + of_match_table: *const bindings::of_device_id,
> > + of_id: *mut *const bindings::of_device_id,
> > +) -> bool {
> > + // SAFETY: Safety requirements are the same as `bindings::acpi_device_id`.
>
> Typo: s/bindings::acpi_device_id/bindings::acpi_of_match_device/
>
> > + unsafe { bindings::acpi_of_match_device(adev, of_match_table, of_id) }
> > +}
Thanks
- Markus Probst
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 870 bytes --]
next prev parent reply other threads:[~2026-04-08 19:40 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-07 21:41 [PATCH v3] rust: ACPI: fix missing match data for PRP0001 Markus Probst
2026-04-08 9:58 ` Rafael J. Wysocki
2026-04-08 16:03 ` Danilo Krummrich
2026-04-08 19:40 ` Markus Probst [this message]
2026-04-08 19:59 ` Danilo Krummrich
2026-04-08 21:42 ` Markus Probst
2026-04-08 22:07 ` Danilo Krummrich
2026-04-10 14:57 ` Markus Probst
2026-04-10 15:53 ` Gary Guo
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=4d5cd9887e67007f4dabfed0986861a60e395ae6.camel@posteo.de \
--to=markus.probst@posteo.de \
--cc=a.hindborg@kernel.org \
--cc=acpica-devel@lists.linux.dev \
--cc=aliceryhl@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun@kernel.org \
--cc=dakr@kernel.org \
--cc=driver-core@lists.linux.dev \
--cc=gary@garyguo.net \
--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=ojeda@kernel.org \
--cc=rafael@kernel.org \
--cc=robert.moore@intel.com \
--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