diff options
Diffstat (limited to 'drivers/acpi/utilities/utstate.c')
-rw-r--r-- | drivers/acpi/utilities/utstate.c | 159 |
1 files changed, 58 insertions, 101 deletions
diff --git a/drivers/acpi/utilities/utstate.c b/drivers/acpi/utilities/utstate.c index 192e7ac95690..c1cb27583be8 100644 --- a/drivers/acpi/utilities/utstate.c +++ b/drivers/acpi/utilities/utstate.c | |||
@@ -41,12 +41,10 @@ | |||
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 | 45 | ||
47 | #define _COMPONENT ACPI_UTILITIES | 46 | #define _COMPONENT ACPI_UTILITIES |
48 | ACPI_MODULE_NAME ("utstate") | 47 | ACPI_MODULE_NAME("utstate") |
49 | |||
50 | 48 | ||
51 | /******************************************************************************* | 49 | /******************************************************************************* |
52 | * | 50 | * |
@@ -61,30 +59,26 @@ | |||
61 | * DESCRIPTION: Create a new state and push it | 59 | * DESCRIPTION: Create a new state and push it |
62 | * | 60 | * |
63 | ******************************************************************************/ | 61 | ******************************************************************************/ |
64 | |||
65 | acpi_status | 62 | acpi_status |
66 | acpi_ut_create_pkg_state_and_push ( | 63 | acpi_ut_create_pkg_state_and_push(void *internal_object, |
67 | void *internal_object, | 64 | void *external_object, |
68 | void *external_object, | 65 | u16 index, |
69 | u16 index, | 66 | union acpi_generic_state ** state_list) |
70 | union acpi_generic_state **state_list) | ||
71 | { | 67 | { |
72 | union acpi_generic_state *state; | 68 | union acpi_generic_state *state; |
73 | |||
74 | 69 | ||
75 | ACPI_FUNCTION_ENTRY (); | 70 | ACPI_FUNCTION_ENTRY(); |
76 | 71 | ||
77 | 72 | state = | |
78 | state = acpi_ut_create_pkg_state (internal_object, external_object, index); | 73 | acpi_ut_create_pkg_state(internal_object, external_object, index); |
79 | if (!state) { | 74 | if (!state) { |
80 | return (AE_NO_MEMORY); | 75 | return (AE_NO_MEMORY); |
81 | } | 76 | } |
82 | 77 | ||
83 | acpi_ut_push_generic_state (state_list, state); | 78 | acpi_ut_push_generic_state(state_list, state); |
84 | return (AE_OK); | 79 | return (AE_OK); |
85 | } | 80 | } |
86 | 81 | ||
87 | |||
88 | /******************************************************************************* | 82 | /******************************************************************************* |
89 | * | 83 | * |
90 | * FUNCTION: acpi_ut_push_generic_state | 84 | * FUNCTION: acpi_ut_push_generic_state |
@@ -99,12 +93,10 @@ acpi_ut_create_pkg_state_and_push ( | |||
99 | ******************************************************************************/ | 93 | ******************************************************************************/ |
100 | 94 | ||
101 | void | 95 | void |
102 | acpi_ut_push_generic_state ( | 96 | acpi_ut_push_generic_state(union acpi_generic_state **list_head, |
103 | union acpi_generic_state **list_head, | 97 | union acpi_generic_state *state) |
104 | union acpi_generic_state *state) | ||
105 | { | 98 | { |
106 | ACPI_FUNCTION_TRACE ("ut_push_generic_state"); | 99 | ACPI_FUNCTION_TRACE("ut_push_generic_state"); |
107 | |||
108 | 100 | ||
109 | /* Push the state object onto the front of the list (stack) */ | 101 | /* Push the state object onto the front of the list (stack) */ |
110 | 102 | ||
@@ -114,7 +106,6 @@ acpi_ut_push_generic_state ( | |||
114 | return_VOID; | 106 | return_VOID; |
115 | } | 107 | } |
116 | 108 | ||
117 | |||
118 | /******************************************************************************* | 109 | /******************************************************************************* |
119 | * | 110 | * |
120 | * FUNCTION: acpi_ut_pop_generic_state | 111 | * FUNCTION: acpi_ut_pop_generic_state |
@@ -127,15 +118,12 @@ acpi_ut_push_generic_state ( | |||
127 | * | 118 | * |
128 | ******************************************************************************/ | 119 | ******************************************************************************/ |
129 | 120 | ||
130 | union acpi_generic_state * | 121 | union acpi_generic_state *acpi_ut_pop_generic_state(union acpi_generic_state |
131 | acpi_ut_pop_generic_state ( | 122 | **list_head) |
132 | union acpi_generic_state **list_head) | ||
133 | { | 123 | { |
134 | union acpi_generic_state *state; | 124 | union acpi_generic_state *state; |
135 | |||
136 | |||
137 | ACPI_FUNCTION_TRACE ("ut_pop_generic_state"); | ||
138 | 125 | ||
126 | ACPI_FUNCTION_TRACE("ut_pop_generic_state"); | ||
139 | 127 | ||
140 | /* Remove the state object at the head of the list (stack) */ | 128 | /* Remove the state object at the head of the list (stack) */ |
141 | 129 | ||
@@ -146,10 +134,9 @@ acpi_ut_pop_generic_state ( | |||
146 | *list_head = state->common.next; | 134 | *list_head = state->common.next; |
147 | } | 135 | } |
148 | 136 | ||
149 | return_PTR (state); | 137 | return_PTR(state); |
150 | } | 138 | } |
151 | 139 | ||
152 | |||
153 | /******************************************************************************* | 140 | /******************************************************************************* |
154 | * | 141 | * |
155 | * FUNCTION: acpi_ut_create_generic_state | 142 | * FUNCTION: acpi_ut_create_generic_state |
@@ -163,17 +150,13 @@ acpi_ut_pop_generic_state ( | |||
163 | * | 150 | * |
164 | ******************************************************************************/ | 151 | ******************************************************************************/ |
165 | 152 | ||
166 | union acpi_generic_state * | 153 | union acpi_generic_state *acpi_ut_create_generic_state(void) |
167 | acpi_ut_create_generic_state ( | ||
168 | void) | ||
169 | { | 154 | { |
170 | union acpi_generic_state *state; | 155 | union acpi_generic_state *state; |
171 | |||
172 | 156 | ||
173 | ACPI_FUNCTION_ENTRY (); | 157 | ACPI_FUNCTION_ENTRY(); |
174 | 158 | ||
175 | 159 | state = acpi_os_acquire_object(acpi_gbl_state_cache); | |
176 | state = acpi_os_acquire_object (acpi_gbl_state_cache); | ||
177 | if (state) { | 160 | if (state) { |
178 | /* Initialize */ | 161 | /* Initialize */ |
179 | memset(state, 0, sizeof(union acpi_generic_state)); | 162 | memset(state, 0, sizeof(union acpi_generic_state)); |
@@ -183,7 +166,6 @@ acpi_ut_create_generic_state ( | |||
183 | return (state); | 166 | return (state); |
184 | } | 167 | } |
185 | 168 | ||
186 | |||
187 | /******************************************************************************* | 169 | /******************************************************************************* |
188 | * | 170 | * |
189 | * FUNCTION: acpi_ut_create_thread_state | 171 | * FUNCTION: acpi_ut_create_thread_state |
@@ -197,32 +179,27 @@ acpi_ut_create_generic_state ( | |||
197 | * | 179 | * |
198 | ******************************************************************************/ | 180 | ******************************************************************************/ |
199 | 181 | ||
200 | struct acpi_thread_state * | 182 | struct acpi_thread_state *acpi_ut_create_thread_state(void) |
201 | acpi_ut_create_thread_state ( | ||
202 | void) | ||
203 | { | 183 | { |
204 | union acpi_generic_state *state; | 184 | union acpi_generic_state *state; |
205 | |||
206 | |||
207 | ACPI_FUNCTION_TRACE ("ut_create_thread_state"); | ||
208 | 185 | ||
186 | ACPI_FUNCTION_TRACE("ut_create_thread_state"); | ||
209 | 187 | ||
210 | /* Create the generic state object */ | 188 | /* Create the generic state object */ |
211 | 189 | ||
212 | state = acpi_ut_create_generic_state (); | 190 | state = acpi_ut_create_generic_state(); |
213 | if (!state) { | 191 | if (!state) { |
214 | return_PTR (NULL); | 192 | return_PTR(NULL); |
215 | } | 193 | } |
216 | 194 | ||
217 | /* Init fields specific to the update struct */ | 195 | /* Init fields specific to the update struct */ |
218 | 196 | ||
219 | state->common.data_type = ACPI_DESC_TYPE_STATE_THREAD; | 197 | state->common.data_type = ACPI_DESC_TYPE_STATE_THREAD; |
220 | state->thread.thread_id = acpi_os_get_thread_id (); | 198 | state->thread.thread_id = acpi_os_get_thread_id(); |
221 | 199 | ||
222 | return_PTR ((struct acpi_thread_state *) state); | 200 | return_PTR((struct acpi_thread_state *)state); |
223 | } | 201 | } |
224 | 202 | ||
225 | |||
226 | /******************************************************************************* | 203 | /******************************************************************************* |
227 | * | 204 | * |
228 | * FUNCTION: acpi_ut_create_update_state | 205 | * FUNCTION: acpi_ut_create_update_state |
@@ -238,34 +215,29 @@ acpi_ut_create_thread_state ( | |||
238 | * | 215 | * |
239 | ******************************************************************************/ | 216 | ******************************************************************************/ |
240 | 217 | ||
241 | union acpi_generic_state * | 218 | union acpi_generic_state *acpi_ut_create_update_state(union acpi_operand_object |
242 | acpi_ut_create_update_state ( | 219 | *object, u16 action) |
243 | union acpi_operand_object *object, | ||
244 | u16 action) | ||
245 | { | 220 | { |
246 | union acpi_generic_state *state; | 221 | union acpi_generic_state *state; |
247 | |||
248 | |||
249 | ACPI_FUNCTION_TRACE_PTR ("ut_create_update_state", object); | ||
250 | 222 | ||
223 | ACPI_FUNCTION_TRACE_PTR("ut_create_update_state", object); | ||
251 | 224 | ||
252 | /* Create the generic state object */ | 225 | /* Create the generic state object */ |
253 | 226 | ||
254 | state = acpi_ut_create_generic_state (); | 227 | state = acpi_ut_create_generic_state(); |
255 | if (!state) { | 228 | if (!state) { |
256 | return_PTR (NULL); | 229 | return_PTR(NULL); |
257 | } | 230 | } |
258 | 231 | ||
259 | /* Init fields specific to the update struct */ | 232 | /* Init fields specific to the update struct */ |
260 | 233 | ||
261 | state->common.data_type = ACPI_DESC_TYPE_STATE_UPDATE; | 234 | state->common.data_type = ACPI_DESC_TYPE_STATE_UPDATE; |
262 | state->update.object = object; | 235 | state->update.object = object; |
263 | state->update.value = action; | 236 | state->update.value = action; |
264 | 237 | ||
265 | return_PTR (state); | 238 | return_PTR(state); |
266 | } | 239 | } |
267 | 240 | ||
268 | |||
269 | /******************************************************************************* | 241 | /******************************************************************************* |
270 | * | 242 | * |
271 | * FUNCTION: acpi_ut_create_pkg_state | 243 | * FUNCTION: acpi_ut_create_pkg_state |
@@ -279,37 +251,32 @@ acpi_ut_create_update_state ( | |||
279 | * | 251 | * |
280 | ******************************************************************************/ | 252 | ******************************************************************************/ |
281 | 253 | ||
282 | union acpi_generic_state * | 254 | union acpi_generic_state *acpi_ut_create_pkg_state(void *internal_object, |
283 | acpi_ut_create_pkg_state ( | 255 | void *external_object, |
284 | void *internal_object, | 256 | u16 index) |
285 | void *external_object, | ||
286 | u16 index) | ||
287 | { | 257 | { |
288 | union acpi_generic_state *state; | 258 | union acpi_generic_state *state; |
289 | |||
290 | |||
291 | ACPI_FUNCTION_TRACE_PTR ("ut_create_pkg_state", internal_object); | ||
292 | 259 | ||
260 | ACPI_FUNCTION_TRACE_PTR("ut_create_pkg_state", internal_object); | ||
293 | 261 | ||
294 | /* Create the generic state object */ | 262 | /* Create the generic state object */ |
295 | 263 | ||
296 | state = acpi_ut_create_generic_state (); | 264 | state = acpi_ut_create_generic_state(); |
297 | if (!state) { | 265 | if (!state) { |
298 | return_PTR (NULL); | 266 | return_PTR(NULL); |
299 | } | 267 | } |
300 | 268 | ||
301 | /* Init fields specific to the update struct */ | 269 | /* Init fields specific to the update struct */ |
302 | 270 | ||
303 | state->common.data_type = ACPI_DESC_TYPE_STATE_PACKAGE; | 271 | state->common.data_type = ACPI_DESC_TYPE_STATE_PACKAGE; |
304 | state->pkg.source_object = (union acpi_operand_object *) internal_object; | 272 | state->pkg.source_object = (union acpi_operand_object *)internal_object; |
305 | state->pkg.dest_object = external_object; | 273 | state->pkg.dest_object = external_object; |
306 | state->pkg.index = index; | 274 | state->pkg.index = index; |
307 | state->pkg.num_packages = 1; | 275 | state->pkg.num_packages = 1; |
308 | 276 | ||
309 | return_PTR (state); | 277 | return_PTR(state); |
310 | } | 278 | } |
311 | 279 | ||
312 | |||
313 | /******************************************************************************* | 280 | /******************************************************************************* |
314 | * | 281 | * |
315 | * FUNCTION: acpi_ut_create_control_state | 282 | * FUNCTION: acpi_ut_create_control_state |
@@ -323,32 +290,27 @@ acpi_ut_create_pkg_state ( | |||
323 | * | 290 | * |
324 | ******************************************************************************/ | 291 | ******************************************************************************/ |
325 | 292 | ||
326 | union acpi_generic_state * | 293 | union acpi_generic_state *acpi_ut_create_control_state(void) |
327 | acpi_ut_create_control_state ( | ||
328 | void) | ||
329 | { | 294 | { |
330 | union acpi_generic_state *state; | 295 | union acpi_generic_state *state; |
331 | |||
332 | |||
333 | ACPI_FUNCTION_TRACE ("ut_create_control_state"); | ||
334 | 296 | ||
297 | ACPI_FUNCTION_TRACE("ut_create_control_state"); | ||
335 | 298 | ||
336 | /* Create the generic state object */ | 299 | /* Create the generic state object */ |
337 | 300 | ||
338 | state = acpi_ut_create_generic_state (); | 301 | state = acpi_ut_create_generic_state(); |
339 | if (!state) { | 302 | if (!state) { |
340 | return_PTR (NULL); | 303 | return_PTR(NULL); |
341 | } | 304 | } |
342 | 305 | ||
343 | /* Init fields specific to the control struct */ | 306 | /* Init fields specific to the control struct */ |
344 | 307 | ||
345 | state->common.data_type = ACPI_DESC_TYPE_STATE_CONTROL; | 308 | state->common.data_type = ACPI_DESC_TYPE_STATE_CONTROL; |
346 | state->common.state = ACPI_CONTROL_CONDITIONAL_EXECUTING; | 309 | state->common.state = ACPI_CONTROL_CONDITIONAL_EXECUTING; |
347 | 310 | ||
348 | return_PTR (state); | 311 | return_PTR(state); |
349 | } | 312 | } |
350 | 313 | ||
351 | |||
352 | /******************************************************************************* | 314 | /******************************************************************************* |
353 | * | 315 | * |
354 | * FUNCTION: acpi_ut_delete_generic_state | 316 | * FUNCTION: acpi_ut_delete_generic_state |
@@ -362,15 +324,10 @@ acpi_ut_create_control_state ( | |||
362 | * | 324 | * |
363 | ******************************************************************************/ | 325 | ******************************************************************************/ |
364 | 326 | ||
365 | void | 327 | void acpi_ut_delete_generic_state(union acpi_generic_state *state) |
366 | acpi_ut_delete_generic_state ( | ||
367 | union acpi_generic_state *state) | ||
368 | { | 328 | { |
369 | ACPI_FUNCTION_TRACE ("ut_delete_generic_state"); | 329 | ACPI_FUNCTION_TRACE("ut_delete_generic_state"); |
370 | 330 | ||
371 | 331 | (void)acpi_os_release_object(acpi_gbl_state_cache, state); | |
372 | (void) acpi_os_release_object (acpi_gbl_state_cache, state); | ||
373 | return_VOID; | 332 | return_VOID; |
374 | } | 333 | } |
375 | |||
376 | |||