aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/utilities/utstate.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/utilities/utstate.c')
-rw-r--r--drivers/acpi/utilities/utstate.c36
1 files changed, 21 insertions, 15 deletions
diff --git a/drivers/acpi/utilities/utstate.c b/drivers/acpi/utilities/utstate.c
index 4b134a722907..0f5c5bb5deff 100644
--- a/drivers/acpi/utilities/utstate.c
+++ b/drivers/acpi/utilities/utstate.c
@@ -96,7 +96,7 @@ void
96acpi_ut_push_generic_state(union acpi_generic_state **list_head, 96acpi_ut_push_generic_state(union acpi_generic_state **list_head,
97 union acpi_generic_state *state) 97 union acpi_generic_state *state)
98{ 98{
99 ACPI_FUNCTION_TRACE("ut_push_generic_state"); 99 ACPI_FUNCTION_TRACE(ut_push_generic_state);
100 100
101 /* Push the state object onto the front of the list (stack) */ 101 /* Push the state object onto the front of the list (stack) */
102 102
@@ -123,12 +123,13 @@ union acpi_generic_state *acpi_ut_pop_generic_state(union acpi_generic_state
123{ 123{
124 union acpi_generic_state *state; 124 union acpi_generic_state *state;
125 125
126 ACPI_FUNCTION_TRACE("ut_pop_generic_state"); 126 ACPI_FUNCTION_TRACE(ut_pop_generic_state);
127 127
128 /* Remove the state object at the head of the list (stack) */ 128 /* Remove the state object at the head of the list (stack) */
129 129
130 state = *list_head; 130 state = *list_head;
131 if (state) { 131 if (state) {
132
132 /* Update the list head */ 133 /* Update the list head */
133 134
134 *list_head = state->common.next; 135 *list_head = state->common.next;
@@ -158,9 +159,10 @@ union acpi_generic_state *acpi_ut_create_generic_state(void)
158 159
159 state = acpi_os_acquire_object(acpi_gbl_state_cache); 160 state = acpi_os_acquire_object(acpi_gbl_state_cache);
160 if (state) { 161 if (state) {
162
161 /* Initialize */ 163 /* Initialize */
162 memset(state, 0, sizeof(union acpi_generic_state)); 164 memset(state, 0, sizeof(union acpi_generic_state));
163 state->common.data_type = ACPI_DESC_TYPE_STATE; 165 state->common.descriptor_type = ACPI_DESC_TYPE_STATE;
164 } 166 }
165 167
166 return (state); 168 return (state);
@@ -183,7 +185,7 @@ struct acpi_thread_state *acpi_ut_create_thread_state(void)
183{ 185{
184 union acpi_generic_state *state; 186 union acpi_generic_state *state;
185 187
186 ACPI_FUNCTION_TRACE("ut_create_thread_state"); 188 ACPI_FUNCTION_TRACE(ut_create_thread_state);
187 189
188 /* Create the generic state object */ 190 /* Create the generic state object */
189 191
@@ -194,7 +196,7 @@ struct acpi_thread_state *acpi_ut_create_thread_state(void)
194 196
195 /* Init fields specific to the update struct */ 197 /* Init fields specific to the update struct */
196 198
197 state->common.data_type = ACPI_DESC_TYPE_STATE_THREAD; 199 state->common.descriptor_type = ACPI_DESC_TYPE_STATE_THREAD;
198 state->thread.thread_id = acpi_os_get_thread_id(); 200 state->thread.thread_id = acpi_os_get_thread_id();
199 201
200 return_PTR((struct acpi_thread_state *)state); 202 return_PTR((struct acpi_thread_state *)state);
@@ -220,7 +222,7 @@ union acpi_generic_state *acpi_ut_create_update_state(union acpi_operand_object
220{ 222{
221 union acpi_generic_state *state; 223 union acpi_generic_state *state;
222 224
223 ACPI_FUNCTION_TRACE_PTR("ut_create_update_state", object); 225 ACPI_FUNCTION_TRACE_PTR(ut_create_update_state, object);
224 226
225 /* Create the generic state object */ 227 /* Create the generic state object */
226 228
@@ -231,7 +233,7 @@ union acpi_generic_state *acpi_ut_create_update_state(union acpi_operand_object
231 233
232 /* Init fields specific to the update struct */ 234 /* Init fields specific to the update struct */
233 235
234 state->common.data_type = ACPI_DESC_TYPE_STATE_UPDATE; 236 state->common.descriptor_type = ACPI_DESC_TYPE_STATE_UPDATE;
235 state->update.object = object; 237 state->update.object = object;
236 state->update.value = action; 238 state->update.value = action;
237 239
@@ -257,7 +259,7 @@ union acpi_generic_state *acpi_ut_create_pkg_state(void *internal_object,
257{ 259{
258 union acpi_generic_state *state; 260 union acpi_generic_state *state;
259 261
260 ACPI_FUNCTION_TRACE_PTR("ut_create_pkg_state", internal_object); 262 ACPI_FUNCTION_TRACE_PTR(ut_create_pkg_state, internal_object);
261 263
262 /* Create the generic state object */ 264 /* Create the generic state object */
263 265
@@ -268,7 +270,7 @@ union acpi_generic_state *acpi_ut_create_pkg_state(void *internal_object,
268 270
269 /* Init fields specific to the update struct */ 271 /* Init fields specific to the update struct */
270 272
271 state->common.data_type = ACPI_DESC_TYPE_STATE_PACKAGE; 273 state->common.descriptor_type = ACPI_DESC_TYPE_STATE_PACKAGE;
272 state->pkg.source_object = (union acpi_operand_object *)internal_object; 274 state->pkg.source_object = (union acpi_operand_object *)internal_object;
273 state->pkg.dest_object = external_object; 275 state->pkg.dest_object = external_object;
274 state->pkg.index = index; 276 state->pkg.index = index;
@@ -294,7 +296,7 @@ union acpi_generic_state *acpi_ut_create_control_state(void)
294{ 296{
295 union acpi_generic_state *state; 297 union acpi_generic_state *state;
296 298
297 ACPI_FUNCTION_TRACE("ut_create_control_state"); 299 ACPI_FUNCTION_TRACE(ut_create_control_state);
298 300
299 /* Create the generic state object */ 301 /* Create the generic state object */
300 302
@@ -305,7 +307,7 @@ union acpi_generic_state *acpi_ut_create_control_state(void)
305 307
306 /* Init fields specific to the control struct */ 308 /* Init fields specific to the control struct */
307 309
308 state->common.data_type = ACPI_DESC_TYPE_STATE_CONTROL; 310 state->common.descriptor_type = ACPI_DESC_TYPE_STATE_CONTROL;
309 state->common.state = ACPI_CONTROL_CONDITIONAL_EXECUTING; 311 state->common.state = ACPI_CONTROL_CONDITIONAL_EXECUTING;
310 312
311 return_PTR(state); 313 return_PTR(state);
@@ -319,15 +321,19 @@ union acpi_generic_state *acpi_ut_create_control_state(void)
319 * 321 *
320 * RETURN: None 322 * RETURN: None
321 * 323 *
322 * DESCRIPTION: Put a state object back into the global state cache. The object 324 * DESCRIPTION: Release a state object to the state cache. NULL state objects
323 * is not actually freed at this time. 325 * are ignored.
324 * 326 *
325 ******************************************************************************/ 327 ******************************************************************************/
326 328
327void acpi_ut_delete_generic_state(union acpi_generic_state *state) 329void acpi_ut_delete_generic_state(union acpi_generic_state *state)
328{ 330{
329 ACPI_FUNCTION_TRACE("ut_delete_generic_state"); 331 ACPI_FUNCTION_TRACE(ut_delete_generic_state);
332
333 /* Ignore null state */
330 334
331 (void)acpi_os_release_object(acpi_gbl_state_cache, state); 335 if (state) {
336 (void)acpi_os_release_object(acpi_gbl_state_cache, state);
337 }
332 return_VOID; 338 return_VOID;
333} 339}