1. 17 11月, 2010 1 次提交
  2. 23 10月, 2010 1 次提交
    • A
      USB: disable endpoints after unbinding interfaces, not before · 80f0cf39
      Alan Stern 提交于
      This patch (as1430) fixes a bug in usbcore.  When a device
      configuration change occurs or a device is removed, the endpoints for
      the old config should be completely disabled.  However it turns out
      they aren't; this is because usb_unbind_interface() calls
      usb_enable_interface() or usb_set_interface() to put interfaces back
      in altsetting 0, which re-enables the interfaces' endpoints.
      
      As a result, when a device goes through a config change or is
      unconfigured, the ep_in[] and ep_out[] arrays may be left holding old
      pointers to usb_host_endpoint structures.  If the device is
      deauthorized these structures get freed, and the stale pointers cause
      errors when the the device is eventually unplugged.
      
      The solution is to disable the endpoints after unbinding the
      interfaces instead of before.  This isn't as large a change as it
      sounds, since usb_unbind_interface() disables all the interface's
      endpoints anyway before calling the driver's disconnect routine,
      unless the driver claims to support "soft" unbind.
      
      This fixes Bugzilla #19192.  Thanks to "Tom" Lei Ming for diagnosing
      the underlying cause of the problem.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Tested-by: NCarsten Sommer <carsten_sommer@ymail.com>
      CC: stable <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      80f0cf39
  3. 25 9月, 2010 1 次提交
  4. 04 9月, 2010 1 次提交
    • T
      usb: allow drivers to use allocated bandwidth until unbound · 0791971b
      Thadeu Lima de Souza Cascardo 提交于
      When using the remove sysfs file, the device configuration is set to -1
      (unconfigured). This eventually unbind drivers with the bandwidth_mutex
      held. Some drivers may call functions that hold said mutex, like
      usb_reset_device. This is the case for rtl8187, for example. This will
      lead to the same process holding the mutex twice, which deadlocks.
      
      Besides, according to Alan Stern:
      "The deadlock problem probably could be handled somehow, but there's a
      separate issue: Until the usb_disable_device call finishes unbinding
      the drivers, the drivers are free to continue using their allocated
      bandwidth.  We musn't change the bandwidth allocations until after the
      unbinding is done.  So this patch is indeed necessary."
      
      Unbinding the driver before holding the bandwidth_mutex solves the
      problem. If any operation after that fails, drivers are not bound again.
      But that would be a problem anyway that the user may solve resetting the
      device configuration to one that works, just like he would need to do in
      most other failure cases.
      Signed-off-by: NThadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: Sarah Sharp <sarah.a.sharp@linux.intel.com>
      Cc: stable <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      0791971b
  5. 30 6月, 2010 1 次提交
  6. 21 5月, 2010 5 次提交
    • A
      USB: simplify usb_sg_init() · 0ba169af
      Alan Stern 提交于
      This patch (as1377) simplifies the code in usb_sg_init(), without
      changing its functionality.  It also removes a couple of unused fields
      from the usb_sg_request structure.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      0ba169af
    • M
      USB: Change the scatterlist type in struct urb · 910f8d0c
      Matthew Wilcox 提交于
      Change the type of the URB's 'sg' pointer from a usb_sg_request to
      a scatterlist.  This allows drivers to submit scatter-gather lists
      without using the usb_sg_wait() interface.  It has the added benefit
      of removing the typecasts that were added as part of patch as1368 (and
      slightly decreasing the number of pointer dereferences).
      Signed-off-by: NMatthew Wilcox <willy@linux.intel.com>
      Reviewed-by: NAlan Stern <stern@rowland.harvard.edu>
      Tested-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      910f8d0c
    • M
      USB: Add a usb_pipe_endpoint() convenience function · fe54b058
      Matthew Wilcox 提交于
      Converting a pipe number to a struct usb_host_endpoint pointer is a little
      messy.  Introduce a new convenience function to hide the mess.
      Signed-off-by: NMatthew Wilcox <willy@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      fe54b058
    • A
      USB: fix usbmon and DMA mapping for scatter-gather URBs · ff9c895f
      Alan Stern 提交于
      This patch (as1368) fixes a rather obscure bug in usbmon: When tracing
      URBs sent by the scatter-gather library, it accesses the data buffers
      while they are still mapped for DMA.
      
      The solution is to move the mapping and unmapping out of the s-g
      library and into the usual place in hcd.c.  This requires the addition
      of new URB flag bits to describe the kind of mapping needed, since we
      have to call dma_map_sg() if the HCD supports native scatter-gather
      operation and dma_map_page() if it doesn't.  The nice thing about
      having the new flags is that they simplify the testing for unmapping.
      
      The patch removes the only caller of usb_buffer_[un]map_sg(), so those
      functions are #if'ed out.  A later patch will remove them entirely.
      
      As a result of this change, urb->sg will be set in situations where
      it wasn't set previously.  Hence the xhci and whci drivers are
      adjusted to test urb->num_sgs instead, which retains its original
      meaning and is nonzero only when the HCD has to handle a scatterlist.
      
      Finally, even when a submission error occurs we don't want to hand
      URBs to usbmon before they are unmapped.  The submission path is
      rearranged so that map_urb_for_dma() is called only for non-root-hub
      URBs and unmap_urb_for_dma() is called immediately after a submission
      error.  This simplifies the error handling.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      CC: <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      
      ff9c895f
    • E
      USB: make hcd.h public (drivers dependency) · 27729aad
      Eric Lescouet 提交于
      The usbcore headers: hcd.h and hub.h are shared between usbcore,
      HCDs and a couple of other drivers (e.g. USBIP modules).
      So, it makes sense to move them into a more public location and
      to cleanup dependency of those modules on kernel internal headers.
      This patch moves hcd.h from drivers/usb/core into include/linux/usb/
      Signed-of-by: NEric Lescouet <eric@lescouet.org>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      27729aad
  7. 03 3月, 2010 3 次提交
  8. 27 2月, 2010 1 次提交
    • R
      PM: Allow USB devices to suspend/resume asynchronously · 927bc916
      Rafael J. Wysocki 提交于
      Set power.async_suspend for USB devices, endpoints and interfaces,
      allowing them to be suspended and resumed asynchronously during
      system sleep transitions.
      
      The power.async_suspend flag is also set for devices that don't have
      suspend or resume callbacks, because otherwise they would make the
      main suspend/resume thread wait for their "asynchronous" children
      (during suspend) or parents (during resume), effectively negating the
      possible gains from executing these devices' suspend and resume
      callbacks asynchronously.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      927bc916
  9. 21 1月, 2010 1 次提交
  10. 12 12月, 2009 4 次提交
    • F
      USB: core: message: fix sparse warning · 09e81f3d
      Felipe Balbi 提交于
      Fix the following sparse warning:
      
      drivers/usb/core/message.c:1583:6: warning: symbol '__usb_queue_reset_device' was not declared. Should it be static?
      Signed-off-by: NFelipe Balbi <felipe.balbi@nokia.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      09e81f3d
    • S
      USB: Check bandwidth when switching alt settings. · 3f0479e0
      Sarah Sharp 提交于
      Make the USB core check the bandwidth when switching from one
      interface alternate setting to another.  Also check the bandwidth
      when resetting a configuration (so that alt setting 0 is used).  If
      this check fails, the device's state is unchanged.  If the device
      refuses the new alt setting, re-instate the old alt setting in the
      host controller hardware.
      
      If a USB device doesn't have an alternate interface setting 0, install
      the first alt setting in its descriptors when a new configuration is
      requested, or the device is reset.
      
      Add a mutex per root hub to protect bandwidth operations:
      adding/reseting/changing configurations, and changing alternate interface
      settings.  We want to ensure that the xHCI host controller and the USB
      device are set up for the same configurations and alternate settings.
      There are two (possibly three) steps to do this:
      
       1. The host controller needs to check that bandwidth is available for a
          different setting, by issuing and waiting for a configure endpoint
          command.
       2. Once that returns successfully, a control message is sent to the
          device.
       3. If that fails, the host controller must be notified through another
          configure endpoint command.
      
      The mutex is used to make these three operations seem atomic, to prevent
      another driver from using more bandwidth for a different device while
      we're in the middle of these operations.
      
      While we're touching the bandwidth code, rename usb_hcd_check_bandwidth()
      to usb_hcd_alloc_bandwidth().  This function does more than just check
      that the bandwidth change won't exceed the bus bandwidth; it actually
      changes the bandwidth configuration in the xHCI host controller.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      3f0479e0
    • A
      USB: fix a bug in the scatter-gather library · ed1db3ad
      Alan Stern 提交于
      This patch (as1298) fixes a bug in the new scatter-gather URB
      facility.  If an URB uses a scatterlist then it should not have the
      URB_NO_INTERRUPT flag set; otherwise the system won't be notified when
      the transfer completes.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Acked-by: NDavid Vrabel <david.vrabel@csr.com>
      CC: Sarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      
      ed1db3ad
    • D
      USB: make urb scatter-gather support more generic · 4c1bd3d7
      David Vrabel 提交于
      The WHCI HCD will also support urbs with scatter-gather lists.  Add a
      usb_bus field to indicated how many sg list elements are supported by
      the HCD.  Use this to decide whether to pass the scatter-list to the HCD
      or not.
      
      Make the usb-storage driver use this new field.
      Signed-off-by: NDavid Vrabel <david.vrabel@csr.com>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: Sarah Sharp <sarah.a.sharp@linux.intel.com>
      Cc: Matthew Dharm <mdharm-usb@one-eyed-alien.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      4c1bd3d7
  11. 04 12月, 2009 1 次提交
  12. 23 9月, 2009 1 次提交
  13. 13 7月, 2009 1 次提交
    • D
      USB: fix LANGID=0 regression · 0cce2eda
      Daniel Mack 提交于
      commit b7af0bb2 ("USB: allow malformed LANGID descriptors") broke support
      for devices without string descriptor support.
      
      Reporting string descriptors is optional to USB devices, and a device
      lets us know it can't deal with strings by responding to the LANGID
      request with a STALL token.
      
      The kernel handled that correctly before b7af0bb2 came in, but failed
      hard if the LANGID was reported but broken. More than that, if a device
      was not able to provide string descriptors, the LANGID was retrieved
      over and over again at each string read request.
      
      This patch changes the behaviour so that
      
       a) the LANGID is only queried once
       b) devices which can't handle string requests are not asked again
       c) devices with malformed LANGID values have a sane fallback to 0x0409
      Signed-off-by: NDaniel Mack <daniel@caiaq.de>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Cc: stable <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      0cce2eda
  14. 16 6月, 2009 4 次提交
    • S
      USB: Push scatter gather lists down to host controller drivers. · e04748e3
      Sarah Sharp 提交于
      This is the original patch I created before David Vrabel posted a better
      patch (http://marc.info/?l=linux-usb&m=123377477209109&w=2) that does
      basically the same thing.  This patch will get replaced with his
      (modified) patch later.
      
      Allow USB device drivers that use usb_sg_init() and usb_sg_wait() to push
      bulk endpoint scatter gather lists down to the host controller drivers.
      This allows host controller drivers to more efficiently enqueue these
      transfers, and allows the xHCI host controller to better take advantage of
      USB 3.0 "bursts" for bulk endpoints.
      
      This patch currently only enables scatter gather lists for bulk endpoints.
      Other endpoint types that use the usb_sg_* functions will not have their
      scatter gather lists pushed down to the host controller.  For periodic
      endpoints, we want each scatterlist entry to be a separate transfer.
      Eventually, HCDs could parse these scatter-gather lists for periodic
      endpoints also.  For now, we use the old code and call usb_submit_urb()
      for each scatterlist entry.
      
      The caller of usb_sg_init() can request that all bytes in the scatter
      gather list be transferred by passing in a length of zero.  Handle that
      request for a bulk endpoint under xHCI by walking the scatter gather list
      and calculating the length.  We could let the HCD handle a zero length in
      this case, but I'm not sure if the core layers in between will get
      confused by this.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      e04748e3
    • S
      USB: Support for bandwidth allocation. · 79abb1ab
      Sarah Sharp 提交于
      Originally, the USB core had no support for allocating bandwidth when a
      particular configuration or alternate setting for an interface was
      selected.  Instead, the device driver's URB submission would fail if
      there was not enough bandwidth for a periodic endpoint.  Drivers could
      work around this, by using the scatter-gather list API to guarantee
      bandwidth.
      
      This patch adds host controller API to allow the USB core to allocate or
      deallocate bandwidth for an endpoint.  Endpoints are added to or dropped
      from a copy of the current schedule by calling add_endpoint() or
      drop_endpoint(), and then the schedule is atomically evaluated with a
      call to check_bandwidth().  This allows all the endpoints for a new
      configuration or alternate setting to be added at the same time that the
      endpoints from the old configuration or alt setting are dropped.
      
      Endpoints must be added to the schedule before any URBs are submitted to
      them.  The HCD must be allowed to reject a new configuration or alt
      setting before the control transfer is sent to the device requesting the
      change.  It may reject the change because there is not enough bandwidth,
      not enough internal resources (such as memory on an embedded host
      controller), or perhaps even for security reasons in a virtualized
      environment.
      
      If the call to check_bandwidth() fails, the USB core must call
      reset_bandwidth().  This causes the schedule to be reverted back to the
      state it was in just after the last successful check_bandwidth() call.
      
      If the call succeeds, the host controller driver (and hardware) will have
      changed its internal state to match the new configuration or alternate
      setting.  The USB core can then issue a control transfer to the device to
      change the configuration or alt setting.  This allows the core to test new
      configurations or alternate settings before unbinding drivers bound to
      interfaces in the old configuration.
      
      WIP:
      
      The USB core must add endpoints from all interfaces in a configuration
      to the schedule, because a driver may claim that interface at any time.
      A slight optimization might be to add the endpoints to the schedule once
      a driver claims that interface.  FIXME
      
      This patch does not cover changing alternate settings, but it does
      handle a configuration change or de-configuration.  FIXME
      
      The code for managing the schedule is currently HCD specific.  A generic
      scheduling algorithm could be added for host controllers without
      built-in scheduling support.  For now, if a host controller does not
      define the check_bandwidth() function, the call to
      usb_hcd_check_bandwidth() will always succeed.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      79abb1ab
    • A
      NLS: update handling of Unicode · 74675a58
      Alan Stern 提交于
      This patch (as1239) updates the kernel's treatment of Unicode.  The
      character-set conversion routines are well behind the current state of
      the Unicode specification: They don't recognize the existence of code
      points beyond plane 0 or of surrogate pairs in the UTF-16 encoding.
      
      The old wchar_t 16-bit type is retained because it's still used in
      lots of places.  This shouldn't cause any new problems; if a
      conversion now results in an invalid 16-bit code then before it must
      have yielded an undefined code.
      
      Difficult-to-read names like "utf_mbstowcs" are replaced with more
      transparent names like "utf8s_to_utf16s" and the ordering of the
      parameters is rationalized (buffer lengths come immediate after the
      pointers they refer to, and the inputs precede the outputs).
      Fortunately the low-level conversion routines are used in only a few
      places; the interfaces to the higher-level uni2char and char2uni
      methods have been left unchanged.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Acked-by: NClemens Ladisch <clemens@ladisch.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      74675a58
    • C
      usb: return device strings in UTF-8 · a853a3d4
      Clemens Ladisch 提交于
      Change the encoding of strings returned by usb_string() from ISO 8859-1
      to UTF-8.
      Signed-off-by: NClemens Ladisch <clemens@ladisch.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      a853a3d4
  15. 18 4月, 2009 1 次提交
    • D
      USB: add reset endpoint operations · 3444b26a
      David Vrabel 提交于
      Wireless USB endpoint state has a sequence number and a current
      window and not just a single toggle bit.  So allow HCDs to provide a
      endpoint_reset method and call this or clear the software toggles as
      required (after a clear halt, set configuration etc.).
      
      usb_settoggle() and friends are then HCD internal and are moved into
      core/hcd.h and all device drivers call usb_reset_endpoint() instead.
      
      If the device endpoint state has been reset (with a clear halt) but
      the host endpoint state has not then subsequent data transfers will
      not complete. The device will only work again after it is reset or
      disconnected.
      Signed-off-by: NDavid Vrabel <david.vrabel@csr.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      3444b26a
  16. 25 3月, 2009 3 次提交
  17. 28 2月, 2009 1 次提交
    • A
      USB: usb_get_string should check the descriptor type · 67f5a4ba
      Alan Stern 提交于
      This patch (as1218) fixes a problem with a radio-control joystick used
      in the "walkera 4#3" helicopter.  This device responds to the initial
      Get-String-Descriptor request for string 0 (which is really the list
      of supported languages) by sending its config descriptor!  The
      usb_get_string() routine needs to check whether it got the right
      type of descriptor.
      
      Oddly enough, this sort of check is already present in
      usb_get_descriptor().  The patch changes the error code from -EPROTO
      to -ENODATA, because -EPROTO shows up in so many other contexts to
      indicate a hardware failure rather than a firmware error.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Tested-by: NGuillermo Jarabo <williamjap@gmail.com>
      Cc: stable <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      
      ===================================================================
      67f5a4ba
  18. 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
  19. 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: cancel pending Set-Config requests if userspace gets there first · df718962
      Alan Stern 提交于
      This patch (as1195) eliminates a potential problem identified by
      Oliver Neukum.  When a driver queues an asynchronous Set-Config
      request using usb_driver_set_configuration(), the request should be
      cancelled if userspace changes the configuration first.  The patch
      introduces a linked list of pending async Set-Config requests, and
      uses it to invalidate the requests for a particular device whenever
      that device's configuration is set.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Cc: Oliver Neukum <oliver@neukum.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      df718962
    • A
      USB: utilize the bus notifiers · 3b23dd6f
      Alan Stern 提交于
      This patch (as1185) makes usbcore take advantage of the bus
      notifications sent out by the driver core.  Now we can create all our
      device and interface attribute files before the device or interface
      uevent is broadcast.
      
      A side effect is that we no longer create the endpoint "pseudo"
      devices at the same time as a device or interface is registered -- it
      seems like a bad idea to try registering an endpoint before the
      registration of its parent is complete.  So the routines for creating
      and removing endpoint devices have been split out and renamed, and
      they are called explicitly when needed.  A new bitflag is used for
      keeping track of whether or not the interface's endpoint devices have
      been created, since (just as with the interface attributes) they vary
      with the altsetting and hence can be changed at random times.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Cc: Kay Sievers <kay.sievers@vrfy.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      3b23dd6f
    • 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
    • H
      USB: avoid needless address-taking of function parameters · da2bbdcc
      Harvey Harrison 提交于
      There's no need to take the address of the function params or local variables
      when the direct value byteswapping routines are available.
      Signed-off-by: NHarvey Harrison <harvey.harrison@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      da2bbdcc
  20. 14 11月, 2008 1 次提交
    • A
      USB: don't register endpoints for interfaces that are going away · 352d0263
      Alan Stern 提交于
      This patch (as1155) fixes a bug in usbcore.  When interfaces are
      deleted, either because the device was disconnected or because of a
      configuration change, the extra attribute files and child endpoint
      devices may get left behind.  This is because the core removes them
      before calling device_del().  But during device_del(), after the
      driver is unbound the core will reinstall altsetting 0 and recreate
      those extra attributes and children.
      
      The patch prevents this by adding a flag to record when the interface
      is in the midst of being unregistered.  When the flag is set, the
      attribute files and child devices will not be created.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Cc: stable <stable@kernel.org> [2.6.27, 2.6.26, 2.6.25]
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      
      352d0263
  21. 18 10月, 2008 1 次提交
  22. 14 8月, 2008 1 次提交