From: Zhang Rui <rui.zhang@intel.com>
To: Lv Zheng <lv.zheng@intel.com>
Cc: Linux ACPI <linux-acpi@vger.kernel.org>,
Len Brown <len.brown@intel.com>,
Robert Moore <robert.moore@intel.com>,
Ying Huang <ying.huang@intel.com>
Subject: Re: [PATCH] ACPI: Add identification objects' user interface.
Date: Thu, 27 Sep 2012 09:45:21 +0800 [thread overview]
Message-ID: <1348710321.10877.273.camel@rui.sh.intel.com> (raw)
In-Reply-To: <ce5e3ff518a8a0a74b2acb2920df409fa618276f.1348709690.git.lv.zheng@intel.com>
On 四, 2012-09-27 at 09:40 +0800, Lv Zheng wrote:
> ACPI devices are glued with physical devices through _ADR object, ACPI
> enumerated devices are identified with _UID object. Currently we can
> observe _HID/_CID through sysfs interfaces (hid/modalias), but there's
> no mean for us to check _ADR/_UID from user space. This patch fix this
> gap for ACPI developers and users.
>
why do we need to get this information from userspace?
thanks,
rui
> Signed-off-by: Lv Zheng <lv.zheng@intel.com>
> ---
> drivers/acpi/scan.c | 25 +++++++++++++++++++++++++
> 1 file changed, 25 insertions(+)
>
> diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
> index bb7fe47..df53190 100644
> --- a/drivers/acpi/scan.c
> +++ b/drivers/acpi/scan.c
> @@ -216,6 +216,22 @@ acpi_device_hid_show(struct device *dev, struct device_attribute *attr, char *bu
> static DEVICE_ATTR(hid, 0444, acpi_device_hid_show, NULL);
>
> static ssize_t
> +acpi_device_uid_show(struct device *dev, struct device_attribute *attr, char *buf) {
> + struct acpi_device *acpi_dev = to_acpi_device(dev);
> +
> + return sprintf(buf, "%s\n", acpi_dev->pnp.unique_id);
> +}
> +static DEVICE_ATTR(uid, 0444, acpi_device_uid_show, NULL);
> +
> +static ssize_t
> +acpi_device_adr_show(struct device *dev, struct device_attribute *attr, char *buf) {
> + struct acpi_device *acpi_dev = to_acpi_device(dev);
> +
> + return sprintf(buf, "0x%08x\n", (unsigned int)(acpi_dev->pnp.bus_address));
> +}
> +static DEVICE_ATTR(adr, 0444, acpi_device_adr_show, NULL);
> +
> +static ssize_t
> acpi_device_path_show(struct device *dev, struct device_attribute *attr, char *buf) {
> struct acpi_device *acpi_dev = to_acpi_device(dev);
> struct acpi_buffer path = {ACPI_ALLOCATE_BUFFER, NULL};
> @@ -257,6 +273,11 @@ static int acpi_device_setup_files(struct acpi_device *dev)
> goto end;
> }
>
> + if (dev->flags.bus_address)
> + result = device_create_file(&dev->dev, &dev_attr_adr);
> + if (dev->pnp.unique_id)
> + result = device_create_file(&dev->dev, &dev_attr_uid);
> +
> /*
> * If device has _EJ0, 'eject' file is created that is used to trigger
> * hot-removal function from userland.
> @@ -281,6 +302,10 @@ static void acpi_device_remove_files(struct acpi_device *dev)
> if (ACPI_SUCCESS(status))
> device_remove_file(&dev->dev, &dev_attr_eject);
>
> + if (dev->pnp.unique_id)
> + device_remove_file(&dev->dev, &dev_attr_uid);
> + if (dev->flags.bus_address)
> + device_remove_file(&dev->dev, &dev_attr_adr);
> device_remove_file(&dev->dev, &dev_attr_modalias);
> device_remove_file(&dev->dev, &dev_attr_hid);
> if (dev->handle)
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2012-09-27 1:45 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-27 1:17 [PATCH] ACPI: Add _UID support for ACPI devices Lv Zheng
2012-09-27 1:33 ` Zhang Rui
2012-09-27 1:40 ` [PATCH] ACPI: Add identification objects' user interface Lv Zheng
2012-09-27 1:45 ` Zhang Rui [this message]
2012-09-27 5:05 ` Zheng, Lv
2012-09-27 5:02 ` [RESEND PATCH] ACPI: Add _UID support for ACPI devices Lv Zheng
2012-09-28 0:39 ` [PATCH v2 0/2] ACPI: Add userland visibility for identification objects Lv Zheng
2012-09-28 0:40 ` [PATCH v2 1/2] ACPI: Add _UID support for ACPI devices Lv Zheng
2012-09-28 0:40 ` [PATCH v2 2/2] ACPI: Add identification objects' user interface Lv Zheng
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=1348710321.10877.273.camel@rui.sh.intel.com \
--to=rui.zhang@intel.com \
--cc=len.brown@intel.com \
--cc=linux-acpi@vger.kernel.org \
--cc=lv.zheng@intel.com \
--cc=robert.moore@intel.com \
--cc=ying.huang@intel.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;
as well as URLs for NNTP newsgroup(s).