1. 24 12月, 2010 1 次提交
  2. 23 10月, 2010 1 次提交
  3. 11 8月, 2010 2 次提交
  4. 30 6月, 2010 1 次提交
    • A
      USB: obey the sysfs power/wakeup setting · 48826626
      Alan Stern 提交于
      This patch (as1403) is a partial reversion of an earlier change
      (commit 5f677f1d "USB: fix remote
      wakeup settings during system sleep").  After hearing from a user, I
      realized that remote wakeup should be enabled during system sleep
      whenever userspace allows it, and not only if a driver requests it
      too.
      
      Indeed, there could be a device with no driver, that does nothing but
      generate a wakeup request when the user presses a button.  Such a
      device should be allowed to do its job.
      
      The problem fixed by the earlier patch -- device generating a wakeup
      request for no reason, causing system suspend to abort -- was also
      addressed by a later patch ("USB: don't enable remote wakeup by
      default", accepted but not yet merged into mainline).  The device
      won't be able to generate the bogus wakeup requests because it will be
      disabled for remote wakeup by default.  Hence this reversion will not
      re-introduce any old problems.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Cc: stable <stable@kernel.org> [.34]
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      
      48826626
  5. 05 6月, 2010 1 次提交
  6. 21 5月, 2010 4 次提交
  7. 23 4月, 2010 2 次提交
    • A
      USB: put claimed interfaces in the "suspended" state · 571dc79d
      Alan Stern 提交于
      This patch (as1370) fixes a bug in the USB runtime power management
      code.  When a driver claims an interface, it doesn't expect to need to
      call usb_autopm_get_interface() or usb_autopm_put_interface() for
      runtime PM to work.  Runtime PM can be controlled by the driver's
      primary interface; the additional interfaces it claims shouldn't
      interfere.  As things stand, the claimed interfaces will prevent the
      device from autosuspending.
      
      To fix this problem, the patch sets interfaces to the suspended state
      when they are claimed.
      
      Also, although in theory this shouldn't matter, the patch changes the
      suspend code so that interfaces are suspended in reverse order from
      detection and resuming.  This is how the PM core works, and we ought
      to use the same approach.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Debugged-and-tested-by: NDominik Brodowski <linux@dominikbrodowski.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      571dc79d
    • A
      USB: fix remote wakeup settings during system sleep · 5f677f1d
      Alan Stern 提交于
      This patch (as1363) changes the way USB remote wakeup is handled
      during system sleeps.  It won't be enabled unless an interface driver
      specifically needs it.  Also, it won't be enabled during the FREEZE or
      QUIESCE phases of hibernation, when the system doesn't respond to
      wakeup events anyway.  Finally, if the device is already
      runtime-suspended with remote wakeup enabled, but wakeup is supposed
      to be disabled for the system sleep, the device gets woken up so that
      it can be suspended again with the proper wakeup setting.
      
      This will fix problems people have reported with certain USB webcams
      that generate wakeup requests when they shouldn't, and as a result
      cause system suspends to fail.  See
      
      	https://bugs.launchpad.net/ubuntu/+source/linux/+bug/515109Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Tested-by: NErik Andrén <erik.andren@gmail.com>
      CC: <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      5f677f1d
  8. 30 3月, 2010 1 次提交
    • T
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking... · 5a0e3ad6
      Tejun Heo 提交于
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
      
      percpu.h is included by sched.h and module.h and thus ends up being
      included when building most .c files.  percpu.h includes slab.h which
      in turn includes gfp.h making everything defined by the two files
      universally available and complicating inclusion dependencies.
      
      percpu.h -> slab.h dependency is about to be removed.  Prepare for
      this change by updating users of gfp and slab facilities include those
      headers directly instead of assuming availability.  As this conversion
      needs to touch large number of source files, the following script is
      used as the basis of conversion.
      
        http://userweb.kernel.org/~tj/misc/slabh-sweep.py
      
      The script does the followings.
      
      * Scan files for gfp and slab usages and update includes such that
        only the necessary includes are there.  ie. if only gfp is used,
        gfp.h, if slab is used, slab.h.
      
      * When the script inserts a new include, it looks at the include
        blocks and try to put the new include such that its order conforms
        to its surrounding.  It's put in the include block which contains
        core kernel includes, in the same order that the rest are ordered -
        alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
        doesn't seem to be any matching order.
      
      * If the script can't find a place to put a new include (mostly
        because the file doesn't have fitting include block), it prints out
        an error message indicating which .h file needs to be added to the
        file.
      
      The conversion was done in the following steps.
      
      1. The initial automatic conversion of all .c files updated slightly
         over 4000 files, deleting around 700 includes and adding ~480 gfp.h
         and ~3000 slab.h inclusions.  The script emitted errors for ~400
         files.
      
      2. Each error was manually checked.  Some didn't need the inclusion,
         some needed manual addition while adding it to implementation .h or
         embedding .c file was more appropriate for others.  This step added
         inclusions to around 150 files.
      
      3. The script was run again and the output was compared to the edits
         from #2 to make sure no file was left behind.
      
      4. Several build tests were done and a couple of problems were fixed.
         e.g. lib/decompress_*.c used malloc/free() wrappers around slab
         APIs requiring slab.h to be added manually.
      
      5. The script was run on all .h files but without automatically
         editing them as sprinkling gfp.h and slab.h inclusions around .h
         files could easily lead to inclusion dependency hell.  Most gfp.h
         inclusion directives were ignored as stuff from gfp.h was usually
         wildly available and often used in preprocessor macros.  Each
         slab.h inclusion directive was examined and added manually as
         necessary.
      
      6. percpu.h was updated not to include slab.h.
      
      7. Build test were done on the following configurations and failures
         were fixed.  CONFIG_GCOV_KERNEL was turned off for all tests (as my
         distributed build env didn't work with gcov compiles) and a few
         more options had to be turned off depending on archs to make things
         build (like ipr on powerpc/64 which failed due to missing writeq).
      
         * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
         * powerpc and powerpc64 SMP allmodconfig
         * sparc and sparc64 SMP allmodconfig
         * ia64 SMP allmodconfig
         * s390 SMP allmodconfig
         * alpha SMP allmodconfig
         * um on x86_64 SMP allmodconfig
      
      8. percpu.h modifications were reverted so that it could be applied as
         a separate patch and serve as bisection point.
      
      Given the fact that I had only a couple of failures from tests on step
      6, I'm fairly confident about the coverage of this conversion patch.
      If there is a breakage, it's likely to be something in one of the arch
      headers which should be easily discoverable easily on most builds of
      the specific arch.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Guess-its-ok-by: NChristoph Lameter <cl@linux-foundation.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
      5a0e3ad6
  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. 03 3月, 2010 6 次提交
    • A
      USB: remove debugging message for uevent constructions · cceffe93
      Alan Stern 提交于
      This patch (as1332) removes an unneeded and annoying debugging message
      announcing all USB uevent constructions.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Cc: stable <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      cceffe93
    • A
      USB: convert to the runtime PM framework · 9bbdf1e0
      Alan Stern 提交于
      This patch (as1329) converts the USB stack over to the PM core's
      runtime PM framework.  This involves numerous changes throughout
      usbcore, especially to hub.c and driver.c.  Perhaps the most notable
      change is that CONFIG_USB_SUSPEND now depends on CONFIG_PM_RUNTIME
      instead of CONFIG_PM.
      
      Several fields in the usb_device and usb_interface structures are no
      longer needed.  Some code which used to depend on CONFIG_USB_PM now
      depends on CONFIG_USB_SUSPEND (requiring some rearrangement of header
      files).
      
      The only visible change in behavior should be that following a system
      sleep (resume from RAM or resume from hibernation), autosuspended USB
      devices will be resumed just like everything else.  They won't remain
      suspended.  But if they aren't in use then they will naturally
      autosuspend again in a few seconds.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      9bbdf1e0
    • A
      USB: rearrange functions in driver.c · 0c590e23
      Alan Stern 提交于
      This patch (as1328) reorders the functions in drivers/usb/core/driver.c
      so as to put all the routines dependent on CONFIG_PM in one place.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      0c590e23
    • A
      USB: implement usb_enable_autosuspend · 088f7fec
      Alan Stern 提交于
      This patch (as1326) adds usb_enable_autosuspend() and
      usb_disable_autosuspend() routines for use by drivers.  If a driver
      knows that its device can handle suspends and resumes correctly, it
      can enable autosuspend all by itself.  This is equivalent to the user
      writing "auto" to the device's power/level attribute.
      
      The implementation differs slightly from what it used to be.  Now
      autosuspend is disabled simply by doing usb_autoresume_device() (to
      increment the usage counter) and enabled by doing
      usb_autosuspend_device() (to decrement the usage counter).
      
      The set_level() attribute method is updated to use the new routines,
      and the USB Power-Management documentation is updated.
      
      The patch adds a usb_enable_autosuspend() call to the hub driver's
      probe routine, allowing the special-case code for hubs in quirks.c to
      be removed.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      088f7fec
    • A
      USB: change locking for device-level autosuspend · 62e299e6
      Alan Stern 提交于
      This patch (as1323) changes the locking requirements for
      usb_autosuspend_device(), usb_autoresume_device(), and
      usb_try_autosuspend_device().  This isn't a very important change;
      mainly it's meant to make the locking more uniform.
      
      The most tricky part of the patch involves changes to usbdev_open().
      To avoid an ABBA locking problem, it was necessary to reduce the
      region protected by usbfs_mutex.  Since that mutex now protects only
      against simultaneous open and remove, this posed no difficulty -- its
      scope was larger than necessary.
      
      And it turns out that usbfs_mutex is no longer needed in
      usbdev_release() at all.  The list of usbfs "ps" structures is now
      protected by the device lock instead of by usbfs_mutex.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      62e299e6
    • A
      USB: rearrange code in usb_probe_interface · 0f3dda9f
      Alan Stern 提交于
      This patch (as1322) reverses the two outcomes of an "if" statement in
      usb_probe_interface(), to avoid an unnecessary level of indentation.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      0f3dda9f
  11. 27 2月, 2010 1 次提交
    • A
      USB: implement non-tree resume ordering constraints for PCI host controllers · 6d19c009
      Alan Stern 提交于
      This patch (as1331) adds non-tree ordering constraints needed for
      proper resume of PCI USB host controllers from hibernation.  The main
      issue is that non-high-speed devices must not be resumed before the
      high-speed root hub, because it is the ehci_bus_resume() routine which
      takes care of handing the device connection over to the companion
      controller.  If the device resume is attempted before the handover
      then the device won't be found and it will be treated as though it had
      disconnected.
      
      The patch adds a new field to the usb_bus structure; for each
      full/low-speed bus this field will contain a pointer to the companion
      high-speed bus (if one exists).  It is used during normal device
      resume; if the hs_companion pointer isn't NULL then we wait for the
      root-hub device on the hs_companion bus.
      
      A secondary issue is that an EHCI controlller shouldn't be resumed
      before any of its companions.  On some machines I have observed
      handovers failing if the companion controller is reinitialized after
      the handover.  Thus, the EHCI resume routine must wait for the
      companion controllers to be resumed.
      
      The patch also fixes a small bug in usb_hcd_pci_probe(); an error path
      jumps to the wrong label, causing a memory leak.
      
      [rjw: Fixed compilation for CONFIG_PM_SLEEP unset.]
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Acked-by: NGreg Kroah-Hartman <gregkh@suse.de>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      6d19c009
  12. 12 12月, 2009 3 次提交
    • C
      USB: add remove_id sysfs attr for usb drivers · 0c7a2b72
      CHENG Renquan 提交于
      Accroding commit 0994375e, which is adding remove_id sysfs attr
      for pci drivers, for management tools dynamically bind/unbind
      a pci/usb devices to a specified drivers; with this patch,
      the management tools can be simplied.
      
      And the original code didn't handle the failure of
      usb_create_newid_file, fixed in this patch.
      Signed-off-by: NCHENG Renquan <rqcheng@smu.edu.sg>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      0c7a2b72
    • A
      USB: prepare for changover to Runtime PM framework · 8e4ceb38
      Alan Stern 提交于
      This patch (as1303) revises the USB Power Management infrastructure to
      make it compatible with the new driver-model Runtime PM framework:
      
      	Drivers are no longer allowed to access intf->pm_usage_cnt
      	directly; the PM framework manages its own usage counters.
      
      	usb_autopm_set_interface() is eliminated, because it directly
      	sets intf->pm_usage_cnt.
      
      	usb_autopm_enable() and usb_autopm_disable() are eliminated,
      	because they call usb_autopm_set_interface().
      
      	usb_autopm_get_interface_no_resume() and
      	usb_autopm_put_interface_no_suspend() are added.  They
      	correspond to pm_runtime_get_noresume() and
      	pm_runtime_put_noidle() in the PM framework.
      
      	The power/level attribute no longer accepts "suspend", only
      	"on" and "auto".  The PM framework doesn't allow devices to be
      	forced into a suspended mode.
      
      The hub driver contains the only code that violates the new
      guidelines.  It is updated to use the new interface routines instead.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      8e4ceb38
    • A
      USB: remove the auto_pm flag · fb34d537
      Alan Stern 提交于
      This patch (as1302) removes the auto_pm flag from struct usb_device.
      The flag's only purpose was to distinguish between autosuspends and
      external suspends, but that information is now available in the
      pm_message_t argument passed to suspend methods.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      fb34d537
  13. 23 9月, 2009 3 次提交
    • O
      USB: fix missing error check in probing · 1e5ea5e3
      Oliver Neukum 提交于
      usb: check for IO errors usb_set_interface can return
      
      if they happen while unbinding a flag is set to retry upon probe
      if they happen during probe they are handled as probe errors
      Signed-off-by: NOliver Neukum <oliver@neukum.org>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      1e5ea5e3
    • A
      USB: make intf.pm_usage an atomic_t · ccf5b801
      Alan Stern 提交于
      This patch (as1260) changes the pm_usage_cnt field in struct
      usb_interface from an int to an atomic_t.  This is so that drivers can
      invoke the usb_autopm_get_interface_async() and
      usb_autopm_put_interface_async() routines without locking and without
      fear of corrupting the pm_usage_cnt value.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      
      ccf5b801
    • A
      USB: add API for userspace drivers to "claim" ports · 7cbe5dca
      Alan Stern 提交于
      This patch (as1258) implements a feature that users have been asking
      for: It gives programs the ability to "claim" a port on a hub, via a
      new usbfs ioctl.  A device plugged into a "claimed" port will not be
      touched by the kernel beyond the immediate necessities of
      initialization and enumeration.
      
      In particular, when a device is plugged into a "claimed" port, the
      kernel will not select and install a configuration.  And when a config
      is installed by usbfs or sysfs, the kernel will not probe any drivers
      for any of the interfaces.  (However the kernel will fetch various
      string descriptors during enumeration.  One could argue that this
      isn't really necessary, but the strings are exported in sysfs.)
      
      The patch does not guarantee exclusive access to these devices; it is
      still possible for more than one program to open the device file
      concurrently.  Programs are responsible for coordinating access among
      themselves.
      
      A demonstration program showing how to use the new interface can be 
      found in an attachment to
      
      	http://marc.info/?l=linux-usb&m=124345857431452&w=2
      
      The patch also makes a small simplification to the hub driver,
      replacing a bunch of more-or-less useless variants of "out of memory"
      with a single message.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      7cbe5dca
  14. 16 6月, 2009 3 次提交
  15. 28 1月, 2009 1 次提交
    • A
      USB: fix toggle mismatch in disable_endpoint paths · ddeac4e7
      Alan Stern 提交于
      This patch (as1200) finishes some fixes that were left incomplete by
      an earlier patch.
      
      Although nobody has addressed this issue in the past, it turns out
      that we need to distinguish between two different modes of disabling
      and enabling endpoints.  In one mode only the data structures in
      usbcore are affected, and in the other mode the host controller and
      device hardware states are affected as well.
      
      The earlier patch added an extra argument to the routines in the
      enable_endpoint pathways to reflect this difference.  This patch adds
      corresponding arguments to the disable_endpoint pathways.  Without
      this change, the endpoint toggle state can get out of sync between
      the host and the device.  The exact mechanism depends on the details
      of the host controller (whether or not it stores its own copy of the
      toggle values).
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Reported-by: NDan Streetman <ddstreet@ieee.org>
      Tested-by: NDan Streetman <ddstreet@ieee.org>
      Cc: stable <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      
      ddeac4e7
  16. 08 1月, 2009 5 次提交
    • A
      USB: re-enable interface after driver unbinds · 2caf7fcd
      Alan Stern 提交于
      This patch (as1197) fixes an error introduced recently.  Since a
      significant number of devices can't handle Set-Interface requests, we
      no longer call usb_set_interface() when a driver unbinds from an
      interface, provided the interface is already in altsetting 0.  However
      the interface still does get disabled, and the call to
      usb_set_interface() was the only thing re-enabling it.  Since the
      interface doesn't get re-enabled, further attempts to use it fail.
      
      So the patch adds a call to usb_enable_interface() when a driver
      unbinds and the interface is in altsetting 0.  For this to work
      right, the interface's endpoints have to be re-enabled but their
      toggles have to be left alone.  Therefore an additional argument is
      added to usb_enable_endpoint() and usb_enable_interface(), a flag
      indicating whether or not the endpoint toggles should be reset.
      
      This is a forward-ported version of a patch which fixes Bugzilla
      #12301.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Reported-by: NDavid Roka <roka@dawid.hu>
      Reported-by: NErik Ekman <erik@kryo.se>
      Tested-by: NErik Ekman <erik@kryo.se>
      Tested-by: NAlon Bar-Lev <alon.barlev@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      2caf7fcd
    • A
      USB: Enhance usage of pm_message_t · 65bfd296
      Alan Stern 提交于
      This patch (as1177) modifies the USB core suspend and resume
      routines.  The resume functions now will take a pm_message_t argument,
      so they will know what sort of resume is occurring.  The new argument
      is also passed to the port suspend/resume and bus suspend/resume
      routines (although they don't use it for anything but debugging).
      
      In addition, special pm_message_t values are used for user-initiated,
      device-initiated (i.e., remote wakeup), and automatic suspend/resume.
      By testing these values, drivers can tell whether or not a particular
      suspend was an autosuspend.  Unfortunately, they can't do the same for
      resumes -- not until the pm_message_t argument is also passed to the
      drivers' resume methods.  That will require a bigger change.
      
      IMO, the whole Power Management framework should have been set up this
      way in the first place.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      65bfd296
    • A
      USB: utilize round_jiffies_up_relative() · 4ec06d62
      Alan Stern 提交于
      This patch (as1178) uses the new round_jiffies_up_relative() routine
      for setting the autosuspend delayed_work timer.  It's appropriate
      since we don't care too much about the exact length of the delay, but
      we don't want it to be too short (rounded down).
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      4ec06d62
    • I
      USB: Introduce usb_queue_reset() to do resets from atomic contexts · dc023dce
      Inaky Perez-Gonzalez 提交于
      This patch introduces a new call to be able to do a USB reset from an
      atomic contect. This is quite helpful in USB callbacks to handle
      errors (when the only thing that can be done is to do a device
      reset).
      
      It is done queuing a work struct that will do the actual reset. The
      struct is "attached" to an interface so pending requests from an
      interface are removed when said interface is unbound from the driver.
      
      The call flow then becomes:
      
      usb_queue_reset_device()
        __usb_queue_reset_device() [workqueue]
          usb_reset_device()
      
      usb_probe_interface()
        usb_cancel_queue_reset()      [error path]
      
      usb_unbind_interface()
        usb_cancel_queue_reset()
      
      usb_driver_release_interface()
        usb_cancel_queue_reset()
      
      Note usb_cancel_queue_reset() needs smarts to try not to unqueue when
      it is actually being executed. This happens when we run the reset from
      the workqueue: usb_reset_device() is called and on interface unbind
      time, usb_cancel_queue_reset() would be called. That would deadlock on
      cancel_work_sync(). To avoid that, we set (before running
      usb_reset_device()) usb_intf->reset_running and clear it inmediately
      after returning.
      
      Patch is against 2.6.28-rc2 and depends on
      http://marc.info/?l=linux-usb&m=122581634925308&w=2 (as submitted by
      Alan Stern).
      Signed-off-by: NInaky Perez-Gonzalez <inaky@linux.intel.com>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      dc023dce
    • A
      USB: add asynchronous autosuspend/autoresume support · 9ac39f28
      Alan Stern 提交于
      This patch (as1160b) adds support routines for asynchronous autosuspend
      and autoresume, with accompanying documentation updates.  There
      already are several potential users of this interface, and others are
      likely to arise as autosuspend support becomes more widespread.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      9ac39f28
  17. 18 12月, 2008 1 次提交
  18. 23 10月, 2008 1 次提交
    • A
      USB: don't rebind drivers after failed resume or reset · 6c640945
      Alan Stern 提交于
      This patch (as1152) may help prevent some problems associated with the
      new policy of unbinding drivers that don't support suspend/resume or
      pre_reset/post_reset.  If for any reason the resume or reset fails, and
      the device is logically disconnected, there's no point in trying to
      rebind the driver.  So the patch checks for success before carrying
      out the unbind/rebind.
      
      There was a report from one user that this fixed a problem he was
      experiencing, but the details never became fully clear.  In any case,
      adding these tests can't hurt.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Cc: stable <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      6c640945
  19. 18 10月, 2008 1 次提交
  20. 22 8月, 2008 1 次提交
    • A
      USB: Don't rebind before "complete" callback · 5096aedc
      Alan Stern 提交于
      This patch (as1130) fixes an incompatibility between the new PM
      infrastructure and USB power management.  We are not allowed to call
      drivers' probe routines during a system sleep transition between the
      "prepare" and "complete" callbacks, but that's exactly what we do when
      a driver doesn't have full suspend/resume support.  Such drivers are
      unbound during the "suspend" call and reprobed during the "resume" call.
      
      The patch causes the reprobe step to be skipped if the "complete"
      callback hasn't been issued yet, i.e., if the interface's
      dev.power.status field is not equal to DPM_ON.  Thus during the
      "resume" callback nothing bad will happen, and during the final
      "complete" callback the reprobing will occur as desired.
      
      This fixes the problem reported in Bugzilla #11263.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      5096aedc