From: Markus Probst <markus.probst@posteo.de>
To: Krzysztof Kozlowski <krzk@kernel.org>
Cc: "Hans de Goede" <hansg@kernel.org>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Bryan O'Donoghue" <bryan.odonoghue@linaro.org>,
"Lee Jones" <lee@kernel.org>, "Pavel Machek" <pavel@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@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>,
"Danilo Krummrich" <dakr@kernel.org>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
"Len Brown" <lenb@kernel.org>,
"Saravana Kannan" <saravanak@kernel.org>,
platform-driver-x86@vger.kernel.org, linux-leds@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
rust-for-linux@vger.kernel.org, linux-acpi@vger.kernel.org
Subject: Re: [PATCH v5 2/4] ACPI: of: match PRP0001 in of_match_device
Date: Mon, 30 Mar 2026 19:04:21 +0000 [thread overview]
Message-ID: <e4b194028dcf25b943438615a83bce68b0949e5f.camel@posteo.de> (raw)
In-Reply-To: <20260330-bipedal-invaluable-slug-0c6dea@quoll>
[-- Attachment #1: Type: text/plain, Size: 3606 bytes --]
On Mon, 2026-03-30 at 09:00 +0200, Krzysztof Kozlowski wrote:
> On Sun, Mar 29, 2026 at 08:02:16PM +0200, Markus Probst wrote:
> > Export `acpi_of_match_device` function and use it to match for PRP0001
> > in `of_match_device`, if the device does not have a device node.
> >
> > This fixes the match data being NULL when using ACPI PRP0001, even though
> > the device was matched against an of device table.
>
> Fixes tag?
>
> I don't see how this is going to fix !ACPI case - the
> acpi_of_match_device() will just return false.
While trying to argue I found out that there already is
`device_get_match_data`, which takes PRP0001 into account.
I will now instead make a patch, which will make rust use this function
instead of calling `of_match_device` and `acpi_match_device`
individually, which ignores PRP0001.
There are still a lot of drivers only using `of_match_device`, which
makes it impossible to use PRP0001 with them. But this is not relevant
for this driver.
Thanks
- Markus Probst
>
>
> >
> > Signed-off-by: Markus Probst <markus.probst@posteo.de>
> > ---
> > drivers/acpi/bus.c | 7 ++++---
> > drivers/of/device.c | 9 +++++++--
> > include/linux/acpi.h | 11 +++++++++++
> > 3 files changed, 22 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
> > index 2ec095e2009e..cd02f04cf685 100644
> > --- a/drivers/acpi/bus.c
> > +++ b/drivers/acpi/bus.c
> > @@ -831,9 +831,9 @@ const struct acpi_device *acpi_companion_match(const struct device *dev)
> > * identifiers and a _DSD object with the "compatible" property, use that
> > * property to match against the given list of identifiers.
> > */
> > -static 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)
> > +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)
> > {
> > const union acpi_object *of_compatible, *obj;
> > int i, nval;
> > @@ -866,6 +866,7 @@ static bool acpi_of_match_device(const struct acpi_device *adev,
> >
> > return false;
> > }
> > +EXPORT_SYMBOL_GPL(acpi_of_match_device);
> >
> > static bool acpi_of_modalias(struct acpi_device *adev,
> > char *modalias, size_t len)
> > diff --git a/drivers/of/device.c b/drivers/of/device.c
> > index f7e75e527667..128682390058 100644
> > --- a/drivers/of/device.c
> > +++ b/drivers/of/device.c
> > @@ -11,6 +11,7 @@
> > #include <linux/mod_devicetable.h>
> > #include <linux/slab.h>
> > #include <linux/platform_device.h>
> > +#include <linux/acpi.h>
> >
> > #include <asm/errno.h>
> > #include "of_private.h"
> > @@ -26,8 +27,12 @@
> > const struct of_device_id *of_match_device(const struct of_device_id *matches,
> > const struct device *dev)
> > {
> > - if (!matches || !dev->of_node || dev->of_node_reused)
> > - return NULL;
> > + if (!matches || !dev->of_node || dev->of_node_reused) {
> > + const struct of_device_id *id = NULL;
> > +
> > + acpi_of_match_device(ACPI_COMPANION(dev), matches, &id);
>
> I don't think this should be done from of_match_device. Yuo will have
> soon recursive calls, because acpi_of_match_device() will call other
> match, that will call of_match_device() and so on...
>
> of_match_device() is supposed to match only against OF. Not ACPI. There
> should be no ACPI header or code in this unit file.
>
> Best regards,
> Krzysztof
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 870 bytes --]
next prev parent reply other threads:[~2026-03-30 19:04 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-29 18:02 [PATCH v5 0/4] Introduce Synology Microp driver Markus Probst via B4 Relay
2026-03-29 18:02 ` [PATCH v5 1/4] dt-bindings: embedded-controller: Add synology microp devices Markus Probst via B4 Relay
2026-03-30 6:51 ` Krzysztof Kozlowski
2026-03-30 23:38 ` Markus Probst
2026-03-29 18:02 ` [PATCH v5 2/4] ACPI: of: match PRP0001 in of_match_device Markus Probst via B4 Relay
2026-03-30 7:00 ` Krzysztof Kozlowski
2026-03-30 19:04 ` Markus Probst [this message]
2026-03-30 19:22 ` Rob Herring
2026-03-30 19:24 ` Markus Probst
2026-03-29 18:02 ` [PATCH v5 3/4] rust: add visibility to of_device_table macro Markus Probst via B4 Relay
2026-03-30 7:02 ` Krzysztof Kozlowski
2026-03-29 18:02 ` [PATCH v5 4/4] platform: Add initial synology microp driver Markus Probst via B4 Relay
2026-03-30 6:51 ` Krzysztof Kozlowski
2026-03-30 16:31 ` Conor Dooley
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=e4b194028dcf25b943438615a83bce68b0949e5f.camel@posteo.de \
--to=markus.probst@posteo.de \
--cc=a.hindborg@kernel.org \
--cc=aliceryhl@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun@kernel.org \
--cc=bryan.odonoghue@linaro.org \
--cc=conor+dt@kernel.org \
--cc=dakr@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=gary@garyguo.net \
--cc=gregkh@linuxfoundation.org \
--cc=hansg@kernel.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=krzk+dt@kernel.org \
--cc=krzk@kernel.org \
--cc=lee@kernel.org \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=ojeda@kernel.org \
--cc=pavel@kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=robh@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=saravanak@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