Archived
14
0
Fork 0
Commit graph

45518 commits

Author SHA1 Message Date
Alan Cox
b9c52f155f cyberjack: Coding style
Coding style fixups

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-07-22 13:03:23 -07:00
Alan Cox
ff7eb60260 cp2101: coding style
Bring up to coding style

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-07-22 13:03:23 -07:00
Alan Cox
c17ee88697 tty-usb-console: Fix termios
Setting CFLAG bits is all well and good but you must sort out ispeed and
ospeed properly.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-07-22 13:03:23 -07:00
Alan Cox
4dbd5a0961 tty-usb-console: tidy the USB console code
Code tidy

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-07-22 13:03:22 -07:00
Alan Cox
c97611c16d usb-serial-bus: tidy coding style
Tidy up

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-07-22 13:03:22 -07:00
Alan Cox
b69c14992e belkin_sa: clean up code
Coding style tidy up for belkin_sa

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-07-22 13:03:22 -07:00
Alan Cox
72e2741256 whiteheat: fix bugs found in the tidy and audit
Termios tidy up, plus fix break and DTR.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-07-22 13:03:22 -07:00
Alan Cox
80359a9c5c whiteheat: coding style
Bring ezusb and whiteheat into line with the coding style

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-07-22 13:03:22 -07:00
Alan Cox
95da310e66 usb_serial: API all change
USB serial likes to use port->tty back pointers for the real work it does and
to do so without any actual locking. Unfortunately when you consider hangup
events, hangup/parallel reopen or even worse hangup followed by parallel close
events the tty->port and port->tty pointers are not guaranteed to be the same
as port->tty is the active tty while tty->port is the port the tty may or
may not still be attached to.

So rework the entire API to pass the tty struct. For console cases we need
to pass both for now. This shows up multiple drivers that immediately crash
with USB console some of which have been fixed in the process.

Longer term we need a proper tty as console abstraction

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-07-22 13:03:22 -07:00
Alan Cox
1aa3692da5 ttydev: Fix up compile failures in the PPC build
Fix up a couple of reported merge problems

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-07-22 13:03:22 -07:00
David Brownell
1673ad52bd gpio: pcf857x: add lock and handle more chips
Two small updates to the pcf857x driver: (a) the max732[89] chips are
also second sources for the pcf8574/a, and (b) add a mutex to prevent
trashing the cached state.  Adding the lock is effectively a bugfix,
although it seems unlikely that anyone would have run into the issue it
protects against.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-07-22 09:59:41 -07:00
Juergen Beisert
0c36ec3147 gpio: gpio driver for max7301 SPI GPIO expander
Maxim's MAX7301 is an SPI GPIO expander with 28 GPIOs.  Note: MAX7301's
interrupt feature is not supported yet.

[akpm@linux-foundation.org: coding-style fixes]
[g.liakhovetski@pengutronix.de: Fix inaccuracies in comments, check spi_setup()
return code, mask off high byte in max7301_read()]
Signed-off-by: Juergen Beisert <j.beisert@pengutronix.de>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@pengutronix.de>
Cc: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-07-22 09:59:40 -07:00
Linus Torvalds
93ded9b8fd Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6: (100 commits)
  usb-storage: revert DMA-alignment change for Wireless USB
  USB: use reset_resume when normal resume fails
  usb_gadget: composite cdc gadget fault handling
  usb gadget: minor USBCV fix for composite framework
  USB: Fix bug with byte order in isp116x-hcd.c fio write/read
  USB: fix double kfree in ipaq in error case
  USB: fix build error in cdc-acm for CONFIG_PM=n
  USB: remove board-specific UP2OCR configuration from pxa27x-udc
  USB: EHCI: Reconciling USB register differences on MPC85xx vs MPC83xx
  USB: Fix pointer/int cast in USB devio code
  usb gadget: g_cdc dependso on NET
  USB: Au1xxx-usb: suspend/resume support.
  USB: Au1xxx-usb: clean up ohci/ehci bus glue sources.
  usbfs: don't store bad pointers in registration
  usbfs: fix race between open and unregister
  usbfs: simplify the lookup-by-minor routines
  usbfs: send disconnect signals when device is unregistered
  USB: Force unbinding of drivers lacking reset_resume or other methods
  USB: ohci-pnx4008: I2C cleanups and fixes
  USB: debug port converter does not accept more than 8 byte packets
  ...
2008-07-21 15:42:53 -07:00
Alan Stern
f756cbd458 usb-storage: revert DMA-alignment change for Wireless USB
This patch (as1110) reverts an earlier patch meant to help with
Wireless USB host controllers.  These controllers can have bulk
maxpacket values larger than 512, which puts unusual constraints on
the sizes of scatter-gather list elements.  However it turns out that
the block layer does not provide the support we need to enforce these
constraints; merely changing the DMA alignment mask doesn't help.
Hence there's no reason to keep the original patch.  The Wireless USB
problem will have to be solved a different way.

In addition, there is a reason to get rid of the earlier patch.  By
dereferencing a pointer stored in the ep_in array of struct
usb_device, the current code risks an invalid memory access when it
runs concurrently with device removal.  The members of that array are
cleared before the driver's disconnect method is called, so it should
not try to use them.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:51 -07:00
Alan Stern
86c57edf60 USB: use reset_resume when normal resume fails
This patch (as1109b) makes USB-Persist more resilient to errors.  With
the current code, if a normal resume fails, it's an unrecoverable
error.  With the patch, if a normal resume fails (and if the device is
enabled for USB-Persist) then a reset-resume is tried.

This fixes the problem reported in Bugzilla #10977.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:48 -07:00
David Brownell
ac90e36592 usb_gadget: composite cdc gadget fault handling
These two fixes ensure the new "CDC Composite Device" gadget
fails cleanly when it's loaded on hardware that can't support
this particular gadget driver.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:48 -07:00
David Lopo
c24f42276b usb gadget: minor USBCV fix for composite framework
Fill in a reserved/unused device qualifier field to ensure that
the USBCV tests will always pass.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:48 -07:00
Julien May
28874b7ec4 USB: Fix bug with byte order in isp116x-hcd.c fio write/read
URB payload data are transfered in wrong byte order on a big endinan
architecture (AVR32).

Signed-off-by: Julien May <mailinglist@miromico.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:48 -07:00
Oliver Neukum
df3e1ab733 USB: fix double kfree in ipaq in error case
in the error case the ipaq driver leaves a dangling pointer to already
freed memory that will be freed again.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:47 -07:00
Oliver Neukum
357585892e USB: fix build error in cdc-acm for CONFIG_PM=n
Here's the fix. cdc-wdm has the same problem. The fix is the same.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:47 -07:00
Daniel Ribeiro
95f371f24c USB: remove board-specific UP2OCR configuration from pxa27x-udc
Remove the board-specific UP2OCR configuration from the
pxa27x-udc driver.

Signed-off-by: Daniel Ribeiro <drwyrm@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:46 -07:00
Srikanth Srinivasan
4f5342583c USB: EHCI: Reconciling USB register differences on MPC85xx vs MPC83xx
A couple of USB register initializations had to be changed on MPC85xx
platforms.  This is due to the internal SoC buses being different on
MPC83xx SoCs vs MPC85xx SoCs.

We currently handle this via an ifdef since 83xx and 85xx are mutually
exclusive kernel builds.

Signed-off-by: Srikanth Srinivasan <srikanth.srinivasan@freescale.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:45 -07:00
David Howells
a80d5ff0d7 USB: Fix pointer/int cast in USB devio code
Fix pointer/int cast in USB devio code, and thus avoid a compiler warning.

A void* data argument passed to bus_find_device() and thence to match_devt()
is used to carry a 32-bit datum.  However, casting directly between a u32 and
a pointer is not permitted - there must be an intermediate cast via (unsigned)
long.

This was introduced by the following patch:

	commit 94b1c9fa060ece2c8f080583beb6cc6008e41413
	Author: Alan Stern <stern@rowland.harvard.edu>
	Date:   Tue Jun 24 14:47:12 2008 -0400

	    usbfs: simplify the lookup-by-minor routines

	    This patch (as1105) simplifies the lookup-by-minor-number code in
	    usbfs.  Instead of passing the minor number to the callback, which
	    must then reconstruct the entire dev_t value, the patch passes the
	    dev_t value directly.

	    Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
	    Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

Signed-off-by: David Howells <dhowells@redhat.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:44 -07:00
Randy Dunlap
4ddd9ec17a usb gadget: g_cdc dependso on NET
g_cdc needs to depend on NET, otherwise net-related build errors happen:

ERROR: "netif_carrier_on" [drivers/usb/gadget/g_cdc.ko] undefined!
ERROR: "netif_carrier_off" [drivers/usb/gadget/g_cdc.ko] undefined!
ERROR: "netif_rx" [drivers/usb/gadget/g_cdc.ko] undefined!
ERROR: "alloc_etherdev_mq" [drivers/usb/gadget/g_cdc.ko] undefined!
ERROR: "free_netdev" [drivers/usb/gadget/g_cdc.ko] undefined!
ERROR: "register_netdev" [drivers/usb/gadget/g_cdc.ko] undefined!
ERROR: "print_mac" [drivers/usb/gadget/g_cdc.ko] undefined!
ERROR: "dev_kfree_skb_any" [drivers/usb/gadget/g_cdc.ko] undefined!
ERROR: "__alloc_skb" [drivers/usb/gadget/g_cdc.ko] undefined!
ERROR: "eth_type_trans" [drivers/usb/gadget/g_cdc.ko] undefined!
ERROR: "unregister_netdev" [drivers/usb/gadget/g_cdc.ko] undefined!
ERROR: "__netif_schedule" [drivers/usb/gadget/g_cdc.ko] undefined!
ERROR: "skb_put" [drivers/usb/gadget/g_cdc.ko] undefined!

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:44 -07:00
Manuel Lauss
42bfc7b44f USB: Au1xxx-usb: suspend/resume support.
Copy the OHCI/EHCI PM callbacks of the PCI implementation since
they work equally well on Au1xxx hardware.

Tested on Au1200.

Signed-off-by: Manuel Lauss <mano@roarinelk.homelinux.net>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:44 -07:00
Manuel Lauss
53c81a348f USB: Au1xxx-usb: clean up ohci/ehci bus glue sources.
- Fold multiple probe/remove callbacks into one function;
- minor style fixes, no functional changes.

Tested on Au1200.

Signed-off-by: Manuel Lauss <mano@roarinelk.homelinux.net>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:44 -07:00
Alan Stern
e04199b216 usbfs: don't store bad pointers in registration
This patch (as1107) fixes a small bug in the usbfs registration and
unregistration code.  It avoids leaving an error value stored in the
device's usb_classdev field and it avoids trying to unregister a NULL
pointer.  (It also fixes a rather extreme overuse of whitespace.)

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:43 -07:00
Alan Stern
d64aac3639 usbfs: fix race between open and unregister
This patch (as1106) fixes a race between opening and unregistering
device files in usbfs.  The current code drops its reference to the
device and then reacquires it, ignoring the possibility that the
device structure might have been removed in the meantime.  It also
doesn't check whether the device is already in the NOTATTACHED state
when the file is opened.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:42 -07:00
Alan Stern
61ad04a89f usbfs: simplify the lookup-by-minor routines
This patch (as1105) simplifies the lookup-by-minor-number code in
usbfs.  Instead of passing the minor number to the callback, which
must then reconstruct the entire dev_t value, the patch passes the
dev_t value directly.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:41 -07:00
Alan Stern
cd9f03759d usbfs: send disconnect signals when device is unregistered
USB device files are accessible in two ways: as files in usbfs and as
character device nodes.  The two paths are supposed to behave
identically, but they don't.  When the underlying USB device is
unplugged, disconnect signals are sent to processes with open usbfs
files (if they requested these signals) but not to processes with open
device node files.

This patch (as1104) fixes the bug by moving the disconnect-signalling
code into a common subroutine which is called from both paths.
Putting this subroutine in devio.c removes the only out-of-file
reference to struct dev_state, and so the structure's declaration can
be moved from usb.h into devio.c.

Finally, the new subroutine performs one extra action: It kills all
the outstanding async URBs.  (I'd kill the outstanding synchronous
URBs too, if there was any way to do it.)  In the past this hasn't
mattered much, because devices were unregistered from usbfs only
when they were disconnected.  But now the unregistration can also
occur whenever devices are unbound from the usb_generic driver.  At
any rate, killing URBs when a device is unregistered from usbfs seems
like a good thing to do.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:40 -07:00
Alan Stern
78d9a487ee USB: Force unbinding of drivers lacking reset_resume or other methods
This patch (as1024) takes care of a FIXME issue: Drivers that don't
have the necessary suspend, resume, reset_resume, pre_reset, or
post_reset methods will be unbound and their interface reprobed when
one of the unsupported events occurs.

This is made slightly more difficult by the fact that bind operations
won't work during a system sleep transition.  So instead the code has
to defer the operation until the transition ends.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:40 -07:00
Jean Delvare
64b3d6d119 USB: ohci-pnx4008: I2C cleanups and fixes
Various cleanups and fixes to the i2c code in ohci-pnx4008:
* Delete empty isp1301_command. The i2c driver command implementation
  is optional, so there's no point in providing an empty
  implementation.
* Give a name to isp1301_driver. I'm surprised that i2c-core accepted
  to register this driver at all. I've chosen "isp1301_pnx" as the
  name, because it's not a generic ISP1301 driver (much like the
  isp1301_omap driver.) We might want to make the name even more
  specific (but "isp1301_ohci_pnx4008" doesn't fit.)
* The ISP1301 is definitely not a hardware monitoring device.
* Fix a memory leak on failure in isp1301_attach. If
  i2c_attach_client fails, the client is not registered so
  isp1301_detach is never called and the i2c_client memory is lost.
* Use strlcpy instead of strcpy.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Vitaly Wool <vitalywool@gmail.com>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:38 -07:00
Aleksey Gorelov
71be4f81e9 USB: debug port converter does not accept more than 8 byte packets
USB debug port only supports 8 byte rx/tx packets. Although spec implies that
"if a packet larger than eight bytes is received from the remote computer, the
device must break the larger packet into eight-byte packets before sending the
data to the Debug Port", the real PLX NET20DC device does not handle it right -
data is corrupted on debug port end if serial interface sends >8 byte urbs.
Patch below fixes the issue by limiting tx urb to 8 byte.

Signed off by: Aleks Gorelov <dared1st@yahoo.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:37 -07:00
Oliver Neukum
830f4021a8 USB: fix disconnect bug in cdc-acm
cdc-acm must give up secondary interfaces if the primary is disconnected
and vice versa. This wasn't done correctly.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:37 -07:00
Oliver Neukum
62ad296b6c USB: fix usb serial pm counter decrement for disconnected interfaces
usb serial decrements the pm counter even if an interface has been
disconnected. If it was a logical disconnect the interface may belong
already to another driver. This patch introduces a check for disconnected
interfaces.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Cc: Stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:36 -07:00
Oliver Neukum
17d80d562f USB: autosuspend for cdc-wdm
this patch implements

- suspend/resume
- aggressive autosuspend for the cdc-wdm driver
- pre/post_reset

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:36 -07:00
Oliver Neukum
11ea859d64 USB: additional power savings for cdc-acm devices that support remote wakeup
this patch saves power for cdc-acm devices that support remote wakeup
while the device is connected.

- request needs_remote_wakeup when needed
- delayed write while a device is autoresumed
- the device is marked busy when appropriate

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:36 -07:00
Ben Collins
188d636027 USB: keyspan: Remove duplicate device entries
The 28xb, as documented in comments, has the same ID's as the 28x.
Remove the duplicated ID's from the device tables, and expand the
comment to document this.

Signed-off-by: Ben Collins <ben.collins@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:35 -07:00
Benny Halevy
3b36a8fd67 usb: fix uninitialized variable warning in keyspan_pda
This fixes the compiler warning.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:35 -07:00
Yoshihiro Shimoda
397f519a0d usb: r8a66597-hcd: fix iinterval for Full/Low speed device
fix interrupt transfer interval for Full/Low speed device.

Signed-off-by: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:35 -07:00
Yoshihiro Shimoda
0bf32b807f usb: r8a66597-hcd: fix interrupt trigger
fix the problem that did not set IRQF_TRIGGER_ flag.

Signed-off-by: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:34 -07:00
Ming Lei
742120c631 USB: fix usb_reset_device and usb_reset_composite_device(take 3)
This patch renames the existing usb_reset_device in hub.c to
usb_reset_and_verify_device and renames the existing
usb_reset_composite_device to usb_reset_device. Also the new
usb_reset_and_verify_device does't need to be EXPORTED .

The idea of the patch is that external interface driver
should warn the other interfaces' driver of the same
device before and after reseting the usb device. One interface
driver shoud call _old_ usb_reset_composite_device instead of
_old_ usb_reset_device since it can't assume the device contains
only one interface. The _old_ usb_reset_composite_device
is safe for single interface device also. we rename the two
functions to make the change easily.

This patch is under guideline from Alan Stern.

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
2008-07-21 15:16:33 -07:00
Andre Haupt
dd9ca5d9be USB: usb-serial: fix a sparse warning about different signedness
fix the following sparse warning:

drivers/usb/serial/usb-serial.c:927:43: warning: incorrect type in argument 3 (different signedness)
drivers/usb/serial/usb-serial.c:927:43:    expected unsigned int *minor
drivers/usb/serial/usb-serial.c:927:43:    got int *<noident>
  CHECK   drivers/usb/serial/generic.c

Signed-off-by: Andre Haupt <andre@bitwigglers.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:33 -07:00
Nate Case
3faefc88c1 USB: isp1760: Support board-specific hardware configurations
This adds support for hardware configurations that don't match the
chip default register settings (e.g., 16-bit data bus, DACK and
DREQ pulled up instead of down, analog overcurrent mode).

These settings are passed in via the OF device tree.  The PCI
interface still assumes the same default values.

Signed-off-by: Nate Case <ncase@xes-inc.com>
Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:33 -07:00
Ming Lei
6d243e5c76 USB: fix comment of usb_set_configuration
It is the usb interface driver probe() methods that
can't call usb_set_configuration, not usb device driver.

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:32 -07:00
Alan Stern
7c3e28bc56 USB: use standard SG iterator in the scatter-gather library
This patch (as1103) changes the iteration in the USB scatter-gather to
use a standard SG iterator.  Otherwise the iteration will fail if it
encounters a chained SG list.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Acked-by: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:32 -07:00
Ming Lei
625f694936 USB: remove interface parameter of usb_reset_composite_device
From the current implementation of usb_reset_composite_device
function, the iface parameter is no longer useful. This function
doesn't do something special for the iface usb_interface,compared
with other interfaces in the usb_device. So remove the parameter
and fix the related caller.

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:32 -07:00
Christophe Jaillet
33578bd706 USB: AccessRunner: avoid unnecessary memset
Remove an explicit memset(.., 0, ...) to a variable allocated with kzalloc
(i.e.  'card_info' array of the structure 'instance').

Signed-off-by: Christophe Jaillet <christophe.jaillet@wanadoo.fr>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:32 -07:00
Andrew Morton
d249afddff USB: drivers/usb/host/isp1760-hcd.c: processor flags have type `unsigned long'
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:32 -07:00
Oliver Neukum
87d65e54b6 USB: cdc-wdm cleanup
- fixes an error with filling out control requests
- increases grepability and error logging
- fixes the short read code path

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:31 -07:00
Greg Kroah-Hartman
640c1bce86 USB: delete airprime driver
This driver is only for one device id, and the option driver should be
used instead for it.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:31 -07:00
Akinobu Mita
518386c7d4 USB: usbmon: use simple_read_from_buffer()
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Acked-by: Pete Zaitcev <zaitcev@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:31 -07:00
Ming Lei
bef4665a2e USB: uhci: mark root_hub_hub_des[] as const
mark this array as const because it is read-only

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:30 -07:00
Ming Lei
fe9b9034aa USB: host: mark const variable tables as "const"
Mark the tables as const so that they end up in .rodata
section and don't cacheline share with things that get
written to.

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Cc: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:29 -07:00
Felipe Balbi
e0d795e4f3 usb: irda: cleanup on ir-usb module
General cleanup on ir-usb module. Introduced
a common header that could be used also on
usb gadget framework.

Lot's of cleanups and now using macros from the header
file.

Signed-off-by: Felipe Balbi <me@felipebalbi.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:27 -07:00
David Brownell
b963801164 USB: ehci-hcd unlink speedups
This patch fixes some performance bugs observed with some workloads
when unlinking EHCI queue header (QH) descriptors from the async ring
(control/bulk schedule).

The mechanism intended to defer unlinking an empty QH (so there is no
penalty in common cases where it's quickly reused) was not working as
intended.  Sometimes the unlink was scheduled:

 - too quickly ... which can be a *strong* negative effect, since
   that QH becomes unavailable for immediate re-use;

 - too slowly ... wasting DMA cycles, usually a minor issue except
   for increased bus contention and power usage;

Plus there was an extreme case of "too slowly":  a logical error in the
IAA watchdog-timer conversion meant that sometimes the unlink never
got scheduled.

The fix replaces a simple counter with a timestamp derived from the
controller's 8 KHz microframe counter, and adjusts the timer usage
for some issues associated with HZ being less than 8K.

(Based on a patch originally by Alan Stern, and good troubleshooting
from  Leonid.)

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Leonid <leonidv11@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:27 -07:00
Felipe Balbi
38f3ad5e74 usb: hub: add check for unsupported bus topology
We can't allow hubs on the 7th tier as they would allow
devices on the 8th tier.

Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:26 -07:00
Pete Zaitcev
6deb270b5c USB: ohci_hcd hang: submit vs. rmmod race
If we do rmmod ohci_hcd while an application is doing something, the
following may happen:

- a control URB completes (in finish_urb) and the ohci's endpoint is
  set into ED_UNLINK in ed_deschedule
- same URB is (re)submitted because of the open/close loop or other
  such application behaviour
- rmmod sets the state to HC_STATE_QUESCING
- finish_unlinks happens at next SOF; normally it would set ed into
  ED_IDLE and immediately call ed_schedule (since URB had extra TDs
  queued), which sets it into ED_OPER. But the check in ed_schedule
  makes it fail with -EAGAIN (which is ignored)
- from now on we have a dead URB stuck; it cannot even be unlinked
  because the ed status is not ED_OPER, and thus start_ed_unlink is
  not invoked.

This patch removes the check. In 2.6.25, all callers check for
__ACTIVE bit before invoking ed_schedule, which is more appropriate.

Alan Stern and David Brownell approved of this (cautiously).

Signed-off-by: Pete Zaitcev <zaitcev@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:25 -07:00
Eric Miao
6381fad77e USB: make SA1111 OHCI driver SA11x0 specific
As RMK pointed out,  considering the fact that the _only_ platform with
a PXA and SA1111 is the Lubbock, and that SA1111 DMA doesn't work there,
(i.e. the SA1111 OHCI doesn't work there) the SA1111 OHCI driver should
really be made SA11x0 specific.

Signed-off-by: Eric Miao <eric.miao@marvell.com>
Acked-by: Russell King <rmk+kernel@arm.linux.org.uk>
Acked-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:24 -07:00
Pete Zaitcev
421b4bf5f2 USB: missing usb_put_hcd to ohci-at91
Looks like usb_put_hcd was missing. Also, make an always-zero function
return void.

Signed-off-by: Pete Zaitcev <zaitcev@yahoo.com>
Acked-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:24 -07:00
Harvey Harrison
abe28c00b9 USB: speedtch.c fix sparse shadowed variable warning
i is used only as a for-loop index no need to declare another.
drivers/usb/atm/speedtch.c:832:7: warning: symbol 'i' shadows an earlier one
drivers/usb/atm/speedtch.c:766:6: originally declared here

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:24 -07:00
Harvey Harrison
b2bdd1f504 USB: cp2101.c fix sparse signedness mismatch warnings
The get/set 2101_config helpers take an unsigned int rather than an
int.  It is safe to change these in each case and may even produce
better code as it will be an unsigned divide rather than a signed
divide in places.  All other manipulation was setting/masking bits
which will not be affected by the sign change.

Fixes the following sparse warnings:
drivers/usb/serial/cp2101.c:378:44: warning: incorrect type in argument 3 (different signedness)
drivers/usb/serial/cp2101.c:378:44:    expected unsigned int *data
drivers/usb/serial/cp2101.c:378:44:    got int *<noident>
drivers/usb/serial/cp2101.c:388:40: warning: incorrect type in argument 3 (different signedness)
drivers/usb/serial/cp2101.c:388:40:    expected unsigned int *data
drivers/usb/serial/cp2101.c:388:40:    got int *<noident>
drivers/usb/serial/cp2101.c:413:42: warning: incorrect type in argument 3 (different signedness)
drivers/usb/serial/cp2101.c:413:42:    expected unsigned int *data
drivers/usb/serial/cp2101.c:413:42:    got int *<noident>
drivers/usb/serial/cp2101.c:421:42: warning: incorrect type in argument 3 (different signedness)
drivers/usb/serial/cp2101.c:421:42:    expected unsigned int *data
drivers/usb/serial/cp2101.c:421:42:    got int *<noident>
drivers/usb/serial/cp2101.c:444:42: warning: incorrect type in argument 3 (different signedness)
drivers/usb/serial/cp2101.c:444:42:    expected unsigned int *data
drivers/usb/serial/cp2101.c:444:42:    got int *<noident>
drivers/usb/serial/cp2101.c:451:42: warning: incorrect type in argument 3 (different signedness)
drivers/usb/serial/cp2101.c:451:42:    expected unsigned int *data
drivers/usb/serial/cp2101.c:451:42:    got int *<noident>
drivers/usb/serial/cp2101.c:458:42: warning: incorrect type in argument 3 (different signedness)
drivers/usb/serial/cp2101.c:458:42:    expected unsigned int *data
drivers/usb/serial/cp2101.c:458:42:    got int *<noident>
drivers/usb/serial/cp2101.c:471:42: warning: incorrect type in argument 3 (different signedness)
drivers/usb/serial/cp2101.c:471:42:    expected unsigned int *data
drivers/usb/serial/cp2101.c:471:42:    got int *<noident>
drivers/usb/serial/cp2101.c:481:42: warning: incorrect type in argument 3 (different signedness)
drivers/usb/serial/cp2101.c:481:42:    expected unsigned int *data
drivers/usb/serial/cp2101.c:481:42:    got int *<noident>
drivers/usb/serial/cp2101.c:561:41: warning: incorrect type in argument 3 (different signedness)
drivers/usb/serial/cp2101.c:561:41:    expected unsigned int *data
drivers/usb/serial/cp2101.c:561:41:    got int *<noident>
drivers/usb/serial/cp2101.c:591:45: warning: incorrect type in argument 3 (different signedness)
drivers/usb/serial/cp2101.c:591:45:    expected unsigned int *data
drivers/usb/serial/cp2101.c:591:45:    got int *<noident>
drivers/usb/serial/cp2101.c:597:41: warning: incorrect type in argument 3 (different signedness)
drivers/usb/serial/cp2101.c:597:41:    expected unsigned int *data
drivers/usb/serial/cp2101.c:597:41:    got int *<noident>
drivers/usb/serial/cp2101.c:608:45: warning: incorrect type in argument 3 (different signedness)
drivers/usb/serial/cp2101.c:608:45:    expected unsigned int *data
drivers/usb/serial/cp2101.c:608:45:    got int *<noident>
drivers/usb/serial/cp2101.c:614:41: warning: incorrect type in argument 3 (different signedness)
drivers/usb/serial/cp2101.c:614:41:    expected unsigned int *data
drivers/usb/serial/cp2101.c:614:41:    got int *<noident>
drivers/usb/serial/cp2101.c:623:45: warning: incorrect type in argument 3 (different signedness)
drivers/usb/serial/cp2101.c:623:45:    expected unsigned int *data
drivers/usb/serial/cp2101.c:623:45:    got int *<noident>
drivers/usb/serial/cp2101.c:680:50: warning: incorrect type in argument 3 (different signedness)
drivers/usb/serial/cp2101.c:680:50:    expected unsigned int *data
drivers/usb/serial/cp2101.c:680:50:    got int *<noident>
drivers/usb/serial/cp2101.c:690:43: warning: incorrect type in argument 3 (different signedness)
drivers/usb/serial/cp2101.c:690:43:    expected unsigned int *data
drivers/usb/serial/cp2101.c:690:43:    got int *<noident>
drivers/usb/serial/cp2101.c:715:41: warning: incorrect type in argument 3 (different signedness)
drivers/usb/serial/cp2101.c:715:41:    expected unsigned int *data
drivers/usb/serial/cp2101.c:715:41:    got int *<noident>

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:23 -07:00
Harvey Harrison
5a33956a30 USB: digi_accelport.c trivial sparse lock annotation
Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:22 -07:00
Stephen Rothwell
554cc171e3 USB: ohci-ppc-of: use linux/of_platform.h instead of asm
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:22 -07:00
Alan Cox
49f1525546 USB: sisusb: Push down the BKL
This is another case where the lock_kernel appears to be unneccessary and
could be removed with a bit more investigative work

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:21 -07:00
Alan Cox
54592157c7 USB: rio100: Push down the BKL
The BKL is actually probably not needed as the mutex seems sufficient. If
so then a further patch to drop it would be a good followup.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:20 -07:00
Alan Cox
f1b5a7fe17 USB: auerwald: Push down the BKL into the driver
Also fix the unknown ioctl return code

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:20 -07:00
Alan Cox
824f16fda5 USB: iowarrior: Push down BKL
I'm pretty sure the mutex is sufficient for all locking but will come
back to that later if the USB folks don't beat me to it. For now get rid
of the old BKL ioctl method and wrap the ioctl handler

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:19 -07:00
Alan Cox
5cb4aeca8e USB: usblcd: Push down BKL into driver
I'm pretty sure this can be eliminated however I couldn't prove (or find)
what stopped the device vanishing mid IOCTL_GET_HARD_VERSION. Perhaps a
USB wizard could double check that and see if the lock_kernel can go
entirely.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:18 -07:00
Alan Cox
1160d07656 USB: ftdi_usb: Eliminate ioctl and BKL ioctl use
ftdi has one ioctl, which is buggy and for debugging. Kill it off

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:18 -07:00
Alan Cox
44c389a00f USB: gadget: Push BKL down into drivers
This keeps the gadget ioctl method wrapped but pushes the BKL down into
the gadget code so we can use unlocked_ioctl().

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:18 -07:00
David Brownell
0391c828ce usb ethernet gadget: use composite gadget framework
Building on the previous patches which took code from this driver and
pakaged it in more-reusable network "function" components, this patch
gets rid of the original code and uses those components instead.

As seen with the other gadget driver conversions, the resulting code
is much easier to understand and (presumably) work with.  In this case
that's especially true, since the Ethernet gadget had grown to handle
three (!) different Ethernet-over-USB protocols.  This modularization
should make it much easier to add a fourth option for the newish CDC
"Ethernet Emulation Model" (or EEM).

Lightly tested, primarily at full speed.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:17 -07:00
David Brownell
19e2068015 usb gadget: new "CDC Composite" gadget driver
This is a simple example of a composite gadget, combining two
Communications Class Device (CDC) functions:  ECM and ACM.

This provides a clear example of how the composite gadget framework
is intended to work.  It's surprising that MS-Windows (or at least,
XP and previous) won't "just work" with something this simple...

One /proc/bus/usb/devices listing looks like:

  T:  Bus=03 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 46 Spd=480 MxCh= 0
  D:  Ver= 2.00 Cls=02(comm.) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
  P:  Vendor=0525 ProdID=a4aa Rev= 3.01
  S:  Manufacturer=Linux 2.6.26-rc6-pnut with net2280
  S:  Product=CDC Composite Gadget
  C:* #Ifs= 4 Cfg#= 1 Atr=c0 MxPwr=  2mA
  I:* If#= 0 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=06 Prot=00 Driver=cdc_ether
  E:  Ad=83(I) Atr=03(Int.) MxPS=  16 Ivl=32ms
  I:  If#= 1 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether
  I:* If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether
  E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
  E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
  I:* If#= 2 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=02 Prot=01 Driver=cdc_acm
  E:  Ad=86(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
  I:* If#= 3 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_acm
  E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
  E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms

Not all USB peripheral controller hardware can support this driver.
All the highspeed-capable peripheral controllers with drivers now in
the mainline kernel seem to support this, as does omap_udc.  But
many full speed controllers don't have enough endpoints, or (as with
the PXA controllers) don't support altsettings.

Lightly tested.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:16 -07:00
David Brownell
45fe3b8e53 usb ethernet gadget: split RNDIS function
This is a RNDIS function driver, extracted from the all-in-one
Ethernet gadget driver.

Lightly tested ... there seems to be a pre-existing problem when
talking to Windows XP SP2, not quite sure what's up with that yet.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:15 -07:00
David Brownell
da741b8c56 usb ethernet gadget: split CDC Ethernet function
This is a "CDC Ethernet" (ECM) function driver, extracted from the
all-in-one Ethernet gadget driver.

This is a good example of how to implement interface altsettings.
In fact it's currently the only such example in the gadget stack,
pending addition of OBEX support.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:13 -07:00
David Brownell
8a40819e97 usb ethernet gadget: split CDC Subset function
This is a simple "CDC Subset" (and MCCI "SAFE") function driver, extracted
from the all-in-one Ethernet gadget driver.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:13 -07:00
David Brownell
2b3d942c48 usb ethernet gadget: split out network core
Abstract the peripheral side Ethernet-over-USB link layer code from
the all-in-one Ethernet gadget driver into a component that can be
called by various functions, so the various flavors can be split
apart and selectively reused.

A notable difference from the approach taken with the serial link
layer code (beyond talking to NET not TTY) is that because of the
initialization requirements, this only supports one network link.
(And one set of Ethernet link addresses.)

That is, each configuration may have only one instance of a network
function.  This doesn't change behavior; the current code has that
same restriction.  If you want multiple logical links, that can
easily be done using network layer tools.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:12 -07:00
David Brownell
15b2d2b529 usb gadget: RNDIS cleanups
Some cleanup to the RNDIS code:

 - Minor bugfix:  rndis_unit() is supposed to put the link into the
   RNDIS_UNINITIALIZED state, which does not mean "unused".  There's
   a separate method to stop using the link.  (Bug doesn't affect
   anything right now because of how the code is used.)

 - Reduce coupling between RNDIS code and its user(s), in preparation
   for updates in that code:

    * Decouple RNDIS_RESPONSE_AVAILABLE notifications from net_device
      by passing just a void* handle.  (Also, remove the unused return
      value of the notification callback.)
    * When it needs a copy of net_device stats, just ask for it

 - Remove unused/untested code backing various never-used OIDs:

    * RNDIS_PM, RNDIS_WAKEUP ... "should" get implemented, but the
      relevant docs were unclear, ambguous, and incomplete.  Someone
      with access to the Hidden Gospels (maybe in the EU?) might be
      able to figure out what this should do.
    * RNDIS_OPTIONAL_STATS ... as the name suggests, optional.  Never
      implemented in part because not all the semantics were clear.
    * OID_GEN_RNDIS_CONFIG_PARAMETER, which has been #if 0 forever.

 - A few small whitespace fixes

Plus switch the VERBOSE symbol over to the newer VERBOSE_DEBUG style.

There should be no functional changes because of this patch; it's a
net source code shrink (because of the dead/unused code removal) and
a small object code shrink (a couple hundred bytes on ARMv5).

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:10 -07:00
David Brownell
7bb5ea54be usb gadget serial: use composite gadget framework
This switches the serial gadget over to using the new "function"
versions of the serial port interfacing code.  The remaining code
in the main source file is quite small...

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:09 -07:00
David Brownell
61d8baea5d usb gadget serial: split out generic serial function
Split out the generic serial support into a "function driver".  This
closely mimics the ACM support, but with a MUCH simpler control model.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:07 -07:00
David Brownell
4d5a73dc39 usb gadget serial: split out CDC ACM function
Split out CDC ACM parts of "gadget serial" to a "function driver".
Some key structural differences from the previous ACM support, shared
with with the generic serial function (next patch):

 - As a function driver, it can be combined with other functions.
   One gadget configuration could offer both serial and network
   links, as an example.

 - One serial port can be exposed in multiple configurations;
   the /dev/ttyGS0 node could be exposed regardless of which
   config the host selected.

 - One configuration can expose multiple serial ports, such as
   ttyGS0, ttyGS1, ttyGS2, and ttyGS3.

This code should be a lot easier to understand than the previous
all-in-one-big-file version of the driver.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:06 -07:00
David Brownell
097db1d034 usb gadget zero: use composite gadget framework
Update Gadget Zero to use the more modular versions of the loopback
and source/sink configuration drivers which build on the new gadget
framework code.

The core code is a LOT simpler, and it should be much easier now to
understand how the parts fit together.  The conversion is an overall
source shrink in terms of this gadget, since it uses more midlayer
support.  However, it's an overall increase in object size because
there's less sharing between the two configurations (improves code
clarity) and because the midlayer is a bit more functional than this
driver actually needs.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:04 -07:00
David Brownell
e5760fdac8 usb gadget zero: split out loopback config
This splits the gadget zero "loopback" configuration into a standalone
"configuration driver", building on the composite gadget framework code.
It doesn't yet pull the original code out of gadget zero or update how
that driver is built.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:03 -07:00
David Brownell
a400cadc07 usb gadget zero: split out source/sink config
This splits the gadget zero "source/sink" configuration into a standalone
"configuration driver", building on the composite gadget framework code.
It doesn't yet pull the original code out of gadget zero or update how
that driver is built.

Neither this, nor its sibling "loopback" configuration, is a function
driver that can be combined with other functions.  (The host "usbtest"
driver wouldn't know how to deal with that!)  However the code becomes
simpler because of this conversion, so it's a net win.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:02 -07:00
David Brownell
40982be52d usb gadget: composite gadget core
Add <linux/usb/composite.h> interfaces for composite gadget drivers, and
basic implementation support behind it:

  - struct usb_function ... groups one or more interfaces into a function
    managed as one unit within a configuration, to which it's added by
    usb_add_function().

  - struct usb_configuration ... groups one or more such functions into
    a configuration managed as one unit by a driver, to which it's added
    by usb_add_config().  These operate at either high or full/low speeds
    and at a given bMaxPower.

  - struct usb_composite_driver ... groups one or more such configurations
    into a gadget driver, which may be registered or unregistered.

  - struct usb_composite_dev ... a usb_composite_driver manages this; it
    wraps the usb_gadget exposed by the controller driver.

This also includes some basic kerneldoc.

How to use it (the short version):  provide a usb_composite_driver with a
bind() that calls usb_add_config() for each of the needed configurations.
The configurations in turn have bind() calls, which will usb_add_function()
for each function required.  Each function's bind() allocates resources
needed to perform its tasks, like endpoints; sometimes configurations will
allocate resources too.

Separate patches will convert most gadget drivers to this infrastructure.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:01 -07:00
David Brownell
a4c39c41bf usb gadget: descriptor copying support
Define three new descriptor manipulation utilities, for use when
setting up functions that may have multiple instances:

	usb_copy_descriptors() to copy a vector of descriptors
	usb_free_descriptors() to free the copy
	usb_find_endpoint() to find a copied version

These will be used as follows.  Functions will continue to have static
tables of descriptors they update, now used as __initdata templates.

When a function creates a new instance, it patches those tables with
relevant interface and string IDs, plus endpoint assignments.  Then it
copies those morphed descriptors, associates the copies with the new
function instance, and records the endpoint descriptors to use when
activating the endpoints.  When initialization is done, only the copies
remain in memory.  The copies are freed on driver removal.

This ensures that each instance has descriptors which hold the right
instance-specific data.  Two instances in the same configuration will
obviously never share the same interface IDs or use the same endpoints.
Instances in different configurations won't do so either, which means
this is slightly less memory-efficient in some cases.

This also includes a bugfix to the epautoconf code that shows up with
this usage model.  It must replace the previous endpoint number when
updating the template descriptors, not just mask in a few more bits.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:16:00 -07:00
David Brownell
a7707adf9e usb gadget: use new serial core
Teach "gadget serial" to use the new abstracted (and bugfixed) TTY glue,
and remove all the orignal tangled-up code.  Update the documentation
accordingly.  This is a net object code shrink and cleanup; it should
make it a lot easier to see how the TTY glue should accomodate updates
to the TTY layer, be bugfixed, etc.

Notable behavior changes include:  it can now support getty even when
there's no USB connection; it fits properly into the mdev/udev world;
and RX handling is better (throttling works, and low latency).

Configurations with scripts setting up the /dev/ttygserial device node
(with "experimental" major number) may want to change that to be a
symlink pointing to the /dev/ttyGS0 file, as a migration aid; else,
just switch entirely over to mdev/udev.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:15:59 -07:00
David Brownell
c1dca562be usb gadget: split out serial core
This abstracts the "gadget serial" driver TTY glue into a separate
component, cleaning it up and disentangling it from connection state.

It also changed some behaviors for the better:

  - Stops using "experimental" major #127, and switches over to
    having the TTY layer allocate the dev_t numbers.
    
  - Provides /sys/class/tty/ttyGS* nodes, thus mdev/udev support.
    (Note "mdev" hotplug bug in Busybox v1.7.2: /dev/ttyGS0 will
    be a *block* device without CONFIG_SYSFS_DEPRECATED_V2.)

  - The tty nodes no longer reject opens when there's no host.
    Now they can support normal getty configs in /etc/inttab...

  - Now implements RX throttling.  When the line discipline says
    it doesn't want any more data, only packets in flight will be
    delivered (currently, max 1K/8K at full/high speeds) until it
    unthrottles the data.

  - Supports low_latency.  This is a good policy for all USB serial
    adapters, since it eliminates scheduler overhead on RX paths.

This also includes much cleanup including better comments, fixing
memory leaks and other bugs (including some locking fixes), messaging
cleanup, and an interface audit and tightening.  This added up to a
significant object code shrinkage, on the order of 20% (!) depending
on CPU and compiler.

A separate patch actually kicks in this new code, using the functions
declared in this new header, and removes the previous glue.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:15:59 -07:00
David Brownell
bb24280ffc USB: at91_udc: updated fifo sizes
It turns out newer versions of the AT91 UDC hardware have increased
sizes of some of the FIFOs.  Reporting that is a Good Thing.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:15:58 -07:00
Alexey Dobriyan
e184d5fcaa USB: rndis: switch to seq_files
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:15:57 -07:00
Adrian Bunk
ea05af61a8 USB: remove CVS keywords
This patch removes CVS keywords that weren't updated for a long time
from comments.

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:15:55 -07:00
Alan Stern
543f7810fb usb-storage: implement "soft" unbinding
This patch (as1092) implements "soft" unbinding for usb-storage.  When
the disconnect routine is called, all commands and reset delays are
allowed to complete normally until after scsi_remove_host() returns.
This means that the commands needed for an orderly shutdown will be
sent through to the device.

Unlike before, the driver will now execute every command that it
accepts.  Hence there's no need for special code to catch unexecuted
commands and fail them.

The new sequence of events when disconnect runs goes as follows:

	If the device is truly unplugged, set the DISCONNECTING
	flag so we won't try to access it any more.

	If the SCSI-scanning thread hasn't started up yet, prevent
	it from doing anything by setting the new DONT_SCAN flag.
	Then wake it up and wait for it to terminate.

	Remove the SCSI host.  This unbinds the upper-level drivers,
	doing an orderly shutdown.  Commands sent to quiesce the
	device will be transmitted normally, unless the device is
	unplugged.

	Set the DISCONNECTING flag so that we won't accept any new
	commands that might get submitted (there aren't supposed to be
	any) and we won't try to access the device for resets.

	Tell the control thread to exit by waking it up with no
	pending command, and wait for it to terminate.

	Go on to do all the other normal stuff: releasing resources,
	freeing memory, and so on.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:15:54 -07:00
Alan Stern
9da82bd464 USB: implement "soft" unbinding
This patch (as1091) changes the way usbcore handles interface
unbinding.  If the interface's driver supports "soft" unbinding (a new
flag in the driver structure) then in-flight URBs are not cancelled
and endpoints are not disabled.  Instead the driver is allowed to
continue communicating with the device (although of course it should
stop before its disconnect routine returns).

The purpose of this change is to allow drivers to do a clean shutdown
when they get unbound from a device that is still plugged in.  Killing
all the URBs and disabling the endpoints before calling the driver's
disconnect method doesn't give the driver any control over what
happens, and it can leave devices in indeterminate states.  For
example, when usb-storage unbinds it doesn't want to stop while in the
middle of transmitting a SCSI command.

The soft_unbind flag is added because in the past, a number of drivers
have experienced problems related to ongoing I/O after their disconnect
routine returned.  Hence "soft" unbinding is made available only to
drivers that claim to support it.

The patch also replaces "interface_to_usbdev(intf)" with "udev" in a
couple of places, a minor simplification.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:15:54 -07:00
Adrian Bunk
473bca94ba USB: isp1760-hcd.c: make 2 functions static
This patch makes the following needlessly global functions static:
- enqueue_an_ATL_packet()
- enqueue_an_INT_packet()

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Acked-by: Sebastian Siewior <bigeasy@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:15:54 -07:00
Alan Stern
7119e3c37f usb-storage: change remaining semaphore to completion
This patch (as1090) converts the one remaining semaphore in
usb-storage into a completion.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Matthew Dharm <mdharm-usb@one-eyed-alien.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:15:53 -07:00
Alan Stern
7e4d6c3879 usb-storage: separate dynamic flags from fixed flags
This patch (as1089) separates out the dynamic atomic bitflags and the
static bitfields in usb-storage.  Until now the two sorts of flags
have been sharing the same word; this has always been awkward.

To help prevent possible confusion, the two new fields each have a
different name from the original.  us->fflags contains the fixed
bitfields (mostly taken from the USB ID table in unusual_devs.h), and
us->dflags contains the dynamic atomic bitflags (used with set_bit,
test_bit, and so on).

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Matthew Dharm <mdharm-usb@one-eyed-alien.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:15:53 -07:00
Alan Cox
2742fd8899 USB: io_ti: FIrst cut at a big clean up
Sort out the insane naming like "OperationalFirmwareVersion" which seems
	designed to cause formatting problems and RSI
Merge various common code together
Clean up the pointlessly complex and spread about MCR handling

This is really just the low hanging fruit.

Needs lots of testing before it goes upstream so testers and reports
appreciated

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:15:53 -07:00
Alan Stern
4330354f76 USB: combine hub_quiesce and hub_stop
This patch (as1083) combines hub_quiesce() and hub_stop() into a
single routine.  There's no point keeping them separate since they are
usually called together.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:15:52 -07:00
Alan Stern
f2835219ed USB: combine hub_activate and hub_restart
This patch (as1071) combines hub_activate() and hub_restart() into a
single routine.  There's no point keeping them separate, since they
are always called together.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:15:52 -07:00
Alan Stern
948fea37dc USB: optimize port debouncing during hub activation
This patch (as1082) makes a small optimization to the way the hub
driver carries out port debouncing immediately after a hub is
activated (i.e., initialized, reset, or resumed).  If any port-change
statuses are observed, the code will delay for a minimal debounce
period -- thereby making a good start at debouncing all the ports at
once.

If this wasn't sufficient then khubd will debounce any port that still
requires attention.  But in most cases it should suffice; it's rare
for a device to need more than a minimal debounce delay.  (In the
cases of hub initialization or reset even that is most likely not
needed, since any devices plugged in at such times have probably been
attached for a while.)

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-07-21 15:15:52 -07:00