Skip to contentSkip to conversation

convert acpi_path_name() callers

PATCH New Randy Dunlap 1 participant 1 message Dec 16, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 2/2 convert acpi_path_name() callers

From: Randy Dunlap <randy_d_dunlap-VuQAYsv1563Yd54FQh9/[email protected]>

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

---
 drivers/pci/hotplug/pciehprm_acpi.c |   21 ++++++---------------
 drivers/pci/hotplug/shpchprm_acpi.c |   19 ++++---------------
 2 files changed, 10 insertions(+), 30 deletions(-)
drivers/pci/hotplug/pciehprm_acpi.c +6 -15
@@ -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;
drivers/pci/hotplug/shpchprm_acpi.c +4 -15
@@ -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