public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
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 2/2] convert acpi_path_name() callers
Date: Thu, 15 Dec 2005 17:20:18 -0800	[thread overview]
Message-ID: <20051215172018.620988ae.randy_d_dunlap@linux.intel.com> (raw)

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

                 reply	other threads:[~2005-12-16  1:20 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20051215172018.620988ae.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