diff options
Diffstat (limited to 'drivers/acpi/acpi_memhotplug.c')
-rw-r--r-- | drivers/acpi/acpi_memhotplug.c | 137 |
1 files changed, 54 insertions, 83 deletions
diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c index 1012284ff4f7..cd57372a6729 100644 --- a/drivers/acpi/acpi_memhotplug.c +++ b/drivers/acpi/acpi_memhotplug.c | |||
@@ -128,7 +128,6 @@ acpi_memory_get_device_resources(struct acpi_memory_device *mem_device) | |||
128 | acpi_status status; | 128 | acpi_status status; |
129 | struct acpi_memory_info *info, *n; | 129 | struct acpi_memory_info *info, *n; |
130 | 130 | ||
131 | ACPI_FUNCTION_TRACE("acpi_memory_get_device_resources"); | ||
132 | 131 | ||
133 | status = acpi_walk_resources(mem_device->handle, METHOD_NAME__CRS, | 132 | status = acpi_walk_resources(mem_device->handle, METHOD_NAME__CRS, |
134 | acpi_memory_get_resource, mem_device); | 133 | acpi_memory_get_resource, mem_device); |
@@ -150,23 +149,21 @@ acpi_memory_get_device(acpi_handle handle, | |||
150 | struct acpi_device *device = NULL; | 149 | struct acpi_device *device = NULL; |
151 | struct acpi_device *pdevice = NULL; | 150 | struct acpi_device *pdevice = NULL; |
152 | 151 | ||
153 | ACPI_FUNCTION_TRACE("acpi_memory_get_device"); | ||
154 | 152 | ||
155 | if (!acpi_bus_get_device(handle, &device) && device) | 153 | if (!acpi_bus_get_device(handle, &device) && device) |
156 | goto end; | 154 | goto end; |
157 | 155 | ||
158 | status = acpi_get_parent(handle, &phandle); | 156 | status = acpi_get_parent(handle, &phandle); |
159 | if (ACPI_FAILURE(status)) { | 157 | if (ACPI_FAILURE(status)) { |
160 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error in acpi_get_parent\n")); | 158 | ACPI_EXCEPTION((AE_INFO, status, "Cannot find acpi parent")); |
161 | return_VALUE(-EINVAL); | 159 | return -EINVAL; |
162 | } | 160 | } |
163 | 161 | ||
164 | /* Get the parent device */ | 162 | /* Get the parent device */ |
165 | status = acpi_bus_get_device(phandle, &pdevice); | 163 | status = acpi_bus_get_device(phandle, &pdevice); |
166 | if (ACPI_FAILURE(status)) { | 164 | if (ACPI_FAILURE(status)) { |
167 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 165 | ACPI_EXCEPTION((AE_INFO, status, "Cannot get acpi bus device")); |
168 | "Error in acpi_bus_get_device\n")); | 166 | return -EINVAL; |
169 | return_VALUE(-EINVAL); | ||
170 | } | 167 | } |
171 | 168 | ||
172 | /* | 169 | /* |
@@ -175,30 +172,29 @@ acpi_memory_get_device(acpi_handle handle, | |||
175 | */ | 172 | */ |
176 | status = acpi_bus_add(&device, pdevice, handle, ACPI_BUS_TYPE_DEVICE); | 173 | status = acpi_bus_add(&device, pdevice, handle, ACPI_BUS_TYPE_DEVICE); |
177 | if (ACPI_FAILURE(status)) { | 174 | if (ACPI_FAILURE(status)) { |
178 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error in acpi_bus_add\n")); | 175 | ACPI_EXCEPTION((AE_INFO, status, "Cannot add acpi bus")); |
179 | return_VALUE(-EINVAL); | 176 | return -EINVAL; |
180 | } | 177 | } |
181 | 178 | ||
182 | end: | 179 | end: |
183 | *mem_device = acpi_driver_data(device); | 180 | *mem_device = acpi_driver_data(device); |
184 | if (!(*mem_device)) { | 181 | if (!(*mem_device)) { |
185 | printk(KERN_ERR "\n driver data not found"); | 182 | printk(KERN_ERR "\n driver data not found"); |
186 | return_VALUE(-ENODEV); | 183 | return -ENODEV; |
187 | } | 184 | } |
188 | 185 | ||
189 | return_VALUE(0); | 186 | return 0; |
190 | } | 187 | } |
191 | 188 | ||
192 | static int acpi_memory_check_device(struct acpi_memory_device *mem_device) | 189 | static int acpi_memory_check_device(struct acpi_memory_device *mem_device) |
193 | { | 190 | { |
194 | unsigned long current_status; | 191 | unsigned long current_status; |
195 | 192 | ||
196 | ACPI_FUNCTION_TRACE("acpi_memory_check_device"); | ||
197 | 193 | ||
198 | /* Get device present/absent information from the _STA */ | 194 | /* Get device present/absent information from the _STA */ |
199 | if (ACPI_FAILURE(acpi_evaluate_integer(mem_device->handle, "_STA", | 195 | if (ACPI_FAILURE(acpi_evaluate_integer(mem_device->handle, "_STA", |
200 | NULL, ¤t_status))) | 196 | NULL, ¤t_status))) |
201 | return_VALUE(-ENODEV); | 197 | return -ENODEV; |
202 | /* | 198 | /* |
203 | * Check for device status. Device should be | 199 | * Check for device status. Device should be |
204 | * present/enabled/functioning. | 200 | * present/enabled/functioning. |
@@ -206,9 +202,9 @@ static int acpi_memory_check_device(struct acpi_memory_device *mem_device) | |||
206 | if (!((current_status & ACPI_MEMORY_STA_PRESENT) | 202 | if (!((current_status & ACPI_MEMORY_STA_PRESENT) |
207 | && (current_status & ACPI_MEMORY_STA_ENABLED) | 203 | && (current_status & ACPI_MEMORY_STA_ENABLED) |
208 | && (current_status & ACPI_MEMORY_STA_FUNCTIONAL))) | 204 | && (current_status & ACPI_MEMORY_STA_FUNCTIONAL))) |
209 | return_VALUE(-ENODEV); | 205 | return -ENODEV; |
210 | 206 | ||
211 | return_VALUE(0); | 207 | return 0; |
212 | } | 208 | } |
213 | 209 | ||
214 | static int acpi_memory_enable_device(struct acpi_memory_device *mem_device) | 210 | static int acpi_memory_enable_device(struct acpi_memory_device *mem_device) |
@@ -217,13 +213,11 @@ static int acpi_memory_enable_device(struct acpi_memory_device *mem_device) | |||
217 | struct acpi_memory_info *info; | 213 | struct acpi_memory_info *info; |
218 | int node; | 214 | int node; |
219 | 215 | ||
220 | ACPI_FUNCTION_TRACE("acpi_memory_enable_device"); | ||
221 | 216 | ||
222 | /* Get the range from the _CRS */ | 217 | /* Get the range from the _CRS */ |
223 | result = acpi_memory_get_device_resources(mem_device); | 218 | result = acpi_memory_get_device_resources(mem_device); |
224 | if (result) { | 219 | if (result) { |
225 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 220 | printk(KERN_ERR PREFIX "get_device_resources failed\n"); |
226 | "\nget_device_resources failed\n")); | ||
227 | mem_device->state = MEMORY_INVALID_STATE; | 221 | mem_device->state = MEMORY_INVALID_STATE; |
228 | return result; | 222 | return result; |
229 | } | 223 | } |
@@ -254,7 +248,7 @@ static int acpi_memory_enable_device(struct acpi_memory_device *mem_device) | |||
254 | num_enabled++; | 248 | num_enabled++; |
255 | } | 249 | } |
256 | if (!num_enabled) { | 250 | if (!num_enabled) { |
257 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "\nadd_memory failed\n")); | 251 | printk(KERN_ERR PREFIX "add_memory failed\n"); |
258 | mem_device->state = MEMORY_INVALID_STATE; | 252 | mem_device->state = MEMORY_INVALID_STATE; |
259 | return -EINVAL; | 253 | return -EINVAL; |
260 | } | 254 | } |
@@ -269,7 +263,6 @@ static int acpi_memory_powerdown_device(struct acpi_memory_device *mem_device) | |||
269 | union acpi_object arg; | 263 | union acpi_object arg; |
270 | unsigned long current_status; | 264 | unsigned long current_status; |
271 | 265 | ||
272 | ACPI_FUNCTION_TRACE("acpi_memory_powerdown_device"); | ||
273 | 266 | ||
274 | /* Issue the _EJ0 command */ | 267 | /* Issue the _EJ0 command */ |
275 | arg_list.count = 1; | 268 | arg_list.count = 1; |
@@ -280,21 +273,21 @@ static int acpi_memory_powerdown_device(struct acpi_memory_device *mem_device) | |||
280 | "_EJ0", &arg_list, NULL); | 273 | "_EJ0", &arg_list, NULL); |
281 | /* Return on _EJ0 failure */ | 274 | /* Return on _EJ0 failure */ |
282 | if (ACPI_FAILURE(status)) { | 275 | if (ACPI_FAILURE(status)) { |
283 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "_EJ0 failed.\n")); | 276 | ACPI_EXCEPTION((AE_INFO, status, "_EJ0 failed")); |
284 | return_VALUE(-ENODEV); | 277 | return -ENODEV; |
285 | } | 278 | } |
286 | 279 | ||
287 | /* Evalute _STA to check if the device is disabled */ | 280 | /* Evalute _STA to check if the device is disabled */ |
288 | status = acpi_evaluate_integer(mem_device->handle, "_STA", | 281 | status = acpi_evaluate_integer(mem_device->handle, "_STA", |
289 | NULL, ¤t_status); | 282 | NULL, ¤t_status); |
290 | if (ACPI_FAILURE(status)) | 283 | if (ACPI_FAILURE(status)) |
291 | return_VALUE(-ENODEV); | 284 | return -ENODEV; |
292 | 285 | ||
293 | /* Check for device status. Device should be disabled */ | 286 | /* Check for device status. Device should be disabled */ |
294 | if (current_status & ACPI_MEMORY_STA_ENABLED) | 287 | if (current_status & ACPI_MEMORY_STA_ENABLED) |
295 | return_VALUE(-EINVAL); | 288 | return -EINVAL; |
296 | 289 | ||
297 | return_VALUE(0); | 290 | return 0; |
298 | } | 291 | } |
299 | 292 | ||
300 | static int acpi_memory_disable_device(struct acpi_memory_device *mem_device) | 293 | static int acpi_memory_disable_device(struct acpi_memory_device *mem_device) |
@@ -302,7 +295,6 @@ static int acpi_memory_disable_device(struct acpi_memory_device *mem_device) | |||
302 | int result; | 295 | int result; |
303 | struct acpi_memory_info *info, *n; | 296 | struct acpi_memory_info *info, *n; |
304 | 297 | ||
305 | ACPI_FUNCTION_TRACE("acpi_memory_disable_device"); | ||
306 | 298 | ||
307 | /* | 299 | /* |
308 | * Ask the VM to offline this memory range. | 300 | * Ask the VM to offline this memory range. |
@@ -320,8 +312,6 @@ static int acpi_memory_disable_device(struct acpi_memory_device *mem_device) | |||
320 | /* Power-off and eject the device */ | 312 | /* Power-off and eject the device */ |
321 | result = acpi_memory_powerdown_device(mem_device); | 313 | result = acpi_memory_powerdown_device(mem_device); |
322 | if (result) { | 314 | if (result) { |
323 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | ||
324 | "Device Power Down failed.\n")); | ||
325 | /* Set the status of the device to invalid */ | 315 | /* Set the status of the device to invalid */ |
326 | mem_device->state = MEMORY_INVALID_STATE; | 316 | mem_device->state = MEMORY_INVALID_STATE; |
327 | return result; | 317 | return result; |
@@ -336,7 +326,6 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data) | |||
336 | struct acpi_memory_device *mem_device; | 326 | struct acpi_memory_device *mem_device; |
337 | struct acpi_device *device; | 327 | struct acpi_device *device; |
338 | 328 | ||
339 | ACPI_FUNCTION_TRACE("acpi_memory_device_notify"); | ||
340 | 329 | ||
341 | switch (event) { | 330 | switch (event) { |
342 | case ACPI_NOTIFY_BUS_CHECK: | 331 | case ACPI_NOTIFY_BUS_CHECK: |
@@ -348,15 +337,14 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data) | |||
348 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 337 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
349 | "\nReceived DEVICE CHECK notification for device\n")); | 338 | "\nReceived DEVICE CHECK notification for device\n")); |
350 | if (acpi_memory_get_device(handle, &mem_device)) { | 339 | if (acpi_memory_get_device(handle, &mem_device)) { |
351 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 340 | printk(KERN_ERR PREFIX "Cannot find driver data\n"); |
352 | "Error in finding driver data\n")); | 341 | return; |
353 | return_VOID; | ||
354 | } | 342 | } |
355 | 343 | ||
356 | if (!acpi_memory_check_device(mem_device)) { | 344 | if (!acpi_memory_check_device(mem_device)) { |
357 | if (acpi_memory_enable_device(mem_device)) | 345 | if (acpi_memory_enable_device(mem_device)) |
358 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 346 | printk(KERN_ERR PREFIX |
359 | "Error in acpi_memory_enable_device\n")); | 347 | "Cannot enable memory device\n"); |
360 | } | 348 | } |
361 | break; | 349 | break; |
362 | case ACPI_NOTIFY_EJECT_REQUEST: | 350 | case ACPI_NOTIFY_EJECT_REQUEST: |
@@ -364,14 +352,12 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data) | |||
364 | "\nReceived EJECT REQUEST notification for device\n")); | 352 | "\nReceived EJECT REQUEST notification for device\n")); |
365 | 353 | ||
366 | if (acpi_bus_get_device(handle, &device)) { | 354 | if (acpi_bus_get_device(handle, &device)) { |
367 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 355 | printk(KERN_ERR PREFIX "Device doesn't exist\n"); |
368 | "Device doesn't exist\n")); | ||
369 | break; | 356 | break; |
370 | } | 357 | } |
371 | mem_device = acpi_driver_data(device); | 358 | mem_device = acpi_driver_data(device); |
372 | if (!mem_device) { | 359 | if (!mem_device) { |
373 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 360 | printk(KERN_ERR PREFIX "Driver Data is NULL\n"); |
374 | "Driver Data is NULL\n")); | ||
375 | break; | 361 | break; |
376 | } | 362 | } |
377 | 363 | ||
@@ -382,8 +368,8 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data) | |||
382 | * with generic sysfs driver | 368 | * with generic sysfs driver |
383 | */ | 369 | */ |
384 | if (acpi_memory_disable_device(mem_device)) | 370 | if (acpi_memory_disable_device(mem_device)) |
385 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 371 | printk(KERN_ERR PREFIX |
386 | "Error in acpi_memory_disable_device\n")); | 372 | "Disable memory device\n"); |
387 | /* | 373 | /* |
388 | * TBD: Invoke acpi_bus_remove to cleanup data structures | 374 | * TBD: Invoke acpi_bus_remove to cleanup data structures |
389 | */ | 375 | */ |
@@ -394,7 +380,7 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data) | |||
394 | break; | 380 | break; |
395 | } | 381 | } |
396 | 382 | ||
397 | return_VOID; | 383 | return; |
398 | } | 384 | } |
399 | 385 | ||
400 | static int acpi_memory_device_add(struct acpi_device *device) | 386 | static int acpi_memory_device_add(struct acpi_device *device) |
@@ -402,14 +388,13 @@ static int acpi_memory_device_add(struct acpi_device *device) | |||
402 | int result; | 388 | int result; |
403 | struct acpi_memory_device *mem_device = NULL; | 389 | struct acpi_memory_device *mem_device = NULL; |
404 | 390 | ||
405 | ACPI_FUNCTION_TRACE("acpi_memory_device_add"); | ||
406 | 391 | ||
407 | if (!device) | 392 | if (!device) |
408 | return_VALUE(-EINVAL); | 393 | return -EINVAL; |
409 | 394 | ||
410 | mem_device = kmalloc(sizeof(struct acpi_memory_device), GFP_KERNEL); | 395 | mem_device = kmalloc(sizeof(struct acpi_memory_device), GFP_KERNEL); |
411 | if (!mem_device) | 396 | if (!mem_device) |
412 | return_VALUE(-ENOMEM); | 397 | return -ENOMEM; |
413 | memset(mem_device, 0, sizeof(struct acpi_memory_device)); | 398 | memset(mem_device, 0, sizeof(struct acpi_memory_device)); |
414 | 399 | ||
415 | INIT_LIST_HEAD(&mem_device->res_list); | 400 | INIT_LIST_HEAD(&mem_device->res_list); |
@@ -422,7 +407,7 @@ static int acpi_memory_device_add(struct acpi_device *device) | |||
422 | result = acpi_memory_get_device_resources(mem_device); | 407 | result = acpi_memory_get_device_resources(mem_device); |
423 | if (result) { | 408 | if (result) { |
424 | kfree(mem_device); | 409 | kfree(mem_device); |
425 | return_VALUE(result); | 410 | return result; |
426 | } | 411 | } |
427 | 412 | ||
428 | /* Set the device state */ | 413 | /* Set the device state */ |
@@ -430,22 +415,21 @@ static int acpi_memory_device_add(struct acpi_device *device) | |||
430 | 415 | ||
431 | printk(KERN_INFO "%s \n", acpi_device_name(device)); | 416 | printk(KERN_INFO "%s \n", acpi_device_name(device)); |
432 | 417 | ||
433 | return_VALUE(result); | 418 | return result; |
434 | } | 419 | } |
435 | 420 | ||
436 | static int acpi_memory_device_remove(struct acpi_device *device, int type) | 421 | static int acpi_memory_device_remove(struct acpi_device *device, int type) |
437 | { | 422 | { |
438 | struct acpi_memory_device *mem_device = NULL; | 423 | struct acpi_memory_device *mem_device = NULL; |
439 | 424 | ||
440 | ACPI_FUNCTION_TRACE("acpi_memory_device_remove"); | ||
441 | 425 | ||
442 | if (!device || !acpi_driver_data(device)) | 426 | if (!device || !acpi_driver_data(device)) |
443 | return_VALUE(-EINVAL); | 427 | return -EINVAL; |
444 | 428 | ||
445 | mem_device = (struct acpi_memory_device *)acpi_driver_data(device); | 429 | mem_device = (struct acpi_memory_device *)acpi_driver_data(device); |
446 | kfree(mem_device); | 430 | kfree(mem_device); |
447 | 431 | ||
448 | return_VALUE(0); | 432 | return 0; |
449 | } | 433 | } |
450 | 434 | ||
451 | static int acpi_memory_device_start (struct acpi_device *device) | 435 | static int acpi_memory_device_start (struct acpi_device *device) |
@@ -453,8 +437,6 @@ static int acpi_memory_device_start (struct acpi_device *device) | |||
453 | struct acpi_memory_device *mem_device; | 437 | struct acpi_memory_device *mem_device; |
454 | int result = 0; | 438 | int result = 0; |
455 | 439 | ||
456 | ACPI_FUNCTION_TRACE("acpi_memory_device_start"); | ||
457 | |||
458 | mem_device = acpi_driver_data(device); | 440 | mem_device = acpi_driver_data(device); |
459 | 441 | ||
460 | if (!acpi_memory_check_device(mem_device)) { | 442 | if (!acpi_memory_check_device(mem_device)) { |
@@ -464,7 +446,7 @@ static int acpi_memory_device_start (struct acpi_device *device) | |||
464 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 446 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
465 | "Error in acpi_memory_enable_device\n")); | 447 | "Error in acpi_memory_enable_device\n")); |
466 | } | 448 | } |
467 | return_VALUE(result); | 449 | return result; |
468 | } | 450 | } |
469 | 451 | ||
470 | /* | 452 | /* |
@@ -477,16 +459,15 @@ static acpi_status is_memory_device(acpi_handle handle) | |||
477 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | 459 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; |
478 | struct acpi_device_info *info; | 460 | struct acpi_device_info *info; |
479 | 461 | ||
480 | ACPI_FUNCTION_TRACE("is_memory_device"); | ||
481 | 462 | ||
482 | status = acpi_get_object_info(handle, &buffer); | 463 | status = acpi_get_object_info(handle, &buffer); |
483 | if (ACPI_FAILURE(status)) | 464 | if (ACPI_FAILURE(status)) |
484 | return_ACPI_STATUS(AE_ERROR); | 465 | return status; |
485 | 466 | ||
486 | info = buffer.pointer; | 467 | info = buffer.pointer; |
487 | if (!(info->valid & ACPI_VALID_HID)) { | 468 | if (!(info->valid & ACPI_VALID_HID)) { |
488 | acpi_os_free(buffer.pointer); | 469 | acpi_os_free(buffer.pointer); |
489 | return_ACPI_STATUS(AE_ERROR); | 470 | return AE_ERROR; |
490 | } | 471 | } |
491 | 472 | ||
492 | hardware_id = info->hardware_id.value; | 473 | hardware_id = info->hardware_id.value; |
@@ -495,7 +476,7 @@ static acpi_status is_memory_device(acpi_handle handle) | |||
495 | status = AE_ERROR; | 476 | status = AE_ERROR; |
496 | 477 | ||
497 | acpi_os_free(buffer.pointer); | 478 | acpi_os_free(buffer.pointer); |
498 | return_ACPI_STATUS(status); | 479 | return status; |
499 | } | 480 | } |
500 | 481 | ||
501 | static acpi_status | 482 | static acpi_status |
@@ -504,21 +485,17 @@ acpi_memory_register_notify_handler(acpi_handle handle, | |||
504 | { | 485 | { |
505 | acpi_status status; | 486 | acpi_status status; |
506 | 487 | ||
507 | ACPI_FUNCTION_TRACE("acpi_memory_register_notify_handler"); | ||
508 | 488 | ||
509 | status = is_memory_device(handle); | 489 | status = is_memory_device(handle); |
510 | if (ACPI_FAILURE(status)) | 490 | if (ACPI_FAILURE(status)){ |
511 | return_ACPI_STATUS(AE_OK); /* continue */ | 491 | ACPI_EXCEPTION((AE_INFO, status, "handle is no memory device")); |
492 | return AE_OK; /* continue */ | ||
493 | } | ||
512 | 494 | ||
513 | status = acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY, | 495 | status = acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY, |
514 | acpi_memory_device_notify, NULL); | 496 | acpi_memory_device_notify, NULL); |
515 | if (ACPI_FAILURE(status)) { | 497 | /* continue */ |
516 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 498 | return AE_OK; |
517 | "Error installing notify handler\n")); | ||
518 | return_ACPI_STATUS(AE_OK); /* continue */ | ||
519 | } | ||
520 | |||
521 | return_ACPI_STATUS(status); | ||
522 | } | 499 | } |
523 | 500 | ||
524 | static acpi_status | 501 | static acpi_status |
@@ -527,22 +504,18 @@ acpi_memory_deregister_notify_handler(acpi_handle handle, | |||
527 | { | 504 | { |
528 | acpi_status status; | 505 | acpi_status status; |
529 | 506 | ||
530 | ACPI_FUNCTION_TRACE("acpi_memory_deregister_notify_handler"); | ||
531 | 507 | ||
532 | status = is_memory_device(handle); | 508 | status = is_memory_device(handle); |
533 | if (ACPI_FAILURE(status)) | 509 | if (ACPI_FAILURE(status)){ |
534 | return_ACPI_STATUS(AE_OK); /* continue */ | 510 | ACPI_EXCEPTION((AE_INFO, status, "handle is no memory device")); |
511 | return AE_OK; /* continue */ | ||
512 | } | ||
535 | 513 | ||
536 | status = acpi_remove_notify_handler(handle, | 514 | status = acpi_remove_notify_handler(handle, |
537 | ACPI_SYSTEM_NOTIFY, | 515 | ACPI_SYSTEM_NOTIFY, |
538 | acpi_memory_device_notify); | 516 | acpi_memory_device_notify); |
539 | if (ACPI_FAILURE(status)) { | ||
540 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | ||
541 | "Error removing notify handler\n")); | ||
542 | return_ACPI_STATUS(AE_OK); /* continue */ | ||
543 | } | ||
544 | 517 | ||
545 | return_ACPI_STATUS(status); | 518 | return AE_OK; /* continue */ |
546 | } | 519 | } |
547 | 520 | ||
548 | static int __init acpi_memory_device_init(void) | 521 | static int __init acpi_memory_device_init(void) |
@@ -550,12 +523,11 @@ static int __init acpi_memory_device_init(void) | |||
550 | int result; | 523 | int result; |
551 | acpi_status status; | 524 | acpi_status status; |
552 | 525 | ||
553 | ACPI_FUNCTION_TRACE("acpi_memory_device_init"); | ||
554 | 526 | ||
555 | result = acpi_bus_register_driver(&acpi_memory_device_driver); | 527 | result = acpi_bus_register_driver(&acpi_memory_device_driver); |
556 | 528 | ||
557 | if (result < 0) | 529 | if (result < 0) |
558 | return_VALUE(-ENODEV); | 530 | return -ENODEV; |
559 | 531 | ||
560 | status = acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, | 532 | status = acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, |
561 | ACPI_UINT32_MAX, | 533 | ACPI_UINT32_MAX, |
@@ -563,19 +535,18 @@ static int __init acpi_memory_device_init(void) | |||
563 | NULL, NULL); | 535 | NULL, NULL); |
564 | 536 | ||
565 | if (ACPI_FAILURE(status)) { | 537 | if (ACPI_FAILURE(status)) { |
566 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "walk_namespace failed\n")); | 538 | ACPI_EXCEPTION((AE_INFO, status, "walk_namespace failed")); |
567 | acpi_bus_unregister_driver(&acpi_memory_device_driver); | 539 | acpi_bus_unregister_driver(&acpi_memory_device_driver); |
568 | return_VALUE(-ENODEV); | 540 | return -ENODEV; |
569 | } | 541 | } |
570 | 542 | ||
571 | return_VALUE(0); | 543 | return 0; |
572 | } | 544 | } |
573 | 545 | ||
574 | static void __exit acpi_memory_device_exit(void) | 546 | static void __exit acpi_memory_device_exit(void) |
575 | { | 547 | { |
576 | acpi_status status; | 548 | acpi_status status; |
577 | 549 | ||
578 | ACPI_FUNCTION_TRACE("acpi_memory_device_exit"); | ||
579 | 550 | ||
580 | /* | 551 | /* |
581 | * Adding this to un-install notification handlers for all the device | 552 | * Adding this to un-install notification handlers for all the device |
@@ -587,11 +558,11 @@ static void __exit acpi_memory_device_exit(void) | |||
587 | NULL, NULL); | 558 | NULL, NULL); |
588 | 559 | ||
589 | if (ACPI_FAILURE(status)) | 560 | if (ACPI_FAILURE(status)) |
590 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "walk_namespace failed\n")); | 561 | ACPI_EXCEPTION((AE_INFO, status, "walk_namespace failed")); |
591 | 562 | ||
592 | acpi_bus_unregister_driver(&acpi_memory_device_driver); | 563 | acpi_bus_unregister_driver(&acpi_memory_device_driver); |
593 | 564 | ||
594 | return_VOID; | 565 | return; |
595 | } | 566 | } |
596 | 567 | ||
597 | module_init(acpi_memory_device_init); | 568 | module_init(acpi_memory_device_init); |