[S390] sclp: undo quiesce handler override on resume
[safe/jmp/linux-2.6] / drivers / acpi / acpi_memhotplug.c
index 37cbe72..28ccdbc 100644 (file)
@@ -53,7 +53,6 @@ MODULE_LICENSE("GPL");
 
 static int acpi_memory_device_add(struct acpi_device *device);
 static int acpi_memory_device_remove(struct acpi_device *device, int type);
-static int acpi_memory_device_start(struct acpi_device *device);
 
 static const struct acpi_device_id memory_device_ids[] = {
        {ACPI_MEMORY_DEVICE_HID, 0},
@@ -68,7 +67,6 @@ static struct acpi_driver acpi_memory_device_driver = {
        .ops = {
                .add = acpi_memory_device_add,
                .remove = acpi_memory_device_remove,
-               .start = acpi_memory_device_start,
                },
 };
 
@@ -242,7 +240,12 @@ static int acpi_memory_enable_device(struct acpi_memory_device *mem_device)
                        num_enabled++;
                        continue;
                }
-
+               /*
+                * If the memory block size is zero, please ignore it.
+                * Don't try to do the following memory hotplug flowchart.
+                */
+               if (!info->length)
+                       continue;
                if (node < 0)
                        node = memory_add_physaddr_to_nid(info->start_addr);
 
@@ -257,8 +260,15 @@ static int acpi_memory_enable_device(struct acpi_memory_device *mem_device)
                mem_device->state = MEMORY_INVALID_STATE;
                return -EINVAL;
        }
-
-       return result;
+       /*
+        * Sometimes the memory device will contain several memory blocks.
+        * When one memory block is hot-added to the system memory, it will
+        * be regarded as a success.
+        * Otherwise if the last memory block can't be hot-added to the system
+        * memory, it will be failure and the memory device can't be bound with
+        * driver.
+        */
+       return 0;
 }
 
 static int acpi_memory_powerdown_device(struct acpi_memory_device *mem_device)
@@ -419,28 +429,6 @@ static int acpi_memory_device_add(struct acpi_device *device)
 
        printk(KERN_DEBUG "%s \n", acpi_device_name(device));
 
-       return result;
-}
-
-static int acpi_memory_device_remove(struct acpi_device *device, int type)
-{
-       struct acpi_memory_device *mem_device = NULL;
-
-
-       if (!device || !acpi_driver_data(device))
-               return -EINVAL;
-
-       mem_device = acpi_driver_data(device);
-       kfree(mem_device);
-
-       return 0;
-}
-
-static int acpi_memory_device_start (struct acpi_device *device)
-{
-       struct acpi_memory_device *mem_device;
-       int result = 0;
-
        /*
         * Early boot code has recognized memory area by EFI/E820.
         * If DSDT shows these memory devices on boot, hotplug is not necessary
@@ -450,8 +438,6 @@ static int acpi_memory_device_start (struct acpi_device *device)
        if (!acpi_hotmem_initialized)
                return 0;
 
-       mem_device = acpi_driver_data(device);
-
        if (!acpi_memory_check_device(mem_device)) {
                /* call add_memory func */
                result = acpi_memory_enable_device(mem_device);
@@ -462,6 +448,20 @@ static int acpi_memory_device_start (struct acpi_device *device)
        return result;
 }
 
+static int acpi_memory_device_remove(struct acpi_device *device, int type)
+{
+       struct acpi_memory_device *mem_device = NULL;
+
+
+       if (!device || !acpi_driver_data(device))
+               return -EINVAL;
+
+       mem_device = acpi_driver_data(device);
+       kfree(mem_device);
+
+       return 0;
+}
+
 /*
  * Helper function to check for memory device
  */
@@ -469,26 +469,23 @@ static acpi_status is_memory_device(acpi_handle handle)
 {
        char *hardware_id;
        acpi_status status;
-       struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
        struct acpi_device_info *info;
 
-
-       status = acpi_get_object_info(handle, &buffer);
+       status = acpi_get_object_info(handle, &info);
        if (ACPI_FAILURE(status))
                return status;
 
-       info = buffer.pointer;
        if (!(info->valid & ACPI_VALID_HID)) {
-               kfree(buffer.pointer);
+               kfree(info);
                return AE_ERROR;
        }
 
-       hardware_id = info->hardware_id.value;
+       hardware_id = info->hardware_id.string;
        if ((hardware_id == NULL) ||
            (strcmp(hardware_id, ACPI_MEMORY_DEVICE_HID)))
                status = AE_ERROR;
 
-       kfree(buffer.pointer);
+       kfree(info);
        return status;
 }