Re: [PATCH 2/2] ACPI / platform: Initialize ACPI handles of platform devices in advance
From: Rafael J. Wysocki <hidden>
Date: 2012-11-19 21:52:27
Also in:
lkml
On Monday, November 19, 2012 11:05:28 PM Mika Westerberg wrote:
On Mon, Nov 19, 2012 at 09:44:21PM +0100, Rafael J. Wysocki wrote:quoted
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.
Yeah, that's kind of something that comes to mind immediately. :-)
Type of that pointer of course needs to be figured out :)
Yup. -- I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center.