1. 02 7月, 2011 9 次提交
    • R
      PM / Runtime: Return special error code if runtime PM is disabled · 632e270e
      Rafael J. Wysocki 提交于
      Some callers of pm_runtime_get_sync() and other runtime PM helper
      functions, scsi_autopm_get_host() and scsi_autopm_get_device() in
      particular, need to distinguish error codes returned when runtime PM
      is disabled (i.e. power.disable_depth is nonzero for the given
      device) from error codes returned in other situations.  For this
      reason, make the runtime PM helper functions return -EACCES when
      power.disable_depth is nonzero and ensure that this error code
      won't be returned by them in any other circumstances.  Modify
      scsi_autopm_get_host() and scsi_autopm_get_device() to check the
      error code returned by pm_runtime_get_sync() and ignore -EACCES.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      632e270e
    • R
      PM: Rename clock management functions · 3d5c3036
      Rafael J. Wysocki 提交于
      The common PM clock management functions may be used for system
      suspend/resume as well as for runtime PM, so rename them
      accordingly.  Modify kerneldoc comments describing these functions
      and kernel messages printed by them, so that they refer to power
      management in general rather that to runtime PM.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Reviewed-by: NKevin Hilman <khilman@ti.com>
      3d5c3036
    • R
      PM: Allow the clocks management code to be used during system suspend · b7b95920
      Rafael J. Wysocki 提交于
      The common clocks management code in drivers/base/power/clock_ops.c
      is going to be used during system-wide power transitions as well as
      for runtime PM, so it shouldn't depend on CONFIG_PM_RUNTIME.
      However, the suspend/resume functions provided by it for
      CONFIG_PM_RUNTIME unset, to be used during system-wide power
      transitions, should not behave in the same way as their counterparts
      defined for CONFIG_PM_RUNTIME set, because in that case the clocks
      are managed differently at run time.
      
      The names of the functions still contain the word "runtime" after
      this change, but that is going to be modified by a separate patch
      later.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Reviewed-by: NKevin Hilman <khilman@ti.com>
      b7b95920
    • R
      PM / Domains: Wakeup devices support for system sleep transitions · d4f2d87a
      Rafael J. Wysocki 提交于
      There is the problem how to handle devices set up to wake up the
      system from sleep states during system-wide power transitions.
      In some cases, those devices can be turned off entirely, because the
      wakeup signals will be generated on their behalf anyway.  In some
      other cases, they will generate wakeup signals if their clocks are
      stopped, but only if power is not removed from them.  Finally, in
      some cases, they can only generate wakeup signals if power is not
      removed from them and their clocks are enabled.
      
      To allow platform-specific code to decide whether or not to put
      wakeup devices (and their PM domains) into low-power state during
      system-wide transitions, such as system suspend, introduce a new
      generic PM domain callback, .active_wakeup(), that will be used
      during the "noirq" phase of system suspend and hibernation (after
      image creation) to decide what to do with wakeup devices.
      Specifically, if this callback is present and returns "true", the
      generic PM domain code will not execute .stop_device() for the
      given wakeup device and its PM domain won't be powered off.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NKevin Hilman <khilman@ti.com>
      d4f2d87a
    • R
      PM / Domains: System-wide transitions support for generic domains (v5) · 596ba34b
      Rafael J. Wysocki 提交于
      Make generic PM domains support system-wide power transitions
      (system suspend and hibernation).  Add suspend, resume, freeze, thaw,
      poweroff and restore callbacks to be associated with struct
      generic_pm_domain objects and make pm_genpd_init() use them as
      appropriate.
      
      The new callbacks do nothing for devices belonging to power domains
      that were powered down at run time (before the transition).  For the
      other devices the action carried out depends on the type of the
      transition.  During system suspend the power domain .suspend()
      callback executes pm_generic_suspend() for the device, while the
      PM domain .suspend_noirq() callback runs pm_generic_suspend_noirq()
      for it, stops it and eventually removes power from the PM domain it
      belongs to (after all devices in the domain have been stopped and its
      subdomains have been powered off).
      
      During system resume the PM domain .resume_noirq() callback
      restores power to the PM domain (when executed for it first time),
      starts the device and executes pm_generic_resume_noirq() for it,
      while the .resume() callback executes pm_generic_resume() for the
      device.  Finally, the .complete() callback executes pm_runtime_idle()
      for the device which should put it back into the suspended state if
      its runtime PM usage count is equal to zero at that time.
      
      The actions carried out during hibernation and resume from it are
      analogous to the ones described above.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Reviewed-by: NKevin Hilman <khilman@ti.com>
      596ba34b
    • R
      PM / Domains: Move code from under #ifdef CONFIG_PM_RUNTIME (v2) · 5248051b
      Rafael J. Wysocki 提交于
      There is some code in drivers/base/power/domain.c that will be useful
      for both runtime PM and system-wide power transitions, so make it
      depend on CONFIG_PM instead of CONFIG_PM_RUNTIME.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Reviewed-by: NKevin Hilman <khilman@ti.com>
      5248051b
    • R
      PM: Introduce generic "noirq" callback routines for subsystems (v2) · e5291928
      Rafael J. Wysocki 提交于
      Introduce generic "noirq" power management callback routines for
      subsystems in addition to the "regular" generic PM callback routines.
      
      The new routines will be used, among other things, for implementing
      system-wide PM transitions support for generic PM domains.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      e5291928
    • R
      PM / Domains: Support for generic I/O PM domains (v8) · f721889f
      Rafael J. Wysocki 提交于
      Introduce common headers, helper functions and callbacks allowing
      platforms to use simple generic power domains for runtime power
      management.
      
      Introduce struct generic_pm_domain to be used for representing
      power domains that each contain a number of devices and may be
      parent domains or subdomains with respect to other power domains.
      Among other things, this structure includes callbacks to be
      provided by platforms for performing specific tasks related to
      power management (i.e. ->stop_device() may disable a device's
      clocks, while ->start_device() may enable them, ->power_off() is
      supposed to remove power from the entire power domain
      and ->power_on() is supposed to restore it).
      
      Introduce functions that can be used as power domain runtime PM
      callbacks, pm_genpd_runtime_suspend() and pm_genpd_runtime_resume(),
      as well as helper functions for the initialization of a power
      domain represented by a struct generic_power_domain object,
      adding a device to or removing a device from it and adding or
      removing subdomains.
      
      Introduce configuration option CONFIG_PM_GENERIC_DOMAINS to be
      selected by the platforms that want to use the new code.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NGreg Kroah-Hartman <gregkh@suse.de>
      Reviewed-by: NKevin Hilman <khilman@ti.com>
      f721889f
    • R
      PM / Domains: Rename struct dev_power_domain to struct dev_pm_domain · 564b905a
      Rafael J. Wysocki 提交于
      The naming convention used by commit 7538e3db6e015e890825fbd9f86599b
      (PM: Add support for device power domains), which introduced the
      struct dev_power_domain type for representing device power domains,
      evidently confuses some developers who tend to think that objects
      of this type must correspond to "power domains" as defined by
      hardware, which is not the case.  Namely, at the kernel level, a
      struct dev_power_domain object can represent arbitrary set of devices
      that are mutually dependent power management-wise and need not belong
      to one hardware power domain.  To avoid that confusion, rename struct
      dev_power_domain to struct dev_pm_domain and rename the related
      pointers in struct device and struct pm_clk_notifier_block from
      pwr_domain to pm_domain.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NKevin Hilman <khilman@ti.com>
      564b905a
  2. 22 6月, 2011 3 次提交
    • R
      PM / Runtime: Handle clocks correctly if CONFIG_PM_RUNTIME is unset · 4d1518f5
      Rafael J. Wysocki 提交于
      Commit 85eb8c8d (PM / Runtime:
      Generic clock manipulation rountines for runtime PM (v6)) converted
      the shmobile platform to using generic code for runtime PM clock
      management, but it changed the behavior for CONFIG_PM_RUNTIME unset
      incorrectly.
      
      Specifically, for CONFIG_PM_RUNTIME unset pm_runtime_clk_notify()
      should enable clocks for action equal to BUS_NOTIFY_BIND_DRIVER and
      it should disable them for action equal to BUS_NOTIFY_UNBOUND_DRIVER
      (instead of BUS_NOTIFY_ADD_DEVICE and BUS_NOTIFY_DEL_DEVICE,
      respectively).  Make this function behave as appropriate.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NMagnus Damm <damm@opensource.se>
      4d1518f5
    • A
      PM: Fix async resume following suspend failure · 6d0e0e84
      Alan Stern 提交于
      The PM core doesn't handle suspend failures correctly when it comes to
      asynchronously suspended devices.  These devices are moved onto the
      dpm_suspended_list as soon as the corresponding async thread is
      started up, and they remain on the list even if they fail to suspend
      or the sleep transition is cancelled before they get suspended.  As a
      result, when the PM core unwinds the transition, it tries to resume
      the devices even though they were never suspended.
      
      This patch (as1474) fixes the problem by adding a new "is_suspended"
      flag to dev_pm_info.  Devices are resumed only if the flag is set.
      
      [rjw:
       * Moved the dev->power.is_suspended check into device_resume(),
         because we need to complete dev->power.completion and clear
         dev->power.is_prepared too for devices whose
         dev->power.is_suspended flags are unset.
       * Fixed __device_suspend() to avoid setting dev->power.is_suspended
         if async_error is different from zero.]
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Cc: stable@kernel.org
      6d0e0e84
    • A
      PM: Rename dev_pm_info.in_suspend to is_prepared · f76b168b
      Alan Stern 提交于
      This patch (as1473) renames the "in_suspend" field in struct
      dev_pm_info to "is_prepared", in preparation for an upcoming change.
      The new name is more descriptive of what the field really means.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Cc: stable@kernel.org
      f76b168b
  3. 08 6月, 2011 1 次提交
  4. 18 5月, 2011 5 次提交
    • R
      PM: Introduce generic prepare and complete callbacks for subsystems · 6538df80
      Rafael J. Wysocki 提交于
      Introduce generic .prepare() and .complete() power management
      callbacks, currently missing, that can be used by subsystems and
      power domains and export them.  Provide NULL definitions of all
      the generic system sleep callbacks for CONFIG_PM_SLEEP unset.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      6538df80
    • R
      PM: Allow drivers to allocate memory from .prepare() callbacks safely · 91e7c75b
      Rafael J. Wysocki 提交于
      If device drivers allocate substantial amounts of memory (above 1 MB)
      in their hibernate .freeze() callbacks (or in their legacy suspend
      callbcks during hibernation), the subsequent creation of hibernate
      image may fail due to the lack of memory.  This is the case, because
      the drivers' .freeze() callbacks are executed after the hibernate
      memory preallocation has been carried out and the preallocated amount
      of memory may be too small to cover the new driver allocations.
      Unfortunately, the drivers' .prepare() callbacks also are executed
      after the hibernate memory preallocation has completed, so they are
      not suitable for allocating additional memory either.  Thus the only
      way a driver can safely allocate memory during hibernation is to use
      a hibernate/suspend notifier.  However, the notifiers are called
      before the freezing of user space and the drivers wanting to use them
      for allocating additional memory may not know how much memory needs
      to be allocated at that point.
      
      To let device drivers overcome this difficulty rework the hibernation
      sequence so that the memory preallocation is carried out after the
      drivers' .prepare() callbacks have been executed, so that the
      .prepare() callbacks can be used for allocating additional memory
      to be used by the drivers' .freeze() callbacks.  Update documentation
      to match the new behavior of the code.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      91e7c75b
    • R
      PM: Remove CONFIG_PM_VERBOSE · c650da23
      Rafael J. Wysocki 提交于
      Now that we have CONFIG_DYNAMIC_DEBUG there is no need for yet
      another flag causing dev_dbg() and pr_debug() statements in the
      core PM code to produce output.  Moreover, CONFIG_PM_VERBOSE
      causes so much output to be generated that it's not really useful
      and almost no one sets it.
      
      References: https://bugzilla.kernel.org/show_bug.cgi?id=23182Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      c650da23
    • E
      PM / Wakeup: Remove useless synchronize_rcu() call · 13e38136
      Eric Dumazet 提交于
      wakeup_source_add() adds an item into wakeup_sources list.
      
      There is no need to call synchronize_rcu() at this point.
      
      Its only needed in wakeup_source_remove()
      Signed-off-by: NEric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      13e38136
    • R
      PM / Wakeup: Fix build warning related to the "wakeup" sysfs file · e762318b
      Rafael J. Wysocki 提交于
      The "wakeup" device sysfs file is only created if CONFIG_PM_SLEEP
      is set, so put it under CONFIG_PM_SLEEP and make a build warning
      related to it go away.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NGreg Kroah-Hartman <gregkh@suse.de>
      e762318b
  5. 17 5月, 2011 1 次提交
  6. 30 4月, 2011 1 次提交
  7. 29 4月, 2011 1 次提交
    • R
      PM: Make power domain callbacks take precedence over subsystem ones · 4d27e9dc
      Rafael J. Wysocki 提交于
      Change the PM core's behavior related to power domains in such a way
      that, if a power domain is defined for a given device, its callbacks
      will be executed instead of and not in addition to the device
      subsystem's PM callbacks.
      
      The idea behind the initial implementation of power domains handling
      by the PM core was that power domain callbacks would be executed in
      addition to subsystem callbacks, so that it would be possible to
      extend the subsystem callbacks by using power domains.  It turns out,
      however, that this wouldn't be really convenient in some important
      situations.
      
      For example, there are systems in which power can only be removed
      from entire power domains.  On those systems it is not desirable to
      execute device drivers' PM callbacks until it is known that power is
      going to be removed from the devices in question, which means that
      they should be executed by power domain callbacks rather then by
      subsystem (e.g. bus type) PM callbacks, because subsystems generally
      have no information about what devices belong to which power domain.
      Thus, for instance, if the bus type in question is the platform bus
      type, its PM callbacks generally should not be called in addition to
      power domain callbacks, because they run device drivers' callbacks
      unconditionally if defined.
      
      While in principle the default subsystem PM callbacks, or a subset of
      them, may be replaced with different functions, it doesn't seem
      correct to do so, because that would change the subsystem's behavior
      with respect to all devices in the system, regardless of whether or
      not they belong to any power domains.  Thus, the only remaining
      option is to make power domain callbacks take precedence over
      subsystem callbacks.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NGrant Likely <grant.likely@secretlab.ca>
      Acked-by: NKevin Hilman <khilman@ti.com>
      4d27e9dc
  8. 26 4月, 2011 1 次提交
    • R
      PM / Wakeup: Fix initialization of wakeup-related device sysfs files · 22110faf
      Rafael J. Wysocki 提交于
      It turns out that some PCI devices are only found to be
      wakeup-capable during registration, in which case, when
      device_set_wakeup_capable() is called, device_is_registered() already
      returns 'true' for the given device, but dpm_sysfs_add() hasn't been
      called for it yet.  This leads to situations in which the device's
      power.can_wakeup flag is not set as requested because of failing
      wakeup_sysfs_add() and its wakeup-related sysfs files are not
      created, although they should be present.  This is a post-2.6.38
      regression introduced by commit cb8f51bd
      (PM: Do not create wakeup sysfs files for devices that cannot wake
      up).
      
      To work around this problem initialize the device's power.entry
      field to an empty list head and make device_set_wakeup_capable()
      check if it is still empty before attempting to add the devices
      wakeup-related sysfs files with wakeup_sysfs_add().  Namely, if
      power.entry is still empty at this point, device_pm_add() hasn't been
      called yet for the device and its wakeup-related files will be
      created later, so device_set_wakeup_capable() doesn't have to create
      them.
      Reported-and-tested-by: NTino Keitel <tino.keitel@tikei.de>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NGreg Kroah-Hartman <gregkh@suse.de>
      22110faf
  9. 12 4月, 2011 1 次提交
    • R
      PM / Hibernate: Introduce CONFIG_HIBERNATE_CALLBACKS · 1f112cee
      Rafael J. Wysocki 提交于
      Xen save/restore is going to use hibernate device callbacks for
      quiescing devices and putting them back to normal operations and it
      would need to select CONFIG_HIBERNATION for this purpose.  However,
      that also would cause the hibernate interfaces for user space to be
      enabled, which might confuse user space, because the Xen kernels
      don't support hibernation.  Moreover, it would be wasteful, as it
      would make the Xen kernels include a substantial amount of code that
      they would never use.
      
      To address this issue introduce new power management Kconfig option
      CONFIG_HIBERNATE_CALLBACKS, such that it will only select the code
      that is necessary for the hibernate device callbacks to work and make
      CONFIG_HIBERNATION select it.  Then, Xen save/restore will be able to
      select CONFIG_HIBERNATE_CALLBACKS without dragging the entire
      hibernate code along with it.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Tested-by: NShriram Rajagopalan <rshriram@cs.ubc.ca>
      1f112cee
  10. 31 3月, 2011 1 次提交
  11. 15 3月, 2011 10 次提交
    • N
      PM / OPP: opp_find_freq_exact() documentation fix · 7ae49618
      Nishanth Menon 提交于
      opp_find_freq_exact() documentation has is_available instead
      of available. This also fixes warning with the kernel-doc:
      scripts/kernel-doc drivers/base/power/opp.c >/dev/null
      Warning(drivers/base/power/opp.c:246): No description found for parameter 'available'
      Warning(drivers/base/power/opp.c:246): Excess function parameter 'is_available' description in 'opp_find_freq_exact'
      Signed-off-by: NNishanth Menon <nm@ti.com>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      7ae49618
    • R
      PM: Make system-wide PM and runtime PM treat subsystems consistently · 9659cc06
      Rafael J. Wysocki 提交于
      The code handling system-wide power transitions (eg. suspend-to-RAM)
      can in theory execute callbacks provided by the device's bus type,
      device type and class in each phase of the power transition.  In
      turn, the runtime PM core code only calls one of those callbacks at
      a time, preferring bus type callbacks to device type or class
      callbacks and device type callbacks to class callbacks.
      
      It seems reasonable to make them both behave in the same way in that
      respect.  Moreover, even though a device may belong to two subsystems
      (eg. bus type and device class) simultaneously, in practice power
      management callbacks for system-wide power transitions are always
      provided by only one of them (ie. if the bus type callbacks are
      defined, the device class ones are not and vice versa).  Thus it is
      possible to modify the code handling system-wide power transitions
      so that it follows the core runtime PM code (ie. treats the
      subsystem callbacks as mutually exclusive).
      
      On the other hand, the core runtime PM code will choose to execute,
      for example, a runtime suspend callback provided by the device type
      even if the bus type's struct dev_pm_ops object exists, but the
      runtime_suspend pointer in it happens to be NULL.  This is confusing,
      because it may lead to the execution of callbacks from different
      subsystems during different operations (eg. the bus type suspend
      callback may be executed during runtime suspend of the device, while
      the device type callback will be executed during system suspend).
      
      Make all of the power management code treat subsystem callbacks in
      a consistent way, such that:
      (1) If the device's type is defined (eg. dev->type is not NULL)
          and its pm pointer is not NULL, the callbacks from dev->type->pm
          will be used.
      (2) If dev->type is NULL or dev->type->pm is NULL, but the device's
          class is defined (eg. dev->class is not NULL) and its pm pointer
          is not NULL, the callbacks from dev->class->pm will be used.
      (3) If dev->type is NULL or dev->type->pm is NULL and dev->class is
          NULL or dev->class->pm is NULL, the callbacks from dev->bus->pm
          will be used provided that both dev->bus and dev->bus->pm are
          not NULL.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NKevin Hilman <khilman@ti.com>
      Reasoning-sounds-sane-to: Grant Likely <grant.likely@secretlab.ca>
      Acked-by: NGreg Kroah-Hartman <gregkh@suse.de>
      9659cc06
    • R
      PM: Add support for device power domains · 7538e3db
      Rafael J. Wysocki 提交于
      The platform bus type is often used to handle Systems-on-a-Chip (SoC)
      where all devices are represented by objects of type struct
      platform_device.  In those cases the same "platform" device driver
      may be used with multiple different system configurations, but the
      actions needed to put the devices it handles into a low-power state
      and back into the full-power state may depend on the design of the
      given SoC.  The driver, however, cannot possibly include all the
      information necessary for the power management of its device on all
      the systems it is used with.  Moreover, the device hierarchy in its
      current form also is not suitable for representing this kind of
      information.
      
      The patch below attempts to address this problem by introducing
      objects of type struct dev_power_domain that can be used for
      representing power domains within a SoC.  Every struct
      dev_power_domain object provides a sets of device power
      management callbacks that can be used to perform what's needed for
      device power management in addition to the operations carried out by
      the device's driver and subsystem.
      
      Namely, if a struct dev_power_domain object is pointed to by the
      pwr_domain field in a struct device, the callbacks provided by its
      ops member will be executed in addition to the corresponding
      callbacks provided by the device's subsystem and driver during all
      power transitions.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Tested-and-acked-by: NKevin Hilman <khilman@ti.com>
      7538e3db
    • R
      PM: Allow pm_runtime_suspend() to succeed during system suspend · e8665002
      Rafael J. Wysocki 提交于
      The dpm_prepare() function increments the runtime PM reference
      counters of all devices to prevent pm_runtime_suspend() from
      executing subsystem-level callbacks.  However, this was supposed to
      guard against a specific race condition that cannot happen, because
      the power management workqueue is freezable, so pm_runtime_suspend()
      can only be called synchronously during system suspend and we can
      rely on subsystems and device drivers to avoid doing that
      unnecessarily.
      
      Make dpm_prepare() drop the runtime PM reference to each device
      after making sure that runtime resume is not pending for it.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NKevin Hilman <khilman@ti.com>
      e8665002
    • R
      PM: Remove CONFIG_PM_OPS · aa338601
      Rafael J. Wysocki 提交于
      After redefining CONFIG_PM to depend on (CONFIG_PM_SLEEP ||
      CONFIG_PM_RUNTIME) the CONFIG_PM_OPS option is redundant and can be
      replaced with CONFIG_PM.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      aa338601
    • R
      PM: Do not create wakeup sysfs files for devices that cannot wake up · cb8f51bd
      Rafael J. Wysocki 提交于
      Currently, wakeup sysfs attributes are created for all devices,
      regardless of whether or not they are wakeup-capable.  This is
      excessive and complicates wakeup device identification from user
      space (i.e. to identify wakeup-capable devices user space has to read
      /sys/devices/.../power/wakeup for all devices and see if they are not
      empty).
      
      Fix this issue by avoiding to create wakeup sysfs files for devices
      that cannot wake up the system from sleep states (i.e. whose
      power.can_wakeup flags are unset during registration) and modify
      device_set_wakeup_capable() so that it adds (or removes) the relevant
      sysfs attributes if a device's wakeup capability status is changed.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      cb8f51bd
    • M
      PM: Use appropriate printk() priority level in trace.c · 0295a34d
      Mandeep Singh Baines 提交于
      printk()s without a priority level default to KERN_WARNING. To reduce
      noise at KERN_WARNING, this patch sets the priority level appriopriately
      for unleveled printks()s. This should be useful to folks that look at
      dmesg warnings closely.
      
      Changed these messages to pr_info().
      Signed-off-by: NMandeep Singh Baines <msb@chromium.org>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      0295a34d
    • R
      PM / Wakeup: Don't update events_check_enabled in pm_get_wakeup_count() · 790c7885
      Rafael J. Wysocki 提交于
      Since pm_save_wakeup_count() has just been changed to clear
      events_check_enabled unconditionally before checking if there are
      any new wakeup events registered since the last read from
      /sys/power/wakeup_count, the detection of wakeup events during
      suspend may be disabled, after it's been enabled, by writing a
      "wrong" value back to /sys/power/wakeup_count.  For this reason,
      it is not necessary to update events_check_enabled in
      pm_get_wakeup_count() any more.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      790c7885
    • R
      PM / Wakeup: Make pm_save_wakeup_count() work as documented · 378eef99
      Rafael J. Wysocki 提交于
      According to Documentation/ABI/testing/sysfs-power, the
      /sys/power/wakeup_count interface should only make the kernel react
      to wakeup events during suspend if the last write to it has been
      successful.  However, if /sys/power/wakeup_count is written to two
      times in a row, where the first write is successful and the second
      is not, the kernel will still react to wakeup events during suspend
      due to a bug in pm_save_wakeup_count().
      
      Fix the bug by making pm_save_wakeup_count() clear
      events_check_enabled unconditionally before checking if there are
      any new wakeup events registered since the previous read from
      /sys/power/wakeup_count.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      378eef99
    • R
      PM / Wakeup: Combine atomic counters to avoid reordering issues · 023d3779
      Rafael J. Wysocki 提交于
      The memory barrier in wakeup_source_deactivate() is supposed to
      prevent the callers of pm_wakeup_pending() and pm_get_wakeup_count()
      from seeing the new value of events_in_progress (0, in particular)
      and the old value of event_count at the same time.  However, if
      wakeup_source_deactivate() is executed by CPU0 and, for instance,
      pm_wakeup_pending() is executed by CPU1, where both processors can
      reorder operations, the memory barrier in wakeup_source_deactivate()
      doesn't affect CPU1 which can reorder reads.  In that case CPU1 may
      very well decide to fetch event_count before it's modified and
      events_in_progress after it's been updated, so pm_wakeup_pending()
      may fail to detect a wakeup event.  This issue can be addressed by
      using a single atomic variable to store both events_in_progress
      and event_count, so that they can be updated together in a single
      atomic operation.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      023d3779
  12. 26 1月, 2011 1 次提交
  13. 24 12月, 2010 5 次提交