diff options
Diffstat (limited to 'drivers/acpi/power.c')
-rw-r--r-- | drivers/acpi/power.c | 145 |
1 files changed, 62 insertions, 83 deletions
diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c index 62a5595ed8bc..224f729f700e 100644 --- a/drivers/acpi/power.c +++ b/drivers/acpi/power.c | |||
@@ -98,23 +98,21 @@ acpi_power_get_context(acpi_handle handle, | |||
98 | int result = 0; | 98 | int result = 0; |
99 | struct acpi_device *device = NULL; | 99 | struct acpi_device *device = NULL; |
100 | 100 | ||
101 | ACPI_FUNCTION_TRACE("acpi_power_get_context"); | ||
102 | 101 | ||
103 | if (!resource) | 102 | if (!resource) |
104 | return_VALUE(-ENODEV); | 103 | return -ENODEV; |
105 | 104 | ||
106 | result = acpi_bus_get_device(handle, &device); | 105 | result = acpi_bus_get_device(handle, &device); |
107 | if (result) { | 106 | if (result) { |
108 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Error getting context [%p]\n", | 107 | printk(KERN_WARNING PREFIX "Getting context [%p]\n", handle); |
109 | handle)); | 108 | return result; |
110 | return_VALUE(result); | ||
111 | } | 109 | } |
112 | 110 | ||
113 | *resource = (struct acpi_power_resource *)acpi_driver_data(device); | 111 | *resource = (struct acpi_power_resource *)acpi_driver_data(device); |
114 | if (!resource) | 112 | if (!resource) |
115 | return_VALUE(-ENODEV); | 113 | return -ENODEV; |
116 | 114 | ||
117 | return_VALUE(0); | 115 | return 0; |
118 | } | 116 | } |
119 | 117 | ||
120 | static int acpi_power_get_state(struct acpi_power_resource *resource) | 118 | static int acpi_power_get_state(struct acpi_power_resource *resource) |
@@ -122,14 +120,13 @@ static int acpi_power_get_state(struct acpi_power_resource *resource) | |||
122 | acpi_status status = AE_OK; | 120 | acpi_status status = AE_OK; |
123 | unsigned long sta = 0; | 121 | unsigned long sta = 0; |
124 | 122 | ||
125 | ACPI_FUNCTION_TRACE("acpi_power_get_state"); | ||
126 | 123 | ||
127 | if (!resource) | 124 | if (!resource) |
128 | return_VALUE(-EINVAL); | 125 | return -EINVAL; |
129 | 126 | ||
130 | status = acpi_evaluate_integer(resource->handle, "_STA", NULL, &sta); | 127 | status = acpi_evaluate_integer(resource->handle, "_STA", NULL, &sta); |
131 | if (ACPI_FAILURE(status)) | 128 | if (ACPI_FAILURE(status)) |
132 | return_VALUE(-ENODEV); | 129 | return -ENODEV; |
133 | 130 | ||
134 | if (sta & 0x01) | 131 | if (sta & 0x01) |
135 | resource->state = ACPI_POWER_RESOURCE_STATE_ON; | 132 | resource->state = ACPI_POWER_RESOURCE_STATE_ON; |
@@ -139,7 +136,7 @@ static int acpi_power_get_state(struct acpi_power_resource *resource) | |||
139 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] is %s\n", | 136 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] is %s\n", |
140 | resource->name, resource->state ? "on" : "off")); | 137 | resource->name, resource->state ? "on" : "off")); |
141 | 138 | ||
142 | return_VALUE(0); | 139 | return 0; |
143 | } | 140 | } |
144 | 141 | ||
145 | static int acpi_power_get_list_state(struct acpi_handle_list *list, int *state) | 142 | static int acpi_power_get_list_state(struct acpi_handle_list *list, int *state) |
@@ -148,20 +145,19 @@ static int acpi_power_get_list_state(struct acpi_handle_list *list, int *state) | |||
148 | struct acpi_power_resource *resource = NULL; | 145 | struct acpi_power_resource *resource = NULL; |
149 | u32 i = 0; | 146 | u32 i = 0; |
150 | 147 | ||
151 | ACPI_FUNCTION_TRACE("acpi_power_get_list_state"); | ||
152 | 148 | ||
153 | if (!list || !state) | 149 | if (!list || !state) |
154 | return_VALUE(-EINVAL); | 150 | return -EINVAL; |
155 | 151 | ||
156 | /* The state of the list is 'on' IFF all resources are 'on'. */ | 152 | /* The state of the list is 'on' IFF all resources are 'on'. */ |
157 | 153 | ||
158 | for (i = 0; i < list->count; i++) { | 154 | for (i = 0; i < list->count; i++) { |
159 | result = acpi_power_get_context(list->handles[i], &resource); | 155 | result = acpi_power_get_context(list->handles[i], &resource); |
160 | if (result) | 156 | if (result) |
161 | return_VALUE(result); | 157 | return result; |
162 | result = acpi_power_get_state(resource); | 158 | result = acpi_power_get_state(resource); |
163 | if (result) | 159 | if (result) |
164 | return_VALUE(result); | 160 | return result; |
165 | 161 | ||
166 | *state = resource->state; | 162 | *state = resource->state; |
167 | 163 | ||
@@ -172,7 +168,7 @@ static int acpi_power_get_list_state(struct acpi_handle_list *list, int *state) | |||
172 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource list is %s\n", | 168 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource list is %s\n", |
173 | *state ? "on" : "off")); | 169 | *state ? "on" : "off")); |
174 | 170 | ||
175 | return_VALUE(result); | 171 | return result; |
176 | } | 172 | } |
177 | 173 | ||
178 | static int acpi_power_on(acpi_handle handle) | 174 | static int acpi_power_on(acpi_handle handle) |
@@ -182,11 +178,10 @@ static int acpi_power_on(acpi_handle handle) | |||
182 | struct acpi_device *device = NULL; | 178 | struct acpi_device *device = NULL; |
183 | struct acpi_power_resource *resource = NULL; | 179 | struct acpi_power_resource *resource = NULL; |
184 | 180 | ||
185 | ACPI_FUNCTION_TRACE("acpi_power_on"); | ||
186 | 181 | ||
187 | result = acpi_power_get_context(handle, &resource); | 182 | result = acpi_power_get_context(handle, &resource); |
188 | if (result) | 183 | if (result) |
189 | return_VALUE(result); | 184 | return result; |
190 | 185 | ||
191 | resource->references++; | 186 | resource->references++; |
192 | 187 | ||
@@ -194,29 +189,29 @@ static int acpi_power_on(acpi_handle handle) | |||
194 | || (resource->state == ACPI_POWER_RESOURCE_STATE_ON)) { | 189 | || (resource->state == ACPI_POWER_RESOURCE_STATE_ON)) { |
195 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] already on\n", | 190 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] already on\n", |
196 | resource->name)); | 191 | resource->name)); |
197 | return_VALUE(0); | 192 | return 0; |
198 | } | 193 | } |
199 | 194 | ||
200 | status = acpi_evaluate_object(resource->handle, "_ON", NULL, NULL); | 195 | status = acpi_evaluate_object(resource->handle, "_ON", NULL, NULL); |
201 | if (ACPI_FAILURE(status)) | 196 | if (ACPI_FAILURE(status)) |
202 | return_VALUE(-ENODEV); | 197 | return -ENODEV; |
203 | 198 | ||
204 | result = acpi_power_get_state(resource); | 199 | result = acpi_power_get_state(resource); |
205 | if (result) | 200 | if (result) |
206 | return_VALUE(result); | 201 | return result; |
207 | if (resource->state != ACPI_POWER_RESOURCE_STATE_ON) | 202 | if (resource->state != ACPI_POWER_RESOURCE_STATE_ON) |
208 | return_VALUE(-ENOEXEC); | 203 | return -ENOEXEC; |
209 | 204 | ||
210 | /* Update the power resource's _device_ power state */ | 205 | /* Update the power resource's _device_ power state */ |
211 | result = acpi_bus_get_device(resource->handle, &device); | 206 | result = acpi_bus_get_device(resource->handle, &device); |
212 | if (result) | 207 | if (result) |
213 | return_VALUE(result); | 208 | return result; |
214 | device->power.state = ACPI_STATE_D0; | 209 | device->power.state = ACPI_STATE_D0; |
215 | 210 | ||
216 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] turned on\n", | 211 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] turned on\n", |
217 | resource->name)); | 212 | resource->name)); |
218 | 213 | ||
219 | return_VALUE(0); | 214 | return 0; |
220 | } | 215 | } |
221 | 216 | ||
222 | static int acpi_power_off_device(acpi_handle handle) | 217 | static int acpi_power_off_device(acpi_handle handle) |
@@ -226,11 +221,10 @@ static int acpi_power_off_device(acpi_handle handle) | |||
226 | struct acpi_device *device = NULL; | 221 | struct acpi_device *device = NULL; |
227 | struct acpi_power_resource *resource = NULL; | 222 | struct acpi_power_resource *resource = NULL; |
228 | 223 | ||
229 | ACPI_FUNCTION_TRACE("acpi_power_off_device"); | ||
230 | 224 | ||
231 | result = acpi_power_get_context(handle, &resource); | 225 | result = acpi_power_get_context(handle, &resource); |
232 | if (result) | 226 | if (result) |
233 | return_VALUE(result); | 227 | return result; |
234 | 228 | ||
235 | if (resource->references) | 229 | if (resource->references) |
236 | resource->references--; | 230 | resource->references--; |
@@ -239,35 +233,35 @@ static int acpi_power_off_device(acpi_handle handle) | |||
239 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 233 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
240 | "Resource [%s] is still in use, dereferencing\n", | 234 | "Resource [%s] is still in use, dereferencing\n", |
241 | device->pnp.bus_id)); | 235 | device->pnp.bus_id)); |
242 | return_VALUE(0); | 236 | return 0; |
243 | } | 237 | } |
244 | 238 | ||
245 | if (resource->state == ACPI_POWER_RESOURCE_STATE_OFF) { | 239 | if (resource->state == ACPI_POWER_RESOURCE_STATE_OFF) { |
246 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] already off\n", | 240 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] already off\n", |
247 | device->pnp.bus_id)); | 241 | device->pnp.bus_id)); |
248 | return_VALUE(0); | 242 | return 0; |
249 | } | 243 | } |
250 | 244 | ||
251 | status = acpi_evaluate_object(resource->handle, "_OFF", NULL, NULL); | 245 | status = acpi_evaluate_object(resource->handle, "_OFF", NULL, NULL); |
252 | if (ACPI_FAILURE(status)) | 246 | if (ACPI_FAILURE(status)) |
253 | return_VALUE(-ENODEV); | 247 | return -ENODEV; |
254 | 248 | ||
255 | result = acpi_power_get_state(resource); | 249 | result = acpi_power_get_state(resource); |
256 | if (result) | 250 | if (result) |
257 | return_VALUE(result); | 251 | return result; |
258 | if (resource->state != ACPI_POWER_RESOURCE_STATE_OFF) | 252 | if (resource->state != ACPI_POWER_RESOURCE_STATE_OFF) |
259 | return_VALUE(-ENOEXEC); | 253 | return -ENOEXEC; |
260 | 254 | ||
261 | /* Update the power resource's _device_ power state */ | 255 | /* Update the power resource's _device_ power state */ |
262 | result = acpi_bus_get_device(resource->handle, &device); | 256 | result = acpi_bus_get_device(resource->handle, &device); |
263 | if (result) | 257 | if (result) |
264 | return_VALUE(result); | 258 | return result; |
265 | device->power.state = ACPI_STATE_D3; | 259 | device->power.state = ACPI_STATE_D3; |
266 | 260 | ||
267 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] turned off\n", | 261 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Resource [%s] turned off\n", |
268 | resource->name)); | 262 | resource->name)); |
269 | 263 | ||
270 | return_VALUE(0); | 264 | return 0; |
271 | } | 265 | } |
272 | 266 | ||
273 | /* | 267 | /* |
@@ -283,31 +277,29 @@ int acpi_enable_wakeup_device_power(struct acpi_device *dev) | |||
283 | int i; | 277 | int i; |
284 | int ret = 0; | 278 | int ret = 0; |
285 | 279 | ||
286 | ACPI_FUNCTION_TRACE("acpi_enable_wakeup_device_power"); | ||
287 | if (!dev || !dev->wakeup.flags.valid) | 280 | if (!dev || !dev->wakeup.flags.valid) |
288 | return_VALUE(-1); | 281 | return -1; |
289 | 282 | ||
290 | arg.integer.value = 1; | 283 | arg.integer.value = 1; |
291 | /* Open power resource */ | 284 | /* Open power resource */ |
292 | for (i = 0; i < dev->wakeup.resources.count; i++) { | 285 | for (i = 0; i < dev->wakeup.resources.count; i++) { |
293 | ret = acpi_power_on(dev->wakeup.resources.handles[i]); | 286 | ret = acpi_power_on(dev->wakeup.resources.handles[i]); |
294 | if (ret) { | 287 | if (ret) { |
295 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 288 | printk(KERN_ERR PREFIX "Transition power state\n"); |
296 | "Error transition power state\n")); | ||
297 | dev->wakeup.flags.valid = 0; | 289 | dev->wakeup.flags.valid = 0; |
298 | return_VALUE(-1); | 290 | return -1; |
299 | } | 291 | } |
300 | } | 292 | } |
301 | 293 | ||
302 | /* Execute PSW */ | 294 | /* Execute PSW */ |
303 | status = acpi_evaluate_object(dev->handle, "_PSW", &arg_list, NULL); | 295 | status = acpi_evaluate_object(dev->handle, "_PSW", &arg_list, NULL); |
304 | if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) { | 296 | if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) { |
305 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluate _PSW\n")); | 297 | printk(KERN_ERR PREFIX "Evaluate _PSW\n"); |
306 | dev->wakeup.flags.valid = 0; | 298 | dev->wakeup.flags.valid = 0; |
307 | ret = -1; | 299 | ret = -1; |
308 | } | 300 | } |
309 | 301 | ||
310 | return_VALUE(ret); | 302 | return ret; |
311 | } | 303 | } |
312 | 304 | ||
313 | /* | 305 | /* |
@@ -323,32 +315,30 @@ int acpi_disable_wakeup_device_power(struct acpi_device *dev) | |||
323 | int i; | 315 | int i; |
324 | int ret = 0; | 316 | int ret = 0; |
325 | 317 | ||
326 | ACPI_FUNCTION_TRACE("acpi_disable_wakeup_device_power"); | ||
327 | 318 | ||
328 | if (!dev || !dev->wakeup.flags.valid) | 319 | if (!dev || !dev->wakeup.flags.valid) |
329 | return_VALUE(-1); | 320 | return -1; |
330 | 321 | ||
331 | arg.integer.value = 0; | 322 | arg.integer.value = 0; |
332 | /* Execute PSW */ | 323 | /* Execute PSW */ |
333 | status = acpi_evaluate_object(dev->handle, "_PSW", &arg_list, NULL); | 324 | status = acpi_evaluate_object(dev->handle, "_PSW", &arg_list, NULL); |
334 | if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) { | 325 | if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) { |
335 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluate _PSW\n")); | 326 | printk(KERN_ERR PREFIX "Evaluate _PSW\n"); |
336 | dev->wakeup.flags.valid = 0; | 327 | dev->wakeup.flags.valid = 0; |
337 | return_VALUE(-1); | 328 | return -1; |
338 | } | 329 | } |
339 | 330 | ||
340 | /* Close power resource */ | 331 | /* Close power resource */ |
341 | for (i = 0; i < dev->wakeup.resources.count; i++) { | 332 | for (i = 0; i < dev->wakeup.resources.count; i++) { |
342 | ret = acpi_power_off_device(dev->wakeup.resources.handles[i]); | 333 | ret = acpi_power_off_device(dev->wakeup.resources.handles[i]); |
343 | if (ret) { | 334 | if (ret) { |
344 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 335 | printk(KERN_ERR PREFIX "Transition power state\n"); |
345 | "Error transition power state\n")); | ||
346 | dev->wakeup.flags.valid = 0; | 336 | dev->wakeup.flags.valid = 0; |
347 | return_VALUE(-1); | 337 | return -1; |
348 | } | 338 | } |
349 | } | 339 | } |
350 | 340 | ||
351 | return_VALUE(ret); | 341 | return ret; |
352 | } | 342 | } |
353 | 343 | ||
354 | /* -------------------------------------------------------------------------- | 344 | /* -------------------------------------------------------------------------- |
@@ -362,10 +352,9 @@ int acpi_power_get_inferred_state(struct acpi_device *device) | |||
362 | int list_state = 0; | 352 | int list_state = 0; |
363 | int i = 0; | 353 | int i = 0; |
364 | 354 | ||
365 | ACPI_FUNCTION_TRACE("acpi_power_get_inferred_state"); | ||
366 | 355 | ||
367 | if (!device) | 356 | if (!device) |
368 | return_VALUE(-EINVAL); | 357 | return -EINVAL; |
369 | 358 | ||
370 | device->power.state = ACPI_STATE_UNKNOWN; | 359 | device->power.state = ACPI_STATE_UNKNOWN; |
371 | 360 | ||
@@ -380,17 +369,17 @@ int acpi_power_get_inferred_state(struct acpi_device *device) | |||
380 | 369 | ||
381 | result = acpi_power_get_list_state(list, &list_state); | 370 | result = acpi_power_get_list_state(list, &list_state); |
382 | if (result) | 371 | if (result) |
383 | return_VALUE(result); | 372 | return result; |
384 | 373 | ||
385 | if (list_state == ACPI_POWER_RESOURCE_STATE_ON) { | 374 | if (list_state == ACPI_POWER_RESOURCE_STATE_ON) { |
386 | device->power.state = i; | 375 | device->power.state = i; |
387 | return_VALUE(0); | 376 | return 0; |
388 | } | 377 | } |
389 | } | 378 | } |
390 | 379 | ||
391 | device->power.state = ACPI_STATE_D3; | 380 | device->power.state = ACPI_STATE_D3; |
392 | 381 | ||
393 | return_VALUE(0); | 382 | return 0; |
394 | } | 383 | } |
395 | 384 | ||
396 | int acpi_power_transition(struct acpi_device *device, int state) | 385 | int acpi_power_transition(struct acpi_device *device, int state) |
@@ -400,14 +389,13 @@ int acpi_power_transition(struct acpi_device *device, int state) | |||
400 | struct acpi_handle_list *tl = NULL; /* Target Resources */ | 389 | struct acpi_handle_list *tl = NULL; /* Target Resources */ |
401 | int i = 0; | 390 | int i = 0; |
402 | 391 | ||
403 | ACPI_FUNCTION_TRACE("acpi_power_transition"); | ||
404 | 392 | ||
405 | if (!device || (state < ACPI_STATE_D0) || (state > ACPI_STATE_D3)) | 393 | if (!device || (state < ACPI_STATE_D0) || (state > ACPI_STATE_D3)) |
406 | return_VALUE(-EINVAL); | 394 | return -EINVAL; |
407 | 395 | ||
408 | if ((device->power.state < ACPI_STATE_D0) | 396 | if ((device->power.state < ACPI_STATE_D0) |
409 | || (device->power.state > ACPI_STATE_D3)) | 397 | || (device->power.state > ACPI_STATE_D3)) |
410 | return_VALUE(-ENODEV); | 398 | return -ENODEV; |
411 | 399 | ||
412 | cl = &device->power.states[device->power.state].resources; | 400 | cl = &device->power.states[device->power.state].resources; |
413 | tl = &device->power.states[state].resources; | 401 | tl = &device->power.states[state].resources; |
@@ -444,11 +432,10 @@ int acpi_power_transition(struct acpi_device *device, int state) | |||
444 | device->power.state = state; | 432 | device->power.state = state; |
445 | end: | 433 | end: |
446 | if (result) | 434 | if (result) |
447 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, | 435 | printk(KERN_WARNING PREFIX "Transitioning device [%s] to D%d\n", |
448 | "Error transitioning device [%s] to D%d\n", | 436 | device->pnp.bus_id, state); |
449 | device->pnp.bus_id, state)); | ||
450 | 437 | ||
451 | return_VALUE(result); | 438 | return result; |
452 | } | 439 | } |
453 | 440 | ||
454 | /* -------------------------------------------------------------------------- | 441 | /* -------------------------------------------------------------------------- |
@@ -461,7 +448,6 @@ static int acpi_power_seq_show(struct seq_file *seq, void *offset) | |||
461 | { | 448 | { |
462 | struct acpi_power_resource *resource = NULL; | 449 | struct acpi_power_resource *resource = NULL; |
463 | 450 | ||
464 | ACPI_FUNCTION_TRACE("acpi_power_seq_show"); | ||
465 | 451 | ||
466 | resource = (struct acpi_power_resource *)seq->private; | 452 | resource = (struct acpi_power_resource *)seq->private; |
467 | 453 | ||
@@ -488,7 +474,7 @@ static int acpi_power_seq_show(struct seq_file *seq, void *offset) | |||
488 | resource->order, resource->references); | 474 | resource->order, resource->references); |
489 | 475 | ||
490 | end: | 476 | end: |
491 | return_VALUE(0); | 477 | return 0; |
492 | } | 478 | } |
493 | 479 | ||
494 | static int acpi_power_open_fs(struct inode *inode, struct file *file) | 480 | static int acpi_power_open_fs(struct inode *inode, struct file *file) |
@@ -500,36 +486,32 @@ static int acpi_power_add_fs(struct acpi_device *device) | |||
500 | { | 486 | { |
501 | struct proc_dir_entry *entry = NULL; | 487 | struct proc_dir_entry *entry = NULL; |
502 | 488 | ||
503 | ACPI_FUNCTION_TRACE("acpi_power_add_fs"); | ||
504 | 489 | ||
505 | if (!device) | 490 | if (!device) |
506 | return_VALUE(-EINVAL); | 491 | return -EINVAL; |
507 | 492 | ||
508 | if (!acpi_device_dir(device)) { | 493 | if (!acpi_device_dir(device)) { |
509 | acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), | 494 | acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), |
510 | acpi_power_dir); | 495 | acpi_power_dir); |
511 | if (!acpi_device_dir(device)) | 496 | if (!acpi_device_dir(device)) |
512 | return_VALUE(-ENODEV); | 497 | return -ENODEV; |
513 | } | 498 | } |
514 | 499 | ||
515 | /* 'status' [R] */ | 500 | /* 'status' [R] */ |
516 | entry = create_proc_entry(ACPI_POWER_FILE_STATUS, | 501 | entry = create_proc_entry(ACPI_POWER_FILE_STATUS, |
517 | S_IRUGO, acpi_device_dir(device)); | 502 | S_IRUGO, acpi_device_dir(device)); |
518 | if (!entry) | 503 | if (!entry) |
519 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 504 | return -EIO; |
520 | "Unable to create '%s' fs entry\n", | ||
521 | ACPI_POWER_FILE_STATUS)); | ||
522 | else { | 505 | else { |
523 | entry->proc_fops = &acpi_power_fops; | 506 | entry->proc_fops = &acpi_power_fops; |
524 | entry->data = acpi_driver_data(device); | 507 | entry->data = acpi_driver_data(device); |
525 | } | 508 | } |
526 | 509 | ||
527 | return_VALUE(0); | 510 | return 0; |
528 | } | 511 | } |
529 | 512 | ||
530 | static int acpi_power_remove_fs(struct acpi_device *device) | 513 | static int acpi_power_remove_fs(struct acpi_device *device) |
531 | { | 514 | { |
532 | ACPI_FUNCTION_TRACE("acpi_power_remove_fs"); | ||
533 | 515 | ||
534 | if (acpi_device_dir(device)) { | 516 | if (acpi_device_dir(device)) { |
535 | remove_proc_entry(ACPI_POWER_FILE_STATUS, | 517 | remove_proc_entry(ACPI_POWER_FILE_STATUS, |
@@ -538,7 +520,7 @@ static int acpi_power_remove_fs(struct acpi_device *device) | |||
538 | acpi_device_dir(device) = NULL; | 520 | acpi_device_dir(device) = NULL; |
539 | } | 521 | } |
540 | 522 | ||
541 | return_VALUE(0); | 523 | return 0; |
542 | } | 524 | } |
543 | 525 | ||
544 | /* -------------------------------------------------------------------------- | 526 | /* -------------------------------------------------------------------------- |
@@ -553,14 +535,13 @@ static int acpi_power_add(struct acpi_device *device) | |||
553 | union acpi_object acpi_object; | 535 | union acpi_object acpi_object; |
554 | struct acpi_buffer buffer = { sizeof(acpi_object), &acpi_object }; | 536 | struct acpi_buffer buffer = { sizeof(acpi_object), &acpi_object }; |
555 | 537 | ||
556 | ACPI_FUNCTION_TRACE("acpi_power_add"); | ||
557 | 538 | ||
558 | if (!device) | 539 | if (!device) |
559 | return_VALUE(-EINVAL); | 540 | return -EINVAL; |
560 | 541 | ||
561 | resource = kmalloc(sizeof(struct acpi_power_resource), GFP_KERNEL); | 542 | resource = kmalloc(sizeof(struct acpi_power_resource), GFP_KERNEL); |
562 | if (!resource) | 543 | if (!resource) |
563 | return_VALUE(-ENOMEM); | 544 | return -ENOMEM; |
564 | memset(resource, 0, sizeof(struct acpi_power_resource)); | 545 | memset(resource, 0, sizeof(struct acpi_power_resource)); |
565 | 546 | ||
566 | resource->handle = device->handle; | 547 | resource->handle = device->handle; |
@@ -605,17 +586,16 @@ static int acpi_power_add(struct acpi_device *device) | |||
605 | if (result) | 586 | if (result) |
606 | kfree(resource); | 587 | kfree(resource); |
607 | 588 | ||
608 | return_VALUE(result); | 589 | return result; |
609 | } | 590 | } |
610 | 591 | ||
611 | static int acpi_power_remove(struct acpi_device *device, int type) | 592 | static int acpi_power_remove(struct acpi_device *device, int type) |
612 | { | 593 | { |
613 | struct acpi_power_resource *resource = NULL; | 594 | struct acpi_power_resource *resource = NULL; |
614 | 595 | ||
615 | ACPI_FUNCTION_TRACE("acpi_power_remove"); | ||
616 | 596 | ||
617 | if (!device || !acpi_driver_data(device)) | 597 | if (!device || !acpi_driver_data(device)) |
618 | return_VALUE(-EINVAL); | 598 | return -EINVAL; |
619 | 599 | ||
620 | resource = (struct acpi_power_resource *)acpi_driver_data(device); | 600 | resource = (struct acpi_power_resource *)acpi_driver_data(device); |
621 | 601 | ||
@@ -623,31 +603,30 @@ static int acpi_power_remove(struct acpi_device *device, int type) | |||
623 | 603 | ||
624 | kfree(resource); | 604 | kfree(resource); |
625 | 605 | ||
626 | return_VALUE(0); | 606 | return 0; |
627 | } | 607 | } |
628 | 608 | ||
629 | static int __init acpi_power_init(void) | 609 | static int __init acpi_power_init(void) |
630 | { | 610 | { |
631 | int result = 0; | 611 | int result = 0; |
632 | 612 | ||
633 | ACPI_FUNCTION_TRACE("acpi_power_init"); | ||
634 | 613 | ||
635 | if (acpi_disabled) | 614 | if (acpi_disabled) |
636 | return_VALUE(0); | 615 | return 0; |
637 | 616 | ||
638 | INIT_LIST_HEAD(&acpi_power_resource_list); | 617 | INIT_LIST_HEAD(&acpi_power_resource_list); |
639 | 618 | ||
640 | acpi_power_dir = proc_mkdir(ACPI_POWER_CLASS, acpi_root_dir); | 619 | acpi_power_dir = proc_mkdir(ACPI_POWER_CLASS, acpi_root_dir); |
641 | if (!acpi_power_dir) | 620 | if (!acpi_power_dir) |
642 | return_VALUE(-ENODEV); | 621 | return -ENODEV; |
643 | 622 | ||
644 | result = acpi_bus_register_driver(&acpi_power_driver); | 623 | result = acpi_bus_register_driver(&acpi_power_driver); |
645 | if (result < 0) { | 624 | if (result < 0) { |
646 | remove_proc_entry(ACPI_POWER_CLASS, acpi_root_dir); | 625 | remove_proc_entry(ACPI_POWER_CLASS, acpi_root_dir); |
647 | return_VALUE(-ENODEV); | 626 | return -ENODEV; |
648 | } | 627 | } |
649 | 628 | ||
650 | return_VALUE(0); | 629 | return 0; |
651 | } | 630 | } |
652 | 631 | ||
653 | subsys_initcall(acpi_power_init); | 632 | subsys_initcall(acpi_power_init); |