diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2015-06-15 08:38:55 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2015-06-15 08:38:55 -0400 |
commit | faacd5ad83857300df4b7b1814ef2eb963063c14 (patch) | |
tree | 57f775901276792de38bea290da3822eba7e1df4 | |
parent | 0f57d86787d8b1076ea8f9cbdddda2a46d534a27 (diff) | |
parent | 0519ade71852701ec76ee7f8a0b37fe5a5504f98 (diff) |
Merge branch 'acpi-scan' into acpi-cca
-rw-r--r-- | drivers/acpi/internal.h | 2 | ||||
-rw-r--r-- | drivers/acpi/property.c | 54 | ||||
-rw-r--r-- | drivers/acpi/scan.c | 30 | ||||
-rw-r--r-- | include/acpi/acpi_bus.h | 3 |
4 files changed, 51 insertions, 38 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 0d083736e25b..7836e2e980f4 100644 --- a/drivers/acpi/property.c +++ b/drivers/acpi/property.c | |||
@@ -79,50 +79,51 @@ static bool acpi_properties_format_valid(const union acpi_object *properties) | |||
79 | static void acpi_init_of_compatible(struct acpi_device *adev) | 79 | static void acpi_init_of_compatible(struct acpi_device *adev) |
80 | { | 80 | { |
81 | const union acpi_object *of_compatible; | 81 | const union acpi_object *of_compatible; |
82 | struct acpi_hardware_id *hwid; | ||
83 | bool acpi_of = false; | ||
84 | int ret; | 82 | int ret; |
85 | 83 | ||
86 | /* | ||
87 | * Check if the special PRP0001 ACPI ID is present and in that | ||
88 | * case we fill in Device Tree compatible properties for this | ||
89 | * device. | ||
90 | */ | ||
91 | list_for_each_entry(hwid, &adev->pnp.ids, list) { | ||
92 | if (!strcmp(hwid->id, "PRP0001")) { | ||
93 | acpi_of = true; | ||
94 | break; | ||
95 | } | ||
96 | } | ||
97 | |||
98 | if (!acpi_of) | ||
99 | return; | ||
100 | |||
101 | ret = acpi_dev_get_property_array(adev, "compatible", ACPI_TYPE_STRING, | 84 | ret = acpi_dev_get_property_array(adev, "compatible", ACPI_TYPE_STRING, |
102 | &of_compatible); | 85 | &of_compatible); |
103 | if (ret) { | 86 | if (ret) { |
104 | ret = acpi_dev_get_property(adev, "compatible", | 87 | ret = acpi_dev_get_property(adev, "compatible", |
105 | ACPI_TYPE_STRING, &of_compatible); | 88 | ACPI_TYPE_STRING, &of_compatible); |
106 | if (ret) { | 89 | if (ret) { |
107 | acpi_handle_warn(adev->handle, | 90 | if (adev->parent |
108 | "PRP0001 requires compatible property\n"); | 91 | && adev->parent->flags.of_compatible_ok) |
92 | goto out; | ||
93 | |||
109 | return; | 94 | return; |
110 | } | 95 | } |
111 | } | 96 | } |
112 | adev->data.of_compatible = of_compatible; | 97 | adev->data.of_compatible = of_compatible; |
98 | |||
99 | out: | ||
100 | adev->flags.of_compatible_ok = 1; | ||
113 | } | 101 | } |
114 | 102 | ||
115 | void acpi_init_properties(struct acpi_device *adev) | 103 | void acpi_init_properties(struct acpi_device *adev) |
116 | { | 104 | { |
117 | struct acpi_buffer buf = { ACPI_ALLOCATE_BUFFER }; | 105 | struct acpi_buffer buf = { ACPI_ALLOCATE_BUFFER }; |
106 | bool acpi_of = false; | ||
107 | struct acpi_hardware_id *hwid; | ||
118 | const union acpi_object *desc; | 108 | const union acpi_object *desc; |
119 | acpi_status status; | 109 | acpi_status status; |
120 | int i; | 110 | int i; |
121 | 111 | ||
112 | /* | ||
113 | * Check if ACPI_DT_NAMESPACE_HID is present and inthat case we fill in | ||
114 | * Device Tree compatible properties for this device. | ||
115 | */ | ||
116 | list_for_each_entry(hwid, &adev->pnp.ids, list) { | ||
117 | if (!strcmp(hwid->id, ACPI_DT_NAMESPACE_HID)) { | ||
118 | acpi_of = true; | ||
119 | break; | ||
120 | } | ||
121 | } | ||
122 | |||
122 | status = acpi_evaluate_object_typed(adev->handle, "_DSD", NULL, &buf, | 123 | status = acpi_evaluate_object_typed(adev->handle, "_DSD", NULL, &buf, |
123 | ACPI_TYPE_PACKAGE); | 124 | ACPI_TYPE_PACKAGE); |
124 | if (ACPI_FAILURE(status)) | 125 | if (ACPI_FAILURE(status)) |
125 | return; | 126 | goto out; |
126 | 127 | ||
127 | desc = buf.pointer; | 128 | desc = buf.pointer; |
128 | if (desc->package.count % 2) | 129 | if (desc->package.count % 2) |
@@ -156,13 +157,20 @@ void acpi_init_properties(struct acpi_device *adev) | |||
156 | adev->data.pointer = buf.pointer; | 157 | adev->data.pointer = buf.pointer; |
157 | adev->data.properties = properties; | 158 | adev->data.properties = properties; |
158 | 159 | ||
159 | acpi_init_of_compatible(adev); | 160 | if (acpi_of) |
160 | return; | 161 | acpi_init_of_compatible(adev); |
162 | |||
163 | goto out; | ||
161 | } | 164 | } |
162 | 165 | ||
163 | fail: | 166 | fail: |
164 | dev_warn(&adev->dev, "Returned _DSD data is not valid, skipping\n"); | 167 | dev_dbg(&adev->dev, "Returned _DSD data is not valid, skipping\n"); |
165 | ACPI_FREE(buf.pointer); | 168 | ACPI_FREE(buf.pointer); |
169 | |||
170 | out: | ||
171 | if (acpi_of && !adev->flags.of_compatible_ok) | ||
172 | acpi_handle_info(adev->handle, | ||
173 | ACPI_DT_NAMESPACE_HID " requires 'compatible' property\n"); | ||
166 | } | 174 | } |
167 | 175 | ||
168 | 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..0a099917a006 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 | } |
@@ -1671,7 +1673,7 @@ static int acpi_bus_extract_wakeup_device_power_package(acpi_handle handle, | |||
1671 | 1673 | ||
1672 | static void acpi_wakeup_gpe_init(struct acpi_device *device) | 1674 | static void acpi_wakeup_gpe_init(struct acpi_device *device) |
1673 | { | 1675 | { |
1674 | struct acpi_device_id button_device_ids[] = { | 1676 | static const struct acpi_device_id button_device_ids[] = { |
1675 | {"PNP0C0C", 0}, | 1677 | {"PNP0C0C", 0}, |
1676 | {"PNP0C0D", 0}, | 1678 | {"PNP0C0D", 0}, |
1677 | {"PNP0C0E", 0}, | 1679 | {"PNP0C0E", 0}, |
@@ -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); |
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index 8de4fa90e8c4..da079976971f 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h | |||
@@ -208,7 +208,8 @@ struct acpi_device_flags { | |||
208 | u32 visited:1; | 208 | u32 visited:1; |
209 | u32 hotplug_notify:1; | 209 | u32 hotplug_notify:1; |
210 | u32 is_dock_station:1; | 210 | u32 is_dock_station:1; |
211 | u32 reserved:23; | 211 | u32 of_compatible_ok:1; |
212 | u32 reserved:22; | ||
212 | }; | 213 | }; |
213 | 214 | ||
214 | /* File System */ | 215 | /* File System */ |