1. 23 9月, 2009 2 次提交
    • S
      USB: xhci: Set route string for all devices. · 4a0cd967
      Sarah Sharp 提交于
      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: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      4a0cd967
    • J
      USB: make usb_buffer_map_sg consistent with doc · 2912282c
      Jiri Slaby 提交于
      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: NJiri Slaby <jirislaby@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      2912282c
  2. 20 9月, 2009 1 次提交
  3. 16 6月, 2009 8 次提交
  4. 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
  5. 08 1月, 2009 6 次提交
    • 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: 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
    • 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
    • R
      USB: Don't use __module_param_call; use core_param. · 785895ff
      Rusty Russell 提交于
      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: NRusty Russell <rusty@rustcorp.com.au>
      Cc: Pete Zaitcev <zaitcev@redhat.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      785895ff
    • 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
    • A
      USB: change interface to usb_lock_device_for_reset() · 011b15df
      Alan Stern 提交于
      This patch (as1161) changes the interface to
      usb_lock_device_for_reset().  The existing interface is apparently not
      very clear, judging from the fact that several of its callers don't
      use it correctly.  The new interface always returns 0 for success and
      it always requires the caller to unlock the device afterward.
      
      The new routine will not return immediately if it is called while the
      driver's probe method is running.  Instead it will wait until the
      probe is over and the device has been unlocked.  This shouldn't cause
      any problems; I don't know of any cases where drivers call
      usb_lock_device_for_reset() during probe.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Cc: Pete Zaitcev <zaitcev@redhat.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      011b15df
  6. 07 1月, 2009 1 次提交
    • R
      PM: Simplify the new suspend/hibernation framework for devices · adf09493
      Rafael J. Wysocki 提交于
      PM: Simplify the new suspend/hibernation framework for devices
      
      Following the discussion at the Kernel Summit, simplify the new
      device PM framework by merging 'struct pm_ops' and
      'struct pm_ext_ops' and removing pointers to 'struct pm_ext_ops'
      from 'struct platform_driver' and 'struct pci_driver'.
      
      After this change, the suspend/hibernation callbacks will only
      reside in 'struct device_driver' as well as at the bus type/
      device class/device type level.  Accordingly, PCI and platform
      device drivers are now expected to put their suspend/hibernation
      callbacks into the 'struct device_driver' embedded in
      'struct pci_driver' or 'struct platform_driver', respectively.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NPavel Machek <pavel@suse.cz>
      Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      adf09493
  7. 22 8月, 2008 1 次提交
    • A
      USB: Add new PM callback methods for USB · f2189c47
      Alan Stern 提交于
      This patch (as1129) adds support for the new PM callbacks to usbcore.
      The new callbacks merely invoke the same old USB power management
      routines as the old ones did.
      
      A minor improvement is that the callbacks are present only in the
      "USB-device" device_type structure, rather than in the bus_type
      structure.  This way they will be invoked only for USB devices, not
      for USB interfaces.  The core USB PM routines automatically handle
      suspending and resuming interfaces along with their devices.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      f2189c47
  8. 22 7月, 2008 2 次提交
  9. 15 5月, 2008 1 次提交
    • A
      USB: create attributes before sending uevent · 2e5f10e4
      Alan Stern 提交于
      This patch (as1087d) fixes a long-standing problem in usbcore: Device,
      interface, and endpoint attributes aren't added until _after_ the
      creation uevent has already been broadcast.
      
      Unfortunately there are a few attributes which cannot be created that
      early.  The "descriptors" attribute is binary and so must be created
      separately.  The power-management attributes can't be created until
      the dev/power/ group exists.  And the interface string can vary from
      one altsetting to another, so it has to be created dynamically.
      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>
      2e5f10e4
  10. 05 3月, 2008 1 次提交
  11. 04 3月, 2008 1 次提交
  12. 02 2月, 2008 4 次提交
    • G
      USB: fix codingstyle issues in drivers/usb/core/*.c · 2c044a48
      Greg Kroah-Hartman 提交于
      Fixes a number of coding style issues in the remaining .c files in
      drivers/usb/core/
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      2c044a48
    • G
      USB: mark USB drivers as being GPL only · 782e70c6
      Greg Kroah-Hartman 提交于
      Over two years ago, the Linux USB developers stated that they believed
      there was no way to create a USB kernel driver that was not under the
      GPL.  This patch moves the USB apis to enforce that decision.
      
      There are no known closed source USB drivers in the wild, so this patch
      should cause no problems.
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      782e70c6
    • S
      USB: Export suspend statistics · 15123006
      Sarah Sharp 提交于
      This patch exports two statistics to userspace:
      /sys/bus/usb/device/.../power/connected_duration
      /sys/bus/usb/device/.../power/active_duration
      
      connected_duration is the total time (in msec) that the device has
      been connected.  active_duration is the total time the device has not
      been suspended.  With these two statistics, tools like PowerTOP can
      calculate the percentage time that a device is active, i.e. not
      suspended or auto-suspended.
      
      Users can also use the active_duration to check if a device is actually
      autosuspended.  Currently, they can set power/level to auto and
      power/autosuspend to a positive timeout, but there's no way to know from
      userspace if a device was actually autosuspended without looking at the
      dmesg output.  These statistics will be useful in creating an automated
      userspace script to test autosuspend for USB devices.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      15123006
    • A
      USB: make ksuspend_usbd thread non-freezable · 4145ed6d
      Alan Stern 提交于
      This patch (as1012b) makes the ksuspend_usbd kernel thread
      non-freezable.  Since the PM core has been changed to lock all devices
      during a system sleep, the thread no longer needs to be frozen.  It
      won't interfere with a system sleep because before trying to resume a
      root hub device, it acquires the device's lock.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      4145ed6d
  13. 29 11月, 2007 1 次提交
    • A
      USB: uevent environment key fix · 4a9bee82
      Alan Stern 提交于
      This patch (as1010) was written by both Kay Sievers and me.  It solves
      the problem of duplicated keys in USB uevent structures by refactoring
      the uevent subroutines, taking advantage of the way the hotplug core
      calls uevent handlers for the device's bus and for the device's type.
      Keys needed for both USB-device and USB-interface events are added in
      usb_uevent(), which is the bus handler.  Keys appropriate only for
      USB-device or USB-interface events are added in usb_dev_uevent() or
      usb_if_uevent() respectively, the type handlers.
      
      In addition, unnecessary tests for NULL pointers are removed as are
      duplicated debugging log statements.
      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>
      4a9bee82
  14. 02 11月, 2007 1 次提交
  15. 17 10月, 2007 1 次提交
  16. 13 10月, 2007 5 次提交
    • S
      USB: Export URB statistics for powertop · 4d59d8a1
      Sarah Sharp 提交于
      powertop currently tracks interrupts generated by uhci, ehci, and ohci,
      but it has no way of telling which USB device to blame USB bus activity on.
      This patch exports the number of URBs that are submitted for a given device.
      Cat the file 'urbnum' in /sys/bus/usb/devices/.../
      Signed-off-by: NSarah Sharp <sarah.a.sharp@intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      4d59d8a1
    • A
      USB: flush outstanding URBs when suspending · 6840d255
      Alan Stern 提交于
      This patch (as989) makes usbcore flush all outstanding URBs for each
      device as the device is suspended.  This will be true even when
      CONFIG_USB_SUSPEND is not enabled.
      
      In addition, an extra can_submit flag is added to the usb_device
      structure.  That flag will be turned off whenever a suspend request
      has been received for the device, even if the device isn't actually
      suspended because CONFIG_USB_SUSPEND isn't set.
      
      It's no longer necessary to check for the device state being equal to
      USB_STATE_SUSPENDED during URB submission; that check can be replaced
      by a check of the can_submit flag.  This also permits us to remove
      some questionable references to the deprecated power.power_state field.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      6840d255
    • I
    • A
      USB: avoid using urb->pipe in usbcore · 5e60a161
      Alan Stern 提交于
      This patch (as946) eliminates many of the uses of urb->pipe in
      usbcore.  Unfortunately there will have to be a significant API
      change, affecting all USB drivers, before we can remove it entirely.
      This patch contents itself with changing only the interface to
      usb_buffer_map_sg() and friends: The pipe argument is replaced with a
      direction flag.  That can be done easily because those routines get
      used in only one place.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      5e60a161
    • A
      USB: add ep->enable · bdd016ba
      Alan Stern 提交于
      This patch (as944) adds an explicit "enabled" field to the
      usb_host_endpoint structure and uses it in place of the current
      mechanism.  This is merely a time-space tradeoff; it makes checking
      whether URBs may be submitted to an endpoint simpler.  The existing
      mechanism is efficient when converting urb->pipe to an endpoint
      pointer, but it's not so efficient when urb->ep is used instead.
      
      As a side effect, the procedure for enabling an endpoint is now a
      little more complicated.  The ad-hoc inline code in usb.c and hub.c
      for enabling ep0 is now replaced with calls to usb_enable_endpoint,
      which is no longer static.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      bdd016ba
  17. 13 7月, 2007 2 次提交
  18. 30 5月, 2007 1 次提交
    • A
      USB: replace flush_workqueue with cancel_sync_work · d5d4db70
      Alan Stern 提交于
      This patch (as912) replaces a couple of calls to flush_workqueue()
      with cancel_sync_work() and cancel_rearming_delayed_work().  Using a
      more directed approach allows us to avoid some nasty deadlocks.  The
      prime example occurs when a first-level device (the parent is a root
      hub) is removed while at the same time the root hub gets a remote
      wakeup request.  khubd would try to flush the autosuspend workqueue
      while holding the root-hub's lock, and the remote-wakeup workqueue
      routine would be waiting to lock the root hub.
      
      The patch also reorganizes the power management portion of
      usb_disconnect(), separating it out into its own routine.  The
      autosuspend workqueue entry is cancelled immediately instead of
      waiting for the device's release routine.  In addition,
      synchronization with the autosuspend thread is carried out even for
      root hubs (an oversight in the original code).
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Greg KH <gregkh@suse.de>
      Cc: Mark Lord <lkml@rtr.ca>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      d5d4db70