1. 17 7月, 2012 1 次提交
    • M
      driver core: Move deferred devices to the end of dpm_list before probing · 8153584e
      Mark Brown 提交于
      When deferred probe was originally added the idea was that devices which
      defer their probes would move themselves to the end of dpm_list in order
      to try to keep the assumptions that we're making about the list being in
      roughly the order things should be suspended correct. However this hasn't
      been what's been happening and doing it requires a lot of duplicated code
      to do the moves.
      
      Instead take a simple, brute force solution and have the deferred probe
      code push devices to the end of dpm_list before it retries the probe. This
      does mean we lock the dpm_list a bit more often but it's very simple and
      the code shouldn't be a fast path. We do the move with the deferred mutex
      dropped since doing things with fewer locks held simultaneously seems like
      a good idea.
      
      This approach was most recently suggested by Grant Likely.
      Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
      Acked-by: NRafael J. Wysocki <rjw@sisk.pl>
      Cc: Grant Likely <grant.likely@secretlab.ca>,
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8153584e
  2. 14 6月, 2012 2 次提交
  3. 09 3月, 2012 3 次提交
    • G
      driver core: minor comment formatting cleanups · 8b0372a2
      Greg Kroah-Hartman 提交于
      Came in in the deferred probe patch, quick, clean them up before a
      kernel janitor finds them and sends me 4 individual patches to fix them
      up...
      
      Cc: Grant Likely <grant.likely@secretlab.ca>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8b0372a2
    • G
      driver core: move the deferred probe pointer into the private area · ef8a3fd6
      Greg Kroah-Hartman 提交于
      Nothing outside of the driver core needs to get to the deferred probe
      pointer, so move it inside the private area of 'struct device' so no one
      tries to mess around with it.
      
      Cc: Grant Likely <grant.likely@secretlab.ca>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ef8a3fd6
    • G
      drivercore: Add driver probe deferral mechanism · d1c3414c
      Grant Likely 提交于
      Allow drivers to report at probe time that they cannot get all the resources
      required by the device, and should be retried at a later time.
      
      This should completely solve the problem of getting devices
      initialized in the right order.  Right now this is mostly handled by
      mucking about with initcall ordering which is a complete hack, and
      doesn't even remotely handle the case where device drivers are in
      modules.  This approach completely sidesteps the issues by allowing
      driver registration to occur in any order, and any driver can request
      to be retried after a few more other drivers get probed.
      
      v4: - Integrate Manjunath's addition of a separate workqueue
          - Change -EAGAIN to -EPROBE_DEFER for drivers to trigger deferral
          - Update comment blocks to reflect how the code really works
      v3: - Hold off workqueue scheduling until late_initcall so that the bulk
            of driver probes are complete before we start retrying deferred devices.
          - Tested with simple use cases.  Still needs more testing though.
            Using it to get rid of the gpio early_initcall madness, or to replace
            the ASoC internal probe deferral code would be ideal.
      v2: - added locking so it should no longer be utterly broken in that regard
          - remove device from deferred list at device_del time.
          - Still completely untested with any real use case, but has been
            boot tested.
      Signed-off-by: NGrant Likely <grant.likely@secretlab.ca>
      Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Dilan Lee <dilee@nvidia.com>
      Cc: Manjunath GKondaiah <manjunath.gkondaiah@linaro.org>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: Tony Lindgren <tony@atomide.com>
      Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
      Reviewed-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
      Acked-by: NDavid Daney <david.daney@cavium.com>
      Reviewed-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d1c3414c
  4. 27 9月, 2011 1 次提交
  5. 18 5月, 2011 1 次提交
    • R
      PM / Runtime: Rework runtime PM handling during driver removal · e1866b33
      Rafael J. Wysocki 提交于
      The driver core tries to prevent race conditions between runtime PM
      and driver removal from happening by incrementing the runtime PM
      usage counter of the device and executing pm_runtime_barrier() before
      running the bus notifier and the ->remove() callbacks provided by the
      device's subsystem or driver.  This guarantees that, if a future
      runtime suspend of the device has been scheduled or a runtime resume
      or idle request has been queued up right before the driver removal,
      it will be canceled or waited for to complete and no other
      asynchronous runtime suspend or idle requests for the device will be
      put into the PM workqueue until the ->remove() callback returns.
      However, it doesn't prevent resume requests from being queued up
      after pm_runtime_barrier() has been called and it doesn't prevent
      pm_runtime_resume() from executing the device subsystem's runtime
      resume callback.  Morever, it prevents the device's subsystem or
      driver from putting the device into the suspended state by calling
      pm_runtime_suspend() from its ->remove() routine.  This turns out to
      be a major inconvenience for some subsystems and drivers that want to
      leave the devices they handle in the suspended state.
      
      To really prevent runtime PM callbacks from racing with the bus
      notifier callback in __device_release_driver(), which is necessary,
      because the notifier is used by some subsystems to carry out
      operations affecting the runtime PM functionality, use
      pm_runtime_get_sync() instead of the combination of
      pm_runtime_get_noresume() and pm_runtime_barrier().  This will resume
      the device if it's in the suspended state and will prevent it from
      being suspended again until pm_runtime_put_*() is called.
      
      To allow subsystems and drivers to put devices into the suspended
      state by calling pm_runtime_suspend() from their ->remove() routines,
      execute pm_runtime_put_sync() after running the bus notifier in
      __device_release_driver().  This will require subsystems and drivers
      to make their ->remove() callbacks avoid races with runtime PM
      directly, but it will allow of more flexibility in the handling of
      devices during the removal of their drivers.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      e1866b33
  6. 23 4月, 2011 2 次提交
  7. 06 8月, 2010 1 次提交
    • M
      Driver core: Add BUS_NOTIFY_BIND_DRIVER · 45daef0f
      Magnus Damm 提交于
      Add BUS_NOTIFY_BIND_DRIVER as a bus notifier event.
      
      For driver binding/unbinding we with this in
      place have the following bus notifier events:
       - BUS_NOTIFY_BIND_DRIVER - before ->probe()
       - BUS_NOTIFY_BOUND_DRIVER - after ->probe()
       - BUS_NOTIFY_UNBIND_DRIVER - before ->remove()
       - BUS_NOTIFY_UNBOUND_DRIVER - after ->remove()
      
      The event BUS_NOTIFY_BIND_DRIVER allows bus code
      to be notified that ->probe() is about to be called.
      
      Useful for bus code that needs to setup hardware before
      the driver gets to run. With this in place platform
      drivers can be loaded and unloaded as modules and the
      new BIND event allows bus code to control for instance
      device clocks that must be enabled before the driver
      can be executed.
      
      Without this patch there is no way for the bus code to
      get notified that a modular driver is about to be probed.
      Signed-off-by: NMagnus Damm <damm@opensource.se>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      45daef0f
  8. 22 5月, 2010 1 次提交
  9. 08 3月, 2010 1 次提交
    • G
      Driver core: create lock/unlock functions for struct device · 8e9394ce
      Greg Kroah-Hartman 提交于
      In the future, we are going to be changing the lock type for struct
      device (once we get the lockdep infrastructure properly worked out)  To
      make that changeover easier, and to possibly burry the lock in a
      different part of struct device, let's create some functions to lock and
      unlock a device so that no out-of-core code needs to be changed in the
      future.
      
      This patch creates the device_lock/unlock/trylock() functions, and
      converts all in-tree users to them.
      
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Jean Delvare <khali@linux-fr.org>
      Cc: Dave Young <hidave.darkstar@gmail.com>
      Cc: Ming Lei <tom.leiming@gmail.com>
      Cc: Jiri Kosina <jkosina@suse.cz>
      Cc: Phil Carmody <ext-phil.2.carmody@nokia.com>
      Cc: Arjan van de Ven <arjan@linux.intel.com>
      Cc: Cornelia Huck <cornelia.huck@de.ibm.com>
      Cc: Rafael J. Wysocki <rjw@sisk.pl>
      Cc: Pavel Machek <pavel@ucw.cz>
      Cc: Len Brown <len.brown@intel.com>
      Cc: Magnus Damm <damm@igel.co.jp>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: Randy Dunlap <randy.dunlap@oracle.com>
      Cc: Stefan Richter <stefanr@s5r6.in-berlin.de>
      Cc: David Brownell <dbrownell@users.sourceforge.net>
      Cc: Vegard Nossum <vegard.nossum@gmail.com>
      Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
      Cc: Alex Chiang <achiang@hp.com>
      Cc: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andrew Patterson <andrew.patterson@hp.com>
      Cc: Yu Zhao <yu.zhao@intel.com>
      Cc: Dominik Brodowski <linux@dominikbrodowski.net>
      Cc: Samuel Ortiz <sameo@linux.intel.com>
      Cc: Wolfram Sang <w.sang@pengutronix.de>
      Cc: CHENG Renquan <rqcheng@smu.edu.sg>
      Cc: Oliver Neukum <oliver@neukum.org>
      Cc: Frans Pop <elendil@planet.nl>
      Cc: David Vrabel <david.vrabel@csr.com>
      Cc: Kay Sievers <kay.sievers@vrfy.org>
      Cc: Sarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      
      8e9394ce
  10. 04 12月, 2009 1 次提交
  11. 16 9月, 2009 1 次提交
  12. 23 8月, 2009 1 次提交
    • R
      PM: Introduce core framework for run-time PM of I/O devices (rev. 17) · 5e928f77
      Rafael J. Wysocki 提交于
      Introduce a core framework for run-time power management of I/O
      devices.  Add device run-time PM fields to 'struct dev_pm_info'
      and device run-time PM callbacks to 'struct dev_pm_ops'.  Introduce
      a run-time PM workqueue and define some device run-time PM helper
      functions at the core level.  Document all these things.
      
      Special thanks to Alan Stern for his help with the design and
      multiple detailed reviews of the pereceding versions of this patch
      and to Magnus Damm for testing feedback.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NMagnus Damm <damm@igel.co.jp>
      5e928f77
  13. 16 6月, 2009 2 次提交
  14. 22 4月, 2009 1 次提交
    • A
      driver synchronization: make scsi_wait_scan more advanced · d4d5291c
      Arjan van de Ven 提交于
      There is currently only one way for userspace to say "wait for my storage
      device to get ready for the modules I just loaded": to load the
      scsi_wait_scan module. Expectations of userspace are that once this
      module is loaded, all the (storage) devices for which the drivers
      were loaded before the module load are present.
      
      Now, there are some issues with the implementation, and the async
      stuff got caught in the middle of this: The existing code only
      waits for the scsy async probing to finish, but it did not take
      into account at all that probing might not have begun yet.
      (Russell ran into this problem on his computer and the fix works for him)
      
      This patch fixes this more thoroughly than the previous "fix", which
      had some bad side effects (namely, for kernel code that wanted to wait for
      the scsi scan it would also do an async sync, which would deadlock if you did
      it from async context already.. there's a report about that on lkml):
      The patch makes the module first wait for all device driver probes, and then it
      will wait for the scsi parallel scan to finish.
      Signed-off-by: NArjan van de Ven <arjan@linux.intel.com>
      Tested-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      d4d5291c
  15. 25 3月, 2009 3 次提交
  16. 22 2月, 2009 1 次提交
  17. 10 1月, 2009 1 次提交
  18. 07 1月, 2009 3 次提交
  19. 17 10月, 2008 1 次提交
    • A
      device model: Do a quickcheck for driver binding before doing an expensive check · 6cd49586
      Arjan van de Ven 提交于
      This patch adds a quick check for the driver<->device match before
      taking the locks and doin gthe expensive checks. Taking the lock hurts
      in asynchronous boot context where the device lock gets hit; one of the
      init functions takes the lock and goes to do an expensive hardware init;
      the other init functions walk the same PCI list and get stuck on the
      lock as a result.
      
      For the common case, we can know there's no chance whatsoever of a match
      if the device isn't in the drivers ID table... so this patch does that
      check as a best-effort-avoid-the-lock approach.
      
      Bootcharts for before and after can be seen at
      http://www.fenrus.org/before.svg
      http://www.fenrus.org/after.svg
      
      Note the long time "agp_ali_init" takes in the first graph; my laptop
      doesn't even have an ALI chip in it!  (the bootgraphs look a bit
      dissimilar, but that's the point, the first one has a bunch of arbitrary
      delays in it that cause it to look very different)
      
      This reduces my kernel boot time by about 20%
      Signed-off-by: NArjan van de Ven <arjan@linux.intel.com>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      6cd49586
  20. 20 4月, 2008 1 次提交
  21. 25 1月, 2008 5 次提交
    • G
      Driver core: coding style fixes · 4a3ad20c
      Greg Kroah-Hartman 提交于
      Fix up a number of coding style issues in the drivers/base/ directory
      that have annoyed me over the years.  checkpatch.pl is now very happy.
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      4a3ad20c
    • A
      Driver core: fix race in __device_release_driver · ef2c5174
      Alan Stern 提交于
      This patch (as1013) was suggested by David Woodhouse; it fixes a race
      in the driver core.  If a device is unregistered at the same time as
      its driver is unloaded, the driver's code pages may be unmapped while
      the remove method is still running.  The calls to get_driver() and
      put_driver() were intended to prevent this, but they don't work if the
      driver's module count has already dropped to 0.
      
      Instead, the patch keeps the device on the driver's list until after
      the remove method has returned.  This forces the necessary
      synchronization to occur.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NDavid Woodhouse <dwmw2@infradead.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      ef2c5174
    • G
      Driver core: clean up debugging messages · 7dc72b28
      Greg Kroah-Hartman 提交于
      The driver core debugging messages are a mess.  This provides a unified
      message that makes them actually useful.
      
      The format for new kobject debug messages should be:
      	driver/bus/class: 'OBJECT_NAME': FUNCTION_NAME: message.\n
      
      Note, the class code is not changed in this patch due to pending patches
      in my queue that this would conflict with.  A later patch will clean
      them up.
      
      Cc: Kay Sievers <kay.sievers@vrfy.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      7dc72b28
    • G
      Driver core: move the static kobject out of struct driver · e5dd1278
      Greg Kroah-Hartman 提交于
      This patch removes the kobject, and a few other driver-core-only fields
      out of struct driver and into the driver core only.  Now drivers can be
      safely create on the stack or statically (like they currently are.)
      
      Cc: Kay Sievers <kay.sievers@vrfy.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      e5dd1278
    • G
      driver core: remove fields from struct bus_type · c6f7e72a
      Greg Kroah-Hartman 提交于
      struct bus_type is static everywhere in the kernel.  This moves the
      kobject in the structure out of it, and a bunch of other private only to
      the driver core fields are now moved to a private structure.  This lets
      us dynamically create the backing kobject properly and gives us the
      chance to be able to document to users exactly how to use the struct
      bus_type as there are no fields they can improperly access.
      
      Thanks to Kay for the build fixes on this patch.
      
      Cc: Kay Sievers <kay.sievers@vrfy.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      c6f7e72a
  22. 12 7月, 2007 2 次提交
  23. 09 6月, 2007 1 次提交
  24. 03 5月, 2007 1 次提交
  25. 28 4月, 2007 2 次提交