Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6
authorLinus Torvalds <torvalds@g5.osdl.org>
Tue, 26 Sep 2006 18:49:46 +0000 (11:49 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Tue, 26 Sep 2006 18:49:46 +0000 (11:49 -0700)
* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6: (47 commits)
  Driver core: Don't call put methods while holding a spinlock
  Driver core: Remove unneeded routines from driver core
  Driver core: Fix potential deadlock in driver core
  PCI: enable driver multi-threaded probe
  Driver Core: add ability for drivers to do a threaded probe
  sysfs: add proper sysfs_init() prototype
  drivers/base: check errors
  drivers/base: Platform notify needs to occur before drivers attach to the device
  v4l-dev2: handle __must_check
  add CONFIG_ENABLE_MUST_CHECK
  add __must_check to device management code
  Driver core: fixed add_bind_files() definition
  Driver core: fix comments in drivers/base/power/resume.c
  sysfs_remove_bin_file: no return value, dump_stack on error
  kobject: must_check fixes
  Driver core: add ability for devices to create and remove bin files
  Class: add support for class interfaces for devices
  Driver core: create devices/virtual/ tree
  Driver core: add device_rename function
  Driver core: add ability for classes to handle devices properly
  ...

1  2 
kernel/power/Kconfig
kernel/power/disk.c
kernel/power/swsusp.c
kernel/power/user.c
lib/Kconfig.debug

diff --combined kernel/power/Kconfig
@@@ -36,17 -36,6 +36,17 @@@ config PM_DEBU
        code. This is helpful when debugging and reporting various PM bugs, 
        like suspend support.
  
 +config DISABLE_CONSOLE_SUSPEND
 +      bool "Keep console(s) enabled during suspend/resume (DANGEROUS)"
 +      depends on PM && PM_DEBUG
 +      default n
 +      ---help---
 +      This option turns off the console suspend mechanism that prevents
 +      debug messages from reaching the console during the suspend/resume
 +      operations.  This may be helpful when debugging device drivers'
 +      suspend/resume routines, but may itself lead to problems, for example
 +      if netconsole is used.
 +
  config PM_TRACE
        bool "Suspend/resume event tracing"
        depends on PM && PM_DEBUG && X86_32 && EXPERIMENTAL
        CAUTION: this option will cause your machine's real-time clock to be
        set to an invalid time after a resume.
  
+ config PM_SYSFS_DEPRECATED
+       bool "Driver model /sys/devices/.../power/state files (DEPRECATED)"
+       depends on PM && SYSFS
+       default n
+       help
+         The driver model started out with a sysfs file intended to provide
+         a userspace hook for device power management.  This feature has never
+         worked very well, except for limited testing purposes, and so it will
+         be removed.   It's not clear that a generic mechanism could really
+         handle the wide variability of device power states; any replacements
+         are likely to be bus or driver specific.
  
  config SOFTWARE_SUSPEND
        bool "Software Suspend"
diff --combined kernel/power/disk.c
@@@ -18,7 -18,6 +18,7 @@@
  #include <linux/fs.h>
  #include <linux/mount.h>
  #include <linux/pm.h>
 +#include <linux/cpu.h>
  
  #include "power.h"
  
@@@ -73,10 -72,7 +73,10 @@@ static int prepare_processes(void
        int error;
  
        pm_prepare_console();
 -      disable_nonboot_cpus();
 +
 +      error = disable_nonboot_cpus();
 +      if (error)
 +              goto enable_cpus;
  
        if (freeze_processes()) {
                error = -EBUSY;
@@@ -88,7 -84,6 +88,7 @@@
                return 0;
  thaw:
        thaw_processes();
 +enable_cpus:
        enable_nonboot_cpus();
        pm_restore_console();
        return error;
@@@ -103,7 -98,7 +103,7 @@@ static void unprepare_processes(void
  }
  
  /**
-  *    pm_suspend_disk - The granpappy of power management.
+  *    pm_suspend_disk - The granpappy of hibernation power management.
   *
   *    If we're going through the firmware, then get it over with quickly.
   *
@@@ -212,7 -207,7 +212,7 @@@ static int software_resume(void
  
        pr_debug("PM: Preparing devices for restore.\n");
  
-       if ((error = device_suspend(PMSG_FREEZE))) {
+       if ((error = device_suspend(PMSG_PRETHAW))) {
                printk("Some devices failed to suspend\n");
                swsusp_free();
                goto Thaw;
diff --combined kernel/power/swsusp.c
@@@ -193,13 -193,14 +193,13 @@@ int swsusp_shrink_memory(void
        printk("Shrinking memory...  ");
        do {
                size = 2 * count_highmem_pages();
 -              size += size / 50 + count_data_pages();
 -              size += (size + PBES_PER_PAGE - 1) / PBES_PER_PAGE +
 -                      PAGES_FOR_IO;
 +              size += size / 50 + count_data_pages() + PAGES_FOR_IO;
                tmp = size;
                for_each_zone (zone)
                        if (!is_highmem(zone) && populated_zone(zone)) {
                                tmp -= zone->free_pages;
                                tmp += zone->lowmem_reserve[ZONE_NORMAL];
 +                              tmp += snapshot_additional_pages(zone);
                        }
                if (tmp > 0) {
                        tmp = __shrink_memory(tmp);
@@@ -247,6 -248,9 +247,9 @@@ int swsusp_suspend(void
        restore_processor_state();
  Restore_highmem:
        restore_highmem();
+       /* NOTE:  device_power_up() is just a resume() for devices
+        * that suspended with irqs off ... no overall powerup.
+        */
        device_power_up();
  Enable_irqs:
        local_irq_enable();
  int swsusp_resume(void)
  {
        int error;
        local_irq_disable();
-       if (device_power_down(PMSG_FREEZE))
+       /* NOTE:  device_power_down() is just a suspend() with irqs off;
+        * it has no special "power things down" semantics
+        */
+       if (device_power_down(PMSG_PRETHAW))
                printk(KERN_ERR "Some devices failed to power down, very bad\n");
        /* We'll ignore saved state, but this gets preempt count (etc) right */
        save_processor_state();
diff --combined kernel/power/user.c
@@@ -19,7 -19,6 +19,7 @@@
  #include <linux/swapops.h>
  #include <linux/pm.h>
  #include <linux/fs.h>
 +#include <linux/cpu.h>
  
  #include <asm/uaccess.h>
  
@@@ -140,15 -139,12 +140,15 @@@ static int snapshot_ioctl(struct inode 
                if (data->frozen)
                        break;
                down(&pm_sem);
 -              disable_nonboot_cpus();
 -              if (freeze_processes()) {
 -                      thaw_processes();
 -                      enable_nonboot_cpus();
 -                      error = -EBUSY;
 +              error = disable_nonboot_cpus();
 +              if (!error) {
 +                      error = freeze_processes();
 +                      if (error) {
 +                              thaw_processes();
 +                              error = -EBUSY;
 +                      }
                }
 +              enable_nonboot_cpus();
                up(&pm_sem);
                if (!error)
                        data->frozen = 1;
                        error = -EPERM;
                        break;
                }
 +              snapshot_free_unused_memory(&data->handle);
                down(&pm_sem);
                pm_prepare_console();
-               error = device_suspend(PMSG_FREEZE);
+               error = device_suspend(PMSG_PRETHAW);
                if (!error) {
                        error = swsusp_resume();
                        device_resume();
diff --combined lib/Kconfig.debug
@@@ -8,6 -8,13 +8,13 @@@ config PRINTK_TIM
          operations.  This is useful for identifying long delays
          in kernel startup.
  
+ config ENABLE_MUST_CHECK
+       bool "Enable __must_check logic"
+       default y
+       help
+         Enable the __must_check logic in the kernel build.  Disable this to
+         suppress the "warning: ignoring return value of 'foo', declared with
+         attribute warn_unused_result" messages.
  
  config MAGIC_SYSRQ
        bool "Magic SysRq key"
@@@ -277,7 -284,7 +284,7 @@@ config DEBUG_HIGHME
  config DEBUG_BUGVERBOSE
        bool "Verbose BUG() reporting (adds 70K)" if DEBUG_KERNEL && EMBEDDED
        depends on BUG
 -      depends on ARM || ARM26 || M32R || M68K || SPARC32 || SPARC64 || X86_32 || FRV
 +      depends on ARM || ARM26 || AVR32 || M32R || M68K || SPARC32 || SPARC64 || X86_32 || FRV
        default !EMBEDDED
        help
          Say Y here to make BUG() panics output the file name and line number
@@@ -315,7 -322,7 +322,7 @@@ config DEBUG_V
  
  config FRAME_POINTER
        bool "Compile the kernel with frame pointers"
 -      depends on DEBUG_KERNEL && (X86 || CRIS || M68K || M68KNOMMU || FRV || UML || S390)
 +      depends on DEBUG_KERNEL && (X86 || CRIS || M68K || M68KNOMMU || FRV || UML || S390 || AVR32)
        default y if DEBUG_INFO && UML
        help
          If you say Y here the resulting kernel image will be slightly larger