aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLv Zheng <lv.zheng@intel.com>2014-01-08 00:43:23 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-01-08 09:31:36 -0500
commitbb3fec146c8561441db058db07b3fbdd7fe7e1df (patch)
tree4ec8e389084149ebf95831cef14de002dddb5055
parent5af2b6351b3cc0dadd6888928005a61f2667c80d (diff)
ACPICA: Remove unused ACPI_FREE_BUFFER macro. No functional change.
This macro is no longer used by ACPICA and it is not public. Also update comments related to the use of ACPI_ALLOCATE_BUFFER and the use of acpi_os_free (kfree is equivalent and prefered in the kernel) to free the buffer. Signed-off-by: Lv Zheng <lv.zheng@intel.com> Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--drivers/acpi/acpica/nsxfeval.c23
-rw-r--r--drivers/acpi/acpica/utalloc.c10
-rw-r--r--include/acpi/actypes.h12
3 files changed, 22 insertions, 23 deletions
diff --git a/drivers/acpi/acpica/nsxfeval.c b/drivers/acpi/acpica/nsxfeval.c
index e973e311f856..1f0c28ba50df 100644
--- a/drivers/acpi/acpica/nsxfeval.c
+++ b/drivers/acpi/acpica/nsxfeval.c
@@ -84,7 +84,7 @@ acpi_evaluate_object_typed(acpi_handle handle,
84 acpi_object_type return_type) 84 acpi_object_type return_type)
85{ 85{
86 acpi_status status; 86 acpi_status status;
87 u8 must_free = FALSE; 87 u8 free_buffer_on_error = FALSE;
88 88
89 ACPI_FUNCTION_TRACE(acpi_evaluate_object_typed); 89 ACPI_FUNCTION_TRACE(acpi_evaluate_object_typed);
90 90
@@ -95,14 +95,13 @@ acpi_evaluate_object_typed(acpi_handle handle,
95 } 95 }
96 96
97 if (return_buffer->length == ACPI_ALLOCATE_BUFFER) { 97 if (return_buffer->length == ACPI_ALLOCATE_BUFFER) {
98 must_free = TRUE; 98 free_buffer_on_error = TRUE;
99 } 99 }
100 100
101 /* Evaluate the object */ 101 /* Evaluate the object */
102 102
103 status = 103 status = acpi_evaluate_object(handle, pathname,
104 acpi_evaluate_object(handle, pathname, external_params, 104 external_params, return_buffer);
105 return_buffer);
106 if (ACPI_FAILURE(status)) { 105 if (ACPI_FAILURE(status)) {
107 return_ACPI_STATUS(status); 106 return_ACPI_STATUS(status);
108 } 107 }
@@ -135,11 +134,15 @@ acpi_evaluate_object_typed(acpi_handle handle,
135 pointer)->type), 134 pointer)->type),
136 acpi_ut_get_type_name(return_type))); 135 acpi_ut_get_type_name(return_type)));
137 136
138 if (must_free) { 137 if (free_buffer_on_error) {
139 138 /*
140 /* Caller used ACPI_ALLOCATE_BUFFER, free the return buffer */ 139 * Free a buffer created via ACPI_ALLOCATE_BUFFER.
141 140 * Note: We use acpi_os_free here because acpi_os_allocate was used
142 ACPI_FREE_BUFFER(*return_buffer); 141 * to allocate the buffer. This purposefully bypasses the
142 * (optionally enabled) allocation tracking mechanism since we
143 * only want to track internal allocations.
144 */
145 acpi_os_free(return_buffer->pointer);
143 return_buffer->pointer = NULL; 146 return_buffer->pointer = NULL;
144 } 147 }
145 148
diff --git a/drivers/acpi/acpica/utalloc.c b/drivers/acpi/acpica/utalloc.c
index 814267f52715..1851762fc5b5 100644
--- a/drivers/acpi/acpica/utalloc.c
+++ b/drivers/acpi/acpica/utalloc.c
@@ -302,9 +302,13 @@ acpi_ut_initialize_buffer(struct acpi_buffer * buffer,
302 return (AE_BUFFER_OVERFLOW); 302 return (AE_BUFFER_OVERFLOW);
303 303
304 case ACPI_ALLOCATE_BUFFER: 304 case ACPI_ALLOCATE_BUFFER:
305 305 /*
306 /* Allocate a new buffer */ 306 * Allocate a new buffer. We directectly call acpi_os_allocate here to
307 307 * purposefully bypass the (optionally enabled) internal allocation
308 * tracking mechanism since we only want to track internal
309 * allocations. Note: The caller should use acpi_os_free to free this
310 * buffer created via ACPI_ALLOCATE_BUFFER.
311 */
308 buffer->pointer = acpi_os_allocate(required_length); 312 buffer->pointer = acpi_os_allocate(required_length);
309 break; 313 break;
310 314
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index 809b1a0fee7f..68a3ada689c9 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -928,8 +928,8 @@ struct acpi_object_list {
928 * Miscellaneous common Data Structures used by the interfaces 928 * Miscellaneous common Data Structures used by the interfaces
929 */ 929 */
930#define ACPI_NO_BUFFER 0 930#define ACPI_NO_BUFFER 0
931#define ACPI_ALLOCATE_BUFFER (acpi_size) (-1) 931#define ACPI_ALLOCATE_BUFFER (acpi_size) (-1) /* Let ACPICA allocate buffer */
932#define ACPI_ALLOCATE_LOCAL_BUFFER (acpi_size) (-2) 932#define ACPI_ALLOCATE_LOCAL_BUFFER (acpi_size) (-2) /* For internal use only (enables tracking) */
933 933
934struct acpi_buffer { 934struct acpi_buffer {
935 acpi_size length; /* Length in bytes of the buffer */ 935 acpi_size length; /* Length in bytes of the buffer */
@@ -937,14 +937,6 @@ struct acpi_buffer {
937}; 937};
938 938
939/* 939/*
940 * Free a buffer created in an struct acpi_buffer via ACPI_ALLOCATE_BUFFER.
941 * Note: We use acpi_os_free here because acpi_os_allocate was used to allocate
942 * the buffer. This purposefully bypasses the internal allocation tracking
943 * mechanism (if it is enabled).
944 */
945#define ACPI_FREE_BUFFER(b) acpi_os_free((b).pointer)
946
947/*
948 * name_type for acpi_get_name 940 * name_type for acpi_get_name
949 */ 941 */
950#define ACPI_FULL_PATHNAME 0 942#define ACPI_FULL_PATHNAME 0