21 May, 2013

1 commit

  • 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: Julius Werner
    Acked-by: Alan Stern
    Signed-off-by: Greg Kroah-Hartman

    Julius Werner
     

30 Apr, 2013

1 commit

  • Pull USB patches from Greg Kroah-Hartman:
    "Here's the big USB pull request for 3.10-rc1.

    Lots of USB patches here, the majority being USB gadget changes and
    USB-serial driver cleanups, the rest being ARM build fixes / cleanups,
    and individual driver updates. We also finally got some chipidea
    fixes, which have been delayed for a number of kernel releases, as the
    maintainer has now reappeared.

    All of these have been in linux-next for a while"

    * tag 'usb-3.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (568 commits)
    USB: ehci-msm: USB_MSM_OTG needs USB_PHY
    USB: OHCI: avoid conflicting platform drivers
    USB: OMAP: ISP1301 needs USB_PHY
    USB: lpc32xx: ISP1301 needs USB_PHY
    USB: ftdi_sio: enable two UART ports on ST Microconnect Lite
    usb: phy: tegra: don't call into tegra-ehci directly
    usb: phy: phy core cannot yet be a module
    USB: Fix initconst in ehci driver
    usb-storage: CY7C68300A chips do not support Cypress ATACB
    USB: serial: option: Added support Olivetti Olicard 145
    USB: ftdi_sio: correct ST Micro Connect Lite PIDs
    ARM: mxs_defconfig: add CONFIG_USB_PHY
    ARM: imx_v6_v7_defconfig: add CONFIG_USB_PHY
    usb: phy: remove exported function from __init section
    usb: gadget: zero: put function instances on unbind
    usb: gadget: f_sourcesink.c: correct a copy-paste misnomer
    usb: gadget: cdc2: fix error return code in cdc_do_config()
    usb: gadget: multi: fix error return code in rndis_do_config()
    usb: gadget: f_obex: fix error return code in obex_bind()
    USB: storage: convert to use module_usb_driver()
    ...

    Linus Torvalds
     

12 Apr, 2013

1 commit


08 Apr, 2013

1 commit

  • 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: Kay Sievers
    Signed-off-by: Greg Kroah-Hartman

    Kay Sievers
     

29 Mar, 2013

1 commit

  • 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: Alan Stern
    CC: Peter Chen
    Signed-off-by: Greg Kroah-Hartman

    Alan Stern
     

22 Nov, 2012

1 commit


25 Oct, 2012

1 commit


11 Jul, 2012

1 commit

  • The USB 3.0 Set/Clear Feature U1/U2 Enable cannot be sent to a device in
    the Default or Addressed state. It can only be sent to a configured
    device. Change the USB core to initialize the LPM disable count to 1
    (disabled), which reflects this limitation.

    Change usb_set_configuration() to ensure that if the device is
    unconfigured on entry, usb_lpm_disable() is not called. This avoids
    sending the Clear Feature U1/U2 when the device is in the Addressed
    state. When usb_set_configuration() exits with a successfully installed
    configuration, usb_lpm_enable() will be called.

    Once the new configuration is installed, make sure
    usb_set_configuration() only calls usb_enable_lpm() if the device moved
    to the Configured state. If we have unconfigured the device by sending
    it a Set Configuration for config 0, don't enable LPM.

    This commit should be backported to kernels as old as 3.5, that contain
    the commit 8306095fd2c1100e8244c09bf560f97aca5a311d "USB: Disable USB
    3.0 LPM in critical sections."

    Signed-off-by: Sarah Sharp
    Cc: stable@vger.kernel.org

    Sarah Sharp
     

16 May, 2012

1 commit

  • Commit da0af6e ("usb: Bind devices to ACPI devices when possible") really
    tries to force-bind devices even when impossible, unlike what it says in
    the subject.

    CONFIG_ACPI is not an indication that ACPI tables are actually present, nor
    is an indication that any USB relevant information is present in them. There
    is no reason to fail the creation of a USB bus if it can't bind it to
    ACPI device during initialization.

    On systems with CONFIG_ACPI set but without ACPI tables it would cause a
    boot panic.

    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Sasha Levin
     

12 May, 2012

1 commit


30 Apr, 2012

1 commit


25 Jan, 2012

1 commit


13 Jan, 2012

1 commit


04 Jan, 2012

1 commit


27 Sep, 2011

1 commit

  • This commit gets BOS(Binary Device Object Store) descriptor set for Super
    Speed devices and High Speed devices which support BOS descriptor.

    BOS descriptor is used to report additional USB device-level capabilities
    that are not reported via the Device descriptor. By getting BOS descriptor
    set, driver can check device's device-level capability such as LPM
    capability.

    Signed-off-by: Andiry Xu
    Signed-off-by: Sarah Sharp
    Signed-off-by: Greg Kroah-Hartman

    Andiry Xu
     

30 Apr, 2011

1 commit


19 Mar, 2011

1 commit

  • USB defines usb_device_type pointing to usb_device_pm_ops that
    provides system-wide PM callbacks only and usb_bus_type pointing to
    usb_bus_pm_ops that provides runtime PM callbacks only. However,
    the USB runtime PM callbacks may be defined in usb_device_pm_ops
    which makes it possible to drop usb_bus_pm_ops and will allow us
    to consolidate the handling of subsystems by the PM core code.

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Greg Kroah-Hartman

    Rafael J. Wysocki
     

17 Nov, 2010

1 commit

  • 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: Alan Stern
    Signed-off-by: Greg Kroah-Hartman

    Alan Stern
     

11 Aug, 2010

1 commit

  • Fake "address-of" expressions that evaluate to NULL generally confuse
    readers and can provoke compiler warnings. This patch (as1412)
    removes three such fake expressions, using "#ifdef"s in their place.

    Signed-off-by: Alan Stern
    Signed-off-by: Greg Kroah-Hartman

    Alan Stern
     

22 May, 2010

1 commit

  • The semaphore is semantically a mutex. Convert it to a real mutex and
    fix up a few places where code was relying on semaphore.h to be included
    by device.h, as well as the users of the trylock function, as that value
    is now reversed.

    Signed-off-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

21 May, 2010

5 commits

  • 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: Stephen Rothwell
    Signed-off-by: Ming Lei
    Signed-off-by: Greg Kroah-Hartman

    Ming Lei
     
  • 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: Ming Lei
    Signed-off-by: Greg Kroah-Hartman

    Ming Lei
     
  • 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: Alan Stern
    CC:
    Signed-off-by: Greg Kroah-Hartman

    Alan Stern
     
  • 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: Alan Stern
    Signed-off-by: Greg Kroah-Hartman

    Alan Stern
     
  • 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: Eric Lescouet
    Cc: Alan Stern
    Signed-off-by: Greg Kroah-Hartman

    Eric Lescouet
     

01 May, 2010

1 commit

  • For more clearance what the functions actually do,

    usb_buffer_alloc() is renamed to usb_alloc_coherent()
    usb_buffer_free() is renamed to usb_free_coherent()

    They should only be used in code which really needs DMA coherency.

    [added compatibility macros so we can convert things easier - gregkh]

    Signed-off-by: Daniel Mack
    Cc: Alan Stern
    Cc: Pedro Ribeiro
    Signed-off-by: Greg Kroah-Hartman

    Daniel Mack
     

03 Mar, 2010

2 commits

  • 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: Herbert Xu
    Cc: stable
    Signed-off-by: Greg Kroah-Hartman

    Herbert Xu
     
  • 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: Alan Stern
    Signed-off-by: Greg Kroah-Hartman

    Alan Stern
     

24 Dec, 2009

1 commit

  • Fix new kernel-doc warnings in usb core:

    Warning(drivers/usb/core/usb.c:79): No description found for parameter 'config'
    Warning(drivers/usb/core/usb.c:79): No description found for parameter 'iface_num'
    Warning(drivers/usb/core/usb.c:79): No description found for parameter 'alt_num'
    Warning(drivers/usb/core/hcd.c:1622): No description found for parameter 'udev'

    Signed-off-by: Randy Dunlap
    Signed-off-by: Greg Kroah-Hartman

    Randy Dunlap
     

16 Dec, 2009

2 commits


15 Dec, 2009

2 commits

  • 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: Russ Dill
    Cc: stable
    Signed-off-by: Greg Kroah-Hartman

    Russ Dill
     
  • This reverts commit a2582bd478c13c574d4c16ef1209d333f2a25935.

    It turned out to be buggy and broke USB printers from working.

    Cc: Russ Dill
    Cc: stable
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

12 Dec, 2009

3 commits

  • 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: Felipe Balbi
    Signed-off-by: Greg Kroah-Hartman

    Felipe Balbi
     
  • 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: Sarah Sharp
    Signed-off-by: Greg Kroah-Hartman

    Sarah Sharp
     
  • 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: Russ Dill
    Cc: stable
    Signed-off-by: Greg Kroah-Hartman

    Russ Dill
     

23 Sep, 2009

2 commits

  • 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: Sarah Sharp
    Signed-off-by: Greg Kroah-Hartman

    Sarah Sharp
     
  • 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: Jiri Slaby
    Signed-off-by: Andrew Morton
    Signed-off-by: Greg Kroah-Hartman

    Jiri Slaby
     

20 Sep, 2009

1 commit

  • This allows subsytems to provide devtmpfs with non-default permissions
    for the device node. Instead of the default mode of 0600, null, zero,
    random, urandom, full, tty, ptmx now have a mode of 0666, which allows
    non-privileged processes to access standard device nodes in case no
    other userspace process applies the expected permissions.

    This also fixes a wrong assignment in pktcdvd and a checkpatch.pl complain.

    Signed-off-by: Kay Sievers
    Signed-off-by: Greg Kroah-Hartman

    Kay Sievers
     

17 Jun, 2009

1 commit

  • * git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6: (143 commits)
    USB: xhci depends on PCI.
    USB: xhci: Add Makefile, MAINTAINERS, and Kconfig entries.
    USB: xhci: Respect critical sections.
    USB: xHCI: Fix interrupt moderation.
    USB: xhci: Remove packed attribute from structures.
    usb; xhci: Fix TRB offset calculations.
    USB: xhci: replace if-elseif-else with switch-case
    USB: xhci: Make xhci-mem.c include linux/dmapool.h
    USB: xhci: drop spinlock in xhci_urb_enqueue() error path.
    USB: Change names of SuperSpeed ep companion descriptor structs.
    USB: xhci: Avoid compiler reordering in Link TRB giveback.
    USB: xhci: Clean up xhci_irq() function.
    USB: xhci: Avoid global namespace pollution.
    USB: xhci: Fix Link TRB handoff bit twiddling.
    USB: xhci: Fix register write order.
    USB: xhci: fix some compiler warnings in xhci.h
    USB: xhci: fix lots of compiler warnings.
    USB: xhci: use xhci_handle_event instead of handle_event
    USB: xhci: URB cancellation support.
    USB: xhci: Scatter gather list support for bulk transfers.
    ...

    Linus Torvalds