Re: [PATCH v3] rust: ACPI: fix missing match data for PRP0001
Markus Probst <[email protected]>
| Newsgroups | dev.linux.lists.acpica-devel,dev.linux.lists.driver-core,org.kernel.vger.linux-acpi,org.kernel.vger.linux-kernel,org.kernel.vger.rust-for-linux |
|---|---|
| Message-ID | <[email protected]> |
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).
Defining
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);
while the symbol is missing doesn't make much sense, as we are
basically lying to bindgen.
Thanks
- Markus Probst
>
> That said, I'm fine with both -- Rafaels call.
signature.asc
(application/pgp-signature, 870 B)
-----BEGIN PGP SIGNATURE----- iQJPBAABCAA5FiEEgnQYxPSsWOdyMMRzNHYf+OetQ9IFAmnWy7obFIAAAAAABAAO bWFudTIsMi41KzEuMTIsMiwyAAoJEDR2H/jnrUPSFXAP/2Jjp0JnmQj7WHvVPRwe iWlBcbTSsTp8x5qOXU6n0T2gJG5Cw2vLQaDMSd9f/sUvN1d7AhNbLR6Yulc26jGy GJi5lVoN8uUE7A2iVEJ7GYuib8ZMP4ZQ1L4lMuGFzSsRQcNLnDdy8wKH6tOuNiyM CdEJC6Sn+aSeML3CwXWJA73+YmEv7jVj4jMZgkQjJwVFah7Q/D5R1wluucQF1GeK dXJbYXmzTAxC5Dd4PkYPBREm/oWTHwAjMP75H9lMtFuB+SftGPrmRGVsrYcOVGF7 JNf/fQII75DEWXdukjCquEkEpsiNEJcQbLDVMsAHmxMVVC9ViiWnfFuWNsqg4yOP Gay3x1rzrdQCEePgQ7gigHP1Z/V+qy+vbF0RgUvU0i0B//n94E3h5jtW55/bK179 7agPne5n9MvnHIdTSH5Eb5eF0XEDWOcHAhs8pt7dZtx4IrRlSnQuDvdb21tg6wqb B6yuwFqheFLNaoL0sIrXbHRUHeY8Msf2f6LUfETX/wuwBNlUUyrAsfrJEUzCEEaf za7H+Up/aoBTesgMCVnrMOBx5O6AFonXd/HRI3rk0Fz6ykiXkahK/xccyevbafRK scuiMMn1FAwsdj4nDDUi+JOGJkBoa6Z2/B+B9sSTNrjCEcEUPpAGnKC14uMPIj6v Vwhw/cndsQ71LAwGPe3GGLhm =E+yp -----END PGP SIGNATURE-----