diff options
Diffstat (limited to 'drivers/acpi/utilities/utdelete.c')
-rw-r--r-- | drivers/acpi/utilities/utdelete.c | 325 |
1 files changed, 148 insertions, 177 deletions
diff --git a/drivers/acpi/utilities/utdelete.c b/drivers/acpi/utilities/utdelete.c index eeafb324c504..2bc878f7a127 100644 --- a/drivers/acpi/utilities/utdelete.c +++ b/drivers/acpi/utilities/utdelete.c | |||
@@ -41,7 +41,6 @@ | |||
41 | * POSSIBILITY OF SUCH DAMAGES. | 41 | * POSSIBILITY OF SUCH DAMAGES. |
42 | */ | 42 | */ |
43 | 43 | ||
44 | |||
45 | #include <acpi/acpi.h> | 44 | #include <acpi/acpi.h> |
46 | #include <acpi/acinterp.h> | 45 | #include <acpi/acinterp.h> |
47 | #include <acpi/acnamesp.h> | 46 | #include <acpi/acnamesp.h> |
@@ -49,19 +48,13 @@ | |||
49 | #include <acpi/amlcode.h> | 48 | #include <acpi/amlcode.h> |
50 | 49 | ||
51 | #define _COMPONENT ACPI_UTILITIES | 50 | #define _COMPONENT ACPI_UTILITIES |
52 | ACPI_MODULE_NAME ("utdelete") | 51 | ACPI_MODULE_NAME("utdelete") |
53 | 52 | ||
54 | /* Local prototypes */ | 53 | /* Local prototypes */ |
54 | static void acpi_ut_delete_internal_obj(union acpi_operand_object *object); | ||
55 | 55 | ||
56 | static void | 56 | static void |
57 | acpi_ut_delete_internal_obj ( | 57 | acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action); |
58 | union acpi_operand_object *object); | ||
59 | |||
60 | static void | ||
61 | acpi_ut_update_ref_count ( | ||
62 | union acpi_operand_object *object, | ||
63 | u32 action); | ||
64 | |||
65 | 58 | ||
66 | /******************************************************************************* | 59 | /******************************************************************************* |
67 | * | 60 | * |
@@ -76,18 +69,14 @@ acpi_ut_update_ref_count ( | |||
76 | * | 69 | * |
77 | ******************************************************************************/ | 70 | ******************************************************************************/ |
78 | 71 | ||
79 | static void | 72 | static void acpi_ut_delete_internal_obj(union acpi_operand_object *object) |
80 | acpi_ut_delete_internal_obj ( | ||
81 | union acpi_operand_object *object) | ||
82 | { | 73 | { |
83 | void *obj_pointer = NULL; | 74 | void *obj_pointer = NULL; |
84 | union acpi_operand_object *handler_desc; | 75 | union acpi_operand_object *handler_desc; |
85 | union acpi_operand_object *second_desc; | 76 | union acpi_operand_object *second_desc; |
86 | union acpi_operand_object *next_desc; | 77 | union acpi_operand_object *next_desc; |
87 | |||
88 | |||
89 | ACPI_FUNCTION_TRACE_PTR ("ut_delete_internal_obj", object); | ||
90 | 78 | ||
79 | ACPI_FUNCTION_TRACE_PTR("ut_delete_internal_obj", object); | ||
91 | 80 | ||
92 | if (!object) { | 81 | if (!object) { |
93 | return_VOID; | 82 | return_VOID; |
@@ -97,11 +86,12 @@ acpi_ut_delete_internal_obj ( | |||
97 | * Must delete or free any pointers within the object that are not | 86 | * Must delete or free any pointers within the object that are not |
98 | * actual ACPI objects (for example, a raw buffer pointer). | 87 | * actual ACPI objects (for example, a raw buffer pointer). |
99 | */ | 88 | */ |
100 | switch (ACPI_GET_OBJECT_TYPE (object)) { | 89 | switch (ACPI_GET_OBJECT_TYPE(object)) { |
101 | case ACPI_TYPE_STRING: | 90 | case ACPI_TYPE_STRING: |
102 | 91 | ||
103 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "**** String %p, ptr %p\n", | 92 | ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, |
104 | object, object->string.pointer)); | 93 | "**** String %p, ptr %p\n", object, |
94 | object->string.pointer)); | ||
105 | 95 | ||
106 | /* Free the actual string buffer */ | 96 | /* Free the actual string buffer */ |
107 | 97 | ||
@@ -112,11 +102,11 @@ acpi_ut_delete_internal_obj ( | |||
112 | } | 102 | } |
113 | break; | 103 | break; |
114 | 104 | ||
115 | |||
116 | case ACPI_TYPE_BUFFER: | 105 | case ACPI_TYPE_BUFFER: |
117 | 106 | ||
118 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "**** Buffer %p, ptr %p\n", | 107 | ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, |
119 | object, object->buffer.pointer)); | 108 | "**** Buffer %p, ptr %p\n", object, |
109 | object->buffer.pointer)); | ||
120 | 110 | ||
121 | /* Free the actual buffer */ | 111 | /* Free the actual buffer */ |
122 | 112 | ||
@@ -127,11 +117,11 @@ acpi_ut_delete_internal_obj ( | |||
127 | } | 117 | } |
128 | break; | 118 | break; |
129 | 119 | ||
130 | |||
131 | case ACPI_TYPE_PACKAGE: | 120 | case ACPI_TYPE_PACKAGE: |
132 | 121 | ||
133 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, " **** Package of count %X\n", | 122 | ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, |
134 | object->package.count)); | 123 | " **** Package of count %X\n", |
124 | object->package.count)); | ||
135 | 125 | ||
136 | /* | 126 | /* |
137 | * Elements of the package are not handled here, they are deleted | 127 | * Elements of the package are not handled here, they are deleted |
@@ -143,11 +133,11 @@ acpi_ut_delete_internal_obj ( | |||
143 | obj_pointer = object->package.elements; | 133 | obj_pointer = object->package.elements; |
144 | break; | 134 | break; |
145 | 135 | ||
146 | |||
147 | case ACPI_TYPE_DEVICE: | 136 | case ACPI_TYPE_DEVICE: |
148 | 137 | ||
149 | if (object->device.gpe_block) { | 138 | if (object->device.gpe_block) { |
150 | (void) acpi_ev_delete_gpe_block (object->device.gpe_block); | 139 | (void)acpi_ev_delete_gpe_block(object->device. |
140 | gpe_block); | ||
151 | } | 141 | } |
152 | 142 | ||
153 | /* Walk the handler list for this device */ | 143 | /* Walk the handler list for this device */ |
@@ -155,54 +145,51 @@ acpi_ut_delete_internal_obj ( | |||
155 | handler_desc = object->device.handler; | 145 | handler_desc = object->device.handler; |
156 | while (handler_desc) { | 146 | while (handler_desc) { |
157 | next_desc = handler_desc->address_space.next; | 147 | next_desc = handler_desc->address_space.next; |
158 | acpi_ut_remove_reference (handler_desc); | 148 | acpi_ut_remove_reference(handler_desc); |
159 | handler_desc = next_desc; | 149 | handler_desc = next_desc; |
160 | } | 150 | } |
161 | break; | 151 | break; |
162 | 152 | ||
163 | |||
164 | case ACPI_TYPE_MUTEX: | 153 | case ACPI_TYPE_MUTEX: |
165 | 154 | ||
166 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, | 155 | ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, |
167 | "***** Mutex %p, Semaphore %p\n", | 156 | "***** Mutex %p, Semaphore %p\n", |
168 | object, object->mutex.semaphore)); | 157 | object, object->mutex.semaphore)); |
169 | 158 | ||
170 | acpi_ex_unlink_mutex (object); | 159 | acpi_ex_unlink_mutex(object); |
171 | (void) acpi_os_delete_semaphore (object->mutex.semaphore); | 160 | (void)acpi_os_delete_semaphore(object->mutex.semaphore); |
172 | break; | 161 | break; |
173 | 162 | ||
174 | |||
175 | case ACPI_TYPE_EVENT: | 163 | case ACPI_TYPE_EVENT: |
176 | 164 | ||
177 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, | 165 | ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, |
178 | "***** Event %p, Semaphore %p\n", | 166 | "***** Event %p, Semaphore %p\n", |
179 | object, object->event.semaphore)); | 167 | object, object->event.semaphore)); |
180 | 168 | ||
181 | (void) acpi_os_delete_semaphore (object->event.semaphore); | 169 | (void)acpi_os_delete_semaphore(object->event.semaphore); |
182 | object->event.semaphore = NULL; | 170 | object->event.semaphore = NULL; |
183 | break; | 171 | break; |
184 | 172 | ||
185 | |||
186 | case ACPI_TYPE_METHOD: | 173 | case ACPI_TYPE_METHOD: |
187 | 174 | ||
188 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, | 175 | ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, |
189 | "***** Method %p\n", object)); | 176 | "***** Method %p\n", object)); |
190 | 177 | ||
191 | /* Delete the method semaphore if it exists */ | 178 | /* Delete the method semaphore if it exists */ |
192 | 179 | ||
193 | if (object->method.semaphore) { | 180 | if (object->method.semaphore) { |
194 | (void) acpi_os_delete_semaphore (object->method.semaphore); | 181 | (void)acpi_os_delete_semaphore(object->method. |
182 | semaphore); | ||
195 | object->method.semaphore = NULL; | 183 | object->method.semaphore = NULL; |
196 | } | 184 | } |
197 | break; | 185 | break; |
198 | 186 | ||
199 | |||
200 | case ACPI_TYPE_REGION: | 187 | case ACPI_TYPE_REGION: |
201 | 188 | ||
202 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, | 189 | ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, |
203 | "***** Region %p\n", object)); | 190 | "***** Region %p\n", object)); |
204 | 191 | ||
205 | second_desc = acpi_ns_get_secondary_object (object); | 192 | second_desc = acpi_ns_get_secondary_object(object); |
206 | if (second_desc) { | 193 | if (second_desc) { |
207 | /* | 194 | /* |
208 | * Free the region_context if and only if the handler is one of the | 195 | * Free the region_context if and only if the handler is one of the |
@@ -211,32 +198,33 @@ acpi_ut_delete_internal_obj ( | |||
211 | */ | 198 | */ |
212 | handler_desc = object->region.handler; | 199 | handler_desc = object->region.handler; |
213 | if (handler_desc) { | 200 | if (handler_desc) { |
214 | if (handler_desc->address_space.hflags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) { | 201 | if (handler_desc->address_space. |
215 | obj_pointer = second_desc->extra.region_context; | 202 | hflags & |
203 | ACPI_ADDR_HANDLER_DEFAULT_INSTALLED) { | ||
204 | obj_pointer = | ||
205 | second_desc->extra.region_context; | ||
216 | } | 206 | } |
217 | 207 | ||
218 | acpi_ut_remove_reference (handler_desc); | 208 | acpi_ut_remove_reference(handler_desc); |
219 | } | 209 | } |
220 | 210 | ||
221 | /* Now we can free the Extra object */ | 211 | /* Now we can free the Extra object */ |
222 | 212 | ||
223 | acpi_ut_delete_object_desc (second_desc); | 213 | acpi_ut_delete_object_desc(second_desc); |
224 | } | 214 | } |
225 | break; | 215 | break; |
226 | 216 | ||
227 | |||
228 | case ACPI_TYPE_BUFFER_FIELD: | 217 | case ACPI_TYPE_BUFFER_FIELD: |
229 | 218 | ||
230 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, | 219 | ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, |
231 | "***** Buffer Field %p\n", object)); | 220 | "***** Buffer Field %p\n", object)); |
232 | 221 | ||
233 | second_desc = acpi_ns_get_secondary_object (object); | 222 | second_desc = acpi_ns_get_secondary_object(object); |
234 | if (second_desc) { | 223 | if (second_desc) { |
235 | acpi_ut_delete_object_desc (second_desc); | 224 | acpi_ut_delete_object_desc(second_desc); |
236 | } | 225 | } |
237 | break; | 226 | break; |
238 | 227 | ||
239 | |||
240 | default: | 228 | default: |
241 | break; | 229 | break; |
242 | } | 230 | } |
@@ -244,21 +232,20 @@ acpi_ut_delete_internal_obj ( | |||
244 | /* Free any allocated memory (pointer within the object) found above */ | 232 | /* Free any allocated memory (pointer within the object) found above */ |
245 | 233 | ||
246 | if (obj_pointer) { | 234 | if (obj_pointer) { |
247 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Deleting Object Subptr %p\n", | 235 | ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, |
248 | obj_pointer)); | 236 | "Deleting Object Subptr %p\n", obj_pointer)); |
249 | ACPI_MEM_FREE (obj_pointer); | 237 | ACPI_MEM_FREE(obj_pointer); |
250 | } | 238 | } |
251 | 239 | ||
252 | /* Now the object can be safely deleted */ | 240 | /* Now the object can be safely deleted */ |
253 | 241 | ||
254 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Deleting Object %p [%s]\n", | 242 | ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, "Deleting Object %p [%s]\n", |
255 | object, acpi_ut_get_object_type_name (object))); | 243 | object, acpi_ut_get_object_type_name(object))); |
256 | 244 | ||
257 | acpi_ut_delete_object_desc (object); | 245 | acpi_ut_delete_object_desc(object); |
258 | return_VOID; | 246 | return_VOID; |
259 | } | 247 | } |
260 | 248 | ||
261 | |||
262 | /******************************************************************************* | 249 | /******************************************************************************* |
263 | * | 250 | * |
264 | * FUNCTION: acpi_ut_delete_internal_object_list | 251 | * FUNCTION: acpi_ut_delete_internal_object_list |
@@ -272,29 +259,24 @@ acpi_ut_delete_internal_obj ( | |||
272 | * | 259 | * |
273 | ******************************************************************************/ | 260 | ******************************************************************************/ |
274 | 261 | ||
275 | void | 262 | void acpi_ut_delete_internal_object_list(union acpi_operand_object **obj_list) |
276 | acpi_ut_delete_internal_object_list ( | ||
277 | union acpi_operand_object **obj_list) | ||
278 | { | 263 | { |
279 | union acpi_operand_object **internal_obj; | 264 | union acpi_operand_object **internal_obj; |
280 | |||
281 | |||
282 | ACPI_FUNCTION_TRACE ("ut_delete_internal_object_list"); | ||
283 | 265 | ||
266 | ACPI_FUNCTION_TRACE("ut_delete_internal_object_list"); | ||
284 | 267 | ||
285 | /* Walk the null-terminated internal list */ | 268 | /* Walk the null-terminated internal list */ |
286 | 269 | ||
287 | for (internal_obj = obj_list; *internal_obj; internal_obj++) { | 270 | for (internal_obj = obj_list; *internal_obj; internal_obj++) { |
288 | acpi_ut_remove_reference (*internal_obj); | 271 | acpi_ut_remove_reference(*internal_obj); |
289 | } | 272 | } |
290 | 273 | ||
291 | /* Free the combined parameter pointer list and object array */ | 274 | /* Free the combined parameter pointer list and object array */ |
292 | 275 | ||
293 | ACPI_MEM_FREE (obj_list); | 276 | ACPI_MEM_FREE(obj_list); |
294 | return_VOID; | 277 | return_VOID; |
295 | } | 278 | } |
296 | 279 | ||
297 | |||
298 | /******************************************************************************* | 280 | /******************************************************************************* |
299 | * | 281 | * |
300 | * FUNCTION: acpi_ut_update_ref_count | 282 | * FUNCTION: acpi_ut_update_ref_count |
@@ -309,16 +291,12 @@ acpi_ut_delete_internal_object_list ( | |||
309 | ******************************************************************************/ | 291 | ******************************************************************************/ |
310 | 292 | ||
311 | static void | 293 | static void |
312 | acpi_ut_update_ref_count ( | 294 | acpi_ut_update_ref_count(union acpi_operand_object *object, u32 action) |
313 | union acpi_operand_object *object, | ||
314 | u32 action) | ||
315 | { | 295 | { |
316 | u16 count; | 296 | u16 count; |
317 | u16 new_count; | 297 | u16 new_count; |
318 | |||
319 | |||
320 | ACPI_FUNCTION_NAME ("ut_update_ref_count"); | ||
321 | 298 | ||
299 | ACPI_FUNCTION_NAME("ut_update_ref_count"); | ||
322 | 300 | ||
323 | if (!object) { | 301 | if (!object) { |
324 | return; | 302 | return; |
@@ -338,58 +316,55 @@ acpi_ut_update_ref_count ( | |||
338 | new_count++; | 316 | new_count++; |
339 | object->common.reference_count = new_count; | 317 | object->common.reference_count = new_count; |
340 | 318 | ||
341 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, | 319 | ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, |
342 | "Obj %p Refs=%X, [Incremented]\n", | 320 | "Obj %p Refs=%X, [Incremented]\n", |
343 | object, new_count)); | 321 | object, new_count)); |
344 | break; | 322 | break; |
345 | 323 | ||
346 | |||
347 | case REF_DECREMENT: | 324 | case REF_DECREMENT: |
348 | 325 | ||
349 | if (count < 1) { | 326 | if (count < 1) { |
350 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, | 327 | ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, |
351 | "Obj %p Refs=%X, can't decrement! (Set to 0)\n", | 328 | "Obj %p Refs=%X, can't decrement! (Set to 0)\n", |
352 | object, new_count)); | 329 | object, new_count)); |
353 | 330 | ||
354 | new_count = 0; | 331 | new_count = 0; |
355 | } | 332 | } else { |
356 | else { | ||
357 | new_count--; | 333 | new_count--; |
358 | 334 | ||
359 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, | 335 | ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, |
360 | "Obj %p Refs=%X, [Decremented]\n", | 336 | "Obj %p Refs=%X, [Decremented]\n", |
361 | object, new_count)); | 337 | object, new_count)); |
362 | } | 338 | } |
363 | 339 | ||
364 | if (ACPI_GET_OBJECT_TYPE (object) == ACPI_TYPE_METHOD) { | 340 | if (ACPI_GET_OBJECT_TYPE(object) == ACPI_TYPE_METHOD) { |
365 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, | 341 | ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, |
366 | "Method Obj %p Refs=%X, [Decremented]\n", | 342 | "Method Obj %p Refs=%X, [Decremented]\n", |
367 | object, new_count)); | 343 | object, new_count)); |
368 | } | 344 | } |
369 | 345 | ||
370 | object->common.reference_count = new_count; | 346 | object->common.reference_count = new_count; |
371 | if (new_count == 0) { | 347 | if (new_count == 0) { |
372 | acpi_ut_delete_internal_obj (object); | 348 | acpi_ut_delete_internal_obj(object); |
373 | } | 349 | } |
374 | 350 | ||
375 | break; | 351 | break; |
376 | 352 | ||
377 | |||
378 | case REF_FORCE_DELETE: | 353 | case REF_FORCE_DELETE: |
379 | 354 | ||
380 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, | 355 | ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, |
381 | "Obj %p Refs=%X, Force delete! (Set to 0)\n", | 356 | "Obj %p Refs=%X, Force delete! (Set to 0)\n", |
382 | object, count)); | 357 | object, count)); |
383 | 358 | ||
384 | new_count = 0; | 359 | new_count = 0; |
385 | object->common.reference_count = new_count; | 360 | object->common.reference_count = new_count; |
386 | acpi_ut_delete_internal_obj (object); | 361 | acpi_ut_delete_internal_obj(object); |
387 | break; | 362 | break; |
388 | 363 | ||
389 | |||
390 | default: | 364 | default: |
391 | 365 | ||
392 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown action (%X)\n", action)); | 366 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Unknown action (%X)\n", |
367 | action)); | ||
393 | break; | 368 | break; |
394 | } | 369 | } |
395 | 370 | ||
@@ -399,15 +374,14 @@ acpi_ut_update_ref_count ( | |||
399 | */ | 374 | */ |
400 | if (count > ACPI_MAX_REFERENCE_COUNT) { | 375 | if (count > ACPI_MAX_REFERENCE_COUNT) { |
401 | 376 | ||
402 | ACPI_DEBUG_PRINT ((ACPI_DB_WARN, | 377 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, |
403 | "**** Warning **** Large Reference Count (%X) in object %p\n\n", | 378 | "**** Warning **** Large Reference Count (%X) in object %p\n\n", |
404 | count, object)); | 379 | count, object)); |
405 | } | 380 | } |
406 | 381 | ||
407 | return; | 382 | return; |
408 | } | 383 | } |
409 | 384 | ||
410 | |||
411 | /******************************************************************************* | 385 | /******************************************************************************* |
412 | * | 386 | * |
413 | * FUNCTION: acpi_ut_update_object_reference | 387 | * FUNCTION: acpi_ut_update_object_reference |
@@ -431,38 +405,36 @@ acpi_ut_update_ref_count ( | |||
431 | ******************************************************************************/ | 405 | ******************************************************************************/ |
432 | 406 | ||
433 | acpi_status | 407 | acpi_status |
434 | acpi_ut_update_object_reference ( | 408 | acpi_ut_update_object_reference(union acpi_operand_object * object, u16 action) |
435 | union acpi_operand_object *object, | ||
436 | u16 action) | ||
437 | { | 409 | { |
438 | acpi_status status = AE_OK; | 410 | acpi_status status = AE_OK; |
439 | union acpi_generic_state *state_list = NULL; | 411 | union acpi_generic_state *state_list = NULL; |
440 | union acpi_operand_object *next_object = NULL; | 412 | union acpi_operand_object *next_object = NULL; |
441 | union acpi_generic_state *state; | 413 | union acpi_generic_state *state; |
442 | acpi_native_uint i; | 414 | acpi_native_uint i; |
443 | |||
444 | |||
445 | ACPI_FUNCTION_TRACE_PTR ("ut_update_object_reference", object); | ||
446 | 415 | ||
416 | ACPI_FUNCTION_TRACE_PTR("ut_update_object_reference", object); | ||
447 | 417 | ||
448 | while (object) { | 418 | while (object) { |
449 | /* Make sure that this isn't a namespace handle */ | 419 | /* Make sure that this isn't a namespace handle */ |
450 | 420 | ||
451 | if (ACPI_GET_DESCRIPTOR_TYPE (object) == ACPI_DESC_TYPE_NAMED) { | 421 | if (ACPI_GET_DESCRIPTOR_TYPE(object) == ACPI_DESC_TYPE_NAMED) { |
452 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, | 422 | ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, |
453 | "Object %p is NS handle\n", object)); | 423 | "Object %p is NS handle\n", object)); |
454 | return_ACPI_STATUS (AE_OK); | 424 | return_ACPI_STATUS(AE_OK); |
455 | } | 425 | } |
456 | 426 | ||
457 | /* | 427 | /* |
458 | * All sub-objects must have their reference count incremented also. | 428 | * All sub-objects must have their reference count incremented also. |
459 | * Different object types have different subobjects. | 429 | * Different object types have different subobjects. |
460 | */ | 430 | */ |
461 | switch (ACPI_GET_OBJECT_TYPE (object)) { | 431 | switch (ACPI_GET_OBJECT_TYPE(object)) { |
462 | case ACPI_TYPE_DEVICE: | 432 | case ACPI_TYPE_DEVICE: |
463 | 433 | ||
464 | acpi_ut_update_ref_count (object->device.system_notify, action); | 434 | acpi_ut_update_ref_count(object->device.system_notify, |
465 | acpi_ut_update_ref_count (object->device.device_notify, action); | 435 | action); |
436 | acpi_ut_update_ref_count(object->device.device_notify, | ||
437 | action); | ||
466 | break; | 438 | break; |
467 | 439 | ||
468 | case ACPI_TYPE_PACKAGE: | 440 | case ACPI_TYPE_PACKAGE: |
@@ -476,9 +448,11 @@ acpi_ut_update_object_reference ( | |||
476 | * Note: There can be null elements within the package, | 448 | * Note: There can be null elements within the package, |
477 | * these are simply ignored | 449 | * these are simply ignored |
478 | */ | 450 | */ |
479 | status = acpi_ut_create_update_state_and_push ( | 451 | status = |
480 | object->package.elements[i], action, &state_list); | 452 | acpi_ut_create_update_state_and_push |
481 | if (ACPI_FAILURE (status)) { | 453 | (object->package.elements[i], action, |
454 | &state_list); | ||
455 | if (ACPI_FAILURE(status)) { | ||
482 | goto error_exit; | 456 | goto error_exit; |
483 | } | 457 | } |
484 | } | 458 | } |
@@ -497,9 +471,13 @@ acpi_ut_update_object_reference ( | |||
497 | case ACPI_TYPE_LOCAL_BANK_FIELD: | 471 | case ACPI_TYPE_LOCAL_BANK_FIELD: |
498 | 472 | ||
499 | next_object = object->bank_field.bank_obj; | 473 | next_object = object->bank_field.bank_obj; |
500 | status = acpi_ut_create_update_state_and_push ( | 474 | status = |
501 | object->bank_field.region_obj, action, &state_list); | 475 | acpi_ut_create_update_state_and_push(object-> |
502 | if (ACPI_FAILURE (status)) { | 476 | bank_field. |
477 | region_obj, | ||
478 | action, | ||
479 | &state_list); | ||
480 | if (ACPI_FAILURE(status)) { | ||
503 | goto error_exit; | 481 | goto error_exit; |
504 | } | 482 | } |
505 | break; | 483 | break; |
@@ -507,9 +485,13 @@ acpi_ut_update_object_reference ( | |||
507 | case ACPI_TYPE_LOCAL_INDEX_FIELD: | 485 | case ACPI_TYPE_LOCAL_INDEX_FIELD: |
508 | 486 | ||
509 | next_object = object->index_field.index_obj; | 487 | next_object = object->index_field.index_obj; |
510 | status = acpi_ut_create_update_state_and_push ( | 488 | status = |
511 | object->index_field.data_obj, action, &state_list); | 489 | acpi_ut_create_update_state_and_push(object-> |
512 | if (ACPI_FAILURE (status)) { | 490 | index_field. |
491 | data_obj, | ||
492 | action, | ||
493 | &state_list); | ||
494 | if (ACPI_FAILURE(status)) { | ||
513 | goto error_exit; | 495 | goto error_exit; |
514 | } | 496 | } |
515 | break; | 497 | break; |
@@ -526,7 +508,7 @@ acpi_ut_update_object_reference ( | |||
526 | 508 | ||
527 | case ACPI_TYPE_REGION: | 509 | case ACPI_TYPE_REGION: |
528 | default: | 510 | default: |
529 | break;/* No subobjects */ | 511 | break; /* No subobjects */ |
530 | } | 512 | } |
531 | 513 | ||
532 | /* | 514 | /* |
@@ -534,7 +516,7 @@ acpi_ut_update_object_reference ( | |||
534 | * happen after we update the sub-objects in case this causes the | 516 | * happen after we update the sub-objects in case this causes the |
535 | * main object to be deleted. | 517 | * main object to be deleted. |
536 | */ | 518 | */ |
537 | acpi_ut_update_ref_count (object, action); | 519 | acpi_ut_update_ref_count(object, action); |
538 | object = NULL; | 520 | object = NULL; |
539 | 521 | ||
540 | /* Move on to the next object to be updated */ | 522 | /* Move on to the next object to be updated */ |
@@ -542,25 +524,23 @@ acpi_ut_update_object_reference ( | |||
542 | if (next_object) { | 524 | if (next_object) { |
543 | object = next_object; | 525 | object = next_object; |
544 | next_object = NULL; | 526 | next_object = NULL; |
545 | } | 527 | } else if (state_list) { |
546 | else if (state_list) { | 528 | state = acpi_ut_pop_generic_state(&state_list); |
547 | state = acpi_ut_pop_generic_state (&state_list); | ||
548 | object = state->update.object; | 529 | object = state->update.object; |
549 | acpi_ut_delete_generic_state (state); | 530 | acpi_ut_delete_generic_state(state); |
550 | } | 531 | } |
551 | } | 532 | } |
552 | 533 | ||
553 | return_ACPI_STATUS (AE_OK); | 534 | return_ACPI_STATUS(AE_OK); |
554 | 535 | ||
555 | error_exit: | 536 | error_exit: |
556 | 537 | ||
557 | ACPI_REPORT_ERROR (("Could not update object reference count, %s\n", | 538 | ACPI_REPORT_ERROR(("Could not update object reference count, %s\n", |
558 | acpi_format_exception (status))); | 539 | acpi_format_exception(status))); |
559 | 540 | ||
560 | return_ACPI_STATUS (status); | 541 | return_ACPI_STATUS(status); |
561 | } | 542 | } |
562 | 543 | ||
563 | |||
564 | /******************************************************************************* | 544 | /******************************************************************************* |
565 | * | 545 | * |
566 | * FUNCTION: acpi_ut_add_reference | 546 | * FUNCTION: acpi_ut_add_reference |
@@ -574,31 +554,27 @@ error_exit: | |||
574 | * | 554 | * |
575 | ******************************************************************************/ | 555 | ******************************************************************************/ |
576 | 556 | ||
577 | void | 557 | void acpi_ut_add_reference(union acpi_operand_object *object) |
578 | acpi_ut_add_reference ( | ||
579 | union acpi_operand_object *object) | ||
580 | { | 558 | { |
581 | 559 | ||
582 | ACPI_FUNCTION_TRACE_PTR ("ut_add_reference", object); | 560 | ACPI_FUNCTION_TRACE_PTR("ut_add_reference", object); |
583 | |||
584 | 561 | ||
585 | /* Ensure that we have a valid object */ | 562 | /* Ensure that we have a valid object */ |
586 | 563 | ||
587 | if (!acpi_ut_valid_internal_object (object)) { | 564 | if (!acpi_ut_valid_internal_object(object)) { |
588 | return_VOID; | 565 | return_VOID; |
589 | } | 566 | } |
590 | 567 | ||
591 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, | 568 | ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, |
592 | "Obj %p Current Refs=%X [To Be Incremented]\n", | 569 | "Obj %p Current Refs=%X [To Be Incremented]\n", |
593 | object, object->common.reference_count)); | 570 | object, object->common.reference_count)); |
594 | 571 | ||
595 | /* Increment the reference count */ | 572 | /* Increment the reference count */ |
596 | 573 | ||
597 | (void) acpi_ut_update_object_reference (object, REF_INCREMENT); | 574 | (void)acpi_ut_update_object_reference(object, REF_INCREMENT); |
598 | return_VOID; | 575 | return_VOID; |
599 | } | 576 | } |
600 | 577 | ||
601 | |||
602 | /******************************************************************************* | 578 | /******************************************************************************* |
603 | * | 579 | * |
604 | * FUNCTION: acpi_ut_remove_reference | 580 | * FUNCTION: acpi_ut_remove_reference |
@@ -611,13 +587,10 @@ acpi_ut_add_reference ( | |||
611 | * | 587 | * |
612 | ******************************************************************************/ | 588 | ******************************************************************************/ |
613 | 589 | ||
614 | void | 590 | void acpi_ut_remove_reference(union acpi_operand_object *object) |
615 | acpi_ut_remove_reference ( | ||
616 | union acpi_operand_object *object) | ||
617 | { | 591 | { |
618 | 592 | ||
619 | ACPI_FUNCTION_TRACE_PTR ("ut_remove_reference", object); | 593 | ACPI_FUNCTION_TRACE_PTR("ut_remove_reference", object); |
620 | |||
621 | 594 | ||
622 | /* | 595 | /* |
623 | * Allow a NULL pointer to be passed in, just ignore it. This saves | 596 | * Allow a NULL pointer to be passed in, just ignore it. This saves |
@@ -625,27 +598,25 @@ acpi_ut_remove_reference ( | |||
625 | * | 598 | * |
626 | */ | 599 | */ |
627 | if (!object || | 600 | if (!object || |
628 | (ACPI_GET_DESCRIPTOR_TYPE (object) == ACPI_DESC_TYPE_NAMED)) { | 601 | (ACPI_GET_DESCRIPTOR_TYPE(object) == ACPI_DESC_TYPE_NAMED)) { |
629 | return_VOID; | 602 | return_VOID; |
630 | } | 603 | } |
631 | 604 | ||
632 | /* Ensure that we have a valid object */ | 605 | /* Ensure that we have a valid object */ |
633 | 606 | ||
634 | if (!acpi_ut_valid_internal_object (object)) { | 607 | if (!acpi_ut_valid_internal_object(object)) { |
635 | return_VOID; | 608 | return_VOID; |
636 | } | 609 | } |
637 | 610 | ||
638 | ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, | 611 | ACPI_DEBUG_PRINT((ACPI_DB_ALLOCATIONS, |
639 | "Obj %p Current Refs=%X [To Be Decremented]\n", | 612 | "Obj %p Current Refs=%X [To Be Decremented]\n", |
640 | object, object->common.reference_count)); | 613 | object, object->common.reference_count)); |
641 | 614 | ||
642 | /* | 615 | /* |
643 | * Decrement the reference count, and only actually delete the object | 616 | * Decrement the reference count, and only actually delete the object |
644 | * if the reference count becomes 0. (Must also decrement the ref count | 617 | * if the reference count becomes 0. (Must also decrement the ref count |
645 | * of all subobjects!) | 618 | * of all subobjects!) |
646 | */ | 619 | */ |
647 | (void) acpi_ut_update_object_reference (object, REF_DECREMENT); | 620 | (void)acpi_ut_update_object_reference(object, REF_DECREMENT); |
648 | return_VOID; | 621 | return_VOID; |
649 | } | 622 | } |
650 | |||
651 | |||