1. 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
  2. 21 1月, 2010 1 次提交
    • S
      USB: Fix duplicate sysfs problem after device reset. · 04a723ea
      Sarah Sharp 提交于
      Borislav Petkov reports issues with duplicate sysfs endpoint files after a
      resume from a hibernate.  It turns out that the code to support alternate
      settings under xHCI has issues when a device with a non-default alternate
      setting is reset during the hibernate:
      
      [  427.681810] Restarting tasks ...
      [  427.681995] hub 1-0:1.0: state 7 ports 6 chg 0004 evt 0000
      [  427.682019] usb usb3: usb resume
      [  427.682030] ohci_hcd 0000:00:12.0: wakeup root hub
      [  427.682191] hub 1-0:1.0: port 2, status 0501, change 0000, 480 Mb/s
      [  427.682205] usb 1-2: usb wakeup-resume
      [  427.682226] usb 1-2: finish reset-resume
      [  427.682886] done.
      [  427.734658] ehci_hcd 0000:00:12.2: port 2 high speed
      [  427.734663] ehci_hcd 0000:00:12.2: GetStatus port 2 status 001005 POWER sig=se0 PE CONNECT
      [  427.746682] hub 3-0:1.0: hub_reset_resume
      [  427.746693] hub 3-0:1.0: trying to enable port power on non-switchable hub
      [  427.786715] usb 1-2: reset high speed USB device using ehci_hcd and address 2
      [  427.839653] ehci_hcd 0000:00:12.2: port 2 high speed
      [  427.839666] ehci_hcd 0000:00:12.2: GetStatus port 2 status 001005 POWER sig=se0 PE CONNECT
      [  427.847717] ohci_hcd 0000:00:12.0: GetStatus roothub.portstatus [1] = 0x00010100 CSC PPS
      [  427.915497] hub 1-2:1.0: remove_intf_ep_devs: if: ffff88022f9e8800 ->ep_devs_created: 1
      [  427.915774] hub 1-2:1.0: remove_intf_ep_devs: bNumEndpoints: 1
      [  427.915934] hub 1-2:1.0: if: ffff88022f9e8800: endpoint devs removed.
      [  427.916158] hub 1-2:1.0: create_intf_ep_devs: if: ffff88022f9e8800 ->ep_devs_created: 0, ->unregistering: 0
      [  427.916434] hub 1-2:1.0: create_intf_ep_devs: bNumEndpoints: 1
      [  427.916609]  ep_81: create, parent hub
      [  427.916632] ------------[ cut here ]------------
      [  427.916644] WARNING: at fs/sysfs/dir.c:477 sysfs_add_one+0x82/0x96()
      [  427.916649] Hardware name: System Product Name
      [  427.916653] sysfs: cannot create duplicate filename '/devices/pci0000:00/0000:00:12.2/usb1/1-2/1-2:1.0/ep_81'
      [  427.916658] Modules linked in: binfmt_misc kvm_amd kvm powernow_k8 cpufreq_ondemand cpufreq_powersave cpufreq_userspace freq_table cpufreq_conservative ipv6 vfat fat
      +8250_pnp 8250 pcspkr ohci_hcd serial_core k10temp edac_core
      [  427.916694] Pid: 278, comm: khubd Not tainted 2.6.33-rc2-00187-g08d869aa-dirty #13
      [  427.916699] Call Trace:
      
      The problem is caused by a mismatch between the USB core's view of the
      device state and the USB device and xHCI host's view of the device state.
      
      After the device reset and re-configuration, the device and the xHCI host
      think they are using alternate setting 0 of all interfaces.  However, the
      USB core keeps track of the old state, which may include non-zero
      alternate settings.  It uses intf->cur_altsetting to keep the endpoint
      sysfs files for the old state across the reset.
      
      The bandwidth allocation functions need to know what the xHCI host thinks
      the current alternate settings are, so original patch set
      intf->cur_altsetting to the alternate setting 0.  This caused duplicate
      endpoint files to be created.
      
      The solution is to not set intf->cur_altsetting before calling
      usb_set_interface() in usb_reset_and_verify_device().  Instead, we add a
      new flag to struct usb_interface to tell usb_hcd_alloc_bandwidth() to use
      alternate setting 0 as the currently installed alternate setting.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Tested-by: NBorislav Petkov <petkovbb@googlemail.com>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      04a723ea
  3. 12 12月, 2009 4 次提交
    • S
      USB: Refactor code to find alternate interface settings. · 91017f9c
      Sarah Sharp 提交于
      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: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      91017f9c
    • 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
    • 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
  4. 23 9月, 2009 2 次提交
    • 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
    • P
      USB: usbmon: end ugly tricks with DMA peeking · 4e9e9200
      Pete Zaitcev 提交于
      This patch fixes crashes when usbmon attempts to access GART aperture.
      The old code attempted to take a bus address and convert it into a
      virtual address, which clearly was impossible on systems with actual
      IOMMUs. Let us not persist in this foolishness, and use transfer_buffer
      in all cases instead.
      
      I think downsides are negligible. The ones I see are:
       - A driver may pass an address of one buffer down as transfer_buffer,
         and entirely different entity mapped for DMA, resulting in misleading
         output of usbmon. Note, however, that PIO based controllers would
         do transfer the same data that usbmon sees here.
       - Out of tree drivers may crash usbmon if they store garbage in
         transfer_buffer. I inspected the in-tree drivers, and clarified
         the documentation in comments.
       - Drivers that use get_user_pages will not be possible to monitor.
         I only found one driver with this problem (drivers/staging/rspiusb).
       - Same happens with with usb_storage transferring from highmem, but
         it works fine on 64-bit systems, so I think it's not a concern.
         At least we don't crash anymore.
      
      Why didn't we do this in 2.6.10? That's because back in those days
      it was popular not to fill in transfer_buffer, so almost all
      traffic would be invisible (e.g. all of HID was like that).
      But now, the tree is almost 100% PIO friendly, so we can do the
      right thing at last.
      Signed-off-by: NPete Zaitcev <zaitcev@redhat.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      4e9e9200
  5. 21 9月, 2009 1 次提交
  6. 20 9月, 2009 1 次提交
  7. 13 7月, 2009 1 次提交
    • R
      USB: usb.h: fix kernel-doc notation · e376bbbb
      Randy Dunlap 提交于
      Fix usb.h kernel-doc warnings:
      
      Warning(include/linux/usb.h:918): Excess struct/union/enum/typedef member 'nodename' description in 'usb_device_driver'
      Warning(include/linux/usb.h:939): No description found for parameter 'nodename'
      Warning(include/linux/usb.h:1219): No description found for parameter 'sg'
      Warning(include/linux/usb.h:1219): No description found for parameter 'num_sgs'
      Signed-off-by: NRandy Dunlap <randy.dunlap@oracle.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      e376bbbb
  8. 16 6月, 2009 10 次提交
    • S
      USB: Change names of SuperSpeed ep companion descriptor structs. · f0058c62
      Sarah Sharp 提交于
      Differentiate between SuperSpeed endpoint companion descriptor and the
      wireless USB endpoint companion descriptor.  Make all structure names for
      this descriptor have "ss" (SuperSpeed) in them.  David Vrabel asked for
      this change in http://marc.info/?l=linux-usb&m=124091465109367&w=2Reported-by: NDavid Vrabel <david.vrabel@csr.com>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      f0058c62
    • 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: Parse and store the SuperSpeed endpoint companion descriptors. · 663c30d0
      Sarah Sharp 提交于
      The USB 3.0 bus specification added an "Endpoint Companion" descriptor that is
      supposed to follow all SuperSpeed Endpoint descriptors.  This descriptor is used
      to extend the bus protocol to allow more packets to be sent to an endpoint per
      "microframe".  The word microframe was removed from the USB 3.0 specification
      because the host controller does not send Start Of Frame (SOF) symbols down the
      USB 3.0 wires.
      
      The descriptor defines a bMaxBurst field, which indicates the number of packets
      of wMaxPacketSize that a SuperSpeed device can send or recieve in a service
      interval.  All non-control endpoints may set this value as high as 16 packets
      (bMaxBurst = 15).
      
      The descriptor also allows isochronous endpoints to further specify that they
      can send and receive multiple bursts per service interval.  The bmAttributes
      allows them to specify a "Mult" of up to 3 (bmAttributes = 2).
      
      Bulk endpoints use bmAttributes to report the number of "Streams" they support.
      This was an extension of the endpoint pipe concept to allow multiple mass
      storage device commands to be outstanding for one bulk endpoint at a time.  This
      should allow USB 3.0 mass storage devices to support SCSI command queueing.
      Bulk endpoints can say they support up to 2^16 (65,536) streams.
      
      The information in the endpoint companion descriptor must be stored with the
      other device, config, interface, and endpoint descriptors because the host
      controller needs to access them quickly, and we need to install some default
      values if a SuperSpeed device doesn't provide an endpoint companion descriptor.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      663c30d0
    • S
      USB: Support for submitting control URBs under xHCI. · 6d65b78a
      Sarah Sharp 提交于
      Warn users of URB_NO_SETUP_DMA_MAP about xHCI behavior.
      
      Device drivers can choose to DMA map the setup packet of a control transfer
      before submitting the URB to the USB core.  Drivers then set the
      URB_NO_SETUP_DMA_MAP and pass in the DMA memory address in setup_dma, instead of
      providing a kernel address for setup_packet.  However, xHCI requires that the
      setup packet be copied into an internal data structure, and we need a kernel
      memory address pointer for that.  Warn users of URB_NO_SETUP_DMA_MAP that they
      should provide a valid pointer for setup_packet, along with the DMA address.
      
      FIXME:  I'm not entirely sure how to work around this in the xHCI driver
      or USB core.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      6d65b78a
    • S
      USB: Support for addressing a USB device under xHCI · c6515272
      Sarah Sharp 提交于
      Add host controller driver API and a slot_id variable to struct
      usb_device.  This allows the xHCI host controller driver to ask the
      hardware to allocate a slot for the device when a struct usb_device is
      allocated.  The slot needs to be allocated at that point because the
      hardware can run out of internal resources, and we want to know that very
      early in the device connection process.  Don't call this new API for root
      hubs, since they aren't real devices.
      
      Add HCD API to let the host controller choose the device address.  This is
      especially important for xHCI hardware running in a virtualized
      environment.  The guests running under the VM don't need to know which
      addresses on the bus are taken, because the hardware picks the address for
      them.  Announce SuperSpeed USB devices after the address has been assigned
      by the hardware.
      
      Don't use the new get descriptor/set address scheme with xHCI.  Unless
      special handling is done in the host controller driver, the xHC can't
      issue control transfers before you set the device address.  Support for
      the older addressing scheme will be added when the xHCI driver supports
      the Block Set Address Request (BSR) flag in the Address Device command.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      c6515272
    • S
      USB: Add route string to struct usb_device. · 7206b001
      Sarah Sharp 提交于
      This patch adds a hex route string to each USB device.  The route string is used
      by the USB 3.0 host controller to send packets through the device tree.  USB 3.0
      hubs use this string to route packets to the correct port.  This is fundamental
      bus change from USB 2.0, where all packets were broadcast across the bus.
      
      Devices (including hubs) under a root port receive the route string 0x0.  Every
      four bits in the route string represent a port on a hub.  This length works
      because USB 3.0 hubs are limited to 15 ports, and USB 2.0 hubs (with potentially
      more ports) will never see packets with a route string.  A port number of 0
      means the packet is destined for that hub.
      
      For example, a peripheral device might have a route string of 0x00097.
      This means the device is connected to port 9 of the hub at depth 1.
      The hub at depth 1 is connected to port 7 of a hub at depth 0.
      The hub at depth 0 is connected to a root port.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      7206b001
    • R
      USB: usb.h: change private: kernel-doc for new format requirement · bf92c190
      Randy Dunlap 提交于
      Use "/* private:" to mark struct members as private so that
      scripts/kernel-doc will handle them correctly.
      Signed-off-by: NRandy Dunlap <randy.dunlap@oracle.com>
      Acked-by: NDavid Brownell <dbrownell@users.sourceforge.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      bf92c190
    • G
      USB: remove unused usb_host class · 820d7a25
      Greg Kroah-Hartman 提交于
      The usb_host class isn't used for anything anymore (it was used for
      debug files, but they have moved to debugfs a few kernel releases ago),
      so let's delete it before someone accidentally puts a file in it.
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      820d7a25
    • G
      USB: add usb debugfs directory · 00048b8b
      Greg Kroah-Hartman 提交于
      Add a common usb directory in debugfs that the usb subsystem can use.
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      00048b8b
    • K
      Driver Core: usb: add nodename support for usb drivers. · f7a386c5
      Kay Sievers 提交于
      This adds support for USB drivers to report their requested nodename to
      userspace.  It also updates a number of USB drivers to provide the
      needed subdirectory and device name to be used for them.
      Signed-off-by: NKay Sievers <kay.sievers@vrfy.org>
      Signed-off-by: NJan Blunck <jblunck@suse.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      f7a386c5
  9. 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
  10. 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
  11. 28 1月, 2009 1 次提交
  12. 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
  13. 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
  14. 18 10月, 2008 3 次提交
  15. 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