1. 17 7月, 2013 1 次提交
    • A
      USB: global suspend and remote wakeup don't mix · e583d9db
      Alan Stern 提交于
      The hub driver was recently changed to use "global" suspend for system
      suspend transitions on non-SuperSpeed buses.  This means that we don't
      suspend devices individually by setting the suspend feature on the
      upstream hub port; instead devices all go into suspend automatically
      when the root hub stops transmitting packets.  The idea was to save
      time and to avoid certain kinds of wakeup races.
      
      Now it turns out that many hubs are buggy; they don't relay wakeup
      requests from a downstream port to their upstream port if the
      downstream port's suspend feature is not set (depending on the speed
      of the downstream port, whether or not the hub is enabled for remote
      wakeup, and possibly other factors).
      
      We can't have hubs dropping wakeup requests.  Therefore this patch
      goes partway back to the old policy: It sets the suspend feature for a
      port if the device attached to that port or any of its descendants is
      enabled for wakeup.  People will still be able to benefit from the
      time savings if they don't care about wakeup and leave it disabled on
      all their devices.
      
      In order to accomplish this, the patch adds a new field to the usb_hub
      structure: wakeup_enabled_descendants is a count of how many devices
      below a suspended hub are enabled for remote wakeup.  A corresponding
      new subroutine determines the number of wakeup-enabled devices at or
      below an arbitrary suspended USB device.
      
      This should be applied to the 3.10 stable kernel.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Reported-and-tested-by: NToralf Förster <toralf.foerster@gmx.de>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e583d9db
  2. 19 6月, 2013 1 次提交
  3. 07 6月, 2013 1 次提交
  4. 06 6月, 2013 1 次提交
  5. 04 6月, 2013 2 次提交
  6. 29 5月, 2013 1 次提交
  7. 21 5月, 2013 1 次提交
    • J
      usb: ehci: Only sleep for post-resume handover if devices use persist · 9b790915
      Julius Werner 提交于
      The current EHCI code sleeps a flat 110ms in the resume path if there
      was a USB 1.1 device connected to its companion controller during
      suspend, waiting for the device to reappear and reset so that it can be
      handed back to the companion. This is necessary if the device uses
      persist, so that the companion controller can actually see it during its
      own resume path.
      
      However, if the device doesn't use persist, this is entirely
      unnecessary. We might just as well ignore it and have the normal device
      detection/reset/handoff code handle it asynchronously when it eventually
      shows up. As USB 1.1 devices are almost exclusively HIDs these days (for
      which persist has no value), this can allow distros to shave another
      tenth of a second off their resume time.
      
      In order to enable this optimization, the patch also adds a new
      usb_for_each_dev() iterator that is exported by the USB core and wraps
      bus_for_each_dev() with the logic to differentiate between struct
      usb_device and struct usb_interface on the usb_bus_type bus.
      Signed-off-by: NJulius Werner <jwerner@chromium.org>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9b790915
  8. 18 5月, 2013 5 次提交
  9. 17 5月, 2013 1 次提交
  10. 16 5月, 2013 1 次提交
  11. 18 4月, 2013 1 次提交
  12. 12 4月, 2013 1 次提交
  13. 10 4月, 2013 1 次提交
  14. 08 4月, 2013 1 次提交
    • K
      driver core: add uid and gid to devtmpfs · 3c2670e6
      Kay Sievers 提交于
      Some drivers want to tell userspace what uid and gid should be used for
      their device nodes, so allow that information to percolate through the
      driver core to userspace in order to make this happen.  This means that
      some systems (i.e.  Android and friends) will not need to even run a
      udev-like daemon for their device node manager and can just rely in
      devtmpfs fully, reducing their footprint even more.
      Signed-off-by: NKay Sievers <kay@vrfy.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3c2670e6
  15. 02 4月, 2013 2 次提交
  16. 30 3月, 2013 1 次提交
    • J
      usb: Make USB persist default configurable · 4f482038
      Julius Werner 提交于
      Commit 9214d1d8 set the USB persist flag as a default for all devices.
      This might be desirable for some distributions, but it certainly has its
      trade-offs... most importantly, it can significantly increase system
      resume time, because the kernel blocks on resuming (and sometimes
      resetting) USB devices before it unfreezes userspace.
      
      This patch introduces a new config option CONFIG_USB_DEFAULT_PERSIST,
      which allows distributions to make this decision on their own without
      the need to carry a custom patch or revert the kernel's setting in
      userspace.
      
      [edited the Kconfig help text a bit - gregkh]
      Signed-off-by: NJulius Werner <jwerner@chromium.org>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4f482038
  17. 29 3月, 2013 4 次提交
    • A
      USB: improve port transitions when EHCI starts up · 05768918
      Alan Stern 提交于
      It seems to be getting more common recently for EHCI host controllers
      to be probed after their companion UHCI or OHCI controllers.  This may
      be caused partly by splitting the ehci-pci driver out from ehci-hcd,
      or it may be caused by changes in the way the kernel does driver
      probing.
      
      Regardless, it has a tendency to cause problems.  When an EHCI
      controller is initialized, it takes ownership of all the ports away
      from the companions.  In effect, it forcefully disconnects all the USB
      devices that may already be using a companion controller.
      
      This patch (as1672b) tries to make the transition more orderly by
      deconfiguring the root hubs for all the companion controllers before
      initializing the EHCI controller, and reconfiguring them afterward.
      The result is a soft disconnect rather than a hard one.
      
      Internally, the patch refactors the code involved in associating EHCI
      controllers with their companions.  The old approach, in which a
      single function is called with an argument telling it what to do (the
      companion_action enum), has been replaced with a scheme using multiple
      callback functions, each performing a single task.
      
      This patch won't solve all the problems people encounter when their
      EHCI controllers start up, but it will at least reduce the number of
      error messages generated by the unexpected disconnections.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Tested-by: NJenya Y <jy.gerstmaier@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      05768918
    • A
      USB: remove CONFIG_USB_SUSPEND option · 84ebc102
      Alan Stern 提交于
      This patch (as1675) removes the CONFIG_USB_SUSPEND option, essentially
      replacing it everywhere with CONFIG_PM_RUNTIME (except for one place
      in hub.c, where it is replaced with CONFIG_PM because the code needs
      to be used in both runtime and system PM).  The net result is code
      shrinkage and simplification.
      
      There's very little point in keeping CONFIG_USB_SUSPEND because almost
      everybody enables it.  The few that don't will find that the usbcore
      module has gotten somewhat bigger and they will have to take active
      measures if they want to prevent hubs from being runtime suspended.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      CC: Peter Chen <peter.chen@freescale.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      84ebc102
    • A
      USB: use "global suspend" for system sleep on USB-2 buses · 0aa2832d
      Alan Stern 提交于
      This patch (as1674) speeds up system sleep transitions by not
      suspending each individual device on a USB-1.1 or USB-2 bus.  The
      devices will automatically go into suspend when their root hubs are
      suspended (i.e., stop sending out Start-Of-Frame packets) -- this is
      what the USB spec calls "global suspend".
      
      Since this is what we do already when CONFIG_USB_SUSPEND isn't
      enabled, it shouldn't cause any problems.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      CC: Peter Chen <peter.chen@freescale.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0aa2832d
    • A
      USB: avoid error messages when a device is disconnected · e9e88fb7
      Alan Stern 提交于
      This patch (as1673) reduces the amount of log spew from the hub driver
      by removing a bunch of error messages in the case where the device in
      question is already known to have been disconnected.  Since the
      disconnect event itself appears in the log, there's no need for other
      error messages.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Tested-by: NJenya Y <jy.gerstmaier@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e9e88fb7
  18. 26 3月, 2013 5 次提交
    • J
      USB: fix urb-poison imbalance · 68a2bed1
      Johan Hovold 提交于
      The calls to usb_poison_urb and usb_unpoison_urb are expected to be
      balanced. However, if an urb that has not yet been submitted is
      poisoned, its reject counter will not be increased as its ep-field is
      NULL. A consecutive call to unpoison will thus in fact poison the urb
      as its reject counter will be decremented to a negative value,
      effectively preventing the urb from being submitted.
      
      Note that there are currently no in-kernel drivers affected by this.
      
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NJohan Hovold <jhovold@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      68a2bed1
    • D
      USB: hub: Avoid NULL pointer dereference when hub doesn't have any ports · 769d7368
      David Linares 提交于
      Return an error if hub->descriptor->bNbrPorts==0. Without this additional
      check, we can end up doing a "hub->ports = kzalloc(0, GFP_KERNEL)".
      This hub->ports pointer will therefore be non-NULL and will be used.
      Example of dmesg:
         INIT: usb 1-1: New USB device found, idVendor=0424, idProduct=2512
         usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
         hub 1-1:1.0: USB hub found
         version 2.86 bootinghub 1-1:1.0: 0 ports detected
         Unable to handle kernel NULL pointer dereference at virtual address 00000010
      Signed-off-by: NDavid Linares <dlinares.linux@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      769d7368
    • M
      USB: adds comment on suspend callback · 303f0847
      Ming Lei 提交于
      This patch adds comments on interface driver suspend callback
      to emphasize that the failure return value is ignored by
      USB core in system sleep context, so do not try to recover
      device for this case and let resume/reset_resume callback
      handle the suspend failure if needed.
      
      Also kerneldoc for usb_suspend_both() is updated with the
      fact.
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NMing Lei <ming.lei@canonical.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      303f0847
    • L
      usb/acpi: binding xhci root hub usb port with ACPI · bafcaf6d
      Lan Tianyu 提交于
      This patch is to bind xhci root hub usb port with its acpi node.
      The port num in the acpi table matches with the sequence in the xhci
      extended capabilities table. So call usb_hcd_find_raw_port_number() to
      transfer hub port num into raw port number which associates with
      the sequence in the xhci extended capabilities table before binding.
      Signed-off-by: NLan Tianyu <tianyu.lan@intel.com>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      bafcaf6d
    • L
      usb: add find_raw_port_number callback to struct hc_driver() · 3f5eb141
      Lan Tianyu 提交于
      xhci driver divides the root hub into two logical hubs which work
      respectively for usb 2.0 and usb 3.0 devices. They are independent
      devices in the usb core. But in the ACPI table, it's one device node
      and all usb2.0 and usb3.0 ports are under it. Binding usb port with
      its acpi node needs the raw port number which is reflected in the xhci
      extended capabilities table. This patch is to add find_raw_port_number
      callback to struct hc_driver(), fill it with xhci_find_raw_port_number()
      which will return raw port number and add a wrap usb_hcd_find_raw_port_number().
      
      Otherwise, refactor xhci_find_real_port_number(). Using
      xhci_find_raw_port_number() to get real index in the HW port status
      registers instead of scanning through the xHCI roothub port array.
      This can help to speed up.
      
      All addresses in xhci->usb2_ports and xhci->usb3_ports array are
      kown good ports and don't include following bad ports in the extended
      capabilities talbe.
           (1) root port that doesn't have an entry
           (2) root port with unknown speed
           (3) root port that is listed twice and with different speeds.
      
      So xhci_find_raw_port_number() will only return port num of good ones
      and never touch bad ports above.
      Signed-off-by: NLan Tianyu <tianyu.lan@intel.com>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      3f5eb141
  19. 16 3月, 2013 1 次提交
  20. 04 3月, 2013 1 次提交
    • R
      ACPI / glue: Add .match() callback to struct acpi_bus_type · 53540098
      Rafael J. Wysocki 提交于
      USB uses the .find_bridge() callback from struct acpi_bus_type
      incorrectly, because as a result of the way it is used by USB every
      device in the system that doesn't have a bus type or parent is
      passed to usb_acpi_find_device() for inspection.
      
      What USB actually needs, though, is to call usb_acpi_find_device()
      for USB ports that don't have a bus type defined, but have
      usb_port_device_type as their device type, as well as for USB
      devices.
      
      To fix that replace the struct bus_type pointer in struct
      acpi_bus_type used for matching devices to specific subsystems
      with a .match() callback to be used for this purpose and update
      the users of struct acpi_bus_type, including USB, accordingly.
      Define the .match() callback routine for USB, usb_acpi_bus_match(),
      in such a way that it will cover both USB devices and USB ports
      and remove the now redundant .find_bridge() callback pointer from
      usb_acpi_bus.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Acked-by: NYinghai Lu <yinghai@kernel.org>
      Acked-by: NJeff Garzik <jgarzik@pobox.com>
      53540098
  21. 24 2月, 2013 1 次提交
    • M
      usb: forbid memory allocation with I/O during bus reset · 4d769def
      Ming Lei 提交于
      If one storage interface or usb network interface(iSCSI case) exists in
      current configuration, memory allocation with GFP_KERNEL during
      usb_device_reset() might trigger I/O transfer on the storage interface
      itself and cause deadlock because the 'us->dev_mutex' is held in
      .pre_reset() and the storage interface can't do I/O transfer when the
      reset is triggered by other interface, or the error handling can't be
      completed if the reset is triggered by the storage itself (error
      handling path).
      Signed-off-by: NMing Lei <ming.lei@canonical.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Eric Dumazet <eric.dumazet@gmail.com>
      Cc: David Decotigny <david.decotigny@google.com>
      Cc: Tom Herbert <therbert@google.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: Oliver Neukum <oneukum@suse.de>
      Reviewed-by: NJiri Kosina <jkosina@suse.cz>
      Cc: Mel Gorman <mel@csn.ul.ie>
      Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
      Cc: Michal Hocko <mhocko@suse.cz>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
      Cc: Greg KH <greg@kroah.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      4d769def
  22. 23 2月, 2013 1 次提交
  23. 07 2月, 2013 1 次提交
  24. 29 1月, 2013 1 次提交
  25. 26 1月, 2013 3 次提交