Pull bugfix into test branch
Len Brown [Sat, 16 Dec 2006 06:01:18 +0000 (01:01 -0500)]
Conflicts:

kernel/power/disk.c

1  2 
drivers/acpi/dock.c
kernel/power/disk.c
kernel/power/main.c

@@@ -681,33 -625,9 +681,33 @@@ static int dock_add(acpi_handle handle
        INIT_LIST_HEAD(&dock_station->dependent_devices);
        INIT_LIST_HEAD(&dock_station->hotplug_devices);
        spin_lock_init(&dock_station->dd_lock);
-       spin_lock_init(&dock_station->hp_lock);
+       mutex_init(&dock_station->hp_lock);
        ATOMIC_INIT_NOTIFIER_HEAD(&dock_notifier_list);
  
 +      /* initialize platform device stuff */
 +      dock_device.name = dock_device_name;
 +      ret = platform_device_register(&dock_device);
 +      if (ret) {
 +              printk(KERN_ERR PREFIX "Error %d registering dock device\n", ret);
 +              kfree(dock_station);
 +              return ret;
 +      }
 +      ret = device_create_file(&dock_device.dev, &dev_attr_docked);
 +      if (ret) {
 +              printk("Error %d adding sysfs file\n", ret);
 +              platform_device_unregister(&dock_device);
 +              kfree(dock_station);
 +              return ret;
 +      }
 +      ret = device_create_file(&dock_device.dev, &dev_attr_undock);
 +      if (ret) {
 +              printk("Error %d adding sysfs file\n", ret);
 +              device_remove_file(&dock_device.dev, &dev_attr_docked);
 +              platform_device_unregister(&dock_device);
 +              kfree(dock_station);
 +              return ret;
 +      }
 +
        /* Find dependent devices */
        acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
                            ACPI_UINT32_MAX, find_dock_devices, dock_station,
@@@ -58,11 -40,15 +58,13 @@@ static inline int platform_prepare(void
  
  static void power_down(suspend_disk_method_t mode)
  {
 -      int error = 0;
 -
        switch(mode) {
        case PM_DISK_PLATFORM:
-               kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
-               pm_ops->enter(PM_SUSPEND_DISK);
-               break;
+               if (pm_ops && pm_ops->enter) {
+                       kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
 -                      error = pm_ops->enter(PM_SUSPEND_DISK);
++                      pm_ops->enter(PM_SUSPEND_DISK);
+                       break;
+               }
        case PM_DISK_SHUTDOWN:
                kernel_power_off();
                break;
  /*This is just an arbitrary number */
  #define FREE_PAGE_NUMBER (100)
  
 -DECLARE_MUTEX(pm_sem);
 +DEFINE_MUTEX(pm_mutex);
  
  struct pm_ops *pm_ops;
- suspend_disk_method_t pm_disk_mode = PM_DISK_SHUTDOWN;
+ suspend_disk_method_t pm_disk_mode = PM_DISK_PLATFORM;
  
  /**
   *    pm_set_ops - Set the global power method table.