aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/acpi_memhotplug.c
diff options
context:
space:
mode:
authorThomas Renninger <trenn@suse.de>2006-06-26 23:58:43 -0400
committerLen Brown <len.brown@intel.com>2006-06-26 23:58:43 -0400
commita6fc67202e0224e6c9d1d285cc0b444bce887ed5 (patch)
treecb2d422f65c0ab0a95f452f6bac80e2bfdd547de /drivers/acpi/acpi_memhotplug.c
parenteb99adde31b7d85c67a5e1c2fa5e098e1056dd79 (diff)
ACPI: Enable ACPI error messages w/o CONFIG_ACPI_DEBUG
Signed-off-by: Thomas Renninger <trenn@suse.de> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/acpi_memhotplug.c')
-rw-r--r--drivers/acpi/acpi_memhotplug.c67
1 files changed, 26 insertions, 41 deletions
diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c
index e0a95ba72371..e49d327ccf4c 100644
--- a/drivers/acpi/acpi_memhotplug.c
+++ b/drivers/acpi/acpi_memhotplug.c
@@ -125,15 +125,14 @@ acpi_memory_get_device(acpi_handle handle,
125 125
126 status = acpi_get_parent(handle, &phandle); 126 status = acpi_get_parent(handle, &phandle);
127 if (ACPI_FAILURE(status)) { 127 if (ACPI_FAILURE(status)) {
128 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error in acpi_get_parent\n")); 128 ACPI_EXCEPTION((AE_INFO, status, "Cannot find acpi parent"));
129 return_VALUE(-EINVAL); 129 return_VALUE(-EINVAL);
130 } 130 }
131 131
132 /* Get the parent device */ 132 /* Get the parent device */
133 status = acpi_bus_get_device(phandle, &pdevice); 133 status = acpi_bus_get_device(phandle, &pdevice);
134 if (ACPI_FAILURE(status)) { 134 if (ACPI_FAILURE(status)) {
135 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 135 ACPI_EXCEPTION((AE_INFO, status, "Cannot get acpi bus device"));
136 "Error in acpi_bus_get_device\n"));
137 return_VALUE(-EINVAL); 136 return_VALUE(-EINVAL);
138 } 137 }
139 138
@@ -143,7 +142,7 @@ acpi_memory_get_device(acpi_handle handle,
143 */ 142 */
144 status = acpi_bus_add(&device, pdevice, handle, ACPI_BUS_TYPE_DEVICE); 143 status = acpi_bus_add(&device, pdevice, handle, ACPI_BUS_TYPE_DEVICE);
145 if (ACPI_FAILURE(status)) { 144 if (ACPI_FAILURE(status)) {
146 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error in acpi_bus_add\n")); 145 ACPI_EXCEPTION((AE_INFO, status, "Cannot add acpi bus"));
147 return_VALUE(-EINVAL); 146 return_VALUE(-EINVAL);
148 } 147 }
149 148
@@ -188,8 +187,7 @@ static int acpi_memory_enable_device(struct acpi_memory_device *mem_device)
188 /* Get the range from the _CRS */ 187 /* Get the range from the _CRS */
189 result = acpi_memory_get_device_resources(mem_device); 188 result = acpi_memory_get_device_resources(mem_device);
190 if (result) { 189 if (result) {
191 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 190 ACPI_ERROR((AE_INFO, "get_device_resources failed"));
192 "\nget_device_resources failed\n"));
193 mem_device->state = MEMORY_INVALID_STATE; 191 mem_device->state = MEMORY_INVALID_STATE;
194 return result; 192 return result;
195 } 193 }
@@ -200,7 +198,7 @@ static int acpi_memory_enable_device(struct acpi_memory_device *mem_device)
200 */ 198 */
201 result = add_memory(mem_device->start_addr, mem_device->length); 199 result = add_memory(mem_device->start_addr, mem_device->length);
202 if (result) { 200 if (result) {
203 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "\nadd_memory failed\n")); 201 ACPI_ERROR((AE_INFO, "add_memory failed"));
204 mem_device->state = MEMORY_INVALID_STATE; 202 mem_device->state = MEMORY_INVALID_STATE;
205 return result; 203 return result;
206 } 204 }
@@ -226,7 +224,7 @@ static int acpi_memory_powerdown_device(struct acpi_memory_device *mem_device)
226 "_EJ0", &arg_list, NULL); 224 "_EJ0", &arg_list, NULL);
227 /* Return on _EJ0 failure */ 225 /* Return on _EJ0 failure */
228 if (ACPI_FAILURE(status)) { 226 if (ACPI_FAILURE(status)) {
229 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "_EJ0 failed.\n")); 227 ACPI_EXCEPTION((AE_INFO, status, "_EJ0 failed"));
230 return_VALUE(-ENODEV); 228 return_VALUE(-ENODEV);
231 } 229 }
232 230
@@ -256,16 +254,12 @@ static int acpi_memory_disable_device(struct acpi_memory_device *mem_device)
256 * Note: Assume that this function returns zero on success 254 * Note: Assume that this function returns zero on success
257 */ 255 */
258 result = remove_memory(start, len); 256 result = remove_memory(start, len);
259 if (result) { 257 if (result)
260 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Hot-Remove failed.\n"));
261 return_VALUE(result); 258 return_VALUE(result);
262 }
263 259
264 /* Power-off and eject the device */ 260 /* Power-off and eject the device */
265 result = acpi_memory_powerdown_device(mem_device); 261 result = acpi_memory_powerdown_device(mem_device);
266 if (result) { 262 if (result) {
267 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
268 "Device Power Down failed.\n"));
269 /* Set the status of the device to invalid */ 263 /* Set the status of the device to invalid */
270 mem_device->state = MEMORY_INVALID_STATE; 264 mem_device->state = MEMORY_INVALID_STATE;
271 return result; 265 return result;
@@ -292,15 +286,14 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data)
292 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 286 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
293 "\nReceived DEVICE CHECK notification for device\n")); 287 "\nReceived DEVICE CHECK notification for device\n"));
294 if (acpi_memory_get_device(handle, &mem_device)) { 288 if (acpi_memory_get_device(handle, &mem_device)) {
295 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 289 ACPI_ERROR((AE_INFO, "Cannot find driver data"));
296 "Error in finding driver data\n"));
297 return_VOID; 290 return_VOID;
298 } 291 }
299 292
300 if (!acpi_memory_check_device(mem_device)) { 293 if (!acpi_memory_check_device(mem_device)) {
301 if (acpi_memory_enable_device(mem_device)) 294 if (acpi_memory_enable_device(mem_device))
302 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 295 ACPI_ERROR((AE_INFO,
303 "Error in acpi_memory_enable_device\n")); 296 "Cannot enable memory device"));
304 } 297 }
305 break; 298 break;
306 case ACPI_NOTIFY_EJECT_REQUEST: 299 case ACPI_NOTIFY_EJECT_REQUEST:
@@ -308,14 +301,12 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data)
308 "\nReceived EJECT REQUEST notification for device\n")); 301 "\nReceived EJECT REQUEST notification for device\n"));
309 302
310 if (acpi_bus_get_device(handle, &device)) { 303 if (acpi_bus_get_device(handle, &device)) {
311 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 304 ACPI_ERROR((AE_INFO, "Device doesn't exist"));
312 "Device doesn't exist\n"));
313 break; 305 break;
314 } 306 }
315 mem_device = acpi_driver_data(device); 307 mem_device = acpi_driver_data(device);
316 if (!mem_device) { 308 if (!mem_device) {
317 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 309 ACPI_ERROR((AE_INFO, "Driver Data is NULL"));
318 "Driver Data is NULL\n"));
319 break; 310 break;
320 } 311 }
321 312
@@ -326,8 +317,8 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data)
326 * with generic sysfs driver 317 * with generic sysfs driver
327 */ 318 */
328 if (acpi_memory_disable_device(mem_device)) 319 if (acpi_memory_disable_device(mem_device))
329 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 320 ACPI_ERROR((AE_INFO,
330 "Error in acpi_memory_disable_device\n")); 321 "Disable memory device\n"));
331 /* 322 /*
332 * TBD: Invoke acpi_bus_remove to cleanup data structures 323 * TBD: Invoke acpi_bus_remove to cleanup data structures
333 */ 324 */
@@ -405,7 +396,7 @@ static acpi_status is_memory_device(acpi_handle handle)
405 396
406 status = acpi_get_object_info(handle, &buffer); 397 status = acpi_get_object_info(handle, &buffer);
407 if (ACPI_FAILURE(status)) 398 if (ACPI_FAILURE(status))
408 return_ACPI_STATUS(AE_ERROR); 399 return_ACPI_STATUS(status);
409 400
410 info = buffer.pointer; 401 info = buffer.pointer;
411 if (!(info->valid & ACPI_VALID_HID)) { 402 if (!(info->valid & ACPI_VALID_HID)) {
@@ -431,18 +422,15 @@ acpi_memory_register_notify_handler(acpi_handle handle,
431 ACPI_FUNCTION_TRACE("acpi_memory_register_notify_handler"); 422 ACPI_FUNCTION_TRACE("acpi_memory_register_notify_handler");
432 423
433 status = is_memory_device(handle); 424 status = is_memory_device(handle);
434 if (ACPI_FAILURE(status)) 425 if (ACPI_FAILURE(status)){
426 ACPI_EXCEPTION((AE_INFO, status, "handle is no memory device"));
435 return_ACPI_STATUS(AE_OK); /* continue */ 427 return_ACPI_STATUS(AE_OK); /* continue */
428 }
436 429
437 status = acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY, 430 status = acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY,
438 acpi_memory_device_notify, NULL); 431 acpi_memory_device_notify, NULL);
439 if (ACPI_FAILURE(status)) { 432 /* continue */
440 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, 433 return_ACPI_STATUS(AE_OK);
441 "Error installing notify handler\n"));
442 return_ACPI_STATUS(AE_OK); /* continue */
443 }
444
445 return_ACPI_STATUS(status);
446} 434}
447 435
448static acpi_status 436static acpi_status
@@ -454,19 +442,16 @@ acpi_memory_deregister_notify_handler(acpi_handle handle,
454 ACPI_FUNCTION_TRACE("acpi_memory_deregister_notify_handler"); 442 ACPI_FUNCTION_TRACE("acpi_memory_deregister_notify_handler");
455 443
456 status = is_memory_device(handle); 444 status = is_memory_device(handle);
457 if (ACPI_FAILURE(status)) 445 if (ACPI_FAILURE(status)){
446 ACPI_EXCEPTION((AE_INFO, status, "handle is no memory device"));
458 return_ACPI_STATUS(AE_OK); /* continue */ 447 return_ACPI_STATUS(AE_OK); /* continue */
448 }
459 449
460 status = acpi_remove_notify_handler(handle, 450 status = acpi_remove_notify_handler(handle,
461 ACPI_SYSTEM_NOTIFY, 451 ACPI_SYSTEM_NOTIFY,
462 acpi_memory_device_notify); 452 acpi_memory_device_notify);
463 if (ACPI_FAILURE(status)) {
464 ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
465 "Error removing notify handler\n"));
466 return_ACPI_STATUS(AE_OK); /* continue */
467 }
468 453
469 return_ACPI_STATUS(status); 454 return_ACPI_STATUS(AE_OK); /* continue */
470} 455}
471 456
472static int __init acpi_memory_device_init(void) 457static int __init acpi_memory_device_init(void)
@@ -487,7 +472,7 @@ static int __init acpi_memory_device_init(void)
487 NULL, NULL); 472 NULL, NULL);
488 473
489 if (ACPI_FAILURE(status)) { 474 if (ACPI_FAILURE(status)) {
490 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "walk_namespace failed\n")); 475 ACPI_EXCEPTION((AE_INFO, status, "walk_namespace failed"));
491 acpi_bus_unregister_driver(&acpi_memory_device_driver); 476 acpi_bus_unregister_driver(&acpi_memory_device_driver);
492 return_VALUE(-ENODEV); 477 return_VALUE(-ENODEV);
493 } 478 }
@@ -511,7 +496,7 @@ static void __exit acpi_memory_device_exit(void)
511 NULL, NULL); 496 NULL, NULL);
512 497
513 if (ACPI_FAILURE(status)) 498 if (ACPI_FAILURE(status))
514 ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "walk_namespace failed\n")); 499 ACPI_EXCEPTION((AE_INFO, status, "walk_namespace failed"));
515 500
516 acpi_bus_unregister_driver(&acpi_memory_device_driver); 501 acpi_bus_unregister_driver(&acpi_memory_device_driver);
517 502