mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Mika Westerberg <mika.westerberg@linux.intel.com>,
	Kartik Rajput <kkartik@nvidia.com>,
	lenb@kernel.org, thierry.reding@gmail.com, jonathanh@nvidia.com,
	linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] ACPI: bus: Use OF match data for PRP0001 matched devices
Date: Mon, 12 Jan 2026 00:01:51 +0200	[thread overview]
Message-ID: <aWQdz37vK-SXVQBv@kekkonen.localdomain> (raw)
In-Reply-To: <CAJZ5v0ijTQC2cFTt+hW-ofJwMqdEeES8d5MMbbq8_Bqg+_9E3g@mail.gmail.com>

Hi Rafael, Andy,

On Fri, Jan 09, 2026 at 10:11:26PM +0100, Rafael J. Wysocki wrote:
> On Fri, Jan 9, 2026 at 6:02 PM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> >
> > On Fri, Jan 09, 2026 at 01:29:59PM +0200, Sakari Ailus wrote:
> > > On Fri, Jan 09, 2026 at 01:05:52PM +0200, Andy Shevchenko wrote:
> > > > On Fri, Jan 09, 2026 at 11:13:02AM +0100, Mika Westerberg wrote:
> > > > > On Fri, Jan 09, 2026 at 03:23:58PM +0530, Kartik Rajput wrote:
> > > > > > During pre-production development, drivers may provide both ACPI and OF
> > > > > > match tables while a formal ACPI HID for the device is not yet
> > > > > > allocated. Such devices are enumerated via PRP0001. In this case,
> > > > > > acpi_device_get_match_data() consults only the driver’s ACPI match table
> > > > > > and returns NULL, even though the device was successfully matched via
> > > > > > PRP0001.
> > > > > >
> > > > > > This behavior also risks breaking existing PRP0001 setups if a driver
> > > > > > later gains an ACPI HID, as the presence of an ACPI match table changes
> > > > > > the match-data lookup path.
> > > > > >
> > > > > > Explicitly detect PRP0001 and fetch match data from the driver's
> > > > > > OF match table via acpi_of_device_get_match_data().
> >
> > ...
> >
> > > > > >         const struct acpi_device_id *acpi_ids = dev->driver->acpi_match_table;
> > > > > > +       struct acpi_device *adev = ACPI_COMPANION(dev);
> > > > > >         const struct acpi_device_id *match;
> > > > > >
> > > > > > -       if (!acpi_ids)
> > > > > > +       if (!adev)
> > > > > > +               return NULL;
> > > > > > +
> > > > > > +       if (!strcmp(acpi_device_hid(adev), ACPI_DT_NAMESPACE_HID))
> > > > > >                 return acpi_of_device_get_match_data(dev);
> > > >
> > > > On top of what Mika asked, shouldn't we check CID as well? Theoretically it's
> > > > possible that some device may have HID "blablabla" and CID PRP0001, I don't
> > > > remember what documentation says about this case, though.
> > >
> > > According to Documentation/firmware-guide/acpi/enumeration.rst PRP0001 is
> > > also valid for _CID. So yes, I think this should be checked as well -- I'd
> > > loop over the &device->pnp.ids list.
> >
> > Yeah, but if we have a device with
> >
> > HID "blablabla"
> > CID "PRP0001"
> >
> > and at the same time the driver has ACPI ID listed, we should probably use that
> > one as HID should have higher weight for matching. Logic here is not just as simple
> > as looping over pnp.ids how I see it.
> 
> Right.
> 
> What about:
> 
> if (acpi_ids) {
>        match = acpi_match_device(acpi_ids, dev);
>        if (match)
>                return (const void *)match->driver_data;
> }
> return acpi_of_device_get_match_data(dev);

That would mean that any ACPI (or PNP) ID has priority over compatible
matching, wouldn't it? AFAIU the documentation says effectively that
_HID/_CID priority is upheld, whether matching with PRP0001 or without.

-- 
Regards,

Sakari Ailus

  reply	other threads:[~2026-01-11 22:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-09  9:53 Kartik Rajput
2026-01-09 10:13 ` Mika Westerberg
2026-01-09 11:05   ` Andy Shevchenko
2026-01-09 11:29     ` Sakari Ailus
2026-01-09 17:02       ` Andy Shevchenko
2026-01-09 21:11         ` Rafael J. Wysocki
2026-01-11 22:01           ` Sakari Ailus [this message]
2026-01-12  8:42             ` Kartik Rajput
2026-01-12  8:55               ` Andy Shevchenko
2026-01-12  9:11                 ` Sakari Ailus

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=aWQdz37vK-SXVQBv@kekkonen.localdomain \
    --to=sakari.ailus@linux.intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=jonathanh@nvidia.com \
    --cc=kkartik@nvidia.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    --cc=rafael@kernel.org \
    --cc=thierry.reding@gmail.com \
    /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

all inboxes | Powered by JetHome®