diff options
Diffstat (limited to 'drivers/pci/pci-label.c')
-rw-r--r-- | drivers/pci/pci-label.c | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/drivers/pci/pci-label.c b/drivers/pci/pci-label.c index f12dcd1dc208..0260b14c8d94 100644 --- a/drivers/pci/pci-label.c +++ b/drivers/pci/pci-label.c | |||
@@ -187,7 +187,6 @@ static const char device_label_dsm_uuid[] = { | |||
187 | }; | 187 | }; |
188 | 188 | ||
189 | enum acpi_attr_enum { | 189 | enum acpi_attr_enum { |
190 | ACPI_ATTR_NONE = 0, | ||
191 | ACPI_ATTR_LABEL_SHOW, | 190 | ACPI_ATTR_LABEL_SHOW, |
192 | ACPI_ATTR_INDEX_SHOW, | 191 | ACPI_ATTR_INDEX_SHOW, |
193 | }; | 192 | }; |
@@ -222,20 +221,16 @@ dsm_get_label(struct device *dev, char *buf, enum acpi_attr_enum attr) | |||
222 | if (obj->type == ACPI_TYPE_PACKAGE && obj->package.count == 2 && | 221 | if (obj->type == ACPI_TYPE_PACKAGE && obj->package.count == 2 && |
223 | tmp[0].type == ACPI_TYPE_INTEGER && | 222 | tmp[0].type == ACPI_TYPE_INTEGER && |
224 | tmp[1].type == ACPI_TYPE_STRING) { | 223 | tmp[1].type == ACPI_TYPE_STRING) { |
225 | len = tmp[0].integer.value; | 224 | /* |
226 | if (buf) { | 225 | * The second string element is optional even when |
227 | /* | 226 | * this _DSM is implemented; when not implemented, |
228 | * This second string element is optional even when | 227 | * this entry must return a null string. |
229 | * this _DSM is implemented; when not implemented, | 228 | */ |
230 | * this entry must return a null string. | 229 | if (attr == ACPI_ATTR_INDEX_SHOW) |
231 | */ | 230 | scnprintf(buf, PAGE_SIZE, "%llu\n", tmp->integer.value); |
232 | if (attr == ACPI_ATTR_INDEX_SHOW) | 231 | else if (attr == ACPI_ATTR_LABEL_SHOW) |
233 | scnprintf(buf, PAGE_SIZE, "%llu\n", | 232 | dsm_label_utf16s_to_utf8s(tmp + 1, buf); |
234 | tmp->integer.value); | 233 | len = strlen(buf) > 0 ? strlen(buf) : -1; |
235 | else if (attr == ACPI_ATTR_LABEL_SHOW) | ||
236 | dsm_label_utf16s_to_utf8s(tmp + 1, buf); | ||
237 | len = strlen(buf) > 0 ? strlen(buf) : -1; | ||
238 | } | ||
239 | } | 234 | } |
240 | 235 | ||
241 | ACPI_FREE(obj); | 236 | ACPI_FREE(obj); |
@@ -246,7 +241,14 @@ dsm_get_label(struct device *dev, char *buf, enum acpi_attr_enum attr) | |||
246 | static bool | 241 | static bool |
247 | device_has_dsm(struct device *dev) | 242 | device_has_dsm(struct device *dev) |
248 | { | 243 | { |
249 | return dsm_get_label(dev, NULL, ACPI_ATTR_NONE) > 0; | 244 | acpi_handle handle; |
245 | |||
246 | handle = ACPI_HANDLE(dev); | ||
247 | if (!handle) | ||
248 | return false; | ||
249 | |||
250 | return !!acpi_check_dsm(handle, device_label_dsm_uuid, 0x2, | ||
251 | 1 << DEVICE_LABEL_DSM); | ||
250 | } | 252 | } |
251 | 253 | ||
252 | static umode_t | 254 | static umode_t |