From: Len Brown Date: Sat, 16 Dec 2006 06:01:18 +0000 (-0500) Subject: Pull bugfix into test branch X-Git-Tag: v2.6.20-rc2~6^2~7 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cfee47f99bc14a6d7c6b0be2284db2cef310a815;p=linux-2.6 Pull bugfix into test branch Conflicts: kernel/power/disk.c --- cfee47f99bc14a6d7c6b0be2284db2cef310a815 diff --cc drivers/acpi/dock.c index 215f5b30a1,c7df2a1ea9..54ce12ab43 --- a/drivers/acpi/dock.c +++ b/drivers/acpi/dock.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, diff --cc kernel/power/disk.c index 0b00f56c2a,ae6bbc903b..88fc5d7ac7 --- a/kernel/power/disk.c +++ b/kernel/power/disk.c @@@ -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; diff --cc kernel/power/main.c index 500eb87f64,1210961a5a..ff3a6182f5 --- a/kernel/power/main.c +++ b/kernel/power/main.c @@@ -26,10 -24,10 +26,10 @@@ /*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.