Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 336682
b: refs/heads/master
c: 19387b2
h: refs/heads/master
v: v3
  • Loading branch information
Yasuaki Ishimatsu authored and Rafael J. Wysocki committed Nov 16, 2012
1 parent 13402c0 commit 5ee56b0
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 54c4c7db6cb94d7d1217df6d7fca6847c61744ab
refs/heads/master: 19387b27e42d5e20a8188cfa15dc902114d98c43
31 changes: 24 additions & 7 deletions trunk/drivers/acpi/acpi_memhotplug.c
Original file line number Diff line number Diff line change
Expand Up @@ -306,25 +306,37 @@ static int acpi_memory_powerdown_device(struct acpi_memory_device *mem_device)
return 0;
}

static int acpi_memory_disable_device(struct acpi_memory_device *mem_device)
static int acpi_memory_remove_memory(struct acpi_memory_device *mem_device)
{
int result;
struct acpi_memory_info *info, *n;


/*
* Ask the VM to offline this memory range.
* Note: Assume that this function returns zero on success
*/
list_for_each_entry_safe(info, n, &mem_device->res_list, list) {
if (info->enabled) {
result = remove_memory(info->start_addr, info->length);
if (result)
return result;
}

list_del(&info->list);
kfree(info);
}

return 0;
}

static int acpi_memory_disable_device(struct acpi_memory_device *mem_device)
{
int result;

/*
* Ask the VM to offline this memory range.
* Note: Assume that this function returns zero on success
*/
result = acpi_memory_remove_memory(mem_device);
if (result)
return result;

/* Power-off and eject the device */
result = acpi_memory_powerdown_device(mem_device);
if (result) {
Expand Down Expand Up @@ -474,12 +486,17 @@ static int acpi_memory_device_add(struct acpi_device *device)
static int acpi_memory_device_remove(struct acpi_device *device, int type)
{
struct acpi_memory_device *mem_device = NULL;

int result;

if (!device || !acpi_driver_data(device))
return -EINVAL;

mem_device = acpi_driver_data(device);

result = acpi_memory_remove_memory(mem_device);
if (result)
return result;

kfree(mem_device);

return 0;
Expand Down

0 comments on commit 5ee56b0

Please sign in to comment.