1. 28 9月, 2011 2 次提交
    • M
      PM / Runtime: Replace dev_dbg() with trace_rpm_*() · c3dc2f14
      Ming Lei 提交于
      This patch replaces dev_dbg with trace_rpm_* inside
      the three important functions:
      
      	rpm_idle
      	rpm_suspend
      	rpm_resume
      
      Trace points have the below advantages compared with dev_dbg:
      
      	- trace points include much runtime information(such as
      	running cpu, current task, ...)
      
      	- most of linux distributions may disable "verbose debug"
      	driver debug compile switch, so it is very difficult to
      	report/debug runtime pm related problems from distribution
      	users without this kind of debug information.
      
      	- for upstream kernel users, enableing the debug switch will
      	produce many useless "rpm_resume" output, and it is very noise.
      
      	- dev_dbg inside rpm_suspend/rpm_resume may have some effects
      	on runtime pm behaviour of console devicer
      Signed-off-by: NMing Lei <ming.lei@canonical.com>
      Acked-by: NSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      c3dc2f14
    • R
      PM / Runtime: Don't run callbacks under lock for power.irq_safe set · ad3c36a5
      Rafael J. Wysocki 提交于
      The rpm_suspend() and rpm_resume() routines execute subsystem or PM
      domain callbacks under power.lock if power.irq_safe is set for the
      given device.  This is inconsistent with that rpm_idle() does after
      commit 02b26774 (PM / Runtime: Allow _put_sync() from
      interrupts-disabled context) and is problematic for subsystems and PM
      domains wanting to use power.lock for synchronization in their
      runtime PM callbacks.
      
      This change requires the code checking if the device's runtime PM
      status is RPM_SUSPENDING or RPM_RESUMING to be modified too, to take
      the power.irq_safe set case into account (that code wasn't reachable
      before with power.irq_safe set, because it's executed with the
      device's power.lock held).
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Reviewed-by: NMing Lei <tom.leiming@gmail.com>
      Reviewed-by: NKevin Hilman <khilman@ti.com>
      ad3c36a5
  2. 27 9月, 2011 2 次提交
    • 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
    • R
      PM / Clocks: Do not acquire a mutex under a spinlock · e8b364b8
      Rafael J. Wysocki 提交于
      Commit b7ab83ed (PM: Use spinlock instead of mutex in clock
      management functions) introduced a regression causing clocks_mutex
      to be acquired under a spinlock.  This happens because
      pm_clk_suspend() and pm_clk_resume() call pm_clk_acquire() under
      pcd->lock, but pm_clk_acquire() executes clk_get() which causes
      clocks_mutex to be acquired.  Similarly, __pm_clk_remove(),
      executed under pcd->lock, calls clk_put(), which also causes
      clocks_mutex to be acquired.
      
      To fix those problems make pm_clk_add() call pm_clk_acquire(), so
      that pm_clk_suspend() and pm_clk_resume() don't have to do that.
      Change pm_clk_remove() and pm_clk_destroy() to separate
      modifications of the pcd->clock_list list from the actual removal of
      PM clock entry objects done by __pm_clk_remove().
      Reported-and-tested-by: NGuennadi Liakhovetski <g.liakhovetski@gmx.de>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      e8b364b8
  3. 06 9月, 2011 1 次提交
  4. 25 8月, 2011 14 次提交
    • 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: Move clock-related definitions and headers to separate file · b5e8d269
      Rafael J. Wysocki 提交于
      Since the PM clock management code in drivers/base/power/clock_ops.c
      is used for both runtime PM and system suspend/hibernation, the
      definitions of data structures and headers related to it should not
      be located in include/linux/pm_rumtime.h.  Move them to a separate
      header file.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      b5e8d269
    • 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: Reference counting of power.subsys_data · ef27bed1
      Rafael J. Wysocki 提交于
      Since the power.subsys_data device field will be used by multiple
      filesystems, introduce a reference counting mechanism for it to avoid
      freeing it prematurely or changing its value at a wrong time.
      
      Make the PM clocks management code that currently is the only user of
      power.subsys_data use the new reference counting.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      ef27bed1
    • R
      PM: Introduce struct pm_subsys_data · 5c095a0e
      Rafael J. Wysocki 提交于
      Introduce struct pm_subsys_data that may be subclassed by subsystems
      to store subsystem-specific information related to the device.  Move
      the clock management fields accessed through the power.subsys_data
      pointer in struct device to the new strucutre.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      5c095a0e
    • 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
    • L
      firmware loader: allow builtin firmware load even if usermodehelper is disabled · caca9510
      Linus Torvalds 提交于
      In commit a144c6a6 ("PM: Print a warning if firmware is requested
      when tasks are frozen") we not only printed a warning if somebody tried
      to load the firmware when tasks are frozen - we also failed the load.
      
      But that check was done before the check for built-in firmware, and then
      when we disallowed usermode helpers during bootup (commit 288d5abe:
      "Boot up with usermodehelper disabled"), that actually means that
      built-in modules can no longer load their firmware even if the firmware
      is built in too.  Which used to work, and some people depended on it for
      the R100 driver.
      
      So move the test for usermodehelper_is_disabled() down, to after
      checking the built-in firmware.
      
      This should fix:
      
      	https://bugzilla.kernel.org/show_bug.cgi?id=40952Reported-by: NJames Cloos <cloos@hjcloos.com>
      Bisected-by: NElimar Riesebieter <riesebie@lxtec.de>
      Cc: Michel Dänzer <michel@daenzer.net>
      Cc: Rafael Wysocki <rjw@sisk.pl>
      Cc: Greg Kroah-Hartman <gregkh@suse.de>
      Cc: Valdis Kletnieks <valdis.kletnieks@vt.edu>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      caca9510
    • R
      PM: Use spinlock instead of mutex in clock management functions · b7ab83ed
      Rafael J. Wysocki 提交于
      The lock member of struct pm_clk_data is of type struct mutex,
      which is a problem, because the suspend and resume routines
      defined in drivers/base/power/clock_ops.c cannot be executed
      with interrupts disabled for this reason.  Modify
      struct pm_clk_data so that its lock member is a spinlock.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NMagnus Damm <damm@opensource.se>
      b7ab83ed
  5. 23 8月, 2011 1 次提交
  6. 16 8月, 2011 1 次提交
  7. 14 8月, 2011 2 次提交
    • C
      PM / Runtime: Add might_sleep() to runtime PM functions · 311aab73
      Colin Cross 提交于
      Some of the entry points to pm runtime are not safe to
      call in atomic context unless pm_runtime_irq_safe() has
      been called.  Inspecting the code, it is not immediately
      obvious that the functions sleep at all, as they run
      inside a spin_lock_irqsave, but under some conditions
      they can drop the lock and turn on irqs.
      
      If a driver incorrectly calls the pm_runtime apis, it can
      cause sleeping and irq processing when it expects to stay
      in atomic context.
      
      Add might_sleep_if to the majority of the __pm_runtime_* entry points
      to enforce correct usage.
      
      Add pm_runtime_put_sync_autosuspend to the list of
      functions that can be called in atomic context.
      Signed-off-by: NColin Cross <ccross@android.com>
      Reviewed-by: NKevin Hilman <khilman@ti.com>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      311aab73
    • R
      PM / Domains: Fix build for CONFIG_PM_RUNTIME unset · 17f2ae7f
      Rafael J. Wysocki 提交于
      Function genpd_queue_power_off_work() is not defined for
      CONFIG_PM_RUNTIME, so pm_genpd_poweroff_unused() causes a build
      error to happen in that case.  Fix the problem by making
      pm_genpd_poweroff_unused() depend on CONFIG_PM_RUNTIME too.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      17f2ae7f
  8. 12 8月, 2011 1 次提交
  9. 09 8月, 2011 2 次提交
    • A
      drivers/base/devtmpfs.c: correct annotation of `setup_done' · f9e0b159
      Arnaud Lacombe 提交于
      This fixes the following section mismatch issue:
      
      WARNING: vmlinux.o(.text+0x1192bf): Section mismatch in reference from the function devtmpfsd() to the variable .init.data:setup_done
      The function devtmpfsd() references the variable __initdata setup_done.
      This is often because devtmpfsd lacks a __initdata annotation or the annotation of setup_done is wrong.
      
      WARNING: vmlinux.o(.text+0x119342): Section mismatch in reference from the function devtmpfsd() to the variable .init.data:setup_done
      The function devtmpfsd() references the variable __initdata setup_done.
      This is often because devtmpfsd lacks a __initdata annotation or the annotation of setup_done is wrong.
      Signed-off-by: NArnaud Lacombe <lacombar@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      f9e0b159
    • R
      driver core: fix kernel-doc warning in platform.c · 7de636fa
      Randy Dunlap 提交于
      Warning(drivers/base/platform.c:50): No description found for parameter 'pdev'
      Warning(drivers/base/platform.c:50): Excess function parameter 'dev' description in 'arch_setup_pdev_archdata'
      Signed-off-by: NRandy Dunlap <rdunlap@xenotime.net>
      Cc: Greg Kroah-Hartman <gregkh@suse.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      7de636fa
  10. 06 8月, 2011 2 次提交
    • K
      PM / Runtime: Allow _put_sync() from interrupts-disabled context · 02b26774
      Kevin Hilman 提交于
      Currently the use of pm_runtime_put_sync() is not safe from
      interrupts-disabled context because rpm_idle() will release the
      spinlock and enable interrupts for the idle callbacks.  This enables
      interrupts during a time where interrupts were expected to be
      disabled, and can have strange side effects on drivers that expected
      interrupts to be disabled.
      
      This is not a bug since the documentation clearly states that only
      _put_sync_suspend() is safe in IRQ-safe mode.
      
      However, pm_runtime_put_sync() could be made safe when in IRQ-safe
      mode by releasing the spinlock but not re-enabling interrupts, which
      is what this patch aims to do.
      
      Problem was found when using some buggy drivers that set
      pm_runtime_irq_safe() and used _put_sync() in interrupts-disabled
      context.
      Reported-by: NColin Cross <ccross@google.com>
      Tested-by: NNishanth Menon <nm@ti.com>
      Signed-off-by: NKevin Hilman <khilman@ti.com>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      02b26774
    • 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
  11. 28 7月, 2011 1 次提交
    • A
      devtmpfs: missing initialialization in never-hit case · 9d108d25
      Al Viro 提交于
      create_path() on something without a single / in it will return err
      without initializing it.  It actually can't happen (we call that thing
      only if create on the same path returns -ENOENT, which won't happen
      happen for single-component path), but in this case initializing err
      to 0 is more than making compiler to STFU - would be the right thing
      to return on such paths; the function creates a parent directory of
      given pathname and in that case it has no work to do...
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      9d108d25
  12. 27 7月, 2011 2 次提交
  13. 26 7月, 2011 1 次提交
    • A
      fix devtmpfs race · e13889ba
      Al Viro 提交于
      After we's done complete(&req->done), there's nothing to prevent the
      scope containing *req from being gone and *req overwritten by any
      kind of junk.  So we must read req->next before that...
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      e13889ba
  14. 25 7月, 2011 1 次提交
  15. 23 7月, 2011 3 次提交
  16. 20 7月, 2011 3 次提交
  17. 16 7月, 2011 1 次提交