23 Sep, 2009

40 commits

  • Signed-off-by: Bob Liu
    Acked-by: Alan Stern
    Signed-off-by: Greg Kroah-Hartman

    Bob Liu
     
  • Fix printk format warnings:
    drivers/usb/class/usbtmc.c:466: warning: format '%zu' expects type 'size_t', but argument 4 has type 'u32'
    drivers/usb/class/usbtmc.c:466: warning: format '%zu' expects type 'size_t', but argument 5 has type 'int'

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

    Randy Dunlap
     
  • According to the specifications, an instrument should not return more data in a
    DEV_DEP_MSG_IN urb than requested. However, some instruments can send more
    than requested. This could cause the kernel to write the extra data past the
    end of the buffer provided by read().

    Fix this by checking that the value of the TranserSize field is not larger than
    the urb itself and not larger than the size of the userspace buffer. Also
    correctly decrement the remaining size of the buffer when userspace read()s
    more than USBTMC_SIZE_IOBUFFER.

    Signed-off-by: Guus Sliepen
    Cc: stable
    Signed-off-by: Greg Kroah-Hartman

    Guus Sliepen
     
  • Signed-off-by: Lothar Wassmann
    Signed-off-by: Michael Hennerich
    Signed-off-by: Bryan Wu
    Signed-off-by: Mike Frysinger
    Signed-off-by: Greg Kroah-Hartman

    Lothar Wassmann
     
  • This patch (as1269) fixes a bug in the way dummy_hcd handles control
    URBs. Currently it returns a -EOVERFLOW error if the wLength value in
    the setup packet is different from the URB's transfer_buffer_length.

    Other host controller drivers don't do this. There's no reason the
    two length values have to be equal, and in fact they sometimes aren't
    -- a driver might set the transfer length to the maxpacket value in
    order to handle buggy devices that don't respect wLength.

    This patch simply removes the unnecessary check and error return.

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

    Alan Stern
     
  • This patch (as1268) changes the way usbcore handles child devices that
    undergo a disconnection and reconnection while the parent hub is
    suspended. Currently, if the child isn't enabled for remote wakeup we
    leave it alone, figuring that it will go through a reset-resume when
    somebody tries to use it.

    However this isn't a good approach if the reason for the disconnection
    is that the child decided to switch modes or in some other way alter
    its descriptors. In that case we want to re-enumerate it as soon as
    possible, not wait until somebody forces a reset-resume.

    To resolve the issue, this patch treats reconnected suspended child
    devices as though they had requested a remote wakeup, even if they
    weren't enabled for it. The mode switch or descriptor change will be
    detected during the reset part of the reset-resume, and the device
    will be re-enumerated immediately.

    The disadvantage of this change is that it will cause autosuspended
    devices to be resumed when the computer wakes up from a system sleep
    during which the root hub was reset or lost power. This shouldn't
    matter much; some people would even argue that autosuspended devices
    should _always_ be resumed when the system wakes up!

    Signed-off-by: Alan Stern
    Tested-by: "Yang Fei-AFY095"
    Signed-off-by: Greg Kroah-Hartman

    Alan Stern
     
  • This patch (as1267) changes usb_kick_khubd() and hdev_to_hub() to make
    them more resilient against situations where a hub device isn't bound
    to the hub driver. The code assumes that if a root hub was
    successfully registered then it must be bound to the hub driver.

    But this assumption can fail if the user manually unbinds the hub
    driver, or more importantly, if the host controller dies causing
    usb_set_configuration to fail.

    To protect against these possibilities, make hdev_to_hub() check that
    the hub device is configured before dereferencing the active
    configuration, and make usb_kick_khubd() check that the pointer to the
    hub's private data structure isn't NULL.

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

    Alan Stern
     
  • if a subdriver has an additional suspend method, it must be called
    first to allow the subdriver to return -EBUSY, because the second
    half cannot be easily undone.

    Signed-off-by: Oliver Neukum
    Signed-off-by: Greg Kroah-Hartman

    Oliver Neukum
     
  • move both ohci-au1xxx and ehci-au1xxx over to dev_pm_ops.

    Tested on Au1200.

    Signed-off-by: Manuel Lauss
    Signed-off-by: Greg Kroah-Hartman

    Manuel Lauss
     
  • In each case, the NULL test is not necessary because the function is static
    and at the only places where it is called, the us argument has already been
    dereferenced.

    The semantic patch that finds the problem is as follows:
    (http://www.emn.fr/x-info/coccinelle/)

    //
    @@
    type T;
    expression E,E1;
    identifier i,fld;
    statement S;
    @@

    - T i = E->fld;
    + T i;
    ... when != E=E1
    when != i
    if (E == NULL||...) S
    + i = E->fld;
    //

    Signed-off-by: Julia Lawall
    Cc: Matthew Dharm
    Cc: Alan Stern
    Signed-off-by: Greg Kroah-Hartman

    Julia Lawall
     
  • Spelling correction in Motorola USB Phone driver

    Changed: * Mororola should be using the CDC ACM USB spec, but instead
    To: * Motorola should be using the CDC ACM USB spec, but instead

    Signed-off-by: Maxin B. John
    Signed-off-by: Greg Kroah-Hartman

    Maxin John
     
  • Platform device support was merged earlier, but support for boards to
    customize the devflags aspect of the controller was not. We want this on
    Blackfin systems to control the bus width, but might as well expose all of
    the fields while we're at it.

    Signed-off-by: Michael Hennerich
    Signed-off-by: Bryan Wu
    Signed-off-by: Mike Frysinger
    Signed-off-by: Greg Kroah-Hartman

    Michael Hennerich
     
  • The Intel Moorestown EHCI controller supports non-standard HOSTPCx register
    extension. This register controls the LPM behaviour and controls the behaviour
    of each USB port.

    Signed-off-by: Jacob Pan
    Signed-off-by: Alek Du
    Acked-by: Alan Stern
    Cc: David Brownell
    Signed-off-by: Greg Kroah-Hartman

    Alek Du
     
  • The ehci_qh structure merged hw and sw together which is not good:
    1. More and more items are being added into ehci_qh, the ehci_qh software
    part are unnecessary to be allocated in DMA qh_pool.
    2. If HCD has local SRAM, the sw part will consume it too, and it won't
    bring any benefit.
    3. For non-cache-coherence system, the entire ehci_qh is uncachable, actually
    we only need the hw part to be uncacheable. Spliting them will let the sw
    part to be cacheable.

    Signed-off-by: Alek Du
    Cc: David Brownell
    CC: Alan Stern
    Signed-off-by: Greg Kroah-Hartman

    Alek Du
     
  • Basically the io watchdog is only useful for those quirk HCDs. For most
    good ones, it only brings unnecessary wakeups. At least, I know the
    Intel EHCI HCDs should turn off the flag.

    Signed-off-by: Alek Du
    Cc: David Brownell
    Cc: Alan Stern
    Signed-off-by: Greg Kroah-Hartman

    Alek Du
     
  • This patch adds to the usbsevseg driver:

    - suspend/resume support
    - reset_resume support
    - autosuspend using the display's power state to determine idleness

    Signed-off-by: Oliver Neukum
    Signed-off-by: Harrison Metzger

    Oliver Neukum
     
  • usb: full runtime PM support for idmouse driver

    - add suspend/resume support
    - add reset_resume support
    - add support for autosuspend

    Signed-off-by: Oliver Neukum
    Tested-by: Andreas Deresch

    Oliver Neukum
     
  • Add missing parentheses

    Signed-off-by: Roel Kluin
    CC: Ben Dooks
    Cc: David Brownell
    Signed-off-by: Andrew Morton
    Signed-off-by: Greg Kroah-Hartman

    Roel Kluin
     
  • list_entry, which is an alias for container_of, cannot return NULL, as
    there is no way to add a NULL value to a doubly linked list.

    A simplified version of the semantic match that findds this problem is as
    follows:
    (http://www.emn.fr/x-info/coccinelle/)

    //
    @r@
    expression x,E;
    statement S1,S2;
    position p,p1;
    @@

    *x = list_entry@p(...)
    ... when != x = E
    *if@p1 (x == NULL) S1 else S2
    //

    Signed-off-by: Julia Lawall
    Signed-off-by: Greg Kroah-Hartman

    Julia Lawall
     
  • poll() should test for a disconnection of the device.

    Signed-off-by: Oliver Neukum
    Signed-off-by: Greg Kroah-Hartman

    Oliver Neukum
     
  • poll needs to return an error if a device is disconnected
    - make poll check for device's presence
    - wake all waiters in disconnect

    Signed-off-by: Oliver Neukum
    Signed-off-by: Greg Kroah-Hartman

    Oliver Neukum
     
  • a class driver should have suspend/resume. This makes sure we
    don't see a virtual disconnect unnecessarily.

    Signed-off-by: Oliver Neukum
    Signed-off-by: Greg Kroah-Hartman

    Oliver Neukum
     
  • usbtmc will happily complete read/write requests even after disconnect
    has returned. The fix is to introduce a flag.

    Signed-off-by: Oliver Neukum
    Signed-off-by: Greg Kroah-Hartman

    Oliver Neukum
     
  • There are some unused variables in serial_do_down. Remove them.

    Signed-off-by: Jiri Slaby
    Signed-off-by: Greg Kroah-Hartman

    Jiri Slaby
     
  • this adds autosupport usable even in an always online mode.

    - enables remote wakeup on open
    - autoresume for sending
    - timeout based autosuspend if nothing is sent or recieved
    - autosuspend without remote wakeup support on open/close

    Signed-off-by: Oliver Neukum
    Tested-off-by: Zhao Ming
    Signed-off-by: Greg Kroah-Hartman

    Oliver Neukum
     
  • This adds very basic otg_transceiver support, with vbus_session
    and vbus_draw callbacks.

    Now VBUS sensing can be handled by an external driver which registers
    the otg_transceiver interface. It also allows gadget drivers to configure
    the current drawn from VBUS. The UDC driver just passes their requests
    along to the transceiver driver.

    Signed-off-by: Philipp Zabel
    Signed-off-by: David Brownell
    Signed-off-by: Greg Kroah-Hartman

    Philipp Zabel
     
  • This patch (as1261) reduces the amount of detailed URB information
    logged by usbfs when the usbfs_snoop parameter is enabled.

    Currently we don't display the final status value for a completed URB.
    But we do display the entire data buffer twice: both before submission
    and after completion. The after-completion display doesn't limit
    itself to the actual_length value. But since usbmon is readily
    available in virtually all distributions, there's no reason for usbfs
    to print out any buffer contents at all!

    So this patch restricts the information to: userspace buffer pointer,
    endpoint number, type, and direction, length or actual_length, and
    timeout value or status. Now everything fits neatly into a single
    line.

    Along with those changes, the patch also fixes the snoop output for
    the REAPURBNDELAY and REAPURBNDELAY32 ioctls. The current version
    omits the 'N' from the names.

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

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

    Alan Stern
     
  • This patch (as1258) implements a feature that users have been asking
    for: It gives programs the ability to "claim" a port on a hub, via a
    new usbfs ioctl. A device plugged into a "claimed" port will not be
    touched by the kernel beyond the immediate necessities of
    initialization and enumeration.

    In particular, when a device is plugged into a "claimed" port, the
    kernel will not select and install a configuration. And when a config
    is installed by usbfs or sysfs, the kernel will not probe any drivers
    for any of the interfaces. (However the kernel will fetch various
    string descriptors during enumeration. One could argue that this
    isn't really necessary, but the strings are exported in sysfs.)

    The patch does not guarantee exclusive access to these devices; it is
    still possible for more than one program to open the device file
    concurrently. Programs are responsible for coordinating access among
    themselves.

    A demonstration program showing how to use the new interface can be
    found in an attachment to

    http://marc.info/?l=linux-usb&m=124345857431452&w=2

    The patch also makes a small simplification to the hub driver,
    replacing a bunch of more-or-less useless variants of "out of memory"
    with a single message.

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

    Alan Stern
     
  • usb_hcd_endpoint_reset() may be called in atomic context and must not
    sleep. So make whci-hcd's endpoint_reset() asynchronous. URBs
    submitted while the reset is in progress will be queued (on the std
    list) and transfers will resume once the reset is complete.

    Signed-off-by: David Vrabel
    Signed-off-by: Greg Kroah-Hartman

    David Vrabel
     
  • Add ehci support for w90p910 platform.

    Signed-off-by: Wan ZongShun
    Cc: David Brownell
    Signed-off-by: Greg Kroah-Hartman

    Wan ZongShun
     
  • Those functions are used only used to fill the set/get members of
    usb_audio_control. It doesn't make much sense to inline them.

    Signed-off-by: Laurent Pinchart
    Signed-off-by: Greg Kroah-Hartman

    Laurent Pinchart
     
  • linux/usb/audio.h is a public header file that includes definitions
    exported to userspace. To avoid namespace clashes, prefix all macro
    definitions with UAC_. Existing macros and structures prefixed with
    USB_AC_ and USB_AS_ are renamed for consistency.

    Signed-off-by: Laurent Pinchart
    Signed-off-by: Greg Kroah-Hartman

    Laurent Pinchart
     
  • USB_SUBCLASS_VENDOR_SPEC is common to several USB classes and as such belongs
    to usb/ch9.h.

    Signed-off-by: Laurent Pinchart
    Signed-off-by: Greg Kroah-Hartman

    Laurent Pinchart
     
  • And use the new definitions in the USB Audio Class gadget driver.

    Signed-off-by: Laurent Pinchart
    Signed-off-by: Greg Kroah-Hartman

    Laurent Pinchart
     
  • This fix permits the "new" usbmon to access usb-storage's data buffer
    without DMA remapping tricks. It should be compatible with PIO controllers
    and not add any new crashes. Note that from now on PIO controllers and
    usbmon are uniform in their access pattern and if one crashes then
    the other will too. Hopefuly neither does.

    As a side effect, we get rid for #ifdefs, which were a little ugly.

    Signed-off-by: Pete Zaitcev
    Signed-off-by: Greg Kroah-Hartman

    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: Pete Zaitcev
    Signed-off-by: Greg Kroah-Hartman

    Pete Zaitcev
     
  • I think this sentence was confusing regarding the possible size
    of the data area.

    Signed-off-by: Pete Zaitcev
    Signed-off-by: Greg Kroah-Hartman

    Pete Zaitcev
     
  • These statements seem to be unnecessary. No idea why, but I built all
    possible configurations and everything gets built just as before.

    It's an old patch that popped from discussion with Paul in November 2008.
    Obviously not a very high priority but better late than never.

    Signed-off-by: Pete Zaitcev
    Signed-off-by: Greg Kroah-Hartman

    Pete Zaitcev
     
  • This patch falls out of my work to fix usbmon so it uses virtual addresses.
    It is not necessary, the "new" usbmon should work just fine with sisusbvga.
    However, it seems ridiculous that anyone would use uncached memory to
    transfer bulk data. Dropping the unnecessary use of usb_buffer_alloc
    should be beneficial here, in case anyone ever uses the dongle on
    anything beyond x86.

    I had no success in raising the author of the driver by e-mail, so
    the patch is not actually tested.

    Signed-off-by: Pete Zaitcev
    Signed-off-by: Greg Kroah-Hartman

    Pete Zaitcev