Re: [PATCH 2/2] ACPI / platform: Initialize ACPI handles of platformdevices in advance

From: Mika Westerberg
Date: Mon Nov 19 2012 - 16:02:27 EST


On Mon, Nov 19, 2012 at 09:44:21PM +0100, Rafael J. Wysocki wrote:
> So, we want to have acpi_handle (or acpi_node) in addition to of_node in struct
> device (to be used in the analogous way plus for the execution of AML methods),
> but we don't want all users of device.h to have to include ACPI headers
> where the acpi_handle data type is defined. For this reason, we're using
> (void *) as its data type now, which let's say I'm not really happy with.
>
> I've been thinking about that for quite a while, though, and I'm not really
> sure what to do about that. Perhaps we could define something like
>
> struct acpi_dev_node {
> #ifdef CONFIG_ACPI
> void *handle;
> #endif
> };
>
> in device.h and use that as "struct acpi_dev_node acpi_node;" in struct device.
> Then, we could add the following macro
>
> #ifdef CONFIG_ACPI
> #define ACPI_HANDLE(dev) ((dev)->acpi_node.handle)
> #else
> #define ACPI_HANDLE(dev) (NULL)
> #endif
>
> and redefine DEVICE_ACPI_HANDLE(dev) as ((acpi_handle)ACPI_HANDLE(dev)).
>
> Then, the $subject patch would add "struct acpi_dev_node acpi_node;" to
> struct platform_device_info and use ACPI_HANDLE(dev) instead of accessing
> the struct device's field directly.

In addition to struct platform_device_info, we are also going to add
similar to struct i2c_board_info. There already is of_node pointer so I was
thinking to add acpi_handle like you did for platform_device. Type of that
pointer of course needs to be figured out :)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/