linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ACPI: Add _UID support for ACPI devices.
@ 2012-09-27  1:17 Lv Zheng
  2012-09-27  1:33 ` Zhang Rui
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Lv Zheng @ 2012-09-27  1:17 UTC (permalink / raw)
  To: Linux ACPI; +Cc: Len Brown, Robert Moore, Ying Huang, Rui Zhang, Lv Zheng

The _UID object is optional, but is required when the device has no
other way to report a persistent unique device ID.
This patch is required for ACPI 5.0 ACPI enumerated IP cores.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
---
 drivers/acpi/scan.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index d730a93..bb7fe47 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -327,6 +327,8 @@ static void acpi_device_release(struct device *dev)
 	struct acpi_device *acpi_dev = to_acpi_device(dev);
 
 	acpi_free_ids(acpi_dev);
+	if (acpi_dev->pnp.unique_id)
+		kfree(acpi_dev->pnp.unique_id);
 	kfree(acpi_dev);
 }
 
@@ -1162,6 +1164,9 @@ static void acpi_device_set_id(struct acpi_device *device)
 			device->pnp.bus_address = info->address;
 			device->flags.bus_address = 1;
 		}
+		if (info->valid & ACPI_VALID_UID) {
+			device->pnp.unique_id = kstrdup(info->unique_id.string, GFP_KERNEL);
+		}
 
 		kfree(info);
 
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] ACPI: Add _UID support for ACPI devices.
  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
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 9+ messages in thread
From: Zhang Rui @ 2012-09-27  1:33 UTC (permalink / raw)
  To: Lv Zheng; +Cc: Linux ACPI, Len Brown, Robert Moore, Ying Huang

On 四, 2012-09-27 at 09:17 +0800, Lv Zheng wrote:
> The _UID object is optional, but is required when the device has no
> other way to report a persistent unique device ID.
> This patch is required for ACPI 5.0 ACPI enumerated IP cores.
> 

> Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>

> ---
>  drivers/acpi/scan.c |    5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
> index d730a93..bb7fe47 100644
> --- a/drivers/acpi/scan.c
> +++ b/drivers/acpi/scan.c
> @@ -327,6 +327,8 @@ static void acpi_device_release(struct device *dev)
>  	struct acpi_device *acpi_dev = to_acpi_device(dev);
>  
>  	acpi_free_ids(acpi_dev);
> +	if (acpi_dev->pnp.unique_id)
> +		kfree(acpi_dev->pnp.unique_id);
>  	kfree(acpi_dev);
>  }
>  
> @@ -1162,6 +1164,9 @@ static void acpi_device_set_id(struct acpi_device *device)
>  			device->pnp.bus_address = info->address;
>  			device->flags.bus_address = 1;
>  		}
> +		if (info->valid & ACPI_VALID_UID) {
> +			device->pnp.unique_id = kstrdup(info->unique_id.string, GFP_KERNEL);
> +		}
>  
>  		kfree(info);
>  


--
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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH] ACPI: Add identification objects' user interface.
  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 ` Lv Zheng
  2012-09-27  1:45   ` Zhang Rui
  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
  3 siblings, 1 reply; 9+ messages in thread
From: Lv Zheng @ 2012-09-27  1:40 UTC (permalink / raw)
  To: Linux ACPI; +Cc: Len Brown, Robert Moore, Ying Huang, Rui Zhang, Lv Zheng

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.

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)
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH] ACPI: Add identification objects' user interface.
  2012-09-27  1:40 ` [PATCH] ACPI: Add identification objects' user interface Lv Zheng
@ 2012-09-27  1:45   ` Zhang Rui
  2012-09-27  5:05     ` Zheng, Lv
  0 siblings, 1 reply; 9+ messages in thread
From: Zhang Rui @ 2012-09-27  1:45 UTC (permalink / raw)
  To: Lv Zheng; +Cc: Linux ACPI, Len Brown, Robert Moore, Ying Huang

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [RESEND PATCH] ACPI: Add _UID support for ACPI devices.
  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  5:02 ` Lv Zheng
  2012-09-28  0:39 ` [PATCH v2 0/2] ACPI: Add userland visibility for identification objects Lv Zheng
  3 siblings, 0 replies; 9+ messages in thread
From: Lv Zheng @ 2012-09-27  5:02 UTC (permalink / raw)
  To: Len Brown; +Cc: linux-acpi, Lv Zheng, Rui Zhang

The _UID object is optional, but is required when the device has no
other way to report a persistent unique device ID.
This patch is required for ACPI 5.0 ACPI enumerated IP cores.

Signed-off-by: Rui Zhang <rui.zhang@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
---
 drivers/acpi/scan.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index d730a93..bb7fe47 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -327,6 +327,8 @@ static void acpi_device_release(struct device *dev)
 	struct acpi_device *acpi_dev = to_acpi_device(dev);
 
 	acpi_free_ids(acpi_dev);
+	if (acpi_dev->pnp.unique_id)
+		kfree(acpi_dev->pnp.unique_id);
 	kfree(acpi_dev);
 }
 
@@ -1162,6 +1164,9 @@ static void acpi_device_set_id(struct acpi_device *device)
 			device->pnp.bus_address = info->address;
 			device->flags.bus_address = 1;
 		}
+		if (info->valid & ACPI_VALID_UID) {
+			device->pnp.unique_id = kstrdup(info->unique_id.string, GFP_KERNEL);
+		}
 
 		kfree(info);
 
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* RE: [PATCH] ACPI: Add identification objects' user interface.
  2012-09-27  1:45   ` Zhang Rui
@ 2012-09-27  5:05     ` Zheng, Lv
  0 siblings, 0 replies; 9+ messages in thread
From: Zheng, Lv @ 2012-09-27  5:05 UTC (permalink / raw)
  To: Zhang, Rui; +Cc: Linux ACPI, Michael Kerrisk

> > 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?

Developers may want to check _ADR from user land to see whether the glue implementation is correct.
Same situation may be encountered on _UID.

We may discuss here to see whether the two files are required for ACPI users.
Thus this optional feature hasn't been combined with the former _UID enabling one.

Best regards/Lv Zheng

> > 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)


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2 0/2] ACPI: Add userland visibility for identification objects.
  2012-09-27  1:17 [PATCH] ACPI: Add _UID support for ACPI devices Lv Zheng
                   ` (2 preceding siblings ...)
  2012-09-27  5:02 ` [RESEND PATCH] ACPI: Add _UID support for ACPI devices Lv Zheng
@ 2012-09-28  0:39 ` 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
  3 siblings, 2 replies; 9+ messages in thread
From: Lv Zheng @ 2012-09-28  0:39 UTC (permalink / raw)
  To: Len Brown; +Cc: Michael Kerrisk, linux-acpi, Lv Zheng

There are four important device identification objects currently used in
the ACPI bus implementation:

_HID/_CID: traditional enumerated devicess use this object for ACPI device
           matching.
_ADR: the ACPI device/physical device binding codes will use this to find
      non-bridge devices.
_UID: the ACPI enumerated devices require this object to identify itself.

This patch set add the missing stuff useful for _UID in the ACPI devices.
Tow sysfs interfaces are also introduced to allow developers monitor _ADR
and _UID from the user space.

Version 2 of this patch set fixed CodingStyle issues.  The two patches are
also combined to form a single patch set.


Lv Zheng (2):
  ACPI: Add _UID support for ACPI devices.
  ACPI: Add identification objects' user interface.

 drivers/acpi/scan.c |   32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

-- 
1.7.10


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2 1/2] ACPI: Add _UID support for ACPI devices.
  2012-09-28  0:39 ` [PATCH v2 0/2] ACPI: Add userland visibility for identification objects Lv Zheng
@ 2012-09-28  0:40   ` Lv Zheng
  2012-09-28  0:40   ` [PATCH v2 2/2] ACPI: Add identification objects' user interface Lv Zheng
  1 sibling, 0 replies; 9+ messages in thread
From: Lv Zheng @ 2012-09-28  0:40 UTC (permalink / raw)
  To: Len Brown; +Cc: Michael Kerrisk, linux-acpi, Lv Zheng, Rui Zhang

The _UID object is optional, but is required when the device has no
other way to report a persistent unique device ID.
This patch is required for ACPI 5.0 ACPI enumerated IP cores.

Signed-off-by: Rui Zhang <rui.zhang@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
---
 drivers/acpi/scan.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index d730a93..7e8a130 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -327,6 +327,7 @@ static void acpi_device_release(struct device *dev)
 	struct acpi_device *acpi_dev = to_acpi_device(dev);
 
 	acpi_free_ids(acpi_dev);
+	kfree(acpi_dev->pnp.unique_id);
 	kfree(acpi_dev);
 }
 
@@ -1162,6 +1163,9 @@ static void acpi_device_set_id(struct acpi_device *device)
 			device->pnp.bus_address = info->address;
 			device->flags.bus_address = 1;
 		}
+		if (info->valid & ACPI_VALID_UID)
+			device->pnp.unique_id = kstrdup(info->unique_id.string,
+							GFP_KERNEL);
 
 		kfree(info);
 
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 2/2] ACPI: Add identification objects' user interface.
  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   ` Lv Zheng
  1 sibling, 0 replies; 9+ messages in thread
From: Lv Zheng @ 2012-09-28  0:40 UTC (permalink / raw)
  To: Len Brown; +Cc: Michael Kerrisk, linux-acpi, Lv Zheng

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.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
---
 drivers/acpi/scan.c |   28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 7e8a130..3f522a9 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -215,6 +215,25 @@ 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);
@@ -257,6 +276,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 +305,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)
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-09-28  0:41 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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).