From: Randy Dunlap <randy_d_dunlap-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
To: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
pcihpd-discuss-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Cc: kristen.c.accardi-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
len.brown-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
gregkh-l3A5Bk7waGM@public.gmane.org
Subject: [PATCH 1/2] make acpi_path_name() global
Date: Thu, 15 Dec 2005 17:20:09 -0800 [thread overview]
Message-ID: <20051215172009.2eb3c3b4.randy_d_dunlap@linux.intel.com> (raw)
From: Randy Dunlap <randy_d_dunlap-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
Make acpi_path_name() usable by everyone.
I need this for adding SATA suspend/resume ACPI support.
Note:
This function is now a memory allocator and callers should kfree()
the memory when done with it. It doesn't seem safe to me to leave
it as returning a pointer to a static buffer (as it was in multiple
cloned copies) as we add callers to it.
Signed-off-by: Randy Dunlap <randy_d_dunlap-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
---
drivers/acpi/osl.c | 29 +++++++++++++++++++++++++++++
include/acpi/acpiosxf.h | 2 ++
2 files changed, 31 insertions(+)
--- linux-2615-rc5g5.orig/drivers/acpi/osl.c
+++ linux-2615-rc5g5/drivers/acpi/osl.c
@@ -1078,6 +1078,35 @@ void acpi_os_release_lock(acpi_handle ha
spin_unlock_irqrestore((spinlock_t *) handle, flags);
}
+/**
+ * acpi_path_name - get ACPI path_name for the given handle
+ * @handle: ACPI object handle to look up name of
+ *
+ * Allocates memory if successul. Caller must free the memory.
+ *
+ * Returns: pointer to path_name if successful, NULL if not.
+ */
+u8 *acpi_path_name(acpi_handle handle)
+{
+ acpi_status status;
+ static u8 *path_name;
+ struct acpi_buffer ret_buf = {ACPI_PATHNAME_MAX, path_name};
+
+ path_name = kzalloc(ACPI_PATHNAME_MAX, GFP_KERNEL);
+ if (!path_name)
+ return NULL;
+
+ status = acpi_get_name(handle, ACPI_FULL_PATHNAME, &ret_buf);
+
+ if (ACPI_FAILURE(status)) {
+ acpi_os_free(path_name);
+ return NULL;
+ }
+
+ return path_name;
+}
+EXPORT_SYMBOL(acpi_path_name);
+
#ifndef ACPI_USE_LOCAL_CACHE
/*******************************************************************************
--- linux-2615-rc5g5.orig/include/acpi/acpiosxf.h
+++ linux-2615-rc5g5/include/acpi/acpiosxf.h
@@ -112,6 +112,8 @@ unsigned long acpi_os_acquire_lock(acpi_
void acpi_os_release_lock(acpi_handle handle, unsigned long flags);
+u8 *acpi_path_name(acpi_handle handle);
+
/*
* Memory allocation and mapping
*/
---
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
next reply other threads:[~2005-12-16 1:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-12-16 1:20 Randy Dunlap [this message]
-- strict thread matches above, loose matches on Subject: below --
2005-12-16 4:56 [PATCH 1/2] make acpi_path_name() global Brown, Len
2005-12-16 5:27 ` Randy.Dunlap
2005-12-16 18:38 ` Kristen Accardi
2005-12-16 21:03 ` Rolf Eike Beer
2005-12-16 21:07 Moore, Robert
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=20051215172009.2eb3c3b4.randy_d_dunlap@linux.intel.com \
--to=randy_d_dunlap-vuqaysv1563yd54fqh9/ca@public.gmane.org \
--cc=acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
--cc=gregkh-l3A5Bk7waGM@public.gmane.org \
--cc=kristen.c.accardi-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=len.brown-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=pcihpd-discuss-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
/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