1. 24 Jan, 2012 1 commit
  2. 12 Jan, 2012 1 commit
  3. 03 Jan, 2012 1 commit
  4. 26 Sep, 2011 1 commit
  5. 29 Apr, 2011 1 commit
  6. 18 Mar, 2011 1 commit
  7. 16 Nov, 2010 1 commit
    • Alan Stern's avatar
      USB: use the runtime-PM autosuspend implementation · fcc4a01e
      Alan Stern authored
      
      
      This patch (as1428) converts USB over to the new runtime-PM core
      autosuspend framework.  One slightly awkward aspect of the conversion
      is that USB devices will now have two suspend-delay attributes: the
      old power/autosuspend file and the new power/autosuspend_delay_ms
      file.  One expresses the delay time in seconds and the other in
      milliseconds, but otherwise they do the same thing.  The old attribute
      can be deprecated and then removed eventually.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      fcc4a01e
  8. 10 Aug, 2010 1 commit
  9. 21 May, 2010 1 commit
  10. 20 May, 2010 5 commits
    • Ming Lei's avatar
      USB: remove match_device · c024b726
      Ming Lei authored
      
      
      usb_find_device was the only one user of match_device, now
      it is removed, so remove match_device to fix the compile warning
      below reported by Stephen Rothwell:
      
      	drivers/usb/core/usb.c:596: warning: 'match_device'
      	defined but not used
      Reported-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
      Signed-off-by: default avatarMing Lei <tom.leiming@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      c024b726
    • Ming Lei's avatar
      USB: remove usb_find_device · 22b4b611
      Ming Lei authored
      
      
      Now on one uses this function and it seems useless,
      so remove usb_find_device.
      
      [tom@tom linux-2.6-next]$ grep -r -n -I usb_find_device ./
      drivers/media/dvb/dvb-usb/dvb-usb-init.c:160:static struct
      dvb_usb_device_description * dvb_usb_find_device(struct usb_device
      *udev,struct dvb_usb_device_properties *props, int *cold)
      
      drivers/media/dvb/dvb-usb/dvb-usb-init.c:230:   if ((desc =
      dvb_usb_find_device(udev,props,&cold)) == NULL) {
      
      drivers/usb/core/usb.c:630: * usb_find_device - find a specific usb device in the system
      drivers/usb/core/usb.c:642:struct usb_device *usb_find_device(u16 vendor_id, u16 product_id)
      Signed-off-by: default avatarMing Lei <tom.leiming@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      22b4b611
    • Alan Stern's avatar
      USB: fix usbmon and DMA mapping for scatter-gather URBs · ff9c895f
      Alan Stern authored
      
      
      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: default avatarAlan Stern <stern@rowland.harvard.edu>
      CC: <stable@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      
      ff9c895f
    • Alan Stern's avatar
      USB: remove uses of URB_NO_SETUP_DMA_MAP · 0ede76fc
      Alan Stern authored
      
      
      This patch (as1350) removes all usages of coherent buffers for USB
      control-request setup-packet buffers.  There's no good reason to
      reserve coherent memory for these things; control requests are hardly
      ever used in large quantity (the major exception is firmware
      transfers, and they aren't time-critical).  Furthermore, only seven
      drivers used it.  We might as well always use streaming DMA mappings
      for setup-packet buffers, and remove some extra complexity from
      usbcore.
      
      The DMA-mapping portion of hcd.c is currently in flux.  A separate
      patch will be submitted to remove support for URB_NO_SETUP_DMA_MAP
      after everything else settles down.  The removal should go smoothly,
      as by then nobody will be using it.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      0ede76fc
    • Eric Lescouet's avatar
      USB: make hcd.h public (drivers dependency) · 27729aad
      Eric Lescouet authored
      
      
      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: default avatarEric Lescouet <eric@lescouet.org>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      27729aad
  11. 30 Apr, 2010 1 commit
  12. 02 Mar, 2010 2 commits
    • Herbert Xu's avatar
      USB: Move hcd free_dev call into usb_disconnect to fix oops · f7410ced
      Herbert Xu authored
      
      
      USB: Move hcd free_dev call into usb_disconnect
      
      I found a way to oops the kernel:
      
      1. Open a USB device through devio.
      2. Remove the hcd module in the host kernel.
      3. Close the devio file descriptor.
      
      The problem is that closing the file descriptor does usb_release_dev
      as it is the last reference.  usb_release_dev then tries to invoke
      the hcd free_dev function (or rather dereferencing the hcd driver
      struct).  This causes an oops as the hcd driver has already been
      unloaded so the struct is gone.
      
      This patch tries to fix this by bringing the free_dev call earlier
      and into usb_disconnect.  I have verified that repeating the
      above steps no longer crashes with this patch applied.
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Cc: stable <stable@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      f7410ced
    • Alan Stern's avatar
      USB: convert to the runtime PM framework · 9bbdf1e0
      Alan Stern authored
      
      
      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: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      9bbdf1e0
  13. 23 Dec, 2009 1 commit
  14. 15 Dec, 2009 3 commits
    • Alexey Dobriyan's avatar
    • Russ Dill's avatar
      USB: Close usb_find_interface race v3 · c2d284ee
      Russ Dill authored
      
      
      USB drivers that create character devices call usb_register_dev in their
      probe function. This associates the usb_interface device with that minor
      number and creates the character device and announces it to the world.
      However, the driver's probe function is called before the new
      usb_interface is added to the driver's klist_devices.
      
      This is a problem because userspace will respond to the character device
      creation announcement by opening the character device. The driver's open
      function will the call usb_find_interface to find the usb_interface
      associated with that minor number. usb_find_interface will walk the
      driver's list of devices and find the usb_interface with the matching
      minor number.
      
      Because the announcement happens before the usb_interface is added to the
      driver's klist_devices, a race condition exists. A straightforward fix
      is to walk the list of devices on usb_bus_type instead since the device
      is added to that list before the announcement occurs.
      
      bus_find_device calls get_device to bump the reference count on the found
      device. It is arguable that the reference count should be dropped by the
      caller of usb_find_interface instead of usb_find_interface, however,
      the current users of usb_find_interface do not expect this.
      
      The original version of this patch only matched against minor number
      instead of driver and minor number. This version matches against both.
      Signed-off-by: default avatarRuss Dill <Russ.Dill@gmail.com>
      Cc: stable <stable@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      c2d284ee
    • Greg Kroah-Hartman's avatar
      Revert "USB: Close usb_find_interface race" · ab7cd8c7
      Greg Kroah-Hartman authored
      This reverts commit a2582bd4
      
      .
      
      It turned out to be buggy and broke USB printers from working.
      
      Cc: Russ Dill <Russ.Dill@gmail.com>
      Cc: stable <stable@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      ab7cd8c7
  15. 11 Dec, 2009 3 commits
    • Felipe Balbi's avatar
      USB: core: fix sparse warning for static function · 719a6e88
      Felipe Balbi authored
      
      
      Fix the following sparse warning:
      
      drivers/usb/core/usb.c:1033:15: warning: symbol 'usb_debug_devices' was not declared. Should it be static?
      Signed-off-by: default avatarFelipe Balbi <felipe.balbi@nokia.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      719a6e88
    • Sarah Sharp's avatar
      USB: Refactor code to find alternate interface settings. · 91017f9c
      Sarah Sharp authored
      
      
      Refactor out the code to find alternate interface settings into
      usb_find_alt_setting().  Print a debugging message and return null if the
      alt setting is not found.
      
      While we're at it, correct a bug in the refactored code.  The interfaces
      in the configuration's interface cache are not necessarily in numerical
      order, so we can't just use the interface number as an array index.  Loop
      through the interface caches, looking for the correct interface.
      Signed-off-by: default avatarSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      91017f9c
    • Russ Dill's avatar
      USB: Close usb_find_interface race · a2582bd4
      Russ Dill authored
      
      
      USB drivers that create character devices call usb_register_dev in their
      probe function. This associates the usb_interface device with that minor
      number and creates the character device and announces it to the world.
      However, the driver's probe function is called before the new
      usb_interface is added to the driver's klist_devices.
      
      This is a problem because userspace will respond to the character device
      creation announcement by opening the character device. The driver's open
      function will the call usb_find_interface to find the usb_interface
      associated with that minor number. usb_find_interface will walk the
      driver's list of devices and find the usb_interface with the matching
      minor number.
      
      Because the announcement happens before the usb_interface is added to the
      driver's klist_devices, a race condition exists. A straightforward fix
      is to walk the list of devices on usb_bus_type instead since the device
      is added to that list before the announcement occurs.
      
      bus_find_device calls get_device to bump the reference count on the found
      device. It is arguable that the reference count should be dropped by the
      caller of usb_find_interface instead of usb_find_interface, however,
      the current users of usb_find_interface do not expect this.
      Signed-off-by: default avatarRuss Dill <Russ.Dill@gmail.com>
      Cc: stable <stable@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      a2582bd4
  16. 23 Sep, 2009 2 commits
    • Sarah Sharp's avatar
      USB: xhci: Set route string for all devices. · 4a0cd967
      Sarah Sharp authored
      
      
      The xHCI driver needs to set the route string in the slot context of all
      devices, not just SuperSpeed devices.  The route string concept was added
      in the USB 3.0 specification, section 10.1.3.2.  Each hub in the topology
      is expected to have no more than 15 ports in order for the route string of
      a device to be unique.  SuperSpeed hubs are restricted to only having 15
      ports, but FS/LS/HS hubs are not.  The xHCI specification says that if the
      port number the device is under is greater than 15, that portion of the
      route string shall be set to 15.
      Signed-off-by: default avatarSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      4a0cd967
    • Jiri Slaby's avatar
      USB: make usb_buffer_map_sg consistent with doc · 2912282c
      Jiri Slaby authored
      
      
      usb_buffer_map_sg should return negative on error according to
      its documentation. But dma_map_sg returns 0 on error. Take this
      into account and return -ENOMEM in such situation.
      
      While at it, return -EINVAL instead of -1 when wrong input is
      passed in.
      
      If this wasn't done, usb_sg_* operations used after usb_sg_init
      which returned 0 may cause oopses/deadlocks since we don't init
      structures/entries, esp. completion and status entry.
      Signed-off-by: default avatarJiri Slaby <jirislaby@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      2912282c
  17. 19 Sep, 2009 1 commit
  18. 15 Jun, 2009 8 commits
  19. 17 Apr, 2009 1 commit
    • David Vrabel's avatar
      USB: add reset endpoint operations · 3444b26a
      David Vrabel authored
      
      
      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: default avatarDavid Vrabel <david.vrabel@csr.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      3444b26a
  20. 07 Jan, 2009 4 commits
    • Alan Stern's avatar
      USB: re-enable interface after driver unbinds · 2caf7fcd
      Alan Stern authored
      
      
      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: default avatarAlan Stern <stern@rowland.harvard.edu>
      Reported-by: default avatarDavid Roka <roka@dawid.hu>
      Reported-by: default avatarErik Ekman <erik@kryo.se>
      Tested-by: default avatarErik Ekman <erik@kryo.se>
      Tested-by: default avatarAlon Bar-Lev <alon.barlev@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      2caf7fcd
    • Alan Stern's avatar
      USB: utilize the bus notifiers · 3b23dd6f
      Alan Stern authored
      
      
      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: default avatarAlan Stern <stern@rowland.harvard.edu>
      Cc: Kay Sievers <kay.sievers@vrfy.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      3b23dd6f
    • Alan Stern's avatar
      USB: Enhance usage of pm_message_t · 65bfd296
      Alan Stern authored
      
      
      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: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      65bfd296
    • Rusty Russell's avatar
      USB: Don't use __module_param_call; use core_param. · 785895ff
      Rusty Russell authored
      
      
      Impact: cleanup
      
      Found this when I changed args to __module_param_call.  We now have
      core_param for exactly this, but Greg assures me "nousb" is used as a
      module parameter, so we need the #ifdef MODULE.
      Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
      Cc: Pete Zaitcev <zaitcev@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      785895ff