--- linux-2.6.15-rc1-orig/drivers/acpi/acpi_memhotplug.c 2005-11-14 10:56:13.000000000 -0800 +++ linux-2.6.15-rc1/drivers/acpi/acpi_memhotplug.c 2005-11-14 21:01:43.000000000 -0800 @@ -110,6 +110,30 @@ return_VALUE(0); } +static int +acpi_memory_get_current_resource(acpi_handle handle, struct acpi_memory_device **return_device) { + + int result; + struct acpi_memory_device *mem_device; + + mem_device = kmalloc(sizeof(struct acpi_memory_device), GFP_KERNEL); + if (!mem_device) + return_VALUE(-ENOMEM); + memset(mem_device,0, sizeof(struct acpi_memory_device)); + + mem_device->handle = handle; + result = acpi_memory_get_device_resources(mem_device); + if (result) { + kfree(mem_device); + return_VALUE(result); + } + mem_device->state = MEMORY_POWER_ON_STATE; + *return_device = mem_device; + + return_VALUE(result); +} + + static int acpi_memory_get_device(acpi_handle handle, struct acpi_memory_device **mem_device) @@ -118,6 +142,7 @@ acpi_handle phandle; struct acpi_device *device = NULL; struct acpi_device *pdevice = NULL; + int result; ACPI_FUNCTION_TRACE("acpi_memory_get_device"); @@ -147,14 +172,17 @@ ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error in acpi_bus_add\n")); return_VALUE(-EINVAL); } - end: *mem_device = acpi_driver_data(device); + if (!(*mem_device)) { - printk(KERN_ERR "\n driver data not found"); - return_VALUE(-ENODEV); + /* Try and get the memory_device from the current handle */ + result = acpi_memory_get_current_resource(handle,mem_device); + if (result) { + printk(KERN_ERR "\nThere is no data for this memory device\n"); + return_VALUE(-EINVAL); + } } - return_VALUE(0); }