[PATCH 1/2] ACPI: Implement acpi_get_device_handle copied from thinkpad_acpi.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The toshiba_acpi driver needs it and others might as well.
Removing the thinkpad_acpi.c implementation will follow in a separate
patch.

Signed-off-by: Thomas Renninger <trenn@xxxxxxx>
CC: Matthew Garrett <mjg@xxxxxxxxxx>
CC: Len Brown <lenb@xxxxxxxxxx>
CC: linux-acpi@xxxxxxxxxxxxxxx
CC: seth.forshee@xxxxxxxxxxxxx
CC: Azael Avalos <coproscefalo@xxxxxxxxx>
CC: Henrique de Moraes Holschuh <hmh@xxxxxxxxxx>
---
 drivers/acpi/osl.c   |   25 +++++++++++++++++++++++++
 include/linux/acpi.h |    2 ++
 2 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index f31c5c5..4f9f7f5 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -1659,3 +1659,28 @@ acpi_status acpi_os_terminate(void)
 
 	return AE_OK;
 }
+
+static acpi_status acpi_handle_locate_callback(acpi_handle handle,
+			       u32 level, void *context, void **return_value)
+{
+	*(acpi_handle *)return_value = handle;
+	return AE_CTRL_TERMINATE;
+}
+
+int acpi_handle_locate(const char *hid, acpi_handle *handle)
+{
+	acpi_status status;
+
+	if (!hid || !handle)
+		return -EINVAL;
+
+	memset(handle, 0, sizeof(acpi_handle));
+	status = acpi_get_devices(hid, acpi_handle_locate_callback, NULL,
+				  handle);
+
+	if (ACPI_FAILURE(status))
+		return -ENODEV;
+
+	return 0;		
+}
+EXPORT_SYMBOL_GPL(acpi_handle_locate);
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 6001b4da..d09aca3 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -146,6 +146,8 @@ struct acpi_pci_driver {
 int acpi_pci_register_driver(struct acpi_pci_driver *driver);
 void acpi_pci_unregister_driver(struct acpi_pci_driver *driver);
 
+extern int acpi_get_device_handle(const char *hid, acpi_handle *handle);
+
 extern int ec_read(u8 addr, u8 *val);
 extern int ec_write(u8 addr, u8 val);
 extern int ec_transaction(u8 command,
-- 
1.7.6.1

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux