public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
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: Fri, 10 Apr 2026 14:57:14 +0000	[thread overview]
Message-ID: <bbf903b3db06fbe9f5042dd64dc18fbc897927a4.camel@posteo.de> (raw)
In-Reply-To: <DHO46CIJNVZH.1Q6ZLX1XNWRR4@kernel.org>

[-- Attachment #1: Type: text/plain, Size: 2886 bytes --]

On Thu, 2026-04-09 at 00:07 +0200, Danilo Krummrich wrote:
> 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.
According to git commit msg [1], __rust_helper is needed to inline
these helpers into Rust code. Does this mean we could omit the extra
function declaration with #[inline(never)] and just use a helper
without __rust_helper?

[1]
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a9aabb3b839aba094ed80861054993785c61462c

Thanks
- Markus Probst

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 870 bytes --]

  reply	other threads:[~2026-04-10 14:57 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
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 [this message]
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=bbf903b3db06fbe9f5042dd64dc18fbc897927a4.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