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: Thu, 09 Apr 2026 00:07:44 +0200	[thread overview]
Message-ID: <DHO46CIJNVZH.1Q6ZLX1XNWRR4@kernel.org> (raw)
In-Reply-To: <e6985ffe6d35e27b85b540e410cf92592d597a69.camel@posteo.de>

On Wed Apr 8, 2026 at 11:42 PM CEST, Markus Probst wrote:
> On Wed, 2026-04-08 at 21:59 +0200, Danilo Krummrich wrote:
>> On Wed Apr 8, 2026 at 9:40 PM CEST, Markus Probst wrote:
>> > 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.
>> 
>> Usually we provide a stub instead of conditionalize the callers; this case might
>> be a bit special, but I'd still follow the usual pattern.
> The usual C pattern would be
>
> static inline 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);
>
> , which is ignored by bindgen (i. e. same error).

That's where you define a Rust helper; we have lots of cases where we only have
the Rust helper to deal with the inline function stub used when the
corresponding CONFIG_* is disabled.

      reply	other threads:[~2026-04-08 22:07 UTC|newest]

Thread overview: 7+ 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
2026-04-08 19:59     ` Danilo Krummrich
2026-04-08 21:42       ` Markus Probst
2026-04-08 22:07         ` Danilo Krummrich [this message]

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=DHO46CIJNVZH.1Q6ZLX1XNWRR4@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