提交 ee892094 编写于 作者: R Rafael J. Wysocki

ACPI / property: Define a symbol for PRP0001

Use a #defined symbol ACPI_DT_NAMESPACE_HID instead of the PRP0001
string.
Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: NMika Westerberg <mika.westerberg@linux.intel.com>
Reviewed-by: NHanjun Guo <hanjun.guo@linaro.org>
上级 5c53b262
...@@ -191,6 +191,8 @@ bool acpi_osi_is_win8(void); ...@@ -191,6 +191,8 @@ bool acpi_osi_is_win8(void);
/*-------------------------------------------------------------------------- /*--------------------------------------------------------------------------
Device properties Device properties
-------------------------------------------------------------------------- */ -------------------------------------------------------------------------- */
#define ACPI_DT_NAMESPACE_HID "PRP0001"
void acpi_init_properties(struct acpi_device *adev); void acpi_init_properties(struct acpi_device *adev);
void acpi_free_properties(struct acpi_device *adev); void acpi_free_properties(struct acpi_device *adev);
......
...@@ -110,11 +110,11 @@ void acpi_init_properties(struct acpi_device *adev) ...@@ -110,11 +110,11 @@ void acpi_init_properties(struct acpi_device *adev)
int i; int i;
/* /*
* Check if the special PRP0001 ACPI ID is present and in that case we * Check if ACPI_DT_NAMESPACE_HID is present and inthat case we fill in
* fill in Device Tree compatible properties for this device. * Device Tree compatible properties for this device.
*/ */
list_for_each_entry(hwid, &adev->pnp.ids, list) { list_for_each_entry(hwid, &adev->pnp.ids, list) {
if (!strcmp(hwid->id, "PRP0001")) { if (!strcmp(hwid->id, ACPI_DT_NAMESPACE_HID)) {
acpi_of = true; acpi_of = true;
break; break;
} }
...@@ -170,7 +170,7 @@ void acpi_init_properties(struct acpi_device *adev) ...@@ -170,7 +170,7 @@ void acpi_init_properties(struct acpi_device *adev)
out: out:
if (acpi_of && !adev->flags.of_compatible_ok) if (acpi_of && !adev->flags.of_compatible_ok)
acpi_handle_info(adev->handle, acpi_handle_info(adev->handle,
"PRP0001 requires 'compatible' property\n"); ACPI_DT_NAMESPACE_HID " requires 'compatible' property\n");
} }
void acpi_free_properties(struct acpi_device *adev) void acpi_free_properties(struct acpi_device *adev)
......
...@@ -135,12 +135,13 @@ static int create_pnp_modalias(struct acpi_device *acpi_dev, char *modalias, ...@@ -135,12 +135,13 @@ static int create_pnp_modalias(struct acpi_device *acpi_dev, char *modalias,
struct acpi_hardware_id *id; struct acpi_hardware_id *id;
/* /*
* Since we skip PRP0001 from the modalias below, 0 should be returned * Since we skip ACPI_DT_NAMESPACE_HID from the modalias below, 0 should
* if PRP0001 is the only ACPI/PNP ID in the device's list. * be returned if ACPI_DT_NAMESPACE_HID is the only ACPI/PNP ID in the
* device's list.
*/ */
count = 0; count = 0;
list_for_each_entry(id, &acpi_dev->pnp.ids, list) list_for_each_entry(id, &acpi_dev->pnp.ids, list)
if (strcmp(id->id, "PRP0001")) if (strcmp(id->id, ACPI_DT_NAMESPACE_HID))
count++; count++;
if (!count) if (!count)
...@@ -153,7 +154,7 @@ static int create_pnp_modalias(struct acpi_device *acpi_dev, char *modalias, ...@@ -153,7 +154,7 @@ static int create_pnp_modalias(struct acpi_device *acpi_dev, char *modalias,
size -= len; size -= len;
list_for_each_entry(id, &acpi_dev->pnp.ids, list) { list_for_each_entry(id, &acpi_dev->pnp.ids, list) {
if (!strcmp(id->id, "PRP0001")) if (!strcmp(id->id, ACPI_DT_NAMESPACE_HID))
continue; continue;
count = snprintf(&modalias[len], size, "%s:", id->id); count = snprintf(&modalias[len], size, "%s:", id->id);
...@@ -177,7 +178,8 @@ static int create_pnp_modalias(struct acpi_device *acpi_dev, char *modalias, ...@@ -177,7 +178,8 @@ static int create_pnp_modalias(struct acpi_device *acpi_dev, char *modalias,
* @size: Size of the buffer. * @size: Size of the buffer.
* *
* Expose DT compatible modalias as of:NnameTCcompatible. This function should * Expose DT compatible modalias as of:NnameTCcompatible. This function should
* only be called for devices having PRP0001 in their list of ACPI/PNP IDs. * only be called for devices having ACPI_DT_NAMESPACE_HID in their list of
* ACPI/PNP IDs.
*/ */
static int create_of_modalias(struct acpi_device *acpi_dev, char *modalias, static int create_of_modalias(struct acpi_device *acpi_dev, char *modalias,
int size) int size)
...@@ -980,9 +982,9 @@ static void acpi_device_remove_files(struct acpi_device *dev) ...@@ -980,9 +982,9 @@ static void acpi_device_remove_files(struct acpi_device *dev)
* @adev: ACPI device object to match. * @adev: ACPI device object to match.
* @of_match_table: List of device IDs to match against. * @of_match_table: List of device IDs to match against.
* *
* If @dev has an ACPI companion which has the special PRP0001 device ID in its * If @dev has an ACPI companion which has ACPI_DT_NAMESPACE_HID in its list of
* list of identifiers and a _DSD object with the "compatible" property, use * identifiers and a _DSD object with the "compatible" property, use that
* that property to match against the given list of identifiers. * property to match against the given list of identifiers.
*/ */
static bool acpi_of_match_device(struct acpi_device *adev, static bool acpi_of_match_device(struct acpi_device *adev,
const struct of_device_id *of_match_table) const struct of_device_id *of_match_table)
...@@ -1038,14 +1040,14 @@ static const struct acpi_device_id *__acpi_match_device( ...@@ -1038,14 +1040,14 @@ static const struct acpi_device_id *__acpi_match_device(
return id; return id;
/* /*
* Next, check the special "PRP0001" ID and try to match the * Next, check ACPI_DT_NAMESPACE_HID and try to match the
* "compatible" property if found. * "compatible" property if found.
* *
* The id returned by the below is not valid, but the only * The id returned by the below is not valid, but the only
* caller passing non-NULL of_ids here is only interested in * caller passing non-NULL of_ids here is only interested in
* whether or not the return value is NULL. * whether or not the return value is NULL.
*/ */
if (!strcmp("PRP0001", hwid->id) if (!strcmp(ACPI_DT_NAMESPACE_HID, hwid->id)
&& acpi_of_match_device(device, of_ids)) && acpi_of_match_device(device, of_ids))
return id; return id;
} }
...@@ -2405,7 +2407,7 @@ static void acpi_default_enumeration(struct acpi_device *device) ...@@ -2405,7 +2407,7 @@ static void acpi_default_enumeration(struct acpi_device *device)
} }
static const struct acpi_device_id generic_device_ids[] = { static const struct acpi_device_id generic_device_ids[] = {
{"PRP0001", }, {ACPI_DT_NAMESPACE_HID, },
{"", }, {"", },
}; };
...@@ -2413,8 +2415,8 @@ static int acpi_generic_device_attach(struct acpi_device *adev, ...@@ -2413,8 +2415,8 @@ static int acpi_generic_device_attach(struct acpi_device *adev,
const struct acpi_device_id *not_used) const struct acpi_device_id *not_used)
{ {
/* /*
* Since PRP0001 is the only ID handled here, the test below can be * Since ACPI_DT_NAMESPACE_HID is the only ID handled here, the test
* unconditional. * below can be unconditional.
*/ */
if (adev->data.of_compatible) if (adev->data.of_compatible)
acpi_default_enumeration(adev); acpi_default_enumeration(adev);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册