diff options
| author | Len Brown <len.brown@intel.com> | 2009-08-02 12:27:26 -0400 |
|---|---|---|
| committer | Len Brown <len.brown@intel.com> | 2009-08-02 12:27:26 -0400 |
| commit | a571a79a7e6b614f26d6bcc25b2ad48fd63fb829 (patch) | |
| tree | 3563df11bc1b5d2b6061448efb3a30ac10d93bf3 | |
| parent | 6a61487791a8b8f85542c51132e8c7ed9bc7fd0b (diff) | |
| parent | 5d2619fca753d270e63e76c9e18437b0d9bc8d75 (diff) | |
Merge branch 'memhotplug-crash' into release
| -rw-r--r-- | drivers/acpi/acpi_memhotplug.c | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c index 7a0f4aa4fa1e..9a62224cc278 100644 --- a/drivers/acpi/acpi_memhotplug.c +++ b/drivers/acpi/acpi_memhotplug.c | |||
| @@ -38,6 +38,9 @@ | |||
| 38 | 38 | ||
| 39 | #define _COMPONENT ACPI_MEMORY_DEVICE_COMPONENT | 39 | #define _COMPONENT ACPI_MEMORY_DEVICE_COMPONENT |
| 40 | 40 | ||
| 41 | #undef PREFIX | ||
| 42 | #define PREFIX "ACPI:memory_hp:" | ||
| 43 | |||
| 41 | ACPI_MODULE_NAME("acpi_memhotplug"); | 44 | ACPI_MODULE_NAME("acpi_memhotplug"); |
| 42 | MODULE_AUTHOR("Naveen B S <naveen.b.s@intel.com>"); | 45 | MODULE_AUTHOR("Naveen B S <naveen.b.s@intel.com>"); |
| 43 | MODULE_DESCRIPTION("Hotplug Mem Driver"); | 46 | MODULE_DESCRIPTION("Hotplug Mem Driver"); |
| @@ -153,6 +156,7 @@ acpi_memory_get_device(acpi_handle handle, | |||
| 153 | acpi_handle phandle; | 156 | acpi_handle phandle; |
| 154 | struct acpi_device *device = NULL; | 157 | struct acpi_device *device = NULL; |
| 155 | struct acpi_device *pdevice = NULL; | 158 | struct acpi_device *pdevice = NULL; |
| 159 | int result; | ||
| 156 | 160 | ||
| 157 | 161 | ||
| 158 | if (!acpi_bus_get_device(handle, &device) && device) | 162 | if (!acpi_bus_get_device(handle, &device) && device) |
| @@ -165,9 +169,9 @@ acpi_memory_get_device(acpi_handle handle, | |||
| 165 | } | 169 | } |
| 166 | 170 | ||
| 167 | /* Get the parent device */ | 171 | /* Get the parent device */ |
| 168 | status = acpi_bus_get_device(phandle, &pdevice); | 172 | result = acpi_bus_get_device(phandle, &pdevice); |
| 169 | if (ACPI_FAILURE(status)) { | 173 | if (result) { |
| 170 | ACPI_EXCEPTION((AE_INFO, status, "Cannot get acpi bus device")); | 174 | printk(KERN_WARNING PREFIX "Cannot get acpi bus device"); |
| 171 | return -EINVAL; | 175 | return -EINVAL; |
| 172 | } | 176 | } |
| 173 | 177 | ||
| @@ -175,9 +179,9 @@ acpi_memory_get_device(acpi_handle handle, | |||
| 175 | * Now add the notified device. This creates the acpi_device | 179 | * Now add the notified device. This creates the acpi_device |
| 176 | * and invokes .add function | 180 | * and invokes .add function |
| 177 | */ | 181 | */ |
| 178 | status = acpi_bus_add(&device, pdevice, handle, ACPI_BUS_TYPE_DEVICE); | 182 | result = acpi_bus_add(&device, pdevice, handle, ACPI_BUS_TYPE_DEVICE); |
| 179 | if (ACPI_FAILURE(status)) { | 183 | if (result) { |
| 180 | ACPI_EXCEPTION((AE_INFO, status, "Cannot add acpi bus")); | 184 | printk(KERN_WARNING PREFIX "Cannot add acpi bus"); |
| 181 | return -EINVAL; | 185 | return -EINVAL; |
| 182 | } | 186 | } |
| 183 | 187 | ||
| @@ -238,7 +242,12 @@ static int acpi_memory_enable_device(struct acpi_memory_device *mem_device) | |||
| 238 | num_enabled++; | 242 | num_enabled++; |
| 239 | continue; | 243 | continue; |
| 240 | } | 244 | } |
| 241 | 245 | /* | |
| 246 | * If the memory block size is zero, please ignore it. | ||
| 247 | * Don't try to do the following memory hotplug flowchart. | ||
| 248 | */ | ||
| 249 | if (!info->length) | ||
| 250 | continue; | ||
| 242 | if (node < 0) | 251 | if (node < 0) |
| 243 | node = memory_add_physaddr_to_nid(info->start_addr); | 252 | node = memory_add_physaddr_to_nid(info->start_addr); |
| 244 | 253 | ||
| @@ -253,8 +262,15 @@ static int acpi_memory_enable_device(struct acpi_memory_device *mem_device) | |||
| 253 | mem_device->state = MEMORY_INVALID_STATE; | 262 | mem_device->state = MEMORY_INVALID_STATE; |
| 254 | return -EINVAL; | 263 | return -EINVAL; |
| 255 | } | 264 | } |
| 256 | 265 | /* | |
| 257 | return result; | 266 | * Sometimes the memory device will contain several memory blocks. |
| 267 | * When one memory block is hot-added to the system memory, it will | ||
| 268 | * be regarded as a success. | ||
| 269 | * Otherwise if the last memory block can't be hot-added to the system | ||
| 270 | * memory, it will be failure and the memory device can't be bound with | ||
| 271 | * driver. | ||
| 272 | */ | ||
| 273 | return 0; | ||
| 258 | } | 274 | } |
| 259 | 275 | ||
| 260 | static int acpi_memory_powerdown_device(struct acpi_memory_device *mem_device) | 276 | static int acpi_memory_powerdown_device(struct acpi_memory_device *mem_device) |
