Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 336695
b: refs/heads/master
c: ab6c570
h: refs/heads/master
i:
  336693: b0f2507
  336691: 071d725
  336687: 515484d
v: v3
  • Loading branch information
Toshi Kani authored and Rafael J. Wysocki committed Nov 21, 2012
1 parent 3dd4a40 commit 1f87805
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 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: 47db4547ffe5aa2eb5b053e6c02f0561fbbfa221
refs/heads/master: ab6c57099db14d64c383e4d0392eab05d013630f
24 changes: 13 additions & 11 deletions trunk/drivers/acpi/acpi_memhotplug.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include <linux/types.h>
#include <linux/memory_hotplug.h>
#include <linux/slab.h>
#include <linux/acpi.h>
#include <acpi/acpi_drivers.h>

#define ACPI_MEMORY_DEVICE_CLASS "memory"
Expand Down Expand Up @@ -175,7 +176,7 @@ acpi_memory_get_device(acpi_handle handle,
/* Get the parent device */
result = acpi_bus_get_device(phandle, &pdevice);
if (result) {
printk(KERN_WARNING PREFIX "Cannot get acpi bus device");
acpi_handle_warn(phandle, "Cannot get acpi bus device\n");
return -EINVAL;
}

Expand All @@ -185,14 +186,14 @@ acpi_memory_get_device(acpi_handle handle,
*/
result = acpi_bus_add(&device, pdevice, handle, ACPI_BUS_TYPE_DEVICE);
if (result) {
printk(KERN_WARNING PREFIX "Cannot add acpi bus");
acpi_handle_warn(handle, "Cannot add acpi bus\n");
return -EINVAL;
}

end:
*mem_device = acpi_driver_data(device);
if (!(*mem_device)) {
printk(KERN_ERR "\n driver data not found");
dev_err(&device->dev, "driver data not found\n");
return -ENODEV;
}

Expand Down Expand Up @@ -229,7 +230,8 @@ static int acpi_memory_enable_device(struct acpi_memory_device *mem_device)
/* Get the range from the _CRS */
result = acpi_memory_get_device_resources(mem_device);
if (result) {
printk(KERN_ERR PREFIX "get_device_resources failed\n");
dev_err(&mem_device->device->dev,
"get_device_resources failed\n");
mem_device->state = MEMORY_INVALID_STATE;
return result;
}
Expand Down Expand Up @@ -276,7 +278,7 @@ static int acpi_memory_enable_device(struct acpi_memory_device *mem_device)
num_enabled++;
}
if (!num_enabled) {
printk(KERN_ERR PREFIX "add_memory failed\n");
dev_err(&mem_device->device->dev, "add_memory failed\n");
mem_device->state = MEMORY_INVALID_STATE;
return -EINVAL;
}
Expand Down Expand Up @@ -336,15 +338,15 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data)
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
"\nReceived DEVICE CHECK notification for device\n"));
if (acpi_memory_get_device(handle, &mem_device)) {
printk(KERN_ERR PREFIX "Cannot find driver data\n");
acpi_handle_err(handle, "Cannot find driver data\n");
break;
}

if (acpi_memory_check_device(mem_device))
break;

if (acpi_memory_enable_device(mem_device)) {
printk(KERN_ERR PREFIX "Cannot enable memory device\n");
acpi_handle_err(handle,"Cannot enable memory device\n");
break;
}

Expand All @@ -356,12 +358,12 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data)
"\nReceived EJECT REQUEST notification for device\n"));

if (acpi_bus_get_device(handle, &device)) {
printk(KERN_ERR PREFIX "Device doesn't exist\n");
acpi_handle_err(handle, "Device doesn't exist\n");
break;
}
mem_device = acpi_driver_data(device);
if (!mem_device) {
printk(KERN_ERR PREFIX "Driver Data is NULL\n");
acpi_handle_err(handle, "Driver Data is NULL\n");
break;
}

Expand Down Expand Up @@ -429,13 +431,13 @@ static int acpi_memory_device_add(struct acpi_device *device)
/* Set the device state */
mem_device->state = MEMORY_POWER_ON_STATE;

printk(KERN_DEBUG "%s \n", acpi_device_name(device));
pr_debug("%s\n", acpi_device_name(device));

if (!acpi_memory_check_device(mem_device)) {
/* call add_memory func */
result = acpi_memory_enable_device(mem_device);
if (result) {
printk(KERN_ERR PREFIX
dev_err(&device->dev,
"Error in acpi_memory_enable_device\n");
acpi_memory_device_free(mem_device);
}
Expand Down

0 comments on commit 1f87805

Please sign in to comment.