Re: [PATCH v5 1/1] ACPI: platform: Add basic support for ACPI 6.5 fixed clock resources
From: Rafael J. Wysocki (Intel)
Date: Fri Nov 27 2026 - 09:27:15 EST
On Fri, Nov 27, 2026 at 3:20 PM Paul Cercueil <paul.cercueil@xxxxxxxxxxx> wrote:
>
> [...]
>
> > > > > +static void acpi_platform_init_clocks(struct acpi_device *adev)
> > > > > +{
> > > > > + struct device *dev = &adev->dev;
> > > >
> > > > Note that &adev->dev is not a real device. It is a "firmware node",
> > > > quite like a DT one, but I guess it may be used for registering
> > > > clocks.
> > > >
> > > > How is a platform device driver going to use those clocks though?
> > >
> > > They just use clk_get(). It searches the clock by device name, which works
> > > here,
> >
> > And they would pass the platform device as dev I suppose?
>
> Yes, I like the fact that it does not change the API - on the driver side you
> just use clk_get(&pdev->dev, NULL) or clk_get(&pdev->dev, "acpi-clk1") like you
> would do with a clock resource from DT.
>
> > > I guess because the "firmware node" device has the same name as the real
> > > device.
> >
> > For platform devices created by acpi_create_platform_device(), yes, it
> > does, but if that is going to be relied on, that assumption needs to
> > be documented in a very visible way.
> >
> > Generally speaking though, they should rather pass the ACPI companion
> > of the platform device as dev, in which case that the name equality
> > doesn't matter, and so the clkdev could be created during the struct
> > acpi_device registration (and the corresponding cleanup would occur
> > during the struct acpi_device removal which is rare).
>
> I think I should update clk_get() then.
>
> It gets passed a "struct device" pointer, if it has an ACPI companion, I can
> just recurse on the ACPI companion's device struct.
>
> Btw - I'm working on the v6 and I added the cleanup on acpi_device removal. Is
> there a way to test a ACPI device removal from userspace? Looking at
> Documentation/ABI/testing/sysfs-bus-acpi it seems to only be for ACPI devices
> which have a _AJ0 method?
The only way to remove a struct acpi_device is to unload the table
containing its definition, so you'd need to load a test SSDT via
configfs and then unload it.