aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/acpi_memhotplug.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/acpi_memhotplug.c')
-rw-r--r--drivers/acpi/acpi_memhotplug.c51
1 files changed, 18 insertions, 33 deletions
diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c
index 9a62224cc278..28ccdbc05ac8 100644
--- a/drivers/acpi/acpi_memhotplug.c
+++ b/drivers/acpi/acpi_memhotplug.c
@@ -53,7 +53,6 @@ MODULE_LICENSE("GPL");
53 53
54static int acpi_memory_device_add(struct acpi_device *device); 54static int acpi_memory_device_add(struct acpi_device *device);
55static int acpi_memory_device_remove(struct acpi_device *device, int type); 55static int acpi_memory_device_remove(struct acpi_device *device, int type);
56static int acpi_memory_device_start(struct acpi_device *device);
57 56
58static const struct acpi_device_id memory_device_ids[] = { 57static const struct acpi_device_id memory_device_ids[] = {
59 {ACPI_MEMORY_DEVICE_HID, 0}, 58 {ACPI_MEMORY_DEVICE_HID, 0},
@@ -68,7 +67,6 @@ static struct acpi_driver acpi_memory_device_driver = {
68 .ops = { 67 .ops = {
69 .add = acpi_memory_device_add, 68 .add = acpi_memory_device_add,
70 .remove = acpi_memory_device_remove, 69 .remove = acpi_memory_device_remove,
71 .start = acpi_memory_device_start,
72 }, 70 },
73}; 71};
74 72
@@ -431,28 +429,6 @@ static int acpi_memory_device_add(struct acpi_device *device)
431 429
432 printk(KERN_DEBUG "%s \n", acpi_device_name(device)); 430 printk(KERN_DEBUG "%s \n", acpi_device_name(device));
433 431
434 return result;
435}
436
437static int acpi_memory_device_remove(struct acpi_device *device, int type)
438{
439 struct acpi_memory_device *mem_device = NULL;
440
441
442 if (!device || !acpi_driver_data(device))
443 return -EINVAL;
444
445 mem_device = acpi_driver_data(device);
446 kfree(mem_device);
447
448 return 0;
449}
450
451static int acpi_memory_device_start (struct acpi_device *device)
452{
453 struct acpi_memory_device *mem_device;
454 int result = 0;
455
456 /* 432 /*
457 * Early boot code has recognized memory area by EFI/E820. 433 * Early boot code has recognized memory area by EFI/E820.
458 * If DSDT shows these memory devices on boot, hotplug is not necessary 434 * If DSDT shows these memory devices on boot, hotplug is not necessary
@@ -462,8 +438,6 @@ static int acpi_memory_device_start (struct acpi_device *device)
462 if (!acpi_hotmem_initialized) 438 if (!acpi_hotmem_initialized)
463 return 0; 439 return 0;
464 440
465 mem_device = acpi_driver_data(device);
466
467 if (!acpi_memory_check_device(mem_device)) { 441 if (!acpi_memory_check_device(mem_device)) {
468 /* call add_memory func */ 442 /* call add_memory func */
469 result = acpi_memory_enable_device(mem_device); 443 result = acpi_memory_enable_device(mem_device);
@@ -474,6 +448,20 @@ static int acpi_memory_device_start (struct acpi_device *device)
474 return result; 448 return result;
475} 449}
476 450
451static int acpi_memory_device_remove(struct acpi_device *device, int type)
452{
453 struct acpi_memory_device *mem_device = NULL;
454
455
456 if (!device || !acpi_driver_data(device))
457 return -EINVAL;
458
459 mem_device = acpi_driver_data(device);
460 kfree(mem_device);
461
462 return 0;
463}
464
477/* 465/*
478 * Helper function to check for memory device 466 * Helper function to check for memory device
479 */ 467 */
@@ -481,26 +469,23 @@ static acpi_status is_memory_device(acpi_handle handle)
481{ 469{
482 char *hardware_id; 470 char *hardware_id;
483 acpi_status status; 471 acpi_status status;
484 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
485 struct acpi_device_info *info; 472 struct acpi_device_info *info;
486 473
487 474 status = acpi_get_object_info(handle, &info);
488 status = acpi_get_object_info(handle, &buffer);
489 if (ACPI_FAILURE(status)) 475 if (ACPI_FAILURE(status))
490 return status; 476 return status;
491 477
492 info = buffer.pointer;
493 if (!(info->valid & ACPI_VALID_HID)) { 478 if (!(info->valid & ACPI_VALID_HID)) {
494 kfree(buffer.pointer); 479 kfree(info);
495 return AE_ERROR; 480 return AE_ERROR;
496 } 481 }
497 482
498 hardware_id = info->hardware_id.value; 483 hardware_id = info->hardware_id.string;
499 if ((hardware_id == NULL) || 484 if ((hardware_id == NULL) ||
500 (strcmp(hardware_id, ACPI_MEMORY_DEVICE_HID))) 485 (strcmp(hardware_id, ACPI_MEMORY_DEVICE_HID)))
501 status = AE_ERROR; 486 status = AE_ERROR;
502 487
503 kfree(buffer.pointer); 488 kfree(info);
504 return status; 489 return status;
505} 490}
506 491