diff options
| author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2015-05-21 22:24:34 -0400 |
|---|---|---|
| committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2015-05-22 17:57:14 -0400 |
| commit | ee89209402e0b9a733169901063afdf0ae7909db (patch) | |
| tree | dad9476770f4f3215e4e234a0e33498edac33295 | |
| parent | 5c53b262c861dc99aefb215eec579ae438d64fdd (diff) | |
ACPI / property: Define a symbol for PRP0001
Use a #defined symbol ACPI_DT_NAMESPACE_HID instead of the PRP0001
string.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Reviewed-by: Hanjun Guo <hanjun.guo@linaro.org>
| -rw-r--r-- | drivers/acpi/internal.h | 2 | ||||
| -rw-r--r-- | drivers/acpi/property.c | 8 | ||||
| -rw-r--r-- | drivers/acpi/scan.c | 28 |
3 files changed, 21 insertions, 17 deletions
diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h index ba4a61e964be..d93628c65661 100644 --- a/drivers/acpi/internal.h +++ b/drivers/acpi/internal.h | |||
| @@ -191,6 +191,8 @@ bool acpi_osi_is_win8(void); | |||
| 191 | /*-------------------------------------------------------------------------- | 191 | /*-------------------------------------------------------------------------- |
| 192 | Device properties | 192 | Device properties |
| 193 | -------------------------------------------------------------------------- */ | 193 | -------------------------------------------------------------------------- */ |
| 194 | #define ACPI_DT_NAMESPACE_HID "PRP0001" | ||
| 195 | |||
| 194 | void acpi_init_properties(struct acpi_device *adev); | 196 | void acpi_init_properties(struct acpi_device *adev); |
| 195 | void acpi_free_properties(struct acpi_device *adev); | 197 | void acpi_free_properties(struct acpi_device *adev); |
| 196 | 198 | ||
diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c index 76075eea5f64..7836e2e980f4 100644 --- a/drivers/acpi/property.c +++ b/drivers/acpi/property.c | |||
| @@ -110,11 +110,11 @@ void acpi_init_properties(struct acpi_device *adev) | |||
| 110 | int i; | 110 | int i; |
| 111 | 111 | ||
| 112 | /* | 112 | /* |
| 113 | * Check if the special PRP0001 ACPI ID is present and in that case we | 113 | * Check if ACPI_DT_NAMESPACE_HID is present and inthat case we fill in |
| 114 | * fill in Device Tree compatible properties for this device. | 114 | * Device Tree compatible properties for this device. |
| 115 | */ | 115 | */ |
| 116 | list_for_each_entry(hwid, &adev->pnp.ids, list) { | 116 | list_for_each_entry(hwid, &adev->pnp.ids, list) { |
| 117 | if (!strcmp(hwid->id, "PRP0001")) { | 117 | if (!strcmp(hwid->id, ACPI_DT_NAMESPACE_HID)) { |
| 118 | acpi_of = true; | 118 | acpi_of = true; |
| 119 | break; | 119 | break; |
| 120 | } | 120 | } |
| @@ -170,7 +170,7 @@ void acpi_init_properties(struct acpi_device *adev) | |||
| 170 | out: | 170 | out: |
| 171 | if (acpi_of && !adev->flags.of_compatible_ok) | 171 | if (acpi_of && !adev->flags.of_compatible_ok) |
| 172 | acpi_handle_info(adev->handle, | 172 | acpi_handle_info(adev->handle, |
| 173 | "PRP0001 requires 'compatible' property\n"); | 173 | ACPI_DT_NAMESPACE_HID " requires 'compatible' property\n"); |
| 174 | } | 174 | } |
| 175 | 175 | ||
| 176 | void acpi_free_properties(struct acpi_device *adev) | 176 | void acpi_free_properties(struct acpi_device *adev) |
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 03141aa4ea95..b19283b336c7 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
| @@ -135,12 +135,13 @@ static int create_pnp_modalias(struct acpi_device *acpi_dev, char *modalias, | |||
| 135 | struct acpi_hardware_id *id; | 135 | struct acpi_hardware_id *id; |
| 136 | 136 | ||
| 137 | /* | 137 | /* |
| 138 | * Since we skip PRP0001 from the modalias below, 0 should be returned | 138 | * Since we skip ACPI_DT_NAMESPACE_HID from the modalias below, 0 should |
| 139 | * if PRP0001 is the only ACPI/PNP ID in the device's list. | 139 | * be returned if ACPI_DT_NAMESPACE_HID is the only ACPI/PNP ID in the |
| 140 | * device's list. | ||
| 140 | */ | 141 | */ |
| 141 | count = 0; | 142 | count = 0; |
| 142 | list_for_each_entry(id, &acpi_dev->pnp.ids, list) | 143 | list_for_each_entry(id, &acpi_dev->pnp.ids, list) |
| 143 | if (strcmp(id->id, "PRP0001")) | 144 | if (strcmp(id->id, ACPI_DT_NAMESPACE_HID)) |
| 144 | count++; | 145 | count++; |
| 145 | 146 | ||
| 146 | if (!count) | 147 | if (!count) |
| @@ -153,7 +154,7 @@ static int create_pnp_modalias(struct acpi_device *acpi_dev, char *modalias, | |||
| 153 | size -= len; | 154 | size -= len; |
| 154 | 155 | ||
| 155 | list_for_each_entry(id, &acpi_dev->pnp.ids, list) { | 156 | list_for_each_entry(id, &acpi_dev->pnp.ids, list) { |
| 156 | if (!strcmp(id->id, "PRP0001")) | 157 | if (!strcmp(id->id, ACPI_DT_NAMESPACE_HID)) |
| 157 | continue; | 158 | continue; |
| 158 | 159 | ||
| 159 | count = snprintf(&modalias[len], size, "%s:", id->id); | 160 | 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 | * @size: Size of the buffer. | 178 | * @size: Size of the buffer. |
| 178 | * | 179 | * |
| 179 | * Expose DT compatible modalias as of:NnameTCcompatible. This function should | 180 | * Expose DT compatible modalias as of:NnameTCcompatible. This function should |
| 180 | * only be called for devices having PRP0001 in their list of ACPI/PNP IDs. | 181 | * only be called for devices having ACPI_DT_NAMESPACE_HID in their list of |
| 182 | * ACPI/PNP IDs. | ||
| 181 | */ | 183 | */ |
| 182 | static int create_of_modalias(struct acpi_device *acpi_dev, char *modalias, | 184 | static int create_of_modalias(struct acpi_device *acpi_dev, char *modalias, |
| 183 | int size) | 185 | int size) |
| @@ -980,9 +982,9 @@ static void acpi_device_remove_files(struct acpi_device *dev) | |||
| 980 | * @adev: ACPI device object to match. | 982 | * @adev: ACPI device object to match. |
| 981 | * @of_match_table: List of device IDs to match against. | 983 | * @of_match_table: List of device IDs to match against. |
| 982 | * | 984 | * |
| 983 | * If @dev has an ACPI companion which has the special PRP0001 device ID in its | 985 | * If @dev has an ACPI companion which has ACPI_DT_NAMESPACE_HID in its list of |
| 984 | * list of identifiers and a _DSD object with the "compatible" property, use | 986 | * identifiers and a _DSD object with the "compatible" property, use that |
| 985 | * that property to match against the given list of identifiers. | 987 | * property to match against the given list of identifiers. |
| 986 | */ | 988 | */ |
| 987 | static bool acpi_of_match_device(struct acpi_device *adev, | 989 | static bool acpi_of_match_device(struct acpi_device *adev, |
| 988 | const struct of_device_id *of_match_table) | 990 | const struct of_device_id *of_match_table) |
| @@ -1038,14 +1040,14 @@ static const struct acpi_device_id *__acpi_match_device( | |||
| 1038 | return id; | 1040 | return id; |
| 1039 | 1041 | ||
| 1040 | /* | 1042 | /* |
| 1041 | * Next, check the special "PRP0001" ID and try to match the | 1043 | * Next, check ACPI_DT_NAMESPACE_HID and try to match the |
| 1042 | * "compatible" property if found. | 1044 | * "compatible" property if found. |
| 1043 | * | 1045 | * |
| 1044 | * The id returned by the below is not valid, but the only | 1046 | * The id returned by the below is not valid, but the only |
| 1045 | * caller passing non-NULL of_ids here is only interested in | 1047 | * caller passing non-NULL of_ids here is only interested in |
| 1046 | * whether or not the return value is NULL. | 1048 | * whether or not the return value is NULL. |
| 1047 | */ | 1049 | */ |
| 1048 | if (!strcmp("PRP0001", hwid->id) | 1050 | if (!strcmp(ACPI_DT_NAMESPACE_HID, hwid->id) |
| 1049 | && acpi_of_match_device(device, of_ids)) | 1051 | && acpi_of_match_device(device, of_ids)) |
| 1050 | return id; | 1052 | return id; |
| 1051 | } | 1053 | } |
| @@ -2405,7 +2407,7 @@ static void acpi_default_enumeration(struct acpi_device *device) | |||
| 2405 | } | 2407 | } |
| 2406 | 2408 | ||
| 2407 | static const struct acpi_device_id generic_device_ids[] = { | 2409 | static const struct acpi_device_id generic_device_ids[] = { |
| 2408 | {"PRP0001", }, | 2410 | {ACPI_DT_NAMESPACE_HID, }, |
| 2409 | {"", }, | 2411 | {"", }, |
| 2410 | }; | 2412 | }; |
| 2411 | 2413 | ||
| @@ -2413,8 +2415,8 @@ static int acpi_generic_device_attach(struct acpi_device *adev, | |||
| 2413 | const struct acpi_device_id *not_used) | 2415 | const struct acpi_device_id *not_used) |
| 2414 | { | 2416 | { |
| 2415 | /* | 2417 | /* |
| 2416 | * Since PRP0001 is the only ID handled here, the test below can be | 2418 | * Since ACPI_DT_NAMESPACE_HID is the only ID handled here, the test |
| 2417 | * unconditional. | 2419 | * below can be unconditional. |
| 2418 | */ | 2420 | */ |
| 2419 | if (adev->data.of_compatible) | 2421 | if (adev->data.of_compatible) |
| 2420 | acpi_default_enumeration(adev); | 2422 | acpi_default_enumeration(adev); |
