public inbox for rust-for-linux@vger.kernel.org
 help / color / mirror / Atom feed
From: "Danilo Krummrich" <dakr@kernel.org>
To: "Markus Probst" <markus.probst@posteo.de>
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 18:03:26 +0200	[thread overview]
Message-ID: <DHNWFFEB3HD9.1QM2XXNE6BANY@kernel.org> (raw)
In-Reply-To: <20260407-rust_acpi_prp0001-v3-1-c5b24590c273@posteo.de>

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.

> +
>  /* 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) }
> +}

  parent reply	other threads:[~2026-04-08 16:03 UTC|newest]

Thread overview: 5+ 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 [this message]
2026-04-08 19:40   ` Markus Probst
2026-04-08 19:59     ` 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=DHNWFFEB3HD9.1QM2XXNE6BANY@kernel.org \
    --to=dakr@kernel.org \
    --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=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=markus.probst@posteo.de \
    --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