public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/2] convert acpi_path_name() callers
@ 2005-12-16  1:20 Randy Dunlap
  0 siblings, 0 replies; only message in thread
From: Randy Dunlap @ 2005-12-16  1:20 UTC (permalink / raw)
  To: acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	pcihpd-discuss-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: kristen.c.accardi-ral2JQCrhuEAvxtiuMwx3w,
	len.brown-ral2JQCrhuEAvxtiuMwx3w, gregkh-l3A5Bk7waGM

From: Randy Dunlap <randy_d_dunlap-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>

Convert the callers of local acpi_path_name() functions to use
the exported version of it.

Signed-off-by: Randy Dunlap <randy_d_dunlap-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
---
 drivers/pci/hotplug/pciehprm_acpi.c |   21 ++++++---------------
 drivers/pci/hotplug/shpchprm_acpi.c |   19 ++++---------------
 2 files changed, 10 insertions(+), 30 deletions(-)

--- linux-2615-rc5g5.orig/drivers/pci/hotplug/pciehprm_acpi.c
+++ linux-2615-rc5g5/drivers/pci/hotplug/pciehprm_acpi.c
@@ -38,21 +38,6 @@
 #define	METHOD_NAME__HPP	"_HPP"
 #define	METHOD_NAME_OSHP	"OSHP"
 
-static u8 * acpi_path_name( acpi_handle	handle)
-{
-	acpi_status		status;
-	static u8		path_name[ACPI_PATHNAME_MAX];
-	struct acpi_buffer	ret_buf = { ACPI_PATHNAME_MAX, path_name };
-
-	memset(path_name, 0, sizeof (path_name));
-	status = acpi_get_name(handle, ACPI_FULL_PATHNAME, &ret_buf);
-
-	if (ACPI_FAILURE(status))
-		return NULL;
-	else
-		return path_name;	
-}
-
 static acpi_status
 acpi_run_hpp(acpi_handle handle, struct hotplug_params *hpp)
 {
@@ -71,6 +56,7 @@ acpi_run_hpp(acpi_handle handle, struct 
 		if (!ret_buf.pointer) {
 			err ("%s:%s alloc for _HPP fail\n", __FUNCTION__,
 					path_name);
+			kfree(path_name);
 			return AE_NO_MEMORY;
 		}
 		status = acpi_evaluate_object(handle, METHOD_NAME__HPP,
@@ -81,6 +67,7 @@ acpi_run_hpp(acpi_handle handle, struct 
 		if (ACPI_FAILURE(status)) {
 			dbg("%s:%s _HPP fail=0x%x\n", __FUNCTION__,
 					path_name, status);
+			kfree(path_name);
 			return status;
 		}
 	}
@@ -121,6 +108,7 @@ acpi_run_hpp(acpi_handle handle, struct 
 
 free_and_return:
 	kfree(ret_buf.pointer);
+	kfree(path_name);
 	return status;
 }
 
@@ -137,6 +125,7 @@ static acpi_status acpi_run_oshp(acpi_ha
 	} else {
 		dbg("%s:%s OSHP passes\n", __FUNCTION__, path_name);
 	}
+	kfree(path_name);
 	return status;
 }
 
@@ -213,8 +202,10 @@ int pciehp_get_hp_hw_control_from_firmwa
 		if (ACPI_SUCCESS(status)) {
 			dbg("Gained control for hotplug HW for pci %s (%s)\n",
 				pci_name(dev), path_name);
+			kfree(path_name);
 			return 0;
 		}
+		kfree(path_name);
 		if (is_root_bridge(handle))
 			break;
 		chandle = handle;
--- linux-2615-rc5g5.orig/drivers/pci/hotplug/shpchprm_acpi.c
+++ linux-2615-rc5g5/drivers/pci/hotplug/shpchprm_acpi.c
@@ -37,21 +37,6 @@
 #define	METHOD_NAME__HPP	"_HPP"
 #define	METHOD_NAME_OSHP	"OSHP"
 
-static u8 * acpi_path_name( acpi_handle	handle)
-{
-	acpi_status		status;
-	static u8	path_name[ACPI_PATHNAME_MAX];
-	struct acpi_buffer		ret_buf = { ACPI_PATHNAME_MAX, path_name };
-
-	memset(path_name, 0, sizeof (path_name));
-	status = acpi_get_name(handle, ACPI_FULL_PATHNAME, &ret_buf);
-
-	if (ACPI_FAILURE(status))
-		return NULL;
-	else
-		return path_name;	
-}
-
 static acpi_status
 acpi_run_hpp(acpi_handle handle, struct hotplug_params *hpp)
 {
@@ -70,6 +55,7 @@ acpi_run_hpp(acpi_handle handle, struct 
 		if (!ret_buf.pointer) {
 			err ("%s:%s alloc for _HPP fail\n", __FUNCTION__,
 					path_name);
+			kfree(path_name);
 			return AE_NO_MEMORY;
 		}
 		status = acpi_evaluate_object(handle, METHOD_NAME__HPP,
@@ -80,6 +66,7 @@ acpi_run_hpp(acpi_handle handle, struct 
 		if (ACPI_FAILURE(status)) {
 			dbg("%s:%s _HPP fail=0x%x\n", __FUNCTION__,
 					path_name, status);
+			kfree(path_name);
 			return status;
 		}
 	}
@@ -120,6 +107,7 @@ acpi_run_hpp(acpi_handle handle, struct 
 
 free_and_return:
 	kfree(ret_buf.pointer);
+	kfree(path_name);
 	return status;
 }
 
@@ -136,6 +124,7 @@ static void acpi_run_oshp(acpi_handle ha
 	} else {
 		dbg("%s:%s OSHP passes\n", __FUNCTION__, path_name);
 	}
+	kfree(path_name);
 }
 
 int shpchprm_get_physical_slot_number(struct controller *ctrl, u32 *sun, u8 busnum, u8 devnum)


---


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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-12-16  1:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-16  1:20 [PATCH 2/2] convert acpi_path_name() callers Randy Dunlap

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox