1. 01 7月, 2012 2 次提交
    • R
      PM / Domains: Do not stop devices after restoring their states · 80de3d7f
      Rafael J. Wysocki 提交于
      While resuming a device belonging to a PM domain,
      pm_genpd_runtime_resume() calls __pm_genpd_restore_device() to
      restore its state, if necessary.  The latter starts the device,
      using genpd_start_dev(), restores its state, using
      genpd_restore_dev(), and then stops it, using genpd_stop_dev().
      However, this last operation is not necessary, because the
      device is supposed to be operational after pm_genpd_runtime_resume()
      has returned and because of it pm_genpd_runtime_resume() has to
      call genpd_start_dev() once again for the "restored" device, which
      is inefficient.
      
      To make things more efficient, remove the call to genpd_stop_dev()
      from __pm_genpd_restore_device() and the direct call to
      genpd_start_dev() from pm_genpd_runtime_resume().  [Of course,
      genpd_start_dev() still has to be called by it for devices with the
      power.irq_safe flag set, because __pm_genpd_restore_device() is not
      executed for them.]
      
      This change has been tested on the SH7372 Mackerel board.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      80de3d7f
    • R
      PM / Domains: Use subsystem runtime suspend/resume callbacks by default · 0b589741
      Rafael J. Wysocki 提交于
      Currently, the default "save state" and "restore state" routines
      for generic PM domains, pm_genpd_default_save_state() and
      pm_genpd_default_restore_state(), respectively, only use runtime PM
      callbacks provided by device drivers, but in general those callbacks
      need not provide the entire necessary functionality.  Namely, in
      general it may be necessary to execute subsystem (i.e. device type,
      device class or bus type) callbacks that will carry out all of the
      necessary operations.
      
      For this reason, modify pm_genpd_default_save_state() and
      pm_genpd_default_restore_state() to execute subsystem callbacks,
      if they are provided, and fall back to driver callbacks otherwise.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      0b589741
  2. 19 5月, 2012 1 次提交
    • R
      PM / Domains: Make it possible to add devices to inactive domains · ca1d72f0
      Rafael J. Wysocki 提交于
      The generic PM domains core code currently requires domains to be in
      the "power on" state for adding devices to them, but this limitation
      turns out to be inconvenient in some situations, so remove it.
      
      For this purpose, make __pm_genpd_add_device() set the device's
      need_restore flag if the domain is in the "power off" state, so that
      the device's "restore state" (usually .runtime_resume()) callback
      is executed when it is resumed after the domain has been turned on.
      If the domain is in the "power on" state, the device's need_restore
      flag will be cleared by __pm_genpd_add_device(), so that its "save
      state" (usually .runtime_suspend()) callback is executed when the
      domain is about to be turned off.  However, since that default
      behavior need not be always desirable, add a helper function
      pm_genpd_dev_need_restore() allowing a device's need_restore flag
      to be set/unset at any time.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      ca1d72f0
  3. 12 5月, 2012 1 次提交
  4. 06 5月, 2012 2 次提交
    • R
      PM / Domains: Cache device stop and domain power off governor results, v3 · 6ff7bb0d
      Rafael J. Wysocki 提交于
      The results of the default device stop and domain power off governor
      functions for generic PM domains, default_stop_ok() and
      default_power_down_ok(), depend only on the timing data of devices,
      which are static, and on their PM QoS constraints.  Thus, in theory,
      these functions only need to carry out their computations, which may
      be time consuming in general, when it is known that the PM QoS
      constraint of at least one of the devices in question has changed.
      
      Use the PM QoS notifiers of devices to implement that.  First,
      introduce new fields, constraint_changed and max_off_time_changed,
      into struct gpd_timing_data and struct generic_pm_domain,
      respectively, and register a PM QoS notifier function when adding
      a device into a domain that will set those fields to 'true' whenever
      the device's PM QoS constraint is modified.  Second, make
      default_stop_ok() and default_power_down_ok() use those fields to
      decide whether or not to carry out their computations from scratch.
      
      The device and PM domain hierarchies are taken into account in that
      and the expense is that the changes of PM QoS constraints of
      suspended devices will not be taken into account immediately, which
      isn't guaranteed anyway in general.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      6ff7bb0d
    • R
      PM / Domains: Make device removal more straightforward · efa69025
      Rafael J. Wysocki 提交于
      The removal of a device from a PM domain doesn't have to browse
      the domain's device list, because it can check directly if the
      device belongs to the given domain.  Moreover, it should clear
      the domain_data pointer in dev->power.subsys_data, because
      dev_pm_put_subsys_data(dev) may not remove dev->power.subsys_data
      and the stale domain data pointer may cause problems to happen.
      
      Rework pm_genpd_remove_device() taking the above observations into
      account.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      efa69025
  5. 02 5月, 2012 3 次提交
    • R
      PM / Runtime: Remove device fields related to suspend time, v2 · 76e267d8
      Rafael J. Wysocki 提交于
      After the previous changes in default_stop_ok() and
      default_power_down_ok() for PM domains, there are two fields in
      struct dev_pm_info that aren't necessary any more,  suspend_time
      and max_time_suspended_ns.
      
      Remove those fields along with all of the code that accesses them,
      which simplifies the runtime PM framework quite a bit.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      76e267d8
    • R
      PM / Domains: Rework default domain power off governor function, v2 · dd8683e9
      Rafael J. Wysocki 提交于
      The existing default domain power down governor function for PM
      domains, default_power_down_ok(), is supposed to check whether or not
      the PM QoS latency constraints of the devices in the domain will be
      violated if the domain is turned off by pm_genpd_poweroff().
      However, the computations carried out by it don't reflect the
      definition of the PM QoS latency constrait in
      Documentation/ABI/testing/sysfs-devices-power.
      
      Make default_power_down_ok() follow the definition of the PM QoS
      latency constrait.  In particular, make it only take latencies into
      account, because it doesn't matter how much time has elapsed since
      the domain's devices were suspended for the computation.
      
      Remove the break_even_ns and power_off_time fields from
      struct generic_pm_domain, because they are not necessary any more.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      dd8683e9
    • R
      PM / Domains: Rework default device stop governor function, v2 · a5bef810
      Rafael J. Wysocki 提交于
      The existing default device stop governor function for PM domains,
      default_stop_ok(), is supposed to check whether or not the device's
      PM QoS latency constraint will be violated if the device is stopped
      by pm_genpd_runtime_suspend().  However, the computations carried out
      by it don't reflect the definition of the PM QoS latency constrait in
      Documentation/ABI/testing/sysfs-devices-power.
      
      Make default_stop_ok() follow the definition of the PM QoS latency
      constrait.  In particular, make it take the device's start and stop
      latencies correctly.
      
      Add a new field, effective_constraint_ns, to struct gpd_timing_data
      and use it to store the difference between the device's PM QoS
      constraint and its resume latency for use by the device's parent
      (the effective_constraint_ns values for the children are used for
      computing the parent's one along with its PM QoS constraint).
      
      Remove the break_even_ns field from struct gpd_timing_data, because
      it's not used any more.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      a5bef810
  6. 19 3月, 2012 1 次提交
  7. 17 3月, 2012 3 次提交
    • R
      PM / Domains: Introduce "always on" device flag · 1e78a0c7
      Rafael J. Wysocki 提交于
      The TMU device on the Mackerel board belongs to the A4R power domain
      and loses power when the domain is turned off.  Unfortunately, the
      TMU driver is not prepared to cope with such situations and crashes
      the system when that happens.  To work around this problem introduce
      a new helper function, pm_genpd_dev_always_on(), allowing a device
      driver to mark its device as "always on" in case it belongs to a PM
      domain, which will make the generic PM domains core code avoid
      powering off the domain containing the device, both at run time and
      during system suspend.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Tested-by: NSimon Horman <horms@verge.net.au>
      Acked-by: NPaul Mundt <lethal@linux-sh.org>
      Cc: stable@vger.kernel.org
      1e78a0c7
    • R
      PM / Domains: Fix hibernation restore of devices, v2 · 65533bbf
      Rafael J. Wysocki 提交于
      During resume from hibernation pm_genpd_restore_noirq() should only
      power off domains whose suspend_power_off flags are set once and
      not every time it is called for a device in the given domain.
      Moreover, it shouldn't decrement genpd->suspended_count, because
      that field is not touched during device freezing and therefore it is
      always equal to 0 when pm_genpd_restore_noirq() runs for the first
      device in the given domain.
      
      This means pm_genpd_restore_noirq() may use genpd->suspended_count
      to determine whether or not it it has been called for the domain in
      question already in this cycle (it only needs to increment that
      field every time it runs for this purpose) and whether or not it
      should check if the domain needs to be powered off.  For that to
      work, though, pm_genpd_prepare() has to clear genpd->suspended_count
      when it runs for the first device in the given domain (in which case
      that flag need not be cleared during domain initialization).
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Cc: stable@vger.kernel.org
      65533bbf
    • R
      PM / Domains: Fix handling of wakeup devices during system resume · cc85b207
      Rafael J. Wysocki 提交于
      During system suspend pm_genpd_suspend_noirq() checks if the given
      device is in a wakeup path (i.e. it appears to be needed for one or
      more wakeup devices to work or is a wakeup device itself) and if it
      needs to be "active" for wakeup to work.  If that is the case, the
      function returns 0 without incrementing the device domain's counter
      of suspended devices and without executing genpd_stop_dev() for the
      device.  In consequence, the device is not stopped (e.g. its clock
      isn't disabled) and power is always supplied to its domain in the
      resulting system sleep state.
      
      However, pm_genpd_resume_noirq() doesn't repeat that check and it
      runs genpd_start_dev() and decrements the domain's counter of
      suspended devices even for the wakeup device that weren't stopped by
      pm_genpd_suspend_noirq().  As a result, the start callback may be run
      unnecessarily for them and their domains' counters of suspended
      devices may become negative.  Both outcomes aren't desirable, so fix
      pm_genpd_resume_noirq() to look for wakeup devices that might not be
      stopped by during system suspend.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Tested-by: NSimon Horman <horms@verge.net.au>
      Cc: stable@vger.kernel.org
      cc85b207
  8. 30 1月, 2012 1 次提交
    • R
      PM / Domains: Run late/early device suspend callbacks at the right time · 0496c8ae
      Rafael J. Wysocki 提交于
      After the introduction of the late/early phases of device
      suspend/resume during system-wide power transitions it is possible
      to make the generic PM domains code execute its default late/early
      device suspend/resume callbacks during those phases instead of the
      corresponding _noirq phases.  The _noirq device suspend/resume
      phases were only used for executing those callbacks, because this
      was the only way it could be done, but now we can do better.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      0496c8ae
  9. 27 1月, 2012 1 次提交
    • T
      PM / Domains: Add OF support · c8aa130b
      Thomas Abraham 提交于
      A device node pointer is added to generic pm domain structure to associate
      the domain with a node in the device tree. The platform code parses the
      device tree to find available nodes representing the generic power domain,
      instantiates the available domains and initializes them by calling
      pm_genpd_init().
      
      Nodes representing the devices include a phandle of the power domain to
      which it belongs. As these devices get instantiated, the driver code
      checkes for availability of a power domain phandle, converts the phandle
      to a device node and uses the new pm_genpd_of_add_device() api to
      associate the device with a power domain.
      
      pm_genpd_of_add_device() runs through its list of registered power domains
      and matches the OF node of the domain with the one specified as the
      parameter. If a match is found, the device is associated with the matched
      domain.
      
      Cc: Rob Herring <rob.herring@calxeda.com>
      Cc: Grant Likely <grant.likely@secretlab.ca>
      Signed-off-by: NThomas Abraham <thomas.abraham@linaro.org>
      Acked-by: NRafael J. Wysocki <rjw@sisk.pl>
      Signed-off-by: NKukjin Kim <kgene.kim@samsung.com>
      c8aa130b
  10. 14 1月, 2012 1 次提交
  11. 09 12月, 2011 1 次提交
  12. 07 12月, 2011 1 次提交
  13. 02 12月, 2011 6 次提交
    • R
      PM / Domains: Automatically update overoptimistic latency information · 0140d8bd
      Rafael J. Wysocki 提交于
      Measure the time of execution of the .stop(), .start(), .save_state()
      and .restore_state() PM domain device callbacks and if the result
      is greater than the corresponding latency value stored in the
      device's struct generic_pm_domain_data object, replace the inaccurate
      value with the measured time.
      
      Do analogously for the PM domains' .power_off() and .power_off()
      callbacks.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      0140d8bd
    • R
      PM / Domains: Add default power off governor function (v4) · 221e9b58
      Rafael J. Wysocki 提交于
      Add a function deciding whether or not a given PM domain should
      be powered off on the basis of the PM QoS constraints of devices
      belonging to it and their PM QoS timing data.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      221e9b58
    • R
      PM / Domains: Add device stop governor function (v4) · b02c999a
      Rafael J. Wysocki 提交于
      Add a function deciding whether or not devices should be stopped in
      pm_genpd_runtime_suspend() depending on their PM QoS constraints
      and stop/start timing values.  Make it possible to add information
      used by this function to device objects.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NMagnus Damm <damm@opensource.se>
      b02c999a
    • R
      PM / Domains: Rework system suspend callback routines (v2) · d23b9b00
      Rafael J. Wysocki 提交于
      The current generic PM domains code attempts to use the generic
      system suspend operations along with the domains' device stop/start
      routines, which requires device drivers to assume that their
      system suspend/resume (and hibernation/restore) callbacks will always
      be used with generic PM domains.  However, in theory, the same
      hardware may be used in devices that don't belong to any PM domain,
      in which case it would be necessary to add "fake" PM domains to
      satisfy the above assumption.  Also, the domain the hardware belongs
      to may not be handled with the help of the generic code.
      
      To allow device drivers that may be used along with the generic PM
      domains code of more flexibility, add new device callbacks,
      .suspend(), .suspend_late(), .resume_early(), .resume(), .freeze(),
      .freeze_late(), .thaw_early(), and .thaw(), that can be supplied by
      the drivers in addition to their "standard" system suspend and
      hibernation callbacks.  These new callbacks, if defined, will be used
      by the generic PM domains code for the handling of system suspend and
      hibernation instead of the "standard" ones.  This will allow drivers
      to be designed to work with generic PM domains as well as without
      them.
      
      For backwards compatibility, introduce default implementations of the
      new callbacks for PM domains that will execute pm_generic_suspend(),
      pm_generic_suspend_noirq(), pm_generic_resume_noirq(),
      pm_generic_resume(), pm_generic_freeze(), pm_generic_freeze_noirq(),
      pm_generic_thaw_noirq(), and pm_generic_thaw(), respectively, for the
      given device if its driver doesn't define those callbacks.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      d23b9b00
    • R
      PM / Domains: Introduce "save/restore state" device callbacks · ecf00475
      Rafael J. Wysocki 提交于
      The current PM domains code uses device drivers' .runtime_suspend()
      and .runtime_resume() callbacks as the "save device state" and
      "restore device state" operations, which may not be appropriate in
      general, because it forces drivers to assume that they always will
      be used with generic PM domains.  However, in theory, the same
      hardware may be used in devices that don't belong to any PM
      domain, in which case it would be necessary to add "fake" PM
      domains to satisfy the above assumption.  It also may be located in
      a PM domain that's not handled with the help of the generic code.
      
      To allow device drivers that may be used along with the generic PM
      domains code of more flexibility, introduce new device callbacks,
      .save_state() and .restore_state(), that can be supplied by the
      drivers in addition to their "standard" runtime PM callbacks.  This
      will allow the drivers to be designed to work with generic PM domains
      as well as without them.
      
      For backwards compatibility, introduce default .save_state() and
      .restore_state() callback routines for PM domains that will execute
      a device driver's .runtime_suspend() and .runtime_resume() callbacks,
      respectively, for the given device if the driver doesn't provide its
      own implementations of .save_state() and .restore_state().
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      ecf00475
    • R
      PM / Domains: Make it possible to use per-device domain callbacks · d5e4cbfe
      Rafael J. Wysocki 提交于
      The current generic PM domains code requires that the same .stop(),
      .start() and .active_wakeup() device callback routines be used for
      all devices in the given domain, which is inflexible and may not
      cover some specific use cases.  For this reason, make it possible to
      use device specific .start()/.stop() and .active_wakeup() callback
      routines by adding corresponding callback pointers to struct
      generic_pm_domain_data.  Add a new helper routine,
      pm_genpd_register_callbacks(), that can be used to populate
      the new per-device callback pointers.
      
      Modify the shmobile's power domains code to allow drivers to add
      their own code to be run during the device stop and start operations
      with the help of the new callback pointers.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NMagnus Damm <damm@opensource.se>
      d5e4cbfe
  14. 22 10月, 2011 1 次提交
    • R
      PM / Sleep: Mark devices involved in wakeup signaling during suspend · 4ca46ff3
      Rafael J. Wysocki 提交于
      The generic PM domains code in drivers/base/power/domain.c has
      to avoid powering off domains that provide power to wakeup devices
      during system suspend.  Currently, however, this only works for
      wakeup devices directly belonging to the given domain and not for
      their children (or the children of their children and so on).
      Thus, if there's a wakeup device whose parent belongs to a power
      domain handled by the generic PM domains code, the domain will be
      powered off during system suspend preventing the device from
      signaling wakeup.
      
      To address this problem introduce a device flag, power.wakeup_path,
      that will be set during system suspend for all wakeup devices,
      their parents, the parents of their parents and so on.  This way,
      all wakeup paths in the device hierarchy will be marked and the
      generic PM domains code will only need to avoid powering off
      domains containing devices whose power.wakeup_path is set.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      4ca46ff3
  15. 27 9月, 2011 1 次提交
    • R
      PM / Domains: Split device PM domain data into base and need_restore · cd0ea672
      Rafael J. Wysocki 提交于
      The struct pm_domain_data data type is defined in such a way that
      adding new fields specific to the generic PM domains code will
      require include/linux/pm.h to be modified.  As a result, data types
      used only by the generic PM domains code will be defined in two
      headers, although they all should be defined in pm_domain.h and
      pm.h will need to include more headers, which won't be very nice.
      
      For this reason change the definition of struct pm_subsys_data
      so that its domain_data member is a pointer, which will allow
      struct pm_domain_data to be subclassed by various PM domains
      implementations.  Remove the need_restore member from
      struct pm_domain_data and make the generic PM domains code
      subclass it by adding the need_restore member to the new data type.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      cd0ea672
  16. 25 8月, 2011 9 次提交
    • R
      PM / Domains: Preliminary support for devices with power.irq_safe set · 0aa2a221
      Rafael J. Wysocki 提交于
      The generic PM domains framework currently doesn't work with devices
      whose power.irq_safe flag is set, because runtime PM callbacks for
      such devices are run with interrupts disabled and the callbacks
      provided by the generic PM domains framework use domain mutexes
      and may sleep.  However, such devices very well may belong to
      power domains on some systems, so the generic PM domains framework
      should take them into account.
      
      For this reason, modify the generic PM domains framework so that the
      domain .power_off() and .power_on() callbacks are never executed for
      a domain containing devices with power.irq_safe set, although the
      .stop_device() and .start_device() callbacks are still run for them.
      
      Additionally, introduce a flag allowing the creator of a
      struct generic_pm_domain object to indicate that its .stop_device()
      and .start_device() callbacks may be run in interrupt context
      (might_sleep_if() triggers if that flag is not set and one of those
      callbacks is run in interrupt context).
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      0aa2a221
    • R
      PM / Domains: Use power.sybsys_data to reduce overhead · 4605ab65
      Rafael J. Wysocki 提交于
      Currently pm_genpd_runtime_resume() has to walk the list of devices
      from the device's PM domain to find the corresponding device list
      object containing the need_restore field to check if the driver's
      .runtime_resume() callback should be executed for the device.
      This is suboptimal and can be simplified by using power.sybsys_data
      to store device information used by the generic PM domains code.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      4605ab65
    • R
      PM / Domains: Rename argument of pm_genpd_add_subdomain() · bc0403ff
      Rafael J. Wysocki 提交于
      Change the name of the second argument of pm_genpd_add_subdomain()
      so that it is (a) shorter and (b) in agreement with the name of
      the second argument of pm_genpd_add_subdomain().
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      bc0403ff
    • R
      PM / Domains: Rename GPD_STATE_WAIT_PARENT to GPD_STATE_WAIT_MASTER · 17877eb5
      Rafael J. Wysocki 提交于
      Since it is now possible for a PM domain to have multiple masters
      instead of one parent, rename the "wait for parent" status to reflect
      the new situation.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      17877eb5
    • R
      PM / Domains: Allow generic PM domains to have multiple masters · 5063ce15
      Rafael J. Wysocki 提交于
      Currently, for a given generic PM domain there may be only one parent
      domain (i.e. a PM domain it depends on).  However, there is at least
      one real-life case in which there should be two parents (masters) for
      one PM domain (the A3RV domain on SH7372 turns out to depend on the
      A4LC domain and it depends on the A4R domain and the same time). For
      this reason, allow a PM domain to have multiple parents (masters) by
      introducing objects representing links between PM domains.
      
      The (logical) links between PM domains represent relationships in
      which one domain is a master (i.e. it is depended on) and another
      domain is a slave (i.e. it depends on the master) with the rule that
      the slave cannot be powered on if the master is not powered on and
      the master cannot be powered off if the slave is not powered off.
      Each struct generic_pm_domain object representing a PM domain has
      two lists of links, a list of links in which it is a master and
      a list of links in which it is a slave.  The first of these lists
      replaces the list of subdomains and the second one is used in place
      of the parent pointer.
      
      Each link is represented by struct gpd_link object containing
      pointers to the master and the slave and two struct list_head
      members allowing it to hook into two lists (the master's list
      of "master" links and the slave's list of "slave" links).  This
      allows the code to get to the link from each side (either from
      the master or from the slave) and follow it in each direction.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      5063ce15
    • R
      PM / Domains: Add "wait for parent" status for generic PM domains · 3f241775
      Rafael J. Wysocki 提交于
      The next patch will make it possible for a generic PM domain to have
      multiple parents (i.e. multiple PM domains it depends on).  To
      prepare for that change it is necessary to change pm_genpd_poweron()
      so that it doesn't jump to the start label after running itself
      recursively for the parent domain.  For this purpose, introduce a new
      PM domain status value GPD_STATE_WAIT_PARENT that will be set by
      pm_genpd_poweron() before calling itself recursively for the parent
      domain and modify the code in drivers/base/power/domain.c so that
      the GPD_STATE_WAIT_PARENT status is guaranteed to be preserved during
      the execution of pm_genpd_poweron() for the parent.
      
      This change also causes pm_genpd_add_subdomain() and
      pm_genpd_remove_subdomain() to wait for started pm_genpd_poweron() to
      complete and allows pm_genpd_runtime_resume() to avoid dropping the
      lock after powering on the PM domain.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      3f241775
    • R
      PM / Domains: Make pm_genpd_poweron() always survive parent removal · 9e08cf42
      Rafael J. Wysocki 提交于
      If pm_genpd_remove_subdomain() is called to remove a PM domain's
      subdomain and pm_genpd_poweron() is called for that subdomain at
      the same time, and the pm_genpd_poweron() called by it recursively
      for the parent returns an error, the first pm_genpd_poweron()'s
      error code path will attempt to decrement the subdomain counter of
      a PM domain that it's not a subdomain of any more.
      
      Rearrange the code in pm_genpd_poweron() to prevent this from
      happening.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      9e08cf42
    • R
      PM / Domains: Do not take parent locks to modify subdomain counters · 3c07cbc4
      Rafael J. Wysocki 提交于
      After the subdomain counter in struct generic_pm_domain has been
      changed into an atomic_t field, it is possible to modify
      pm_genpd_poweron() and pm_genpd_poweroff() so that they don't take
      the parents locks.  This requires pm_genpd_poweron() to increment
      the parent's subdomain counter before calling itself recursively
      for the parent and to decrement it if an error is to be returned.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      3c07cbc4
    • R
      PM / Domains: Implement subdomain counters as atomic fields · c4bb3160
      Rafael J. Wysocki 提交于
      Currently, pm_genpd_poweron() and pm_genpd_poweroff() need to take
      the parent PM domain's lock in order to modify the parent's counter
      of active subdomains in a nonracy way.  This causes the locking to be
      considerably complex and in fact is not necessary, because the
      subdomain counters may be implemented as atomic fields and they
      won't have to be modified under a lock.
      
      Replace the unsigned in sd_count field in struct generic_pm_domain
      by an atomic_t one and modify the code in drivers/base/power/domain.c
      to take this change into account.
      
      This patch doesn't change the locking yet, that is going to be done
      in a separate subsequent patch.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      c4bb3160
  17. 14 8月, 2011 1 次提交
  18. 06 8月, 2011 1 次提交
    • R
      PM / Domains: Fix pm_genpd_poweron() · fe202fde
      Rafael J. Wysocki 提交于
      The local variable ret is defined twice in pm_genpd_poweron(), which
      causes this function to always return 0, even if the PM domain's
      .power_on() callback fails, in which case an error code should be
      returned.
      
      Remove the wrong second definition of ret and additionally remove an
      unnecessary definition of wait from pm_genpd_poweron().
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      fe202fde
  19. 15 7月, 2011 2 次提交
  20. 13 7月, 2011 1 次提交