From: Jiang Liu <jiang.liu@linux.intel.com>
To: "Rafael J . Wysocki" <rafael.j.wysocki@intel.com>,
Bjorn Helgaas <bhelgaas@google.com>,
Lv Zheng <lv.zheng@intel.com>, Len Brown <lenb@kernel.org>,
Leonidas Da Silva Barbosa <leosilva@linux.vnet.ibm.com>,
Ashley Lai <ashley@ashleylai.com>,
Peter Huewe <peterhuewe@gmx.de>, Rajiv Andrade <mail@srajiv.net>,
Marcel Selhorst <tpmdd@selhorst.net>,
Sirrix AG <tpmdd@sirrix.com>,
Daniel Vetter <daniel.vetter@ffwll.ch>,
David Airlie <airlied@linux.ie>, Jiri Kosina <jkosina@suse.cz>,
linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Jiang Liu <jiang.liu@linux.intel.com>, Tony Luck <tony.luck@intel.com>
Subject: [RFC Patch v1 05/13] PCI, pci-label: treat PCI label with index 0 as valid label
Date: Wed, 18 Dec 2013 14:58:13 +0800 [thread overview]
Message-ID: <1387349901-3391-6-git-send-email-jiang.liu@linux.intel.com> (raw)
In-Reply-To: <1387349901-3391-1-git-send-email-jiang.liu@linux.intel.com>
Current pci-label driver detects ACPI label by checking label index
returned by ACPI _DSM method, and treat 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>
---
drivers/pci/pci-label.c | 34 ++++++++++++++++++----------------
1 file changed, 18 insertions(+), 16 deletions(-)
diff --git a/drivers/pci/pci-label.c b/drivers/pci/pci-label.c
index f12dcd1..0260b14 100644
--- a/drivers/pci/pci-label.c
+++ b/drivers/pci/pci-label.c
@@ -187,7 +187,6 @@ static const char device_label_dsm_uuid[] = {
};
enum acpi_attr_enum {
- ACPI_ATTR_NONE = 0,
ACPI_ATTR_LABEL_SHOW,
ACPI_ATTR_INDEX_SHOW,
};
@@ -222,20 +221,16 @@ dsm_get_label(struct device *dev, char *buf, enum acpi_attr_enum attr)
if (obj->type == ACPI_TYPE_PACKAGE && obj->package.count == 2 &&
tmp[0].type == ACPI_TYPE_INTEGER &&
tmp[1].type == ACPI_TYPE_STRING) {
- len = tmp[0].integer.value;
- if (buf) {
- /*
- * This second string element is optional even when
- * this _DSM is implemented; when not implemented,
- * this entry must return a null string.
- */
- if (attr == ACPI_ATTR_INDEX_SHOW)
- scnprintf(buf, PAGE_SIZE, "%llu\n",
- tmp->integer.value);
- else if (attr == ACPI_ATTR_LABEL_SHOW)
- dsm_label_utf16s_to_utf8s(tmp + 1, buf);
- len = strlen(buf) > 0 ? strlen(buf) : -1;
- }
+ /*
+ * The second string element is optional even when
+ * this _DSM is implemented; when not implemented,
+ * this entry must return a null string.
+ */
+ if (attr == ACPI_ATTR_INDEX_SHOW)
+ scnprintf(buf, PAGE_SIZE, "%llu\n", tmp->integer.value);
+ else if (attr == ACPI_ATTR_LABEL_SHOW)
+ dsm_label_utf16s_to_utf8s(tmp + 1, buf);
+ len = strlen(buf) > 0 ? strlen(buf) : -1;
}
ACPI_FREE(obj);
@@ -246,7 +241,14 @@ dsm_get_label(struct device *dev, char *buf, enum acpi_attr_enum attr)
static bool
device_has_dsm(struct device *dev)
{
- return dsm_get_label(dev, NULL, ACPI_ATTR_NONE) > 0;
+ acpi_handle handle;
+
+ handle = ACPI_HANDLE(dev);
+ if (!handle)
+ return false;
+
+ return !!acpi_check_dsm(handle, device_label_dsm_uuid, 0x2,
+ 1 << DEVICE_LABEL_DSM);
}
static umode_t
--
1.7.10.4
next prev parent reply other threads:[~2013-12-18 6:57 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1387349901-3391-1-git-send-email-jiang.liu@linux.intel.com>
2013-12-18 6:58 ` [RFC Patch v1 01/13] ACPI: introduce helper interfaces to support ACPI _DSM method Jiang Liu
2013-12-18 6:58 ` [RFC Patch v1 02/13] ACPI, extlog: replace open-coded _DSM specific code with helper functions Jiang Liu
2013-12-18 6:58 ` [RFC Patch v1 03/13] PCI, pci-label: release allocated ACPI object on error recovery path Jiang Liu
2013-12-18 6:58 ` [RFC Patch v1 04/13] ACPI, PCI: replace open-coded _DSM specific code with helper functions Jiang Liu
2013-12-18 6:58 ` Jiang Liu [this message]
2013-12-18 6:58 ` [RFC Patch v1 06/13] ACPI, TPM: fix memory leak when walking ACPI namespace Jiang Liu
2013-12-18 6:58 ` [RFC Patch v1 07/13] ACPI, TPM: matching node name instead of full path when searching for TPM device Jiang Liu
2013-12-18 6:58 ` [RFC Patch v1 08/13] ACPI, TPM: replace open-coded _DSM specific code with helper functions Jiang Liu
2013-12-18 6:58 ` [RFC Patch v1 09/13] ACPI, TPM: detecting PPI features by checking availability of _DSM functions Jiang Liu
2013-12-18 6:58 ` [RFC Patch v1 10/13] ACPI, i2c-hid: replace open-coded _DSM specific code with helper functions Jiang Liu
2013-12-18 6:58 ` [RFC Patch v1 11/13] ACPI, i915: " Jiang Liu
2013-12-18 8:15 ` Daniel Vetter
2013-12-18 6:58 ` [RFC Patch v1 12/13] nouveau: fix memory leak in ACPI _DSM related code Jiang Liu
2013-12-18 6:58 ` [RFC Patch v1 13/13] ACPI, nouveau: replace open-coded _DSM specific code with helper functions Jiang Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1387349901-3391-6-git-send-email-jiang.liu@linux.intel.com \
--to=jiang.liu@linux.intel.com \
--cc=airlied@linux.ie \
--cc=ashley@ashleylai.com \
--cc=bhelgaas@google.com \
--cc=daniel.vetter@ffwll.ch \
--cc=jkosina@suse.cz \
--cc=lenb@kernel.org \
--cc=leosilva@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lv.zheng@intel.com \
--cc=mail@srajiv.net \
--cc=peterhuewe@gmx.de \
--cc=rafael.j.wysocki@intel.com \
--cc=tony.luck@intel.com \
--cc=tpmdd@selhorst.net \
--cc=tpmdd@sirrix.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®