ACPI / property: Expose data-only subnodes via sysfs

Add infrastructure needed to expose data-only subnodes of ACPI
device objects introduced previously via sysfs.

Each data-only subnode is represented as a sysfs directory under
the directory corresponding to its parent object (a device or a
data-only subnode).  Each of them has a "path" attribute (containing
the full ACPI namespace path to the object the subnode data come from)
at this time.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Tested-by: Mika Westerberg <mika.westerberg@linux.intel.com>
diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c
index 17c436d..333f914 100644
--- a/drivers/acpi/property.c
+++ b/drivers/acpi/property.c
@@ -64,12 +64,13 @@
 		goto fail;
 
 	if (acpi_extract_properties(buf.pointer, &dn->data))
-		dn->data.pointer = buf.pointer;
+		dn->handle = handle;
 
 	if (acpi_enumerate_nondev_subnodes(scope, buf.pointer, &dn->data))
-		dn->data.pointer = buf.pointer;
+		dn->handle = handle;
 
-	if (dn->data.pointer) {
+	if (dn->handle) {
+		dn->data.pointer = buf.pointer;
 		list_add_tail(&dn->sibling, list);
 		return true;
 	}
@@ -302,6 +303,7 @@
 
 	list_for_each_entry_safe_reverse(dn, next, list, sibling) {
 		acpi_destroy_nondev_subnodes(&dn->data.subnodes);
+		wait_for_completion(&dn->kobj_done);
 		list_del(&dn->sibling);
 		ACPI_FREE((void *)dn->data.pointer);
 		kfree(dn);