openwrt/staging/blogic.git
17 years agoUSB: Driver for CH341 USB-serial adaptor
Frank A Kingswood [Wed, 22 Aug 2007 19:48:58 +0000 (20:48 +0100)]
USB: Driver for CH341 USB-serial adaptor

This patch implements a USB serial port driver for the Winchiphead
CH341 USB-RS232 Converter. This chip also implements an IEEE 1284
parallel port, I2C and SPI, but that is not supported by the driver.

Signed-off-by: Frank A Kingswood <frank@kingswood-consulting.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: cxacru: Use appropriate logging for errors
Simon Arlott [Tue, 25 Sep 2007 19:20:10 +0000 (20:20 +0100)]
USB: cxacru: Use appropriate logging for errors

When an error occurs, existing logging uses dbg() so the cause of a
problem is hard to determine. Error conditions shouldn't only be
properly reported with debugging enabled.

A side effect of this change is that when an uninitialised device is
started, a log message similar to the following is sent:
cxacru 5-2:1.0: receive of cm 0x90 failed (-104)
This is normal - the device did not respond so firmware will be loaded.

Signed-off-by: Simon Arlott <simon@fire.lp0.eu>
Acked-by: Duncan Sands <baldrick@free.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: cp2101.c: add additional device ID
Edouard Lafargue [Tue, 25 Sep 2007 08:15:36 +0000 (10:15 +0200)]
USB: cp2101.c: add additional device ID

This patch adds an additional device ID to the cp2101 USB serial
driver. This device is a Gemalto Prox-PU or CU contactless card reader
(ISO14443-A/B and Mifare). The reader is a standard Gemalto serial
proximity reader using the Gemalto Block Protocol (see reader's
documentation) bundled with a built-in CP2102 for serial/USB
conversion.

Signed-off-by: Edouard Lafargue (edouard@lafargue.name)
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: unusual_devs modification for Nikon D200
Phil Dibowitz [Sun, 23 Sep 2007 03:58:12 +0000 (20:58 -0700)]
USB: unusual_devs modification for Nikon D200

Upgrade the unusual_devs.h file to support the Nikon D200

Signed-off-by: Mike Pagano <mpagano-kernel@mpagano.com>
Signed-off-by: Phil Dibowitz <phil@ipom.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: remove USB_QUIRK_NO_AUTOSUSPEND
Alan Stern [Fri, 21 Sep 2007 20:57:54 +0000 (16:57 -0400)]
USB: remove USB_QUIRK_NO_AUTOSUSPEND

This patch (as995) cleans up the remains of the former NO_AUTOSUSPEND
quirk.  Since autosuspend is disabled by default, we will let
userspace worry about which devices can safely be suspended.  Thus the
lengthy series of quirk entries is no longer needed, and neither is
the quirk ID.  I suppose someone might eventually run across a hub
that can't be suspended; let's ignore the possibility for now.

The patch also cleans up the hasty way in which autosuspend gets
disabled.  Setting udev->autosuspend_delay to -1 wasn't quite right,
because the value is always supposed to be a multiple of HZ.  It's
better to leave the delay value alone and set autosuspend_disabled,
which is what the quirk routine used to do.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: don't propagate FREEZE or PRETHAW suspends
Alan Stern [Thu, 20 Sep 2007 16:37:50 +0000 (12:37 -0400)]
USB: don't propagate FREEZE or PRETHAW suspends

This patch (as992) fixes a recently-added bug.  During a FREEZE or
PRETHAW suspend notification, non-root devices don't actually get
suspended.  So we shouldn't tell their parent hubs that they did.

(This code path used to be skipped over, until the FREEZE/PRETHAW test
got moved out of usb_suspend_both() into generic_suspend().)

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: unusual_devs update for Nokia 6131
Alan Stern [Tue, 18 Sep 2007 14:09:32 +0000 (10:09 -0400)]
USB: unusual_devs update for Nokia 6131

This patch (as991) updates the unusual_devs entry for the Nokia 6131
phone.  As reported by Juan Ignacio Cherrutti, there's new firmware
available but it still has the same old transfer-size limit.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: fix limited_power setting mistake in hub.c
jidong xiao [Thu, 13 Sep 2007 16:08:51 +0000 (00:08 +0800)]
USB: fix limited_power setting mistake in hub.c

This patch (jx001) fixes a variable assignment mistake in hub driver.
limited_power should be set to 0 if the hub is self-powered,and 1 if
the hub is bus-powered.

However, the effect of the code was exactly opposite to the spec's
statement for the Local Power Source field. The spec says, this field
is 1 meaning Local power supply lost while this field is 0 indicating
Local power supply good.(This statement is very confusing.)

So this patch switchs the 0 and 1.

Signed-off-by: Jason Xiao <jidong.xiao@gmail.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: fix double frees in error code paths of ipaq driver
Oliver Neukum [Mon, 17 Sep 2007 18:15:53 +0000 (20:15 +0200)]
USB: fix double frees in error code paths of ipaq driver

the error code paths can be enter with buffers to freed buffers.
Serial core would do a kfree() on memory already freed.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: always visit drivers/usb/misc/
Adrian Bunk [Tue, 11 Sep 2007 17:10:21 +0000 (19:10 +0200)]
USB: always visit drivers/usb/misc/

Currently, every driver under drivers/usb/misc/ also has to be listed in
drivers/usb/Makefile. This has been forgotten more than once, and this
patch changes drivers/usb/Makefile to simply always visit
drivers/usb/misc/ when building the USB code.

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Cc: Toralf Förster <toralf.foerster@gmx.de>
Acked-by: Satyam Sharma <satyam@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
17 years agoUSB: usb-skeleton leaking locks on open
Mark Gross [Mon, 24 Sep 2007 16:28:14 +0000 (09:28 -0700)]
USB: usb-skeleton leaking locks on open

This weekend I was hacking around with a trivial USB driver for talking
to the boot load firmware of a USB Bit Whacker.  It's running the
MicroChip Pic18 boot loader firmware and I'm putting together a flash
program for writing new FW to the thing.

Anyway in my use of the usb-skeleton.c as my starting point I discovered
my test program was getting hung up after attempting to write a buffer.
The application and driver where hung in a way that required me to
reboot to get it to clean up so I could try again.

It turned out the code path through skel_open can grap the driver's
io_mutex lock and forget to release it.

The following patch fixes the problem for me.

Signed-off-by: Mark Gross <mgross@linux.intel.com>
Cc: Oliver Neukum <oliver@neukum.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
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>