1. 16 6月, 2009 4 次提交
  2. 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
  3. 25 3月, 2009 3 次提交
    • G
      USB: make actual_length in struct urb field u32 · 8c209e67
      Greg Kroah-Hartman 提交于
      actual_length should also be a u32 and not a signed value.  This patch
      changes this field to be 'u32' to prevent any potential negative
      conversion and comparison errors.
      
      This triggered a few compiler warning messages when these fields were
      being used with the min macro, so they have also been fixed up in this
      patch.
      
      Cc: Roel Kluin <roel.kluin@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      8c209e67
    • G
      USB: make transfer_buffer_lengths in struct urb field u32 · 16e2e5f6
      Greg Kroah-Hartman 提交于
      Roel Kluin pointed out that transfer_buffer_lengths in struct urb was
      declared as an 'int'.  This patch changes this field to be 'u32' to
      prevent any potential negative conversion and comparison errors.
      
      This triggered a few compiler warning messages when these fields were
      being used with the min macro, so they have also been fixed up in this
      patch.
      
      Cc: Roel Kluin <roel.kluin@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      16e2e5f6
    • J
      USB: Move definitions from usb.h to usb/ch9.h · 4d6914b7
      Julia Lawall 提交于
      The functions:
      
      usb_endpoint_dir_in(epd)
      usb_endpoint_dir_out(epd)
      usb_endpoint_is_bulk_in(epd)
      usb_endpoint_is_bulk_out(epd)
      usb_endpoint_is_int_in(epd)
      usb_endpoint_is_int_out(epd)
      usb_endpoint_is_isoc_in(epd)
      usb_endpoint_is_isoc_out(epd)
      usb_endpoint_num(epd)
      usb_endpoint_type(epd)
      usb_endpoint_xfer_bulk(epd)
      usb_endpoint_xfer_control(epd)
      usb_endpoint_xfer_int(epd)
      usb_endpoint_xfer_isoc(epd)
      
      are moved from include/linux/usb.h to include/linux/usb/ch9.h.
      include/linux/usb/ch9.h makes more sense for these functions because they
      only depend on constants that are defined in this file.
      Signed-off-by: NJulia Lawall <julia@diku.dk>
      Acked-by: NDavid Brownell <dbrownell@users.sourceforge.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      4d6914b7
  4. 28 1月, 2009 1 次提交
  5. 08 1月, 2009 9 次提交
    • G
      USB: remove info() macro from usb.h · 34c65d82
      Greg Kroah-Hartman 提交于
      USB should not be having it's own printk macros, so remove info() and
      use the system-wide standard of dev_info() wherever possible.
      
      No one in the tree is using the macro, so it can now be removed.
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      34c65d82
    • G
      USB: remove warn() macro from usb.h · 338b67b0
      Greg Kroah-Hartman 提交于
      USB should not be having it's own printk macros, so remove warn() and
      use the system-wide standard of dev_warn() wherever possible.  In the
      few places that will not work out, use a basic printk().
      
      Now that all in-tree users are gone, remove the macro.
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      338b67b0
    • O
      USB: extension of anchor API to unpoison an anchor · 856395d6
      Oliver Neukum 提交于
      This extension allows unpoisoning an anchor allowing drivers that
      resubmit URBs to reuse an anchor for methods like resume()
      Signed-off-by: NOliver Neukum <oneukum@suse.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      856395d6
    • M
      USB: mark "reject" field of struct urb as atomic_t · 49367d8f
      Ming Lei 提交于
      It is enough to protect accesses to reject field of urb
      by marking it as atomic_t,also it is the only reason of
      existence of usb_reject_lock,so remove the lock to make
      code more clean.
      Signed-off-by: NMing Lei <tom.leiming@gmail.com>
      Acked-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      49367d8f
    • 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
    • P
      USB: Allow usbmon as a module even if usbcore is builtin · f150fa1a
      Pete Zaitcev 提交于
      usbmon can only be built as a module if usbcore is a module too. Trivial
      changes to the relevant Kconfig and Makefile (and a few trivial changes
      elsewhere) allow usbmon to be built as a module even if usbcore is
      builtin.
      
      This is verified to work in all 9 permutations (3 correctly prohibited
      by Kconfig, 6 build a suitable result).
      Signed-off-by: NPaul Bolle <pebolle@tiscali.nl>
      Signed-off-by: NPete Zaitcev <zaitcev@redhat.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      f150fa1a
    • 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
  6. 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
  7. 18 10月, 2008 3 次提交
  8. 22 8月, 2008 1 次提交
    • A
      USB: Defer Set-Interface for suspended devices · 55151d7d
      Alan Stern 提交于
      This patch (as1128) fixes one of the problems related to the new PM
      infrastructure.  We are not allowed to register new child devices
      during the middle of a system sleep transition, but unbinding a USB
      driver causes the core to automatically install altsetting 0 and
      thereby create new endpoint pseudo-devices.
      
      The patch fixes this problem (and the related problem that installing
      altsetting 0 will fail if the device is suspended) by deferring the
      Set-Interface call until some later time when it is legal and can
      succeed.  Possible later times are: when a new driver is being probed
      for the interface, and when the interface is being resumed.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      55151d7d
  9. 14 8月, 2008 1 次提交
  10. 22 7月, 2008 5 次提交
    • A
      USB: Force unbinding of drivers lacking reset_resume or other methods · 78d9a487
      Alan Stern 提交于
      This patch (as1024) takes care of a FIXME issue: Drivers that don't
      have the necessary suspend, resume, reset_resume, pre_reset, or
      post_reset methods will be unbound and their interface reprobed when
      one of the unsupported events occurs.
      
      This is made slightly more difficult by the fact that bind operations
      won't work during a system sleep transition.  So instead the code has
      to defer the operation until the transition ends.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      78d9a487
    • M
      USB: fix usb_reset_device and usb_reset_composite_device(take 3) · 742120c6
      Ming Lei 提交于
      This patch renames the existing usb_reset_device in hub.c to
      usb_reset_and_verify_device and renames the existing
      usb_reset_composite_device to usb_reset_device. Also the new
      usb_reset_and_verify_device does't need to be EXPORTED .
      
      The idea of the patch is that external interface driver
      should warn the other interfaces' driver of the same
      device before and after reseting the usb device. One interface
      driver shoud call _old_ usb_reset_composite_device instead of
      _old_ usb_reset_device since it can't assume the device contains
      only one interface. The _old_ usb_reset_composite_device
      is safe for single interface device also. we rename the two
      functions to make the change easily.
      
      This patch is under guideline from Alan Stern.
      Signed-off-by: NMing Lei <tom.leiming@gmail.com>
      742120c6
    • M
      USB: remove interface parameter of usb_reset_composite_device · 625f6949
      Ming Lei 提交于
      From the current implementation of usb_reset_composite_device
      function, the iface parameter is no longer useful. This function
      doesn't do something special for the iface usb_interface,compared
      with other interfaces in the usb_device. So remove the parameter
      and fix the related caller.
      Signed-off-by: NMing Lei <tom.leiming@gmail.com>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      625f6949
    • A
      USB: implement "soft" unbinding · 9da82bd4
      Alan Stern 提交于
      This patch (as1091) changes the way usbcore handles interface
      unbinding.  If the interface's driver supports "soft" unbinding (a new
      flag in the driver structure) then in-flight URBs are not cancelled
      and endpoints are not disabled.  Instead the driver is allowed to
      continue communicating with the device (although of course it should
      stop before its disconnect routine returns).
      
      The purpose of this change is to allow drivers to do a clean shutdown
      when they get unbound from a device that is still plugged in.  Killing
      all the URBs and disabling the endpoints before calling the driver's
      disconnect method doesn't give the driver any control over what
      happens, and it can leave devices in indeterminate states.  For
      example, when usb-storage unbinds it doesn't want to stop while in the
      middle of transmitting a SCSI command.
      
      The soft_unbind flag is added because in the past, a number of drivers
      have experienced problems related to ongoing I/O after their disconnect
      routine returned.  Hence "soft" unbinding is made available only to
      drivers that claim to support it.
      
      The patch also replaces "interface_to_usbdev(intf)" with "udev" in a
      couple of places, a minor simplification.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      9da82bd4
    • G
      USB: handle pci_name() being const · 1b26da15
      Greg Kroah-Hartman 提交于
      This changes usb_create_hcd() to be able to handle the fact that
      pci_name() has changed to a constant string.
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      1b26da15
  11. 25 4月, 2008 7 次提交
  12. 05 3月, 2008 1 次提交
  13. 04 3月, 2008 1 次提交
  14. 02 2月, 2008 2 次提交
    • G
      USB: fix codingstyle issues in include/linux/usb.h · 969ab2ee
      Greg Kroah-Hartman 提交于
      No logical code changes were made, but checkpatch.pl is much happier now.
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      969ab2ee
    • 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