Re: [PATCH v3] rust: ACPI: fix missing match data for PRP0001

From: Danilo Krummrich

Date: Wed Apr 08 2026 - 18:08:05 EST


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.