linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] ACPI: Implement acpi_get_device_handle copied from thinkpad_acpi.c
@ 2011-12-16  0:26 Thomas Renninger
  2011-12-16  0:26 ` [PATCH 2/2] ACPI: Remove tpacpi_acpi_handle_locate_callback and make use of the global implementation Thomas Renninger
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Renninger @ 2011-12-16  0:26 UTC (permalink / raw)
  To: lenb
  Cc: Thomas Renninger, Matthew Garrett, linux-acpi, seth.forshee,
	Azael Avalos, Henrique de Moraes Holschuh

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@suse.de>
CC: Matthew Garrett <mjg@redhat.com>
CC: Len Brown <lenb@kernel.org>
CC: linux-acpi@vger.kernel.org
CC: seth.forshee@canonical.com
CC: Azael Avalos <coproscefalo@gmail.com>
CC: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
---
 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


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

end of thread, other threads:[~2011-12-16  0:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-16  0:26 [PATCH 1/2] ACPI: Implement acpi_get_device_handle copied from thinkpad_acpi.c Thomas Renninger
2011-12-16  0:26 ` [PATCH 2/2] ACPI: Remove tpacpi_acpi_handle_locate_callback and make use of the global implementation Thomas Renninger

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