aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJiang Liu <jiang.liu@linux.intel.com>2013-12-19 07:38:14 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-01-05 10:07:14 -0500
commit2fc59fe2ecdca56a68728b6091590c07bb3e358d (patch)
tree64591b36eaf2df389b13dc2b3cce3cc5b31d4223 /drivers
parent1d0fcef732832432aee47cb75bf4a2cb3107be64 (diff)
PCI / pci-label: treat PCI label with index 0 as valid label
Current pci-label driver detects ACPI label by checking label index returned by ACPI _DSM method, and treats it as valid if label index is positive. According to ACPI Firmware specification 3.1, zero is also an valid label index. So change code to detect availability of ACPI slot label by checking availaiblity of ACPI _DSM function for PCI label. Signed-off-by: Jiang Liu <jiang.liu@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/pci/pci-label.c34
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
189enum acpi_attr_enum { 189enum 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)
246static bool 241static bool
247device_has_dsm(struct device *dev) 242device_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
252static umode_t 254static umode_t