platform/kernel/linux-3.10.git
17 years agoUSB: flush outstanding URBs when suspending
Alan Stern [Mon, 10 Sep 2007 15:34:26 +0000 (11:34 -0400)]
USB: flush outstanding URBs when suspending

This patch (as989) makes usbcore flush all outstanding URBs for each
device as the device is suspended.  This will be true even when
CONFIG_USB_SUSPEND is not enabled.

In addition, an extra can_submit flag is added to the usb_device
structure.  That flag will be turned off whenever a suspend request
has been received for the device, even if the device isn't actually
suspended because CONFIG_USB_SUSPEND isn't set.

It's no longer necessary to check for the device state being equal to
USB_STATE_SUSPENDED during URB submission; that check can be replaced
by a check of the can_submit flag.  This also permits us to remove
some questionable references to the deprecated power.power_state field.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: break apart flush_endpoint and disable_endpoint
Alan Stern [Mon, 10 Sep 2007 15:33:05 +0000 (11:33 -0400)]
USB: break apart flush_endpoint and disable_endpoint

This patch (as988) breaks usb_hcd_endpoint_disable() apart into two
routines.  The first, usb_hcd_flush_endpoint() does the -ESHUTDOWN
unlinking of all URBs in the endpoint's queue and waits for them to
complete.  The second, usb_hcd_disable_endpoint() -- renamed for
better grammatical style -- merely calls the HCD's endpoint_disable
method.  The changeover is easy because the routine currently has only
one caller.

This separation of function will be exploited in the following patch:
When a device is suspended, the core will be able to cancel all
outstanding URBs for that device while leaving the HCD's
endpoint-related data structures intact for later.

As an added benefit, HCDs no longer need to check for existing URBs in
their endpoint_disable methods.  It is now guaranteed that there will
be none.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: move decision to ignore FREEZE events
Alan Stern [Mon, 10 Sep 2007 15:31:43 +0000 (11:31 -0400)]
USB: move decision to ignore FREEZE events

This patch (as987) changes the way FREEZE and PRETHAW suspend events
are handled in usbcore.  The decision about whether or not to ignore
them for non-root devices is pushed down into the USB-device driver,
instead of being made in the core code.

This is appropriate, since devices exported to a virtualized guest or
over a network may indeed need to handle these types of suspend, even
though normal devices don't.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: Get rid of annoying endpoint-release message
Alan Stern [Mon, 10 Sep 2007 15:35:14 +0000 (11:35 -0400)]
USB: Get rid of annoying endpoint-release message

This patch (as990) removes an annoying debugging message.  Nobody
really cares when endpoint pseudo-devices are released.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: AMD5536: use pdev->revision
Auke Kok [Mon, 27 Aug 2007 23:16:13 +0000 (16:16 -0700)]
USB: AMD5536: use pdev->revision

Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com>
Cc: Thomas Dahlmann <thomas.dahlmann@amd.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: sisusbvga: Fix bug
Satyam Sharma [Sun, 2 Sep 2007 20:07:31 +0000 (01:37 +0530)]
USB: sisusbvga: Fix bug

drivers/usb/misc/sisusbvga/sisusb.c: In function sisusb_open
drivers/usb/misc/sisusbvga/sisusb.c:2444: warning: sisusb is used uninitialized in this function

is a genuine bug (which will cause oops). We cannot use "sisusb" in
error path for (!interface), because sisusb will itself be derived
from "interface" later.

Signed-off-by: Satyam Sharma <satyam@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: fix errornous assumption in the usb serial framework revealed by iuu_phoenix
Oliver Neukum [Fri, 17 Aug 2007 12:01:38 +0000 (14:01 +0200)]
USB: fix errornous assumption in the usb serial framework revealed by iuu_phoenix

the iuu_phoenix driver submits another URB from a completion handler.
This dictates a certain order of calls to usb_kill_urb() in kill_traffic().
As other drivers may do it the other way round, we need to use both
orders in kill_traffic().
This patch does so and should be merged before iuu_phoenix is merged.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: ELAN U132 Host Controller Driver: convert sw_lock to mutex
Matthias Kaehlcke [Thu, 6 Sep 2007 21:18:15 +0000 (23:18 +0200)]
USB: ELAN U132 Host Controller Driver: convert sw_lock to mutex

The ELAN U132 Host Controller Driver uses the semaphore sw_lock as
mutex. Use the mutex API instead of the (binary) semaphore.

Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: usb-storage: Initialize Huawei E220 properly
Johann Wilhelm [Wed, 5 Sep 2007 11:49:29 +0000 (13:49 +0200)]
USB: usb-storage: Initialize Huawei E220 properly

This is a reworked version of this patch:
http://www.mail-archive.com/linux-usb-devel%40lists.sourceforge.net/msg55094/activate_huawei_dev.patch

That properly initializes the HUAWEI E220 devices into multi-port mode.

Signed-off-by: Johann Wilhelm <johann.wilhelm@student.tugraz.at>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: fix location of statement label in dummy-hcd
Alan Stern [Tue, 4 Sep 2007 13:53:24 +0000 (09:53 -0400)]
USB: fix location of statement label in dummy-hcd

This patch (as984) fixes a rather elementary mistake in dummy_hcd.
The new statement label should come before the spin_unlock_irqrestore,
not after it.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: remove traces of urb->status from usbcore
Alan Stern [Fri, 24 Aug 2007 19:42:52 +0000 (15:42 -0400)]
USB: remove traces of urb->status from usbcore

This patch (as981) removes the remaining nontrivial usages of
urb->status from usbcore.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: get rid of urb->lock
Alan Stern [Fri, 24 Aug 2007 19:42:39 +0000 (15:42 -0400)]
USB: get rid of urb->lock

Now that urb->status isn't used, urb->lock doesn't protect anything.
This patch (as980) removes it and replaces it with a private mutex in
the one remaining place it was still used: usb_kill_urb.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: Eliminate urb->status usage!
Alan Stern [Fri, 24 Aug 2007 19:42:24 +0000 (15:42 -0400)]
USB: Eliminate urb->status usage!

This patch (as979) removes the last vestiges of urb->status from the
host controller drivers and the root-hub emulator.  Now the field
doesn't get set until just before the URB's completion routine is
called.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
CC: David Brownell <david-b@pacbell.net>
CC: Olav Kongas <ok@artecdesign.ee>
CC: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
CC: Tony Olech <tony.olech@elandigitalsystems.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: reorganize urb->status use in usbmon
Alan Stern [Fri, 24 Aug 2007 19:41:41 +0000 (15:41 -0400)]
USB: reorganize urb->status use in usbmon

This patch (as978) reorganizes the way usbmon uses urb->status.  It
now accepts the status value as an argument.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Acked-by: Pete Zaitcev <zaitcev@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: reorganize urb->status use in r8a66597-hcd
Alan Stern [Fri, 24 Aug 2007 19:41:18 +0000 (15:41 -0400)]
USB: reorganize urb->status use in r8a66597-hcd

This patch (as977) reorganizes the way r8a66597-hcd sets urb->status.  It
now keeps the information in a local variable until the last moment.

Parts of this patch were written by Yoshihiro Shimoda.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
CC: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: reorganize urb->status use in sl811-hcd
Alan Stern [Fri, 24 Aug 2007 19:40:47 +0000 (15:40 -0400)]
USB: reorganize urb->status use in sl811-hcd

This patch (as976) reorganizes the way sl811-hcd sets urb->status.  It
now keeps the information in a local variable until the last moment.

The patch also improves the handling of faults during the status stage
of a control transfer, since it no longer needs to retain the error
information from the earlier stages.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
CC: David Brownell <david-b@pacbell.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: reorganize urb->status use in ohci-hcd
Alan Stern [Fri, 24 Aug 2007 19:40:34 +0000 (15:40 -0400)]
USB: reorganize urb->status use in ohci-hcd

This patch (as975) reorganizes the way ohci-hcd sets urb->status.  It
now keeps the information in a local variable until the last moment.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
CC: David Brownell <david-b@pacbell.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: reorganize urb->status use in ehci-hcd
Alan Stern [Fri, 24 Aug 2007 19:40:19 +0000 (15:40 -0400)]
USB: reorganize urb->status use in ehci-hcd

This patch (as974) reorganizes the way ehci-hcd sets urb->status.  It
now keeps the information in a local variable until the last moment.

The patch also simplifies the handling of -EREMOTEIO, since the only
use of that code is to set the do_status flag.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
CC: David Brownell <david-b@pacbell.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: reorganize urb->status use in dummy-hcd
Alan Stern [Fri, 24 Aug 2007 19:40:10 +0000 (15:40 -0400)]
USB: reorganize urb->status use in dummy-hcd

This patch (as973) reorganizes the way dummy-hcd sets urb->status.  It
now keeps the information in a local variable until the last moment.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agousb: serial/pl2303: support for BenQ Siemens Mobile Phone EF81
Andreas Loibl [Thu, 23 Aug 2007 23:51:11 +0000 (01:51 +0200)]
usb: serial/pl2303: support for BenQ Siemens Mobile Phone EF81

This patch adds support for the BenQ Mobile Phone EF81 to pl2303

Signed-off-by: Andreas Loibl <andreas@andreas-loibl.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agousb: avoid redundant cast of kmalloc() return value in OTi-6858 driver
Jesper Juhl [Fri, 24 Aug 2007 00:35:14 +0000 (02:35 +0200)]
usb: avoid redundant cast of kmalloc() return value in OTi-6858 driver

In drivers/usb/serial/oti6858.c::pl2303_buf_alloc() the return value
of kmalloc() is being cast to "struct pl2303_buf *", but that need
not be done here since kmalloc() returns "void *".

Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: usbmon doc update - mention new wildcard ('0') bus
Paolo 'Blaisorblade' Giarrusso [Fri, 24 Aug 2007 10:19:22 +0000 (12:19 +0200)]
USB: usbmon doc update - mention new wildcard ('0') bus

Update usbmon documentation, mentioning the "zero" (wildcard) bus.
Possibly, in my first hunk, the 'either ... or ...' should be rephrased a bit to
be expressed better.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Pete Zaitcev <zaitcev@redhat.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agousb-serial: show port number in sysfs
Roman Kagan [Fri, 24 Aug 2007 16:22:52 +0000 (20:22 +0400)]
usb-serial: show port number in sysfs

Some usb-serial devices (e.g. certain Edgeport models) have more than
one serial port on the same USB device/interface.

Currently the only way to distinguish these ports in userspace is by
their minor device number: the driver makes them consecutive and in
stable order.

However, for the purpose of stable naming with udev this is
insufficient: when udev handles the ADD event for one of the ports it
doesn't know what minor number the other one has.

To make stable naming easier, export the port number via sysfs.

Signed-off-by: Roman Kagan <rkagan@sw.ru>
Signed-off-by: Dmitry Guryanov <dimak@dgap.mipt.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: fix memory leak in berry_charge driver
Greg Kroah-Hartman [Thu, 23 Aug 2007 22:55:34 +0000 (15:55 -0700)]
USB: fix memory leak in berry_charge driver

This fixes a small memory leak that happens every time the device is
plugged in.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: less-restrictive command checking in g-file-storage
Alan Stern [Fri, 24 Aug 2007 20:27:50 +0000 (16:27 -0400)]
USB: less-restrictive command checking in g-file-storage

This patch (as983) makes a test for minimum-length command sizes in
g_file_storage less restrictive.  It doesn't matter because commands
with bad lengths will be detected later on anyway, and doing it like
this makes the driver interoperable with certain buggy hosts such as
the JVC HiFi (reported by Samuel Hangouet).

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: kobil_sct: Rework driver
Alan Cox [Wed, 22 Aug 2007 22:09:16 +0000 (23:09 +0100)]
USB: kobil_sct: Rework driver

No hardware but this driver is currently totally broken so we can't make
it much worse. Remove all tbe broken invalid termios handling and replace
it with a proper set_termios method.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: cp2101: Coding style police
Alan Cox [Wed, 22 Aug 2007 22:06:48 +0000 (23:06 +0100)]
USB: cp2101: Coding style police

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: avoid the donelist after an error in ohci-hcd
Alan Stern [Wed, 22 Aug 2007 17:08:40 +0000 (13:08 -0400)]
USB: avoid the donelist after an error in ohci-hcd

This patch (as972) changes ohci-hcd so that after an error occurs, the
remaining TDs for the URB will be skipped over entirely instead of
going through the donelist.  This enables the driver to give back the
URB as soon as the error is detected, avoiding the need to store the
error status in urb->status.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
CC: David Brownell <david-b@pacbell.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: fix mistake in usb_hcd_giveback_urb
Alan Stern [Wed, 22 Aug 2007 17:06:53 +0000 (13:06 -0400)]
USB: fix mistake in usb_hcd_giveback_urb

This patch (as971) fixes a small mistake: The URB's completion status
needs to be adjusted before the URB is passed to usmon_urb_complete(),
not afterward.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: ftdi_sio: Handle FT232RL devices like FT232BM devices
Andrew M. Bishop [Tue, 21 Aug 2007 18:08:56 +0000 (19:08 +0100)]
USB: ftdi_sio: Handle FT232RL devices like FT232BM devices

Handle the FT232RL device type in exactly the same way as FT232BM
devices (FT232RL detection was added around kernel 2.6.20 but not code
for handling it).

Signed-off-by: Andrew M. Bishop <amb@gedanken.demon.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: add urb->unlinked field
Alan Stern [Tue, 21 Aug 2007 19:40:36 +0000 (15:40 -0400)]
USB: add urb->unlinked field

This patch (as970) adds a new urb->unlinked field, which is used to
store the status of unlinked URBs since we can't use urb->status for
that purpose any more.  To help simplify the HCDs, usbcore will check
urb->unlinked before calling the completion handler; if the value is
set it will automatically override the status reported by the HCD.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
CC: David Brownell <david-b@pacbell.net>
CC: Olav Kongas <ok@artecdesign.ee>
CC: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
CC: Tony Olech <tony.olech@elandigitalsystems.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: centralize -EREMOTEIO handling
Alan Stern [Tue, 21 Aug 2007 19:39:21 +0000 (15:39 -0400)]
USB: centralize -EREMOTEIO handling

This patch (as969) continues the ongoing changes to the way HCDs
report URB statuses.  The programming interface has been simplified by
making usbcore responsible for clearing urb->hcpriv and for setting
-EREMOTEIO status when an URB with the URB_SHORT_NOT_OK flag ends up
as a short transfer.

By moving the work out of the HCDs, this removes a fair amount of
repeated code.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
CC: David Brownell <david-b@pacbell.net>
CC: Olav Kongas <ok@artecdesign.ee>
CC: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
CC: Tony Olech <tony.olech@elandigitalsystems.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: remove Iso status value in uhci-hcd
Alan Stern [Tue, 21 Aug 2007 19:37:50 +0000 (15:37 -0400)]
USB: remove Iso status value in uhci-hcd

This patch (968) changes the way uhci-hcd reports status for
Isochronous URBs.  Until now urb->status has been set to the last
detected error code.  But other HCDs don't do this; they leave the
status set to 0 and report errors only in the individual iso packet
descriptors.  So this patch removes the extra computation and makes
uhci-hcd behave like the others.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: minor fixes for r8a66597 driver
Alan Stern [Tue, 21 Aug 2007 19:36:52 +0000 (15:36 -0400)]
USB: minor fixes for r8a66597 driver

This patch (as967) makes a few relatively minor changes to the
r8a66597 driver:

finish_request() does nothing but call done(), so merge the
two routines.

Detect and report -EOVERFLOW errors.

Fix the calculation that checks for short packets.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
CC: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: EHCI restart speedup
Marcelo Tosatti [Tue, 21 Aug 2007 01:13:27 +0000 (18:13 -0700)]
USB: EHCI restart speedup

It is not necessary to powerdown the ports on ehci_pci_reinit() when the
chip reset already did that.  Removing this saves 20ms during restart
after poweroff paths (which OLPC uses a lot).

To ensure driver startup then behaves consistently, force a reset during
driver startup.  (Not doing this was an accident of some previous changes
to the init sequence.)

Make the corresponding change in the PS3 support.  It's not clear what
ehci-fsl should do here; it has similar code to the PS3.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: <rvinson@mvista.com>
Acked-by: Geoff Levand <geoffrey.levand@am.sony.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUEAGLE: Cosmetic
Stanislaw Gruszka [Mon, 20 Aug 2007 21:21:19 +0000 (23:21 +0200)]
UEAGLE: Cosmetic

Update copyrights and remove not necessary warning (ueagle-atm works
well on suspend/resume).

Signed-off-by: Stanislaw Gruszka <stf_xl@wp.pl>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUEAGLE: Do not sleep when device is disconnected
Stanislaw Gruszka [Mon, 20 Aug 2007 21:21:14 +0000 (23:21 +0200)]
UEAGLE: Do not sleep when device is disconnected

Do not sleep in kernel thread when device is disconnected, this make faster
suspending and module unloading. Use one wait queue for sleeping.

Signed-off-by: Stanislaw Gruszka <stf_xl@wp.pl>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUEAGLE: Avoid keyboard driver blocking
Stanislaw Gruszka [Mon, 20 Aug 2007 21:21:10 +0000 (23:21 +0200)]
UEAGLE: Avoid keyboard driver blocking

Ueagle-atm driver load DSP firmware in function, which is running from
common workqueue. In some (error) circumstances loading firmware may
sleep for long periods (even 60 seconds, depending on timeout). This
block keyboard driver, which also use common workqueue. To fix problem
use custom workqueue in ueagle-atm.

Signed-off-by: Stanislaw Gruszka <stf_xl@wp.pl>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUEAGLE: Allow user to choose input interface alternate setting
Stanislaw Gruszka [Mon, 20 Aug 2007 21:21:06 +0000 (23:21 +0200)]
UEAGLE: Allow user to choose input interface alternate setting

Let's user control how much USB bus bandwidth will be reserved by
ueagle-atm device. This make possible to share bus with other devices
when ueagle-atm driver works in isochronous mode.

Signed-off-by: Stanislaw Gruszka <stf_xl@wp.pl>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUEAGLE: Devolo and Elsa chipsets support
Stanislaw Gruszka [Mon, 20 Aug 2007 21:21:01 +0000 (23:21 +0200)]
UEAGLE: Devolo and Elsa chipsets support

Support for Devolo and Elsa chipsets. These chipsets have no information
about ADSL annex (line type) encoded in USB descriptors. Driver try to
get this information from USB VID and PID or it can be explicitly set by
the user through module parameter. Thanks to Johann Hanne, whose make
most of this patch.

Signed-off-by: Stanislaw Gruszka <stf_xl@wp.pl>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUEAGLE: Eagle IV chipset support
Stanislaw Gruszka [Mon, 20 Aug 2007 21:23:12 +0000 (23:23 +0200)]
UEAGLE: Eagle IV chipset support

Add support to newest chipset of eagle family. It is compatible with
older chipsets at USB level. However DSP firmware and CMVs
(Configuration and Management Variables) have different format of data
and are sent/received by different way.

Signed-off-by: Stanislaw Gruszka <stf_xl@wp.pl>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: remove unnecessary tests in isp116x and sl811
Alan Stern [Thu, 16 Aug 2007 20:17:49 +0000 (16:17 -0400)]
USB: remove unnecessary tests in isp116x and sl811

This patch (as962) cleans up some code I forgot to remove earlier in
the isp116x and sl811 HCDs.  There is no longer any need to check for
unlink-during-submit; it can't happen since the endpoint queues are
now under the protection of the HCD-private spinlock.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
CC: David Brownell <david-b@pacbell.net>
CC: Olav Kongas <ok@artecdesign.ee>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: ark3116.c: fix check-after-use
Adrian Bunk [Tue, 14 Aug 2007 21:22:50 +0000 (23:22 +0200)]
USB: ark3116.c: fix check-after-use

The Coverity checker spotted that we'd have already oops'ed if one of
these was NULL.

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: missing test for ESHUTDOWN in adutux driver
Oliver Neukum [Thu, 16 Aug 2007 14:02:08 +0000 (16:02 +0200)]
USB: missing test for ESHUTDOWN in adutux driver

this driver lacks a test for unlink due to ESHUTDOWN

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agousb: remove redundant memset from amd5536udc
Mariusz Kozlowski [Fri, 10 Aug 2007 21:53:37 +0000 (14:53 -0700)]
usb: remove redundant memset from amd5536udc

Remove redundant memset() call from udc_pci_probe().  No functional change.

Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: ftdi-elan.c: kmalloc + memset conversion to kzalloc
Mariusz Kozlowski [Fri, 10 Aug 2007 21:53:35 +0000 (14:53 -0700)]
USB: ftdi-elan.c: kmalloc + memset conversion to kzalloc

 drivers/usb/misc/ftdi-elan.c | 121253 -> 121196 (-57 bytes)
 drivers/usb/misc/ftdi-elan.o | 209425 -> 209265 (-160 bytes)

Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: mct_u232-convert-to-proper-speed-handling-api-fix
Andrew Morton [Fri, 10 Aug 2007 21:53:35 +0000 (14:53 -0700)]
USB: mct_u232-convert-to-proper-speed-handling-api-fix

Make Pete happy

Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Pete Zaitcev <zaitcev@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: kl5kusb105: witch to new speed API
Alan Cox [Fri, 10 Aug 2007 21:53:34 +0000 (14:53 -0700)]
USB: kl5kusb105: witch to new speed API

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agousblp: Fix a double kfree
Pete Zaitcev [Tue, 14 Aug 2007 20:19:16 +0000 (13:19 -0700)]
usblp: Fix a double kfree

If submit fails, slab hits a BUG() because of a double kfree.
The today's lesson is, you cannot just slap USB_FREE_BUFFER on code
without adjusting the error paths.

The patch is made bigger by opportunistic refactoring.

Signed-Off-By: Pete Zaitcev <zaitcev@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agousbmon: Smooth the core code
Pete Zaitcev [Tue, 14 Aug 2007 07:42:53 +0000 (00:42 -0700)]
usbmon: Smooth the core code

Two things:
 - mbus can be NULL (in case of bus removal while reader is reading)
 - Remove a useless assignment

Signed-off-by: Pete Zaitcev <zaitcev@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agousbmon: Drop DMA mapping for setup packet
Pete Zaitcev [Tue, 14 Aug 2007 07:37:51 +0000 (00:37 -0700)]
usbmon: Drop DMA mapping for setup packet

Setup packet must be visible in virtual space. There's absolutely no
good reason to implement any kind of zero-copy transfer of 8 bytes, and
the documentation in usb.h is explicit about it. So, drop DMA remapping.

Signed-off-by: Pete Zaitcev <zaitcev@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agousbmon: Update pipe removal to suit my taste
Pete Zaitcev [Tue, 14 Aug 2007 07:33:40 +0000 (00:33 -0700)]
usbmon: Update pipe removal to suit my taste

This is a set of small updates to Alan's work to make the code more to
my liking. Mostly premature optimizations, but also direction of control
transfers in the binary interface was always out.

Signed-off-by: Pete Zaitcev <zaitcev@redhat.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agousblp: Cosmetics
Pete Zaitcev [Tue, 14 Aug 2007 05:54:29 +0000 (22:54 -0700)]
usblp: Cosmetics

This is a small bunch of cosmetic fixes:
 - Timeout is not a write timeout anymore, rename
 - Condition in poll was confusingly backwards, invert and simplify
 - The comment log gave a wrong impression of version 0.13, terminate it.

Signed-off-by: Pete Zaitcev <zaitcev@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agousblp: mutex in usblp_check_status
Pete Zaitcev [Tue, 14 Aug 2007 05:50:13 +0000 (22:50 -0700)]
usblp: mutex in usblp_check_status

Add a mutex to protect the ->statusbuf. Not really an issue, because CUPS
is single-threaded when it talks to the printer, but I feel safer this way.
This should be deadlock-free, but I kept this as a separate patch in case
someone ends running a git bisect.

Signed-off-by: Pete Zaitcev <zaitcev@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: SisUSB2VGA: Convert printk to dev_* macros
Felipe Balbi [Wed, 15 Aug 2007 14:38:12 +0000 (10:38 -0400)]
USB: SisUSB2VGA: Convert printk to dev_* macros

This patch convert printk entries to dev_* macros, this provide better
debugging and better readability to the code.

Signed-off-by: Felipe Balbi <felipe.lima@indt.org.br>
Cc: Thomas <thomas@winischhofer.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: SisUSB2VGA: Lindent drivers/usb/misc/sisusbvga/sisusb_struct.h
Felipe Balbi [Fri, 10 Aug 2007 20:04:56 +0000 (16:04 -0400)]
USB: SisUSB2VGA: Lindent drivers/usb/misc/sisusbvga/sisusb_struct.h

Better indentation

Signed-off-by: Felipe Balbi <felipe.lima@indt.org.br>
Cc: Thomas Winischhofer <thomas@winischhofer.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: SisUSB2VGA: Lindent drivers/usb/misc/sisusbvga/sisusb_init.h
Felipe Balbi [Fri, 10 Aug 2007 13:34:32 +0000 (09:34 -0400)]
USB: SisUSB2VGA: Lindent drivers/usb/misc/sisusbvga/sisusb_init.h

Better indentation

Signed-off-by: Felipe Balbi <felipe.lima@indt.org.br>
Cc: Thomas Winischhofer <thomas@winischhofer.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: SisUSB2VGA: Lindent drivers/usb/misc/sisusbvga/sisusb_init.c
Felipe Balbi [Fri, 10 Aug 2007 13:34:31 +0000 (09:34 -0400)]
USB: SisUSB2VGA: Lindent drivers/usb/misc/sisusbvga/sisusb_init.c

Better indentation

Signed-off-by: Felipe Balbi <felipe.lima@indt.org.br>
Cc: Thomas Winischhofer <thomas@winischhofer.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: SisUSB2VGA: Lindent drivers/usb/misc/sisusbvga/sisusb.h
Felipe Balbi [Fri, 10 Aug 2007 13:34:29 +0000 (09:34 -0400)]
USB: SisUSB2VGA: Lindent drivers/usb/misc/sisusbvga/sisusb.h

Better indentation

Signed-off-by: Felipe Balbi <felipe.lima@indt.org.br>
Cc: Thomas Winischhofer <thomas@winischhofer.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: SisUSB2VGA: Mis-spelled word
Felipe Balbi [Fri, 10 Aug 2007 13:34:27 +0000 (09:34 -0400)]
USB: SisUSB2VGA: Mis-spelled word

Trivial fix

Signed-off-by: Felipe Balbi <felipe.lima@indt.org.br>
Cc: Thomas Winischhofer <thomas@winischhofer.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: SisUSB2VGA: Remove if 0'ed code
Felipe Balbi [Fri, 10 Aug 2007 13:34:26 +0000 (09:34 -0400)]
USB: SisUSB2VGA: Remove if 0'ed code

Unused code should be removed. We don't need to increase
the size of the file with dead code inside if 0 statements.

Signed-off-by: Felipe Balbi <felipe.lima@indt.org.br>
Cc: Thomas Winischhofer <thomas@winischhofer.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: SisUSB2VGA: Whitespace Cleanups
Felipe Balbi [Fri, 10 Aug 2007 13:34:24 +0000 (09:34 -0400)]
USB: SisUSB2VGA: Whitespace Cleanups

This patches clean some trailing whitespaces in sisusb2vga
driver.

Signed-off-by: Felipe Balbi <felipe.lima@indt.org.br>
Cc: Thomas Winischhofer <thomas@winischhofer.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: cleanups for g_file_storage
Alan Stern [Wed, 8 Aug 2007 21:10:11 +0000 (17:10 -0400)]
USB: cleanups for g_file_storage

This patch (as957) makes some minor cleanups to the g_file_storage
driver:

Update the copyright date and version string;

Uniformize the logging macros for the gadget and the LUNs;

Remove "inline" markers -- nowadays we rely on the compiler
to decide which routines are best inlined;

Use the print_hex_dump() library routines;

Remove some unnecessary assignments within conditionals
and fix some close-brace indenting levels;

Fix some column-80 violations.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: don't touch sysfs stuff when altsetting is unchanged
Alan Stern [Wed, 8 Aug 2007 15:59:18 +0000 (11:59 -0400)]
USB: don't touch sysfs stuff when altsetting is unchanged

This patch (as955) prevents the interface-related sysfs files and
endpoint pseudo-devices from being deleted and recreated when a call
to usb_set_interface() specifies the current altsetting.  Since the
altsetting doesn't get changed, there's no need to do anything.

Furthermore, avoiding changes to the endpoint devices will be
necessary in the future.  This code is called from usb_reset_device(),
which gets invoked for reset-resume processing, but upcoming changes
to the PM and driver cores will make it impossible to register devices
while a suspend/resume transition is in progress.  Since we don't need
to re-register those endpoint devices anyhow, it's best to skip the
whole thing.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: make HCDs responsible for managing endpoint queues
Alan Stern [Wed, 8 Aug 2007 15:48:02 +0000 (11:48 -0400)]
USB: make HCDs responsible for managing endpoint queues

This patch (as954) implements a suggestion of David Brownell's.  Now
the host controller drivers are responsible for linking and unlinking
URBs to/from their endpoint queues.  This eliminates the possiblity of
strange situations where usbcore thinks an URB is linked but the HCD
thinks it isn't.  It also means HCDs no longer have to check for URBs
being dequeued before they were fully enqueued.

In addition to the core changes, this requires changing every host
controller driver and the root-hub URB handler.  For the most part the
required changes are fairly small; drivers have to call
usb_hcd_link_urb_to_ep() in their urb_enqueue method,
usb_hcd_check_unlink_urb() in their urb_dequeue method, and
usb_hcd_unlink_urb_from_ep() before giving URBs back.  A few HCDs make
matters more complicated by the way they split up the flow of control.

In addition some method interfaces get changed.  The endpoint argument
for urb_enqueue is now redundant so it is removed.  The unlink status
is required by usb_hcd_check_unlink_urb(), so it has been added to
urb_dequeue.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
CC: David Brownell <david-b@pacbell.net>
CC: Olav Kongas <ok@artecdesign.ee>
CC: Tony Olech <tony.olech@elandigitalsystems.com>
CC: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: make usb_release_interface static
Greg Kroah-Hartman [Fri, 3 Aug 2007 04:44:27 +0000 (22:44 -0600)]
USB: make usb_release_interface static

No one else calls it, this makes sparse happy.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: rename choose_configuration
Greg Kroah-Hartman [Fri, 3 Aug 2007 04:44:27 +0000 (22:44 -0600)]
USB: rename choose_configuration

As it is global, give it a usb specific name in the global namespace.

Cc: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agousb: document device authorization
Inaky Perez-Gonzalez [Wed, 1 Aug 2007 03:34:08 +0000 (20:34 -0700)]
usb: document device authorization

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agousb: hook up device authorization to sysfs
Inaky Perez-Gonzalez [Wed, 1 Aug 2007 03:34:07 +0000 (20:34 -0700)]
usb: hook up device authorization to sysfs

Makes it possible to control the authorization of USB devices through
sysfs's /sys/usb/devices/*/authorize.

Update: per Adrian Bunk's suggestion, make dev_attr_authorized_default static

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agousb: introduce usb_authorize/deauthorize()
Inaky Perez-Gonzalez [Wed, 1 Aug 2007 03:34:06 +0000 (20:34 -0700)]
usb: introduce usb_authorize/deauthorize()

These USB API functions will do the full authorization/deauthorization
to be used for a device. When authorized we effectively allow a
configuration to be set. Reverse that when deauthorized.

Effectively this means that we have to clean all the configuration
descriptors on deauthorize and reload them when we authorized. We could
do without throwing them out for wired devices, but for wireless, we can
read them only after authenticating, and thus, when authorizing an
authenticated device we would need to read them. So to simplify, always
release them on deauthorize(), re-read them on authorize().

Also fix leak reported by Ragner Magalhaes; in usb_deauthorize_device(),
bNumConfigurations was being set to zero before the for loop, and thus
the different raw descriptors where never being freed.

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agousb: split usb_new_device for clarity and refactoring
Inaky Perez-Gonzalez [Wed, 1 Aug 2007 03:34:05 +0000 (20:34 -0700)]
usb: split usb_new_device for clarity and refactoring

This patch takes hub.c:usb_new_device() and splits it in three parts:

- The actual actions of adding a new device (quirk detection,
  announcement and autoresume tracking)

- Actual discovery and probing of the configuration and interfaces
  (split into __usb_configure_device())

- Configuration of the On-the-go parameters (split into
  __usb_configure_device_otg()).

The fundamental reasons for doing this split are clarity (smaller
functions are easier to maintain) and to allow part of the code to be
reused when authorizing devices to connect.

When a device is authorized connection, we need to run through the
hoops we didn't run when it was connected but not authorized, which is
basically parsing the configurations and probing
them. usb_configure_device() will do that for us.

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agousb: usb_generic_probe() obeys authorization
Inaky Perez-Gonzalez [Wed, 1 Aug 2007 03:34:04 +0000 (20:34 -0700)]
usb: usb_generic_probe() obeys authorization

If called and the device is not authorized to be used, then we won't
choose a configuration (as they are not a concept that exists for an
unauthorized device). However, the device is added to the system.

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agousb: usb_probe_interface() obeys authorization
Inaky Perez-Gonzalez [Wed, 1 Aug 2007 03:34:03 +0000 (20:34 -0700)]
usb: usb_probe_interface() obeys authorization

If called and the device is not authorized to be used, it won't
configure the interface and print a message saying so.

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agousb: usb_get_configuration() obeys authorization
Inaky Perez-Gonzalez [Wed, 1 Aug 2007 03:34:02 +0000 (20:34 -0700)]
usb: usb_get_configuration() obeys authorization

If called and the device is not authorized to be used, then we don't
allow reading the configurations.

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agousb: usb_set_configuration() obeys authorization
Inaky Perez-Gonzalez [Wed, 1 Aug 2007 03:34:01 +0000 (20:34 -0700)]
usb: usb_set_configuration() obeys authorization

Will refuse to configure a non-authorized device.

Update: simplified if statement--thanks to Ragner Magalhaes for the
heads up.

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agousb: initialize authorization and wusb bits in USB devices
Inaky Perez-Gonzalez [Wed, 1 Aug 2007 03:34:00 +0000 (20:34 -0700)]
usb: initialize authorization and wusb bits in USB devices

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agousb: cleanup usb_register_bus() and hook up sysfs group
Inaky Perez-Gonzalez [Wed, 1 Aug 2007 03:33:59 +0000 (20:33 -0700)]
usb: cleanup usb_register_bus() and hook up sysfs group

This path cleans the exit paths of usb_register_bus() [to use a goto
schema], maximum line length (keeping it under ~75).

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agousb: add the concept of default authorization to USB hosts
Inaky Perez-Gonzalez [Wed, 1 Aug 2007 03:33:58 +0000 (20:33 -0700)]
usb: add the concept of default authorization to USB hosts

This introduces /sys/bus/devices/usb*/authorized_default; it dictates
what is going to be the default authorization state for devices
connected to the host. User space can set that using the sysfs file.

We hook to the root hub instead of to the device controller as it is
quite easy to get to it in sysfs from the device structure (device
5-4.3 is usb5) vs. backtracking to the controller device.

By default it is set to be 'authorized' (!0) for normal, wired USB
devices and 'unauthorized' (0) for Wireless USB devices.

As suggested by Adrian Bunk, make authorized_default static

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agousb: introduce usb_device authorization bits
Inaky Perez-Gonzalez [Wed, 1 Aug 2007 03:33:57 +0000 (20:33 -0700)]
usb: introduce usb_device authorization bits

This just modifies 'struct usb_device' to contain the 'authorized'
bit. It also adds a 'wusb' bit. This is needed because nonauthorized
(and thus non-authenticated) wusb devices will fail certain kind of
simple requests (such as string descriptors). By knowing the device is
WUSB, we just avoid them.

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: gadget: gadget zero cleanups
David Brownell [Thu, 2 Aug 2007 19:20:05 +0000 (12:20 -0700)]
USB: gadget: gadget zero cleanups

Clean up gadget zero, using newer APIs and conventions:

 - gadget_is_dualspeed() and gadget_is_otg() ... #ifdef removal

 - Remove many now-needless #includes

 - Use the VERBOSE_DEBUG convention

 - Some whitespace fixes.

 - A few comment updates

 - Plus a few other small cleanups:  don't pass gfp_t around when it's
   always going to be GFP_ATOMIC, and do static init of serial number.

Also go to straight GPL; there's no real point in dual licensing this
stuff any more.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: gadget: file storage gadget cleanups
David Brownell [Thu, 2 Aug 2007 07:03:39 +0000 (00:03 -0700)]
USB: gadget: file storage gadget cleanups

Clean up the file storage gadget, using newer APIs and conventions:

 - gadget_is_dualspeed() and gadget_is_otg() ... #ifdef removal

 - Remove many now-needless #includes

 - Use the DEBUG (from Kconfig+Makefile) and VERBOSE_DEBUG conventions.

 - Remove some "sparse" warnings (it still dislikes the __user annotations)

This gave only a minor object code shrinkage.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: gadget: serial gadget cleanups
David Brownell [Thu, 2 Aug 2007 07:02:47 +0000 (00:02 -0700)]
USB: gadget: serial gadget cleanups

Clean up the serial gadget, using newer APIs and conventions:

 - gadget_is_dualspeed() and gadget_is_otg() ... #ifdef removal

 - Remove many now-needless #includes

 - Use the DEBUG and VERBOSE_DEBUG conventions; turned up a bug in
   the original debug messaging

 - Various whitespace fixes.

This gave only a minor object code shrinkage, but the source looks
much cleaner in various places.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: Al Borchers <alborchers@steinerpoint.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: gadget: gmidi cleanups
David Brownell [Thu, 2 Aug 2007 07:01:27 +0000 (00:01 -0700)]
USB: gadget: gmidi cleanups

Clean up the midi gadget, using newer APIs and conventions:

 - Remove many now-needless #includes

 - Use the DEBUG (from Kconfig+Makefile) and VERBOSE_DEBUG conventions.

 - Whitespace fixes

There should be no effect on object code size.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: Ben Williamson <ben.williamson@greyinnovation.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: gadget: ethernet gadget cleanups, shrinkage
David Brownell [Thu, 2 Aug 2007 07:00:38 +0000 (00:00 -0700)]
USB: gadget: ethernet gadget cleanups, shrinkage

Clean up the ethernet gadget, using newer APIs and conventions:

 - gadget_is_dualspeed() and gadget_is_otg() ... #ifdef removal

 - Remove many now-needless #includes

 - Use the VERBOSE_DEBUG convention

 - Minor whitespace fixes.

 - Fix a warning from "sparse".

Surprisingly, this saved about 2K of code (16%) on a fullspeed-only
ARMv4 platform.  I'm bit puzzled by that (it's so much!), but approve
of the result.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: gadget: gadget_is_{dualspeed,otg} predicates and cleanup
David Brownell [Thu, 2 Aug 2007 06:58:22 +0000 (23:58 -0700)]
USB: gadget: gadget_is_{dualspeed,otg} predicates and cleanup

This adds two small inlines to the gadget stack, which will
often evaluate to compile-time constants.  That can help
shrink object code and remove #ifdeffery.

 - gadget_is_dualspeed(), currently always a compile-time
   constant (depending on which controller is selected).

 - gadget_is_otg(), usually a compile time "false", but this
   is a runtime test if the platform enables OTG (since it's
   reasonable to populate boards with different USB sockets).

It also updates two peripheral controller drivers to use these:

 - fsl_usb2_udc, mostly OTG-related bugfixes:  non-OTG devices
   must follow the rules about drawing VBUS power, and OTG ones
   need to reject invalid SET_FEATURE requests.

 - omap_udc, just scrubbing a bit of #ifdeffery.

And also gadgetfs, which lost some #ifdefs and moved to a more
standard handling of DEBUG and VERBOSE_DEBUG.

The main benefits come from patches which will follow.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: Add drivers/usb/misc/iowarrior.c to the Makefile
Nico Erfurth [Thu, 2 Aug 2007 20:25:20 +0000 (22:25 +0200)]
USB: Add drivers/usb/misc/iowarrior.c to the Makefile

This patch adds the new iowarrior module to the Makefile in drivers/usb.
Currently the module isn't build unless another driver from usb/misc is
selected.

Signed-off-by: Nico Erfurth <masta@perlgolf.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: separate out endpoint queue management and DMA mapping routines
Alan Stern [Thu, 2 Aug 2007 19:06:54 +0000 (15:06 -0400)]
USB: separate out endpoint queue management and DMA mapping routines

This patch (as953) separates out three key portions from
usb_hcd_submit_urb(), usb_hcd_unlink_urb(), and usb_hcd_giveback_urb()
and puts them in separate functions of their own.  In the next patch,
these functions will be called directly by host controller drivers
while holding their private spinlocks, which will remove the
possibility of some unpleasant races.

The code responsible for mapping and unmapping DMA buffers is also
placed into a couple of separate subroutines, for the sake of
cleanliness and consistency.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: update spinlock usage for root-hub URBs
Alan Stern [Thu, 2 Aug 2007 19:05:45 +0000 (15:05 -0400)]
USB: update spinlock usage for root-hub URBs

This patch (as952) adjusts the spinlock usage in the root-hub
emulation part of usbcore, to make it match more closely the pattern
used by regular host controller drivers.  To wit: The private lock
(usb_hcd_root_hub_lock) is held throughout the important parts, and it
is dropped temporarily without re-enabling interrupts around the call
to usb_hcd_giveback_urb().

A nice side effect is that the code now avoids calling
local_irq_save(), thereby becoming more RT-friendly.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: cleanup for previous patches
Alan Stern [Thu, 2 Aug 2007 19:04:52 +0000 (15:04 -0400)]
USB: cleanup for previous patches

This patch (as951) cleans up a few loose ends from earlier patches.
Redundant checks for non-NULL urb->dev are removed, as are checks of
urb->dev->bus (which can never be NULL).  Conversely, a check for
non-NULL urb->ep is added to the unlink paths.

A homegrown round-down-to-power-of-2 loop is simplified by using the
ilog2 routine.  The comparison in usb_urb_dir_in() is made more
transparent.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: avoid urb->pipe in usbmon
Alan Stern [Mon, 30 Jul 2007 21:10:36 +0000 (17:10 -0400)]
USB: avoid urb->pipe in usbmon

This patch (as949) changes the usbmon driver to use the new urb->ep
field rather than urb->pipe.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Pete Zaitcev <zaitcev@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: avoid urb->pipe in usbfs
Alan Stern [Mon, 30 Jul 2007 21:09:28 +0000 (17:09 -0400)]
USB: avoid urb->pipe in usbfs

This patch (as948) removes most of the references to urb->pipe from
the usbfs routines in devio.c.  The one tricky aspect is in
snoop_urb(), which can be called before the URB is submitted and which
uses usb_urb_dir_in().  For this to work properly, the URB's direction
flag must be set manually in proc_do_submiturb().

The patch also fixes a minor bug; the wValue, wIndex, and wLength
fields were snooped in proc_do_submiturb() without conversion from
le16 to CPU-byte-ordering.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: address-0 handling during device initialization
Alan Stern [Mon, 30 Jul 2007 21:08:43 +0000 (17:08 -0400)]
USB: address-0 handling during device initialization

This patch (as947) changes the device initialization and enumeration
code in hub.c; now udev->devnum will be set to 0 while the device is
being accessed at address 0.  Until now this wasn't needed because the
address value was passed as part of urb->pipe; without that field the
device address must be stored elsewhere.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: avoid using urb->pipe in usbcore
Alan Stern [Mon, 30 Jul 2007 21:07:21 +0000 (17:07 -0400)]
USB: avoid using urb->pipe in usbcore

This patch (as946) eliminates many of the uses of urb->pipe in
usbcore.  Unfortunately there will have to be a significant API
change, affecting all USB drivers, before we can remove it entirely.
This patch contents itself with changing only the interface to
usb_buffer_map_sg() and friends: The pipe argument is replaced with a
direction flag.  That can be done easily because those routines get
used in only one place.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: add direction bit to urb->transfer_flags
Alan Stern [Mon, 30 Jul 2007 21:06:16 +0000 (17:06 -0400)]
USB: add direction bit to urb->transfer_flags

This patch (as945) adds a bit to urb->transfer_flags for recording the
direction of the URB.  The bit is set/cleared automatically in
usb_submit_urb() so drivers don't have to worry about it (although as
a result, it isn't valid until the URB has been submitted).  Inline
routines are added for easily checking an URB's direction.  They
replace calls to usb_pipein in the DMA-mapping parts of hcd.c.

For non-control endpoints, the direction is determined directly from
the endpoint descriptor.  However control endpoints are
bi-directional; for them the direction is determined from the
bRequestType byte and the wLength value in the setup packet.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: add ep->enable
Alan Stern [Mon, 30 Jul 2007 21:05:22 +0000 (17:05 -0400)]
USB: add ep->enable

This patch (as944) adds an explicit "enabled" field to the
usb_host_endpoint structure and uses it in place of the current
mechanism.  This is merely a time-space tradeoff; it makes checking
whether URBs may be submitted to an endpoint simpler.  The existing
mechanism is efficient when converting urb->pipe to an endpoint
pointer, but it's not so efficient when urb->ep is used instead.

As a side effect, the procedure for enabling an endpoint is now a
little more complicated.  The ad-hoc inline code in usb.c and hub.c
for enabling ep0 is now replaced with calls to usb_enable_endpoint,
which is no longer static.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: add urb->ep
Alan Stern [Mon, 30 Jul 2007 21:04:37 +0000 (17:04 -0400)]
USB: add urb->ep

This patch (as943) prepares the way for eliminating urb->pipe by
introducing an endpoint pointer into struct urb.  For now urb->ep
is set by usb_submit_urb() from the pipe value; eventually drivers
will set it themselves and we will remove urb->pipe completely.

The patch also adds new inline routines to retrieve an endpoint
descriptor's number and transfer type, essentially as replacements for
usb_pipeendpoint and usb_pipetype.

usb_submit_urb(), usb_hcd_submit_urb(), and usb_hcd_unlink_urb() are
converted to use the new field and new routines.  Other parts of
usbcore will be converted in later patches.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: Storage: usbat_check_status(): fix check-after-use
Adrian Bunk [Mon, 30 Jul 2007 22:28:22 +0000 (00:28 +0200)]
USB: Storage: usbat_check_status(): fix check-after-use

The Coverity checker spotted that we have already oops'ed if "us"
was NULL.

Since "us" can't be NULL in the only caller this patch removes the
NULL check.

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Matthew Dharm <mdharm-usb@one-eyed-alien.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: usb_gadget.h whitespace fixes
David Brownell [Wed, 1 Aug 2007 23:04:53 +0000 (16:04 -0700)]
USB: usb_gadget.h whitespace fixes

This just fixes some whitespace bugs in <linux/usb_gadget.h>,
mostly extraneous spaces where a single tab suffices.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: Remove dead references to "SAFE_SERIAL" CONFIG variables.
Robert P. J. Day [Wed, 1 Aug 2007 22:16:55 +0000 (18:16 -0400)]
USB: Remove dead references to "SAFE_SERIAL" CONFIG variables.

Remove the references to CONFIG_USBD_SAFE_SERIAL_{VENDOR,PRODUCT},
which aren't defined in any Kconfig file.

Signed-off-by: Robert P. J. Day <rpjday@mindspring.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: OHCI handles more ZFMicro quirks
Mike Nuss [Wed, 1 Aug 2007 20:24:30 +0000 (13:24 -0700)]
USB: OHCI handles more ZFMicro quirks

The ZF Micro OHCI controller exhibits unexpected behavior that seems to be
related to high load.  Under certain conditions, the controller will
complete a TD, remove it from the endpoint's queue, and fail to add it to
the donelist. This causes the endpoint to appear to stop responding. Worse,
if the device is removed while in that state, OHCI will hang while waiting
for the orphaned TD to complete.  The situation is not recoverable without
rebooting.

This fix enhances the scope of the existing OHCI_QUIRK_ZFMICRO flag:

 1. A watchdog routine periodically scans the OHCI structures to check
    for orphaned TDs. In these cases the TD is taken back from the
    controller and completed normally.

 2. If a device is removed while the endpoint is hung but before the
    watchdog catches the situation, any outstanding TDs are taken back
    from the controller in the 'sanitize' phase.

The ohci-hcd driver used to print "INTR_SF lossage" in this situation;
this changes it to the universally accurate "ED unlink timeout".  Other
instances of this message presumably have different root causes.

Both this Compaq quirk and a NEC quirk are now properly compiled out for
non-PCI builds of this driver.

Signed-off-by: Mike Nuss <mike@terascala.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>