Commit Graph

2690 Commits (4b119e21d0c66c22e8ca03df05d9de623d0eb50f)

Author SHA1 Message Date
Alan Stern 95cf82f99c 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>
2007-10-12 14:55:26 -07:00
Alan Stern 5ad4f71e2f 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>
2007-10-12 14:55:26 -07:00
Alan Stern 7477120e34 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>
2007-10-12 14:55:25 -07:00
Auke Kok 1d3ee41e95 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>
2007-10-12 14:55:25 -07:00
Satyam Sharma e6d42f0e96 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>
2007-10-12 14:55:25 -07:00
Oliver Neukum 5adceac5da 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>
2007-10-12 14:55:25 -07:00
Matthias Kaehlcke b5b80f2b20 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>
2007-10-12 14:55:24 -07:00
Johann Wilhelm d853d872c1 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>
2007-10-12 14:55:24 -07:00
Alan Stern 63f991b287 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>
2007-10-12 14:55:24 -07:00
Alan Stern e015268d2f 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>
2007-10-12 14:55:24 -07:00
Alan Stern 1431d2a44c 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>
2007-10-12 14:55:23 -07:00
Alan Stern 4a00027dcb 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>
2007-10-12 14:55:23 -07:00
Alan Stern 9347d51c52 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>
2007-10-12 14:55:23 -07:00
Alan Stern 888fda4705 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>
2007-10-12 14:55:23 -07:00
Alan Stern 65e51098d9 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>
2007-10-12 14:55:22 -07:00
Alan Stern 55d8496837 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>
2007-10-12 14:55:21 -07:00
Alan Stern 14c04c0f88 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>
2007-10-12 14:55:21 -07:00
Alan Stern 4d2f110c51 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>
2007-10-12 14:55:21 -07:00
Andreas Loibl e7beb66784 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>
2007-10-12 14:55:21 -07:00
Jesper Juhl b84d2bf07f 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>
2007-10-12 14:55:21 -07:00
Roman Kagan ce0d9325b1 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>
2007-10-12 14:55:20 -07:00
Greg Kroah-Hartman fdf99c9ec1 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>
2007-10-12 14:55:20 -07:00
Alan Stern 12943f097e 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>
2007-10-12 14:55:20 -07:00
Alan Cox 94d0f7eac7 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>
2007-10-12 14:55:20 -07:00
Alan Cox c4e41562e0 USB: cp2101: Coding style police
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-10-12 14:55:20 -07:00
Alan Stern 6e8fe43b26 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>
2007-10-12 14:55:19 -07:00
Alan Stern 1f5a3d0f34 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>
2007-10-12 14:55:19 -07:00
Andrew M. Bishop ed6e52829c 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>
2007-10-12 14:55:19 -07:00
Alan Stern eb23105462 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>
2007-10-12 14:55:19 -07:00
Alan Stern b0d9efba3e 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>
2007-10-12 14:55:19 -07:00
Alan Stern ee7d1f3f0c 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>
2007-10-12 14:55:18 -07:00
Alan Stern dfd1e53777 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>
2007-10-12 14:55:18 -07:00
Marcelo Tosatti af1c51fcb2 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>
2007-10-12 14:55:18 -07:00
Stanislaw Gruszka 0eb0226c9d 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>
2007-10-12 14:55:18 -07:00
Stanislaw Gruszka 337427f91f 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>
2007-10-12 14:55:17 -07:00
Stanislaw Gruszka 04ea02f574 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>
2007-10-12 14:55:17 -07:00
Stanislaw Gruszka 503add467d 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>
2007-10-12 14:55:17 -07:00
Stanislaw Gruszka 603cf6087c 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>
2007-10-12 14:55:17 -07:00
Stanislaw Gruszka c8e463796c 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>
2007-10-12 14:55:17 -07:00
Alan Stern e39ab592f1 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>
2007-10-12 14:55:16 -07:00
Adrian Bunk f311cf58bd 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>
2007-10-12 14:55:16 -07:00
Oliver Neukum f6c1ceaa38 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>
2007-10-12 14:55:16 -07:00
Mariusz Kozlowski 60b69a966f 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>
2007-10-12 14:55:16 -07:00
Mariusz Kozlowski 5280d6083a 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>
2007-10-12 14:55:15 -07:00
Andrew Morton b3aceb2bab 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>
2007-10-12 14:55:15 -07:00
Alan Cox 3f6ff6ef04 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>
2007-10-12 14:55:15 -07:00
Pete Zaitcev 42cb967fd0 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>
2007-10-12 14:55:15 -07:00
Pete Zaitcev c36d54ab38 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>
2007-10-12 14:55:15 -07:00
Pete Zaitcev cdd5a8fd24 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>
2007-10-12 14:55:14 -07:00
Pete Zaitcev 30c7431de3 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>
2007-10-12 14:55:14 -07:00
Pete Zaitcev 283face86b 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>
2007-10-12 14:55:14 -07:00
Pete Zaitcev fc401e697f 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>
2007-10-12 14:55:14 -07:00
Felipe Balbi 7b5cd5fefb 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>
2007-10-12 14:55:13 -07:00
Felipe Balbi ecb8b190bc 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>
2007-10-12 14:55:13 -07:00
Felipe Balbi 7c59901421 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>
2007-10-12 14:55:12 -07:00
Felipe Balbi 22b2c526e7 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>
2007-10-12 14:55:11 -07:00
Felipe Balbi 1c1772a260 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>
2007-10-12 14:55:11 -07:00
Felipe Balbi 2acbd64731 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>
2007-10-12 14:55:11 -07:00
Felipe Balbi 9dedd36778 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>
2007-10-12 14:55:11 -07:00
Felipe Balbi ed86d97068 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>
2007-10-12 14:55:10 -07:00
Alan Stern 79a7d9ee1a 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>
2007-10-12 14:55:10 -07:00
Alan Stern d74d4a69dc 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>
2007-10-12 14:55:10 -07:00
Alan Stern e9df41c5c5 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>
2007-10-12 14:55:10 -07:00
Greg Kroah-Hartman b0e396e309 USB: make usb_release_interface static
No one else calls it, this makes sparse happy.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-10-12 14:55:09 -07:00
Greg Kroah-Hartman b5ea060f1e 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>
2007-10-12 14:55:08 -07:00
Inaky Perez-Gonzalez e03f2e8a53 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>
2007-10-12 14:55:08 -07:00
Inaky Perez-Gonzalez 93993a0a3e 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>
2007-10-12 14:55:07 -07:00
Inaky Perez-Gonzalez d9d16e8a92 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>
2007-10-12 14:55:07 -07:00
Inaky Perez-Gonzalez f8a374648b 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>
2007-10-12 14:55:07 -07:00
Inaky Perez-Gonzalez 72230abb21 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>
2007-10-12 14:55:07 -07:00
Inaky Perez-Gonzalez 1145065cd0 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>
2007-10-12 14:55:06 -07:00
Inaky Perez-Gonzalez 16bbab2966 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>
2007-10-12 14:55:06 -07:00
Inaky Perez-Gonzalez d7d07255d3 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>
2007-10-12 14:55:05 -07:00
Inaky Perez-Gonzalez eb579f5811 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>
2007-10-12 14:55:04 -07:00
Inaky Perez-Gonzalez 5234ce1b02 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>
2007-10-12 14:55:04 -07:00
David Brownell ca2bdf4bcc 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>
2007-10-12 14:55:04 -07:00
David Brownell 2e806f67cc 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>
2007-10-12 14:55:04 -07:00
David Brownell 51a0e85cd9 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>
2007-10-12 14:55:03 -07:00
David Brownell 8c07021635 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>
2007-10-12 14:55:03 -07:00
David Brownell 0cf4f2de0a 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>
2007-10-12 14:55:03 -07:00
David Brownell a4e3ef5597 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>
2007-10-12 14:55:03 -07:00
Nico Erfurth a1d534bb23 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>
2007-10-12 14:55:02 -07:00
Alan Stern 9a9bf406df 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>
2007-10-12 14:55:02 -07:00
Alan Stern 9439eb94b5 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>
2007-10-12 14:55:01 -07:00
Alan Stern d617bc83ff 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>
2007-10-12 14:55:01 -07:00
Alan Stern 18ea5d00d0 USB: avoid urb->pipe in usbmon
This patch (as949) changes the usbmon driver to use the new urb->ep
field rather than urb->pipe.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Pete Zaitcev <zaitcev@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-10-12 14:55:01 -07:00
Alan Stern 93cf9b909e USB: avoid urb->pipe in usbfs
This patch (as948) removes most of the references to urb->pipe from
the usbfs routines in devio.c.  The one tricky aspect is in
snoop_urb(), which can be called before the URB is submitted and which
uses usb_urb_dir_in().  For this to work properly, the URB's direction
flag must be set manually in proc_do_submiturb().

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

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-10-12 14:55:01 -07:00
Alan Stern 4326ed0be9 USB: address-0 handling during device initialization
This patch (as947) changes the device initialization and enumeration
code in hub.c; now udev->devnum will be set to 0 while the device is
being accessed at address 0.  Until now this wasn't needed because the
address value was passed as part of urb->pipe; without that field the
device address must be stored elsewhere.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-10-12 14:55:01 -07:00
Alan Stern 5e60a16139 USB: avoid using urb->pipe in usbcore
This patch (as946) eliminates many of the uses of urb->pipe in
usbcore.  Unfortunately there will have to be a significant API
change, affecting all USB drivers, before we can remove it entirely.
This patch contents itself with changing only the interface to
usb_buffer_map_sg() and friends: The pipe argument is replaced with a
direction flag.  That can be done easily because those routines get
used in only one place.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-10-12 14:55:00 -07:00
Alan Stern fea3409112 USB: add direction bit to urb->transfer_flags
This patch (as945) adds a bit to urb->transfer_flags for recording the
direction of the URB.  The bit is set/cleared automatically in
usb_submit_urb() so drivers don't have to worry about it (although as
a result, it isn't valid until the URB has been submitted).  Inline
routines are added for easily checking an URB's direction.  They
replace calls to usb_pipein in the DMA-mapping parts of hcd.c.

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

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-10-12 14:55:00 -07:00
Alan Stern bdd016ba64 USB: add ep->enable
This patch (as944) adds an explicit "enabled" field to the
usb_host_endpoint structure and uses it in place of the current
mechanism.  This is merely a time-space tradeoff; it makes checking
whether URBs may be submitted to an endpoint simpler.  The existing
mechanism is efficient when converting urb->pipe to an endpoint
pointer, but it's not so efficient when urb->ep is used instead.

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

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-10-12 14:55:00 -07:00
Alan Stern 5b653c79c0 USB: add urb->ep
This patch (as943) prepares the way for eliminating urb->pipe by
introducing an endpoint pointer into struct urb.  For now urb->ep
is set by usb_submit_urb() from the pipe value; eventually drivers
will set it themselves and we will remove urb->pipe completely.

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

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

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-10-12 14:55:00 -07:00
Adrian Bunk a96173af52 USB: Storage: usbat_check_status(): fix check-after-use
The Coverity checker spotted that we have already oops'ed if "us"
was NULL.

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

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Matthew Dharm <mdharm-usb@one-eyed-alien.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-10-12 14:54:59 -07:00
Robert P. J. Day 9f705bde6e USB: Remove dead references to "SAFE_SERIAL" CONFIG variables.
Remove the references to CONFIG_USBD_SAFE_SERIAL_{VENDOR,PRODUCT},
which aren't defined in any Kconfig file.

Signed-off-by: Robert P. J. Day <rpjday@mindspring.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-10-12 14:54:59 -07:00
Mike Nuss 89a0fd18a9 USB: OHCI handles more ZFMicro quirks
The ZF Micro OHCI controller exhibits unexpected behavior that seems to be
related to high load.  Under certain conditions, the controller will
complete a TD, remove it from the endpoint's queue, and fail to add it to
the donelist. This causes the endpoint to appear to stop responding. Worse,
if the device is removed while in that state, OHCI will hang while waiting
for the orphaned TD to complete.  The situation is not recoverable without
rebooting.

This fix enhances the scope of the existing OHCI_QUIRK_ZFMICRO flag:

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

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

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

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

Signed-off-by: Mike Nuss <mike@terascala.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-10-12 14:54:59 -07:00
Pete Zaitcev e8fa0ce65c usblp: Make use of URB_FREE_BUFFER
Employ the new API URB_FREE_BUFFER that we've got. There was talk of a combined
constructor for this case, but apparently it's not happening, so just set the
flag explicitly for now.

Signed-off-by: Pete Zaitcev <zaitcev@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-10-12 14:54:58 -07:00
Pete Zaitcev 7f477358e2 usblp: Implement the ENOSPC convention
This patch implements a mode when a printer returns ENOSPC when it runs
out of paper. The default remains the same as before. An application which
wishes to use this function has to enable it explicitly with an ioctl
LPABORT.

This is done on a request by our (Fedora) CUPS guy, Tim Waugh. The API is
similar enough to the lp0's one that CUPS works with both (but see below),
but it's has some differences.

Most importantly, the abort mode is persistent in case of lp0: once tunelp
was run your cat fill blow up until you reboot or run tunelp again. For
usblp, I made it so the abort mode is only in effect as long as device
is open. This way you can mix and match CUPS and cat(1) freely and nothing
bad happens even if you run out of paper. It is also safer in the face
of any unexpected crashes.

It has to be noted that mixing LPABORT and O_NONBLOCK is not advised.
It probably does not do what you want: instead of returning -ENOSPC
it will always return -EAGAIN (because it would otherwise block while
waiting for the paper). Applications which use O_NONBLOCK should continue
to use LPGETSTATUS like before.

Finally, CUPS actually requires patching to take full advantage of this.
It has several components; those which invoke LPABORT work, but some of
them need the ioctl added. This is completely compatible, you can mix
old CUPS and new kernels or vice versa.

Signed-off-by: Pete Zaitcev <zaitcev@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-10-12 14:54:58 -07:00
Jesper Juhl ca337db6f9 USB: Clean up duplicate includes in drivers/usb/
This patch cleans up duplicate includes in
	drivers/usb/

Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-10-12 14:54:58 -07:00
Micah Gruber 011db81523 USB: Remove unneeded pointer intf from speedtch_upload_firmware()
This trivial patch removes the unneeded pointer intf returned from
usb_ifnum_to_if(), which is never used. The check for NULL can be simply done
by if (!usb_ifnum_to_if(usb_dev, 2)).

Signed-off-by: Micah Gruber <micah.gruber@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-10-12 14:54:58 -07:00
Greg Kroah-Hartman 7e7654a92a cdev: remove unneeded setting of cdev names
struct cdev does not need the kobject name to be set, as it is never
used.  This patch fixes up the few places it is set.


Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Acked-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-10-12 14:51:02 -07:00
Kay Sievers 7eff2e7a8b Driver core: change add_uevent_var to use a struct
This changes the uevent buffer functions to use a struct instead of a
long list of parameters. It does no longer require the caller to do the
proper buffer termination and size accounting, which is currently wrong
in some places. It fixes a known bug where parts of the uevent
environment are overwritten because of wrong index calculations.

Many thanks to Mathieu Desnoyers for finding bugs and improving the
error handling.

Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Cc: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-10-12 14:51:01 -07:00
Russell King 6549e6c957 [ARM] pxa: update PXA UDC driver to use clk support
Note: this produces a WARN() dump.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
2007-10-12 21:15:11 +01:00
Boaz Harrosh dff6de73f9 [SCSI] usb storage: use scsi_eh API in REQUEST_SENSE execution
- Use new scsi_eh_prep/restor_cmnd() for synchronous
    REQUEST_SENSE invocation.

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:55:02 -04:00
Boaz Harrosh afd9a033ca [SCSI] microtek: use data accessors and !use_sg cleanup
- use scsi_cmnd data accessors
  - Clean the !use_sg code paths

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
[jejb: merge conflict fix]
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-10-12 14:38:21 -04:00
Linus Torvalds 038a5008b2 Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
* 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (867 commits)
  [SKY2]: status polling loop (post merge)
  [NET]: Fix NAPI completion handling in some drivers.
  [TCP]: Limit processing lost_retrans loop to work-to-do cases
  [TCP]: Fix lost_retrans loop vs fastpath problems
  [TCP]: No need to re-count fackets_out/sacked_out at RTO
  [TCP]: Extract tcp_match_queue_to_sack from sacktag code
  [TCP]: Kill almost unused variable pcount from sacktag
  [TCP]: Fix mark_head_lost to ignore R-bit when trying to mark L
  [TCP]: Add bytes_acked (ABC) clearing to FRTO too
  [IPv6]: Update setsockopt(IPV6_MULTICAST_IF) to support RFC 3493, try2
  [NETFILTER]: x_tables: add missing ip6t_modulename aliases
  [NETFILTER]: nf_conntrack_tcp: fix connection reopening
  [QETH]: fix qeth_main.c
  [NETLINK]: fib_frontend build fixes
  [IPv6]: Export userland ND options through netlink (RDNSS support)
  [9P]: build fix with !CONFIG_SYSCTL
  [NET]: Fix dev_put() and dev_hold() comments
  [NET]: make netlink user -> kernel interface synchronious
  [NET]: unify netlink kernel socket recognition
  [NET]: cleanup 3rd argument in netlink_sendskb
  ...

Fix up conflicts manually in Documentation/feature-removal-schedule.txt
and my new least favourite crap, the "mod_devicetable" support in the
files include/linux/mod_devicetable.h and scripts/mod/file2alias.c.

(The latter files seem to be explicitly _designed_ to get conflicts when
different subsystems work with them - that have an absolutely horrid
lack of subsystem separation!)

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-10-11 19:40:14 -07:00
Ralf Baechle 10d024c1b2 [NET]: Nuke SET_MODULE_OWNER macro.
It's been a useless no-op for long enough in 2.6 so I figured it's time to
remove it.  The number of people that could object because they're
maintaining unified 2.4 and 2.6 drivers is probably rather small.

[ Handled drivers added by netdev tree and some missed IRDA cases... -DaveM ]

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2007-10-10 16:51:13 -07:00
Jeff Garzik 1855256c49 drivers/firmware: const-ify DMI API and internals
Three main sets of changes:

1) dmi_get_system_info() return value should have been marked const,
   since callers should not be changing that data.

2) const-ify DMI internals, since DMI firmware tables should,
   whenever possible, be marked const to ensure we never ever write to
   that data area.

3) const-ify DMI API, to enable marking tables const where possible
   in low-level drivers.

And if we're really lucky, this might enable some additional
optimizations on the part of the compiler.

The bulk of the changes are #2 and #3, which are interrelated.  #1 could
have been a separate patch, but it was so small compared to the others,
it was easier to roll it into this changeset.

Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2007-10-09 20:22:20 -04:00
Greg Kroah-Hartman d526875deb Revert "usb-storage: implement autosuspend"
This reverts commit 8dfe4b1486.

There are a number of issues still remaining in usb-storage autosuspend,
so, to be safe, we need to revert this for now.

Acked-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-09-13 06:01:24 -07:00
Alan Stern 7d2c592609 USB: disable autosuspend by default for non-hubs
This patch (as965) disables autosuspend by default for all USB devices
other than hubs.  We are seeing too many devices that can't suspend or
resume properly, the blacklist is growing unreasonably quickly, and
this sort of thing should be handled in userspace.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-09-13 05:49:04 -07:00
Satyam Sharma 03fc370bdc USB: drivers/usb/serial/bus.c: Fix incompatible pointer type warning
drivers/usb/serial/bus.c: In function usb_serial_bus_deregister:
drivers/usb/serial/bus.c:185:
warning: passing argument 1 of free_dynids from incompatible pointer type

Above build warning comes when CONFIG_HOTPLUG=n because argument of
free_dynids() in serial/bus.c is a struct usb_serial_driver, not a
struct usb_driver. This is not a runtime bug, because the function
is an empty stub and never dereferences the passed pointer anyway.

Signed-off-by: Satyam Sharma <satyam@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-09-11 07:48:17 -07:00
Oliver Neukum e6a20ff999 USB: another quirky device (LCD display)
this time it is an LCD.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-09-11 07:48:16 -07:00
David Brownell 49b4f90285 USB: fix serial gadget ACM breakage
Two of the CDC ACM control requests in the serial gadget have never
been correct, and have been reported to cause serious troubles ... as
in, soft lockup and maybe watchdog reset (depending on hardware).

This patch makes those request fail cleanly, rather than misbehaving.
Someone using CDC ACM should fix them according to the FIXME comments
which now replace the previous bugs.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-09-11 07:48:16 -07:00
Lamarque Vieira Souza 86833691c2 USB: More USB_QUIRK_RESET_RESUME devices
I would like have the attached patch added to Linux kernel. The three
usb flash memories listed in the patch are being used in Intel's
ClassmatePC and need USB_QUIRK_RESET_RESUME to work reliably when
resuming from ram.
2007-09-11 07:48:16 -07:00
Massimiliano Ghilardi c4766560e4 USB Mass Storage: limit "Rockchip ROCK MP3" device (071b:3203) max I/O to 64 sectors per command
The MP3/MP4/AVI player "Rockchip ROCK MP3" is seen as a USB disk, but fails
if more than 128 sectors (64kB) are sent or requested in a single read or write
command, and disconnects from the USB bus.

Typical kernel log showing the problem is:

usb 3-1: reset high speed USB device using ehci_hcd and address 6
usb 3-1: reset high speed USB device using ehci_hcd and address 6
sd 14:0:0:0: [sdb] Result: hostbyte=0x07 driverbyte=0x00
end_request: I/O error, dev sdb, sector 32
sd 14:0:0:0: [sdb] Result: hostbyte=0x07 driverbyte=0x00
end_request: I/O error, dev sdb, sector 32
usb 3-1: USB disconnect, address 6

This patch works around the device limitation by adding "Rockchip ROCK MP3"
to unusual USB devices list and limiting data transfers to 64 sectors (32kB)
per command.
Tested on 2.6.23-rc5 (amd64).

Signed-off-by: Massimiliano Ghilardi <massimiliano.ghilardi@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-09-11 07:48:16 -07:00
Ortwin Glück 9374b9fd6c USB: Nikon D40 Quirks
The D40 needs the same quirks as the other (semi-)professional Nikon cameras.
The patch is against 2.6.23-rc5.

Details:
http://bugs.gentoo.org/show_bug.cgi?id=191431


From: Ortwin Glück <odi@odi.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-09-11 07:48:16 -07:00
Ricardo Barberis 61392af387 USB: Add Sony Ericsson P1i to unusual_devs.h
Signed-off-by: Phil Dibowitz <phil@ipom.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-09-11 07:48:16 -07:00
Greg Kroah-Hartman 2c4cd1f13a USB: option: Add Dell HSDPA 5520 to driver
This is based on information sent in by Christian Gothe.

Cc: Christian Gothe <christian.gothe@kapelan.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-09-11 07:48:15 -07:00
Jaime Velasco Juan a3209a0efc USB: option: Add a new device ID for the HUAWEI E220 HSDPA modem.
Signed-off-by: Jaime Velasco Juan <jaime@singular.local>
CC: Matthias Urlichs <smurf@smurf.noris.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-09-11 07:48:15 -07:00
Nathael Pajani e5dd01154c USB: fix linked list insertion bugfix for usb core
This patch fixes the order of list_add_tail() arguments in
usb_store_new_id() so the list can have more than one single element.

Signed-off-by: Nathael Pajani <nathael.pajani@cpe.fr>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-09-11 07:48:15 -07:00
Oliver Neukum ce05916f6b USB: quirky flash drive
That drive is quite odd. It has 2K sectors, times out getting string
descriptors and needs a quirk.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-09-11 07:48:15 -07:00
Alan Stern c269b6abd6 USB: prevent Genesys USB-IDE from autosuspending
This patch (as986) prevents the troublesome Genesys USB-IDE adapter
from autosuspending.  It may not be necessary for all such devices,
but the one in Bugzilla #8892 sometimes fails to resume.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-09-11 07:48:15 -07:00
Alan Stern d7790baf62 USB: prevent Thomson card reader from autosuspending
This patch (as985) prevents the SGS THomson Microelectronics 4in1 card
reader from autosuspending.  This resolves Bugzilla #8885.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-09-11 07:48:14 -07:00
Matt Colyer a74108d338 USB: Add iPhone device id to the quirk list. 2007-09-11 07:48:14 -07:00
Pierre Castella d7fde2d672 USB: ftdi_sio: add of a new product/manufacturer, TML
I have added to a new product based on the FTDI 232R USB/Serial
transceiver, which is commercialized by The Mobility Lab. Here is a
trivial patch enclosed, against 2.6.22.6 kernel.

Signed-off-by: Pierre Castella <pp.castella@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-09-11 07:48:14 -07:00
samson yeung ca9024eb6c usb/misc/sisusbvga: add product ID of TARGUS/MCT device
Device is Targus ACP50US which includes a Magic Control Technologies
usb vga device using the SiS315(E) or compatible.

Signed-off-by: Samson Yeung <fragmede@onepatchdown.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-09-11 07:48:14 -07:00
Alan Cox fa0e6721e7 USB: oti6858: Remove broken ioctl code in -mm tree and also the broken fixes
This stuff is simply not needed.

Signed-off-by: Alan Cox <alan@redhat.com>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-09-11 07:48:13 -07:00
Kay Sievers d65cc1b45e usb: add PRODUCT, TYPE to usb-interface events
This fixes a regression for userspace programs that were relying on these events.


Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Cc: Andreas Jellinghaus <aj@ciphirelabs.com>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-08-22 14:28:02 -07:00
Mike Pagano 83fc8a151b USB: resubmission unusual_devs modification for Nikon D80
Upgrade the unusual_devs.h file to support the new 1.01 firmware for the Nikon D80.

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>
2007-08-22 14:28:02 -07:00
Paul Walmsley a78d702bee usb quirks: Add Canon EOS 5D (PC Connection mode) to the autosuspend blacklist
Recent versions of the Linux kernel auto-suspend attached USB devices.
After this happens to the Canon EOS 5D camera, the camera's interrupt endpoints
don't seem to wake back up correctly, causing further use with libgphoto2
to fail with a -114 "OS error in camera communication" error.

A similar fix is probably necessary for this camera in PTP mode, which
identifies as USB product id 0x3102, but we haven't tested this.

As part of our testing process, we tried the USB_QUIRK_RESET_RESUME
quirk also, it's not helpful in this case.

Signed-off-by: Raj Kumar <rkumar@archive.org>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-08-22 14:28:01 -07:00
Mike Nuss c907d3b09f USB: make EHCI initialize properly on PPC SOCs
Correctly initialize the on-chip EHCI controller on the AMCC PPC440EPx.
Fix "USB 0.0" initialization message, and properly put the controller
into a known state before starting it.

Add "FIXME" comment to the au1xxx bus glue which is doing the same wrong
thing here.  (Who maintains that, now that AMD sold off Alchemy?)  Remove
some false copyright attributions which were somehow placed in the au1xxx
bus glue then copied into ppc-soc.

Signed-off-by: Mike Nuss <mike@terascala.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: K.Boge <karsten.boge@amd.com>
Cc: Jordan Crouse <jordan.crouse@amd.com>
Signed-off-by: Stefan Roese <sr@denx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-08-22 14:28:01 -07:00
Stanislaw Gruszka 4c132e7724 UEAGLE: Remove sysfs files on error case
Bugfix, remove sysfs files when modem fails to boot.

Signed-off-by: Stanislaw Gruszka <stf_xl@wp.pl>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-08-22 14:28:00 -07:00
Li Yang 39d1f8c9fc USB: fsl_usb2_udc: fix bug in processing setup requests
Kim Liu found that in the original code certain class setup requests
are wrongly recognized and processed as standard setup requests.
For that reason gadget ether can't work in RNDIS mode with Windows host.

The patch fixes the setup request processing code, and makes class
requests correctly passed to gadget layer.

Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Kim Liu <KLiu@vixs.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-08-22 14:28:00 -07:00
Alan Stern d1a94f080f USB: g_file_storage: fix bug in DMA buffer handling
This patch (as963) fixes a recently-introduced bug.  The gadget
conversion removing DMA-mapped buffer allocation did not remove quite
enough code from the g_file_storage driver; DMA pointers were being
set to 0.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-08-22 14:27:59 -07:00
Alan Stern 013d27f265 USB: update last_busy field correctly
This patch (as966) fixes a bug in the autosuspend code.  The last_busy
field should be updated whenever any event occurs, not just events
that cause an autosuspend or an autoresume.

This partially fixes Bugzilla #8892.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-08-22 14:27:59 -07:00
Alan Stern c39772d82a USB: allow retry on descriptor fetch errors
This patch (as964) was suggested by Steffen Koepf.  It makes
usb_get_descriptor() retry on all errors other than ETIMEDOUT, instead
of only on EPIPE.  This helps with some devices.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
CC: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-08-22 14:27:58 -07:00
Oliver Neukum 3b79cc2670 USB: unkill cxacru atm driver
it seems like you overdid it a bit in your quest to clean up the
use of urb->status. In this driver you read it the first thing, which
means that you are in a race against URB completion you'll
usually lose, returning -EINPROGRESS. This kills the driver.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-08-22 14:27:58 -07:00
Christian Heim 04cab13293 USB: Adding support for HTC Smartphones to ipaq
This patch enables support for HTC Smartphones. The original patch is at
https://bugs.gentoo.org/show_bug.cgi?id=187522. Original author is Mike Doty
<kingtaco@gentoo.org>.

Signed-off-by: Christian Heim <phreak@gentoo.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-08-22 14:27:54 -07:00
Oliver Neukum 53059f4d19 USB: another quirky device
for the drive Jean reported.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-08-22 14:27:53 -07:00
Oliver Neukum 5f546c5835 USB: quirky mass storage device
this device has been reported to break with autosuspend.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-08-22 14:27:52 -07:00
David Brownell bdd203a002 USB: ohci, fix oddball gcc warning
Some versions of GCC recently grew annoying warnings about constants.
This gets rid of that warning from the OHCI driver.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-08-22 14:27:52 -07:00
Alan Stern 2f67cd5b1d usb-storage: fix bugs in the disconnect pathway
This patch (as961) fixes a couple of bugs in the disconnect pathway of
usb-storage.

The first problem, which apparently has been around for a while
although nobody noticed it, shows up when an aborted command is still
pending when a disconnect occurs.  The SCSI error-handler will
continue to wait in command_abort() until the us->notify completion is
signalled.  Thus quiesce_and_remove_host() needs to signal it.

The second problem was introduced recently along with autosuspend
support.  Since usb_stor_scan_thread() now calls
usb_autopm_put_interface() before exiting, we can't simply leave the
scanning thread running after a disconnect; we must wait until the
thread exits.  This is solved by adding a new struct completion to the
private data structure.  Fortuitously, it allows the removal of the
rather clunky mechanism used in the past to insure that all threads
have finished before the module is unloaded.

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>
2007-08-22 14:27:52 -07:00
M4rkusXXL fa0de2b614 usb: typo in usb R8A66597 HCD config
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-08-22 14:27:49 -07:00
Alan Stern 46dede4690 USB: accept 1-byte Device Status replies, fixing some b0rken devices
Some devices have a bug which causes them to send a 1-byte reply to
Get-Device-Status requests instead of 2 bytes as required by the
spec.  This doesn't play well with autosuspend, since we look for a
valid status reply to make sure the device is still present when it
resumes.  Without both bytes, we assume the device has been
disconnected.

Lack of the second byte shouldn't matter much, since the spec requires
it always to be equal to 0.  Hence this patch (as959) causes
finish_port_resume() to accept a 1-byte reply as valid.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Acked-by: David Brownell <david-b@pacbell.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-08-22 14:27:49 -07:00
Oliver Neukum f095137e79 USB: blacklist Samsung ML-2010 printer
Hi,

this printer does not survive suspension.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-08-22 14:27:48 -07:00
Thomas Viehmann a66639ab28 usb-serial: fix oti6858.c segfault in termios handling
The oti6858 usb serial driver should use kernel_termios_to_user_termios/
user_termios_to_kernel_termios to avoid segfaults because the kernel
uses a structure differing from that of user space with a different
size.

Signed-off-by: Thomas Viehmann <tv@beamnet.de>
CC: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-08-22 14:27:48 -07:00
Alan Stern 0bd307e1b9 USB: remove DEBUG definition from dummy_hcd
This patch (as958) removes an unneeded and unwanted #define line from
dummy_hcd.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-08-22 14:27:47 -07:00
Andy Green e48eb085ac USB: belkin_sa: avoid divide by zero error
The belkin_sa module has a problem coping with a 0 return from
tty_get_baud_rate() -- the subsequent BELKIN_SA_BAUD macro

drivers/usb/serial/belkin_sa.h:#define BELKIN_SA_BAUD(b) (230400/b)

performs a divide with it leading to the following divide error:

usb 3-1: Belkin / Peracom / GoHubs USB Serial Adapter converter now attached to ttyUSB0
PM: Adding info for No Bus:usbdev3.3_ep81
PM: Adding info for No Bus:usbdev3.3_ep01
PM: Adding info for No Bus:usbdev3.3_ep82
divide error: 0000 [#1]
SMP
Modules linked in: vfat fat iwl3945 mac80211 cfg80211 belkin_sa usbserial usb_storage autofs4 vmnet(P) vmmon(P) aes nf_conntrack_netbios_ns ipt_REJECT nf_conntrack_ipv4 xt_state nf_conntrack nfnetlink xt_tcpudp iptable_filter ip_tables x_tables cpufreq_ondemand acpi_cpufreq video output sbs button dock battery ac arc4 snd_hda_intel ecb blkcipher snd_seq_dummy snd_seq_oss snd_seq_midi_event snd_seq snd_seq_device snd_pcm_oss sr_mod snd_mixer_oss rtc_cmos cdrom iTCO_wdt iTCO_vendor_support snd_pcm rtc_core snd_timer serio_raw b44 ssb rtc_lib parport ata_piix snd soundcore snd_page_alloc mii ata_generic sg ahci libata sd_mod scsi_mod ext3 jbd mbcache ehci_hcd ohci_hcd uhci_hcd
CPU:    1
EIP:    0060:[<f8dd1747>]    Tainted: P        VLI
EFLAGS: 00010246   (2.6.23-rc1 #1)
EIP is at belkin_sa_set_termios+0x18e/0x5b9 [belkin_sa]
eax: 00038400   ebx: 00000000   ecx: 00000000   edx: 00000000
esi: 00038400   edi: 00001cb2   ebp: de49adb0   esp: de49ad6c
ds: 007b   es: 007b   fs: 00d8  gs: 0033  ss: 0068
Process minicom (pid: 7306, ti=de49a000 task=eed6c3b0 task.ti=de49a000)
Stack: d85c74f0 00000046 00000002 00000001 d85c74f0 d85c74f0 00000246 c887c658
       00000001 00000cb0 00000001 00000084 00000000 d01b58c0 f6ba10e0 de49ade8
       de49ae40 de49add0 f8e2526b d85c74b8 ca6e6dbc de49ae40 d85c746c eded72e8
Call Trace:
 [<c0405f35>] show_trace_log_lvl+0x1a/0x2f
 [<c0405fe5>] show_stack_log_lvl+0x9b/0xa3
 [<c04061a5>] show_registers+0x1b8/0x289
 [<c0406389>] die+0x113/0x246
 [<c0622f98>] do_trap+0x8a/0xa3
 [<c04068dc>] do_divide_error+0x85/0x8f
 [<c0622d6a>] error_code+0x72/0x78
 [<f8e2526b>] serial_set_termios+0x86/0x8d [usbserial]
 [<c0542d33>] set_termios+0x309/0x34c
 [<c0542ece>] n_tty_ioctl+0x158/0x4ba
 [<c054030b>] tty_ioctl+0xc78/0xcd6
 [<c048aea0>] do_ioctl+0x50/0x67
 [<c048b100>] vfs_ioctl+0x249/0x25c
 [<c048b15c>] sys_ioctl+0x49/0x61
 [<c0404ed2>] sysenter_past_esp+0x5f/0x99
 =======================
Code: 85 c0 79 14 c7 44 24 04 67 1c dd f8 c7 04 24 d4 1e dd f8 e8 96 99 65 c7 8b 46 04 be 00 84 03 00 e8 47 11 77 c7 31 d2 89 c1 89 f0 <f7> f1 66 85 c0 89 c1 b8 01 00 00 00 0f 44 c8 8b 45 d8 85 db 8b
EIP: [<f8dd1747>] belkin_sa_set_termios+0x18e/0x5b9 [belkin_sa] SS:ESP 0068:de49ad6c

The small patch below should take care of this situation.  Note that my
kernel was tainted (vmware) but the problem will occur if
tty_get_baud_rate() ever returns zero and should be taken care of.

Signed-off-by: Andy Green <andy@warmcat.com>
Cc: William Greathouse <wgreathouse@smva.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: stable <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-08-22 14:27:46 -07:00
Søren Hauberg c1f8ea7d35 USB: Support for the Evolution Scorpion robots
The attached (mostly trivial) patches adds support for the Evolution
Scorpion Robots.
  Evolution Robotics supplies a patch against 2.6.8 with their
software. My patch is based on their work, so I don't know if I can
sign it off, or if you need some Evolution people to do this (which
might be hard).
  The patch adds device ID's for some robots which is trivial.



From: Søren Hauberg <hauberg@gmail.com>
Acked-by: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

Søren
2007-08-22 14:27:46 -07:00
David Brownell 8b2580e265 USB: quirks: multicard reader doesn't like autosuspend
It appears that one reason the "iConnect"-labeled multi-card reader was
on sale for only $5 is that it doesn't handle suspend/resume correctly.
Other than that, it was a good deal for a highspeed MMC/SD bridge.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-08-22 14:27:45 -07:00
Paul Mundt 71ee9a6c6c usb: r8a66597-hcd: fix up error path.
Currently when registration fails we're left with a stray reference to
release_mem_region(), this leads to the following case:

    r8a66597_hcd r8a66597_hcd: irq 13, io base 0x18040000
    drivers/usb/host/r8a66597-hcd.c: register access fail.
    r8a66597_hcd r8a66597_hcd: startup error -6
    r8a66597_hcd r8a66597_hcd: USB bus 1 deregistered
    drivers/usb/host/r8a66597-hcd.c: Failed to add hcd
    Trying to free nonexistent resource <0000000018040000-0000000018040000>

This fixes it up.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-08-22 14:27:45 -07:00
Paul Mundt a3b53514bd usb: Enable hcd support on SH unconditionally.
Previous boards were likely seeing USB_ARCH_HAS_HCD selected by way
of PCMCIA or PCI, though none of those are required for hcd support
on SH. Enable support unconditionally.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-08-22 14:27:45 -07:00
Faidon Liambotis 96443218be USB: fix support for Dell Wireless Broadband (aka WWAN)
Dell Wireless Broadband ExpressCards are rebrands of Novatel's cards.
Add all of their known PCI IDs to date along with their mapping to the exact
Novatel model to the Option driver which already claims to support them.

Signed-off-by: Faidon Liambotis <paravoid@debian.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-08-22 14:27:44 -07:00
Gabriel C 5b570d43ce USB: u132-hcd.c - Fix a warning when CONFIG_PM=n
I noticed this warning with CONFING_PM=n 

...

drivers/usb/host/u132-hcd.c:1525: warning: 'port_power' defined but not used

...

Signed-off-by: Gabriel Craciunescu <nix.or.die@googlemail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-08-22 14:27:44 -07:00
Robert P. J. Day 3aec6e26d7 USB: Typo: "USB_SAFE_PADDED" -> "USB_SERIAL_SAFE_PADDED".
Fix typo in safe_serial.c to match the actual CONFIG variable.

Signed-off-by: Robert P. J. Day <rpjday@mindspring.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-08-22 14:27:44 -07:00
Luis Lloret 88e45dbbab USB: Stall control endpoint when file storage class request wValue != 0
This patch makes the File Storage Gadget stall the control endpoint
when a MSC class request is made with wValue != 0.  This change makes
some MSC compliance test warnings disappear.

Signed-off-by: Luis Lloret <luislloret@gmail.com>
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-08-22 14:27:44 -07:00
Hermann Kneissel 468d13623b USB: serial: garmin_gps: fixes package loss if used from gpsbabel
This patch contains two fixes submitted by Ondrej Palkovsky:
- the 'ACK' packet is sent after the transfer of the USB packet is
completed, i.e. in the write_callback function. Because the close
function sends the 'abort' command, a parameter is added that allows
the caller of garmin_write_bulk to specify, if the 'ack' should be
propagated to the serial link or dimissed.
This fixes the problem with gpsbabel, it has sent several packets that
were acknowledged before they were sent to the GPS and GpsBabel closed
the device - thus effectively cancelled all outstanding requests in the
queue.
- removed the APP_RESP_SEEN and APP_REQ_SEEN flags and changed
them into counters. It evades USB reset of the gps on every device close.

Signed-off-by: Hermann Kneissel <hermann.kneissel@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-08-22 14:27:44 -07:00
Maximilian Attems c8ba84a0c6 USB: visor add ACER S10 palm device id
modprobe visor vendor=0x502 product=0x1
is said to work, plus there are patch instructions for it.
fixes http://bugs.debian.org/340547
see http://www.chinaitpower.com/A/2004-07-28/87909.html

Signed-off-by: Maximilian Attems <max@stro.at>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-08-22 14:27:43 -07:00
Alan Stern 74da5d68a5 USB: cdc-acm: fix sysfs attribute registration bug
This patch (as950) fixes a bug in the cdc-acm driver.  It doesn't keep
track of which interface (control or data) the sysfs attributes get
registered for, and as a result, during disconnect it will sometimes
attempt to remove the attributes from the wrong interface.  The
left-over attributes can cause a crash later on, particularly if the driver
module has been unloaded.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Acked-by: Oliver Neukum <oneukum@suse.de>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-08-22 14:27:43 -07:00
David Brownell 8c27303390 USB: px2xx_udc bugfix, missing check for gpio_pullup
git commit b2bbb20b37 added direct
support for PXA GPIO D+ pullup as alternative to the older udc_command
ops method.  This was done by introduction of the pxa2xx_udc_mach_info
member "gpio_pullup" which, if initialized, is now used in (almost)
all places where udc_command used to be called.

This patch fixes two places where checks for availability of D+ pullup
control still only honor udc_command.

Signed-off-by: Uli Luckas <u.luckas@road.de>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-08-22 14:27:43 -07:00
Linus Torvalds 8eb891fc80 Revert "USB: EHCI cpufreq fix"
This reverts commit 196705c9bb.  It was
reported to cause a regression by Daniel Exner, and Arjan van de Ven
points out that we actually already have infrastructure in place for
setting limits on acceptable DMA latency that would be the much more
correct fix for the problem with some Broadcom EHCI controllers.

Fixed up trivial conflicts due to the changes to support big-endian host
controller descriptors in drivers/usb/host/{ehci-sched.c,ehci.h}.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-08-20 23:38:44 -07:00
Jan Engelhardt 06bfb7eb15 Add some help texts to recently-introduced kconfig items
Signed-off-by: Jan Engelhardt <jengelh@gmx.de>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> (edited MACINTOSH_DRIVERS per Geert Uytterhoeven's remark)
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-08-18 09:52:50 -07:00
David Brownell a947522697 USB: "sparse" cleanups for usb gadgets
This removes complaints about the gadget stack which are generated by
the currrent "sparse":  it doesn't like the fact that zero is the null
pointer.  (Last I checked, C guarantees that's correct ...)

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-30 13:27:47 -07:00
Adam Kropelin bc71e479cd usb-serial: Fix edgeport regression on non-EPiC devices
Fix serious regression on non-EPiC edgeport usb-serial devices. Baud
rate and MCR/LCR registers are not being written on these models due
to apparent copy-n-paste errors introduced with EPiC support.

Failure reported by Nick Pasich <Nick@NickAndBarb.net>.

Signed-off-by: Adam Kropelin <akropel1@rochester.rr.com>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-30 13:27:47 -07:00
David Brownell 1060bce7b7 USB: more pxa2xx_udc dead code removal
Remove some more dead code from the pxa2xx_udc driver:  support
for a no-longer-undocumented hardware "test mode".  Newer chips
made this the default, evidently as the best workaround for deep
silicon bugs.  The interest was that this seemed to be the only
way to kick in the (documented!) double buffering capability.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-30 13:27:47 -07:00
Milinevsky Dmitry 4f47bb5673 USB: NIKON D50 is an unusual device
This short patch allows NIKON D50 to be mounted as UMS[unusual device]
on Linux niam 2.6.22-rc7-cfs-v18 #2 PREEMPT Tue Jul 3 22:35:53 EEST
2007 i686 Intel(R) Celeron(R) M processor 1.50GHz GenuineIntel
GNU/Linux,
some previous kernels...

lsusb -v
Bus 001 Device 006: ID 04b0:0409 Nikon Corp.
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0        64
  idVendor           0x04b0 Nikon Corp.
  idProduct          0x0409
  bcdDevice            1.00
  iManufacturer           1 NIKON
  iProduct                2 NIKON DSC D50
  iSerial                 0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           32
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0xc0
      Self Powered
    MaxPower                2mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         8 Mass Storage
      bInterfaceSubClass      6 SCSI
      bInterfaceProtocol     80 Bulk (Zip)
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
Device Qualifier (for other device speed):
  bLength                10
  bDescriptorType         6
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0        64
  bNumConfigurations      1
Device Status:     0x0001
  Self Powered

Signed-off-by: Milinevsky Dmitry <niam.niam@gmail.com>
Cc: Oliver Neukum <oliver@neukum.org>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: <caglar@pardus.org.tr>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-30 13:27:46 -07:00
Adrian Bunk 82a24e6885 USB: drivers/usb/serial/sierra.c: make 3 functions static
This patch makes three needlessly global functions static.

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Cc: Kevin Lloyd <linux@sierrawireless.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-30 13:27:46 -07:00
Oliver Neukum 3ddad8232c USB: fix BUG: sleeping function called from invalid context at /home/jeremy/hg/xen/paravirt/linux/drivers/usb/core/urb.c:524, in_atomic():1, irqs_disabled():0
Clearly there's a bug in
drivers/usb/serial/usb-serial.c:usb_serial_put().  It shouldn't call
kref_put() while holding a spinlock.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-30 13:27:46 -07:00
Alan Cox f424490031 USB: mct_u232: Convert to proper speed handling API
Signed-off-by: Alan Cox <alan@redhat.com>
Acked-by: Pete Zaitcev <zaitcev@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-30 13:27:46 -07:00
Alan Cox c6d61269f5 digi_acceleport: Drag the driver kicking and screaming into coding style
- The outbreak of acute bracketitus has been cured
- The belief that brackets should have spaces everywhere likewise
- Various other coding style tweaks
- Use baud rates not Bfoo in the speed setup switch

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-30 13:27:46 -07:00
Alan Cox 01e96d282a cp2101: Remove broken termios optimisation, use proper speed API
I've also enabled the commented out support for 7200, 14400, 55854,
127117 and 3686400 baud as you can now set such rates in the kernel.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-30 13:27:45 -07:00
Alan Stern 67f5dde3d4 USB: Fix a bug in usb_start_wait_urb
This patch (as941) fixes a bug recently added to the USB synchronous
API.  The status of a completed URB must be preserved separately
across a completion callback.  Also, the actual_length value isn't
available until after the URB has fully completed.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-30 13:27:45 -07:00
David Brownell a12b8db020 USB: fix scatterlist PIO case (IOMMU)
Update the scatterlist logic so that PIO options are also disabled
when an IOMMU may have coalesced pages during dma_map_sg() ... it's
not just HIGHMEM that can make trouble supporting both PIO and DMA
based host controller drivers.

There also seems to be a cross-arch issue here, with 64bit powerpc
not using an IOMMU define ... and its IOMMU_VMERGE config can always
be overridden on the kernel command line.  So this is better, but
still imperfect.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-30 13:27:45 -07:00
Oliver Neukum e31c18804f USB: fix usb_serial_suspend(): buggy code
Am Montag 23 Juli 2007 schrieb Adrian Bunk:
> Commit ec22559e0b added the following 
> function to drivers/usb/serial/usb-serial.c:
> 
[..]
> 
> The Coverity checker spotted the inconsequent NULL checking for "serial".
> 
> Looking at the code it also doesn't seem to have been intended to always 
> return 0.

Coverity is right. The check for NULL is wrongly done and the error
return is lost.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-30 13:27:45 -07:00
Oliver Neukum 209b3cfd53 USB: yet another quirky device
another quirky scanner.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-30 13:27:45 -07:00
Johann Felix Soden d2298136f1 USB: Add CanonScan LiDE30 to the quirk list
This patch adds CanoScan N1240U/LiDE30 (Scanner) to the list of quirky USB
devices.

Signed-off-by: Johann Felix Soden <johfel@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-30 13:27:45 -07:00
Oliver Neukum 81ac0dd191 USB: even more quirks
The number of quirky devices seems to be large.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-30 13:27:44 -07:00
Oliver Neukum fb745354f3 USB: more quirky devices
our list of devices which cannot be suspended keeps growing.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-30 13:27:44 -07:00
Jeremy Katz c17b49ec31 USB: Don't let usb-storage steal Blackberry Pearl
The Blackberry Pearl can run in two modes; a usb-storage only mode
and a mode that allows access via mass storage and to its database.
The berry_charge module will set the device to dual mode and thus we
should ignore its native mode if that module is built

Signed-off-by: Jeremy Katz <katzj@redhat.com>
Signed-off-by: Phil Dibowitz <phil@ipom.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-30 13:27:44 -07:00
Juergen Beisert 1aebb781e3 USB: devices misc: Trivial patch to build the IOWARRIOR when it is selected in Kconfig
Trivial patch to build the IOWARRIOR when it is selected in Kconfig.

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-30 13:27:43 -07:00
Linus Torvalds 2fe83b3ad1 Merge branch 'for-linus' of git://git.o-hand.com/linux-rpurdie-backlight
* 'for-linus' of git://git.o-hand.com/linux-rpurdie-backlight:
  leds: cr_bllcd.c: build fix
  backlight: Convert from struct class_device to struct device
  backlight: Fix order of Kconfig entries
2007-07-22 11:19:46 -07:00
Linus Torvalds 52a23685f3 Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/usb-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/usb-2.6: (44 commits)
  USB: drivers/usb/storage/dpcm.c whitespace cleanup
  USB: r8a66597-hcd: fixes some problem
  USB: change name of spinlock in hcd.c
  USB: move routines in hcd.c
  USB: misc: uss720: clean up urb->status usage
  USB: misc: usbtest: clean up urb->status usage
  USB: misc: usblcd: clean up urb->status usage
  USB: misc: phidgetmotorcontrol: clean up urb->status usage
  USB: misc: phidgetkit: clean up urb->status usage
  USB: misc: legousbtower: clean up urb->status usage
  USB: misc: ldusb: clean up urb->status usage
  USB: misc: iowarrior: clean up urb->status usage
  USB: misc: ftdi-elan: clean up urb->status usage
  USB: misc: auerswald: clean up urb->status usage
  USB: misc: appledisplay: clean up urb->status usage
  USB: misc: adtux: clean up urb->status usage
  USB: core: message: clean up urb->status usage
  USB: image: microtek: clean up urb->status usage
  USB: image: mdc800: clean up urb->status usage
  USB: storage: onetouch: clean up urb->status usage
  ...
2007-07-20 08:25:49 -07:00
Paul Mundt 20c2df83d2 mm: Remove slab destructors from kmem_cache_create().
Slab destructors were no longer supported after Christoph's
c59def9f22 change. They've been
BUGs for both slab and slub, and slob never supported them
either.

This rips out support for the dtor pointer from kmem_cache_create()
completely and fixes up every single callsite in the kernel (there were
about 224, not including the slab allocator definitions themselves,
or the documentation references).

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
2007-07-20 10:11:58 +09:00
S.Caglar Onur d20da3c39b USB: drivers/usb/storage/dpcm.c whitespace cleanup
Following trivial patch converts smarttabs/whitespaces into real tabs.

Signed-off-by: S.Caglar Onur <caglar@pardus.org.tr>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-19 17:46:08 -07:00
Yoshihiro Shimoda e294531dc9 USB: r8a66597-hcd: fixes some problem
This patch incorporates some updates. Updates include:

 - Fix the problem that control transfer might fail
 - Change from GFP_KERNEL to GFP_ATOMIC
 - Clean up some coding style issue

Signed-off-by: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-19 17:46:08 -07:00
Alan Stern 809a58b896 USB: change name of spinlock in hcd.c
This patch (as940 renames hcd_data_lock in hcd.c to hcd_urb_list_lock,
which is more descriptive of the lock's job.  It also introduces a
convenient inline routine for testing whether a particular USB device
is a root hub.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-19 17:46:08 -07:00
Alan Stern 32aca56005 USB: move routines in hcd.c
This patch (as939) moves a couple of routine in hcd.c around.  The
purpose is to put all the general URB- and endpoint-related routines
(submit, unlink, giveback, and disable) together in one spot.

There are no functional changes.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-19 17:46:08 -07:00
Greg Kroah-Hartman 82210d3774 USB: misc: uss720: clean up urb->status usage
This done in anticipation of removal of urb->status, which will make
that patch easier to review and apply in the future.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-19 17:46:08 -07:00
Greg Kroah-Hartman 59d99785a9 USB: misc: usbtest: clean up urb->status usage
This done in anticipation of removal of urb->status, which will make
that patch easier to review and apply in the future.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-19 17:46:08 -07:00
Greg Kroah-Hartman 0723af13bf USB: misc: usblcd: clean up urb->status usage
This done in anticipation of removal of urb->status, which will make
that patch easier to review and apply in the future.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-19 17:46:08 -07:00
Greg Kroah-Hartman a95a03811b USB: misc: phidgetmotorcontrol: clean up urb->status usage
This done in anticipation of removal of urb->status, which will make
that patch easier to review and apply in the future.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-19 17:46:07 -07:00
Greg Kroah-Hartman 2fe8c3f153 USB: misc: phidgetkit: clean up urb->status usage
This done in anticipation of removal of urb->status, which will make
that patch easier to review and apply in the future.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-19 17:46:07 -07:00
Greg Kroah-Hartman 64771a0f19 USB: misc: legousbtower: clean up urb->status usage
This done in anticipation of removal of urb->status, which will make
that patch easier to review and apply in the future.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-19 17:46:07 -07:00
Greg Kroah-Hartman 491c021e0b USB: misc: ldusb: clean up urb->status usage
This done in anticipation of removal of urb->status, which will make
that patch easier to review and apply in the future.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-19 17:46:07 -07:00
Greg Kroah-Hartman fb3abee69d USB: misc: iowarrior: clean up urb->status usage
This done in anticipation of removal of urb->status, which will make
that patch easier to review and apply in the future.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-19 17:46:07 -07:00
Greg Kroah-Hartman 84346269f9 USB: misc: ftdi-elan: clean up urb->status usage
This done in anticipation of removal of urb->status, which will make
that patch easier to review and apply in the future.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-19 17:46:07 -07:00
Greg Kroah-Hartman 22bea334c9 USB: misc: auerswald: clean up urb->status usage
This done in anticipation of removal of urb->status, which will make
that patch easier to review and apply in the future.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-19 17:46:07 -07:00
Greg Kroah-Hartman 13f9782d8e USB: misc: appledisplay: clean up urb->status usage
This done in anticipation of removal of urb->status, which will make
that patch easier to review and apply in the future.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-19 17:46:07 -07:00
Greg Kroah-Hartman 24497a0011 USB: misc: adtux: clean up urb->status usage
This done in anticipation of removal of urb->status, which will make
that patch easier to review and apply in the future.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-19 17:46:07 -07:00
Greg Kroah-Hartman 3fc3e8269f USB: core: message: clean up urb->status usage
This done in anticipation of removal of urb->status, which will make
that patch easier to review and apply in the future.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-19 17:46:06 -07:00
Greg Kroah-Hartman b44cd112a0 USB: image: microtek: clean up urb->status usage
This done in anticipation of removal of urb->status, which will make
that patch easier to review and apply in the future.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-19 17:46:06 -07:00
Greg Kroah-Hartman dd6fa4d755 USB: image: mdc800: clean up urb->status usage
This done in anticipation of removal of urb->status, which will make
that patch easier to review and apply in the future.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-19 17:46:06 -07:00
Greg Kroah-Hartman 62e5a330dc USB: storage: onetouch: clean up urb->status usage
This done in anticipation of removal of urb->status, which will make
that patch easier to review and apply in the future.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-19 17:46:06 -07:00
Greg Kroah-Hartman 18ac301605 USB: class: usblp: clean up urb->status usage
This done in anticipation of removal of urb->status, which will make
that patch easier to review and apply in the future.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-19 17:46:06 -07:00
Greg Kroah-Hartman 185d40587d USB: class: cdc-acm: clean up urb->status usage
This done in anticipation of removal of urb->status, which will make
that patch easier to review and apply in the future.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-19 17:46:06 -07:00
Greg Kroah-Hartman 33fea2b2f5 USB: atm: usbatm: clean up urb->status usage
This done in anticipation of removal of urb->status, which will make
that patch easier to review and apply in the future.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-19 17:46:06 -07:00
Greg Kroah-Hartman 508330ebda USB: atm: ueagle-atm: clean up urb->status usage
This done in anticipation of removal of urb->status, which will make
that patch easier to review and apply in the future.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-19 17:46:06 -07:00
Greg Kroah-Hartman 9a5a3e95b4 USB: atm: speedtch: clean up urb->status usage
This done in anticipation of removal of urb->status, which will make
that patch easier to review and apply in the future.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-19 17:46:05 -07:00
Greg Kroah-Hartman c35f68a05d USB: atm: cxacru: clean up urb->status usage
This done in anticipation of removal of urb->status, which will make
that patch easier to review and apply in the future.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-19 17:46:05 -07:00
Yoshihiro Shimoda 598f22e11b USB: m66592-udc: fixes some problems
This patch incorporates some updates from the review of the
Renesas m66592-udc driver.  Updates include:

 - Fix some locking bugs; and add a few sparse annotations
 - Don't #define __iomem !
 - Lots of whitespace fixes (most of the patch by volume)
 - Some #include file trimmage
 - Other checkpatch.pl and sparse updates
 - Alphabetized and slightly-more-informative Kconfig
 - Don't use the ID which was assigned to the amd5536udc driver.
 - Remove pointless suspend/resume methods updating obsolete field.
 - Some section fixups
 - Fix some leak bugs
 - Fix byteswapping

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-19 17:46:05 -07:00
Alan Stern d8fbba2f59 USB: usb-storage: unusual_devs entry for Nikon D100
This patch (as938) adds an unusual_devs entry for the Nikon DSC D100.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Phil Dibowitz <phil@ipom.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-19 17:46:05 -07:00
Jesper Juhl 0d46c0079a USB: Remove pointless conditional in drivers/usb/serial/io_ti.c::edge_shutdown()
Coverity scan found (CID: 1708) this in
drivers/usb/serial/io_ti.c::edge_shutdown() :

...
2797 		for (i=0; i < serial->num_ports; ++i) {
2798 			edge_port = usb_get_serial_port_data(serial->port[i]);
2799 			edge_remove_sysfs_attrs(edge_port->port);
2800 			if (edge_port) {
2801 				edge_buf_free(edge_port->ep_out_buf);
2802 				kfree(edge_port);
2803 			}
2804 			usb_set_serial_port_data(serial->port[i], NULL);
2805 		}
...

It's complaining that we dereference 'edge_port' in line 2799 which
makes the test of that pointer against NULL in 2800 pointless, since if
edge_port was actually NULL we'd have crashed already before reaching
line 2800.
Reading the edge_open() function it seems to me that the pointer
returned by usb_get_serial_port_data(serial->port[i]) and stored in
'edge_port' can never actually be NULL here, so the test is entirely
superfluous (even if it could be NULL it would be pointless here,
ignoring the then possible crash in that case, since both
edge_buf_free() and kfree() can handle being passed NULL pointers.

This patch removes the pointless conditional (and also makes a few
tiny style corrections now that I was in the area anyway).


Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-19 17:46:05 -07:00
Thomas Dahlmann 55d402d854 USB: amd5536 UDC driver (in GEODE southbridge)
Driver for the AMD5536 UDC, as found in the AMD Geode CS5536 (southbridge).
This is a high speed DMA-capable controller, which can also be used in
OTG configurations (which are not supported by this patch).

Acked-by: Jordan Crouse <jordan.crouse@amd.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-19 17:46:05 -07:00
Alan Stern beafef072a USB: documentation update for usb_unlink_urb
This patch (as936) updates the kerneldoc for usb_unlink_urb.  The
explanation of how endpoint queues are meant to work is now clearer
and in better agreement with reality.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-19 17:46:05 -07:00
Alan Stern e7e7c360fb UHCI: short control URBs get a status stage
It has recently been pointed out that short control transfers should
have a status stage, even if they generate an error because
URB_SHORT_NOT_OK was set.  This patch (as935) changes uhci-hcd to
enable the status stage when this happens.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-19 17:46:04 -07:00
Florin Malita e94fa28f13 USB: mos7720, mos7840: remove redundant urb check
Coverity (1709, 1710, 1711, 1712, 1713) actually flagged these as
REVERSE_INULLs (NULL check performed after dereference). But looking at
the other drivers I can't see any similar tests and the USB core already
makes sure urb is non-null - so might as well get rid of the checks.


Signed-off-by: Florin Malita <fmalita@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-19 17:46:04 -07:00
Alan Stern 195af2cce5 USB: fix warning caused by autosuspend counter going negative
This patch (as937) fixes a minor bug in the autosuspend usage-counting
code.  Each hub's usage counter keeps track of the number of
unsuspended children.  However the current driver increments the
counter after registering a new child, by which time the child may
already have been suspended and caused the counter to go negative.
The obvious solution is to increment the counter before registering
the child.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-19 17:46:04 -07:00
Alan Stern 69d42a78f9 USB: add "descriptors" binary sysfs attribute
This patch (as934) adds a new readonly binary sysfs attribute file
called "descriptors" for each USB device.  The attribute contains the
device descriptor followed by the raw descriptor entry (config plug
subsidiary descriptors) for the current configuration.

Having this information available in fixed-format binary makes life a
lot easier for user programs by avoiding the need to open, read, and
parse multiple sysfs text files.

The information in this attribute file is much like that in usbfs's
device file, but there are some significant differences:

	The 2-byte fields in the device descriptor are left in
	little-endian byte order, as they appear on the bus and
	in the kernel.

	Only one raw descriptor set is presented, that of the
	current configuration.

	Opening this file will not cause a suspended device to be
	autoresumed.

The last item in particular should be a big selling point for libusb,
which currently forces all USB devices to be resumed as it scans the
device tree.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Dave Mielke <dave@mielke.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-19 17:46:04 -07:00
Alan Stern 1b4cd43bd3 isp116x-hcd: prepare for urb->status
This patch (as931b), adapted from a patch by Olav Kongas, makes a small
set of conservative changes to the isp116x-hcd driver in preparation
for the removal of urb->status.

	finish_request() is moved up in the source and is called
	as soon as the URB is known to have completed, rather than
	after all the active endpoints have been scanned.

	The status of a completed URB is kept in a local variable
	and copied to urb->status only when the URB is about to be
	given back.

	-EREMOTEIO error status for control transfers is set after
	the status stage rather than when the short packet arrives.

	Some unnecessary uses of urb->lock are removed.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Olav Kongas <ok@artecdesign.ee>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-19 17:46:04 -07:00
Pete Zaitcev 10e485221e USB: usblp: "Big cleanup" breaks O_NONBLOCK
I found the first regresson in the rewritten ("all dynamic" and "no races")
driver. If application uses O_NONBLOCK, I return -EAGAIN despite the URB
being submitted successfuly. This causes the application to resubmit the
same data erroneously.

The fix is to pretend that the transfer has succeeded even if URB was
merely queued. It is the same behaviour as with the old version.

Signed-off-by: Pete Zaitcev <zaitcev@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-19 17:46:03 -07:00
Kevin Lloyd 9454c46a89 USB: sierra: Add new devices
This patch adds new devices to the Sierra Wireless driver. This is being
resubmitted because the dependent patch (patch 01/02) needed to be
resubmitted.

Signed-off-by: Kevin Lloyd <linux@sierrawireless.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-19 17:46:03 -07:00
Kevin Lloyd 112225b13c USB: sierra: Add TRU-Install (c) Support
This patch adds compatibility with Sierra Wireless' new TRU-Install
feature. Future devices that use this feature will not work unless this
patch has been applied.

Signed-off-by: Kevin Lloyd <linux@sierrawireless.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-19 17:46:03 -07:00
Matthias Kaehlcke eb33caec1e USB: use mutex instead of semaphore in the FTDI ELAN driver
The FTDI ELAN driver uses a semaphore 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>
2007-07-19 17:46:03 -07:00
Matthias Kaehlcke 8293c568b2 USB: use mutex instead of semaphore in the Adutux driver
The Adutux driver uses a semaphore 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>
2007-07-19 17:46:03 -07:00
Matthias Kaehlcke d2066eb659 USB: use mutex instead of semaphore in the ELAN U132 adapter driver
The ELAN U132 adapter driver uses the semaphore u132_module_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>
2007-07-19 17:46:03 -07:00
Matthias Kaehlcke 831c70fc13 USB: use mutex instead of semaphore in the USB gadget serial driver
The USB gadget serial driver uses a semaphore as mutex. Use the
mutex API instead of the (binary) semaphore.

Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com>
Acked-by: David Brownell <david-b@pacbell.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-19 17:46:03 -07:00
Yoann Padioleau dd00cc486a some kmalloc/memset ->kzalloc (tree wide)
Transform some calls to kmalloc/memset to a single kzalloc (or kcalloc).

Here is a short excerpt of the semantic patch performing
this transformation:

@@
type T2;
expression x;
identifier f,fld;
expression E;
expression E1,E2;
expression e1,e2,e3,y;
statement S;
@@

 x =
- kmalloc
+ kzalloc
  (E1,E2)
  ...  when != \(x->fld=E;\|y=f(...,x,...);\|f(...,x,...);\|x=E;\|while(...) S\|for(e1;e2;e3) S\)
- memset((T2)x,0,E1);

@@
expression E1,E2,E3;
@@

- kzalloc(E1 * E2,E3)
+ kcalloc(E1,E2,E3)

[akpm@linux-foundation.org: get kcalloc args the right way around]
Signed-off-by: Yoann Padioleau <padator@wanadoo.fr>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Acked-by: Russell King <rmk@arm.linux.org.uk>
Cc: Bryan Wu <bryan.wu@analog.com>
Acked-by: Jiri Slaby <jirislaby@gmail.com>
Cc: Dave Airlie <airlied@linux.ie>
Acked-by: Roland Dreier <rolandd@cisco.com>
Cc: Jiri Kosina <jkosina@suse.cz>
Acked-by: Dmitry Torokhov <dtor@mail.ru>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Acked-by: Pierre Ossman <drzeus-list@drzeus.cx>
Cc: Jeff Garzik <jeff@garzik.org>
Cc: "David S. Miller" <davem@davemloft.net>
Acked-by: Greg KH <greg@kroah.com>
Cc: James Bottomley <James.Bottomley@steeleye.com>
Cc: "Antonino A. Daplas" <adaplas@pol.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-07-19 10:04:50 -07:00
David Brownell aebdc3b450 dev_vdbg(), available with -DVERBOSE_DEBUG
This defines a dev_vdbg() call, which is enabled with -DVERBOSE_DEBUG.
When enabled, dev_vdbg() acts just like dev_dbg().  When disabled, it is a
NOP ...  just like dev_dbg() without -DDEBUG.  The specific code was moved
out of a USB patch, but lots of drivers have similar support.

That is, code can now be written to use an additional level of debug
output, selected at compile time.  Many driver authors have found this
idiom to be very useful.  A typical usage model is for "normal" debug
messages to focus on fault paths and not be very "chatty", so that those
messages can be left on during normal operation without much of a
performance or syslog load.  On the other hand "verbose" messages would be
noisy enough that they wouldn't normally be enabled; they might even affect
timings enough to change system or driver behavior.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-18 15:49:50 -07:00
Jeff Garzik a6343afb6e drivers/*: mark variables with uninitialized_var()
Mark variables in drivers/* with uninitialized_var() if such a warning
appears, and analysis proves that the var is initialized properly on all
paths it is used.

Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-07-17 16:23:19 -04:00
Jeff Garzik ae97fec370 drivers/usb/misc/auerswald: fix status check, remove redundant check
1) We should only set 'actual_length' output variable if usb length is
known to be good.

2) No need to check actual_length for NULL.  The only caller always
passes non-NULL value.

Signed-off-by: Jeff Garzik <jeff@garzik.org>
2007-07-17 16:18:00 -04:00
Al Viro 0ab7a252a5 no USB on M32R
Won't build due to lack of dma-mapping.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-07-17 11:01:07 -07:00
Rafael J. Wysocki 8314418629 Freezer: make kernel threads nonfreezable by default
Currently, the freezer treats all tasks as freezable, except for the kernel
threads that explicitly set the PF_NOFREEZE flag for themselves.  This
approach is problematic, since it requires every kernel thread to either
set PF_NOFREEZE explicitly, or call try_to_freeze(), even if it doesn't
care for the freezing of tasks at all.

It seems better to only require the kernel threads that want to or need to
be frozen to use some freezer-related code and to remove any
freezer-related code from the other (nonfreezable) kernel threads, which is
done in this patch.

The patch causes all kernel threads to be nonfreezable by default (ie.  to
have PF_NOFREEZE set by default) and introduces the set_freezable()
function that should be called by the freezable kernel threads in order to
unset PF_NOFREEZE.  It also makes all of the currently freezable kernel
threads call set_freezable(), so it shouldn't cause any (intentional)
change of behaviour to appear.  Additionally, it updates documentation to
describe the freezing of tasks more accurately.

[akpm@linux-foundation.org: build fixes]
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Nigel Cunningham <nigel@nigel.suspend2.net>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Gautham R Shenoy <ego@in.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-07-17 10:23:02 -07:00
Richard Purdie 655bfd7aeb backlight: Convert from struct class_device to struct device
Convert the backlight and LCD classes from struct class_device
to struct device since class_device is scheduled for removal.

One nasty API break is the backlight power attribute has had to be
renamed to bl_power and the LCD power attribute has had to be renamed
to lcd_power since the original names clash with the core. I can't see
a way around this.

Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-16 01:20:23 +01:00
Al Viro 53b6795002 minimal fixes for drivers/usb/gadget/m66592-udc.c
still looks racy (and definitely leaks)

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-07-15 16:40:51 -07:00
Linus Torvalds 773208946a Revert "USB: fix gregkh-usb-usb-use-menuconfig-objects"
This reverts commit acb11c8b80.

It was broken.  We most certainly *do* want the default to be the old
behaviour (and the common case!), instead of breaking everybodys
configuration and making 99% of all people have to override the default.

What were you guys thinking?

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-07-12 17:06:50 -07:00
Suresh Jayaraman 13f9966b3b USB: ohci-pnx4008: Remove unnecessary cast of return value of kzalloc
Remove unnecessary cast of return value of kzalloc() in
usb/host/ohci-pnx4008.c

Signed-off-by: Suresh Jayaraman <sjayaraman@novell.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:43 -07:00
Oliver Neukum 6c59649d49 USB: additions to the quirk list
this adds some scanners reported to be crashed by autosuspend to
the quirk list.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:43 -07:00
Alan Stern 8dfe4b1486 usb-storage: implement autosuspend
This patch (as930) implements autosuspend for usb-storage.  It is
adapted from a patch by Oliver Neukum.  Autosuspend is allowed except
during LUN scanning, resets, and command execution.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:43 -07:00
Andrey Arapov b0e2a705bf USB: cdc-acm: add new device id to option driver
USB: add new device id to option driver
device is Samsung X180 China cellphone

Signed-off-by: Andrey Arapov <andrey.arapov@gmail.com>
Acked-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:43 -07:00
David Brownell 2d70c99b93 USB: goku_udc trivial cleanups
Minor fixes to goku_udc ... whitespace, let -DDEBUG do its thing,
check the return value of device_register(), sparse tweaks.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:43 -07:00
David Brownell 70790f6339 USB: usb gadget stack can now -DDEBUG with Kconfig
Although the other USB driver directories got taught how use Kconfig
and the Makefile to enable the debugging messages enabled by -DDEBUG,
the gadget stack was overlooked.

This patch remedies that omission, but doesn't update any drivers to
remove previous idiosyncracies in this area ... other than the RNDIS
code, which defined its own DEBUG() macro in a broken way.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:42 -07:00
David Brownell c67ab134ba usb gadget stack: remove usb_ep_*_buffer(), part 2
This patch removes controller driver infrastructure which supported
the now-removed usb_ep_{alloc,free}_buffer() calls.

As can be seen, many of the implementations of this were broken to
various degrees.  Many didn't properly return dma-coherent mappings;
those which did so were necessarily ugly because of bogosity in the
underlying dma_free_coherent() calls ... which on many platforms
can't be called from the same contexts (notably in_irq) from which
their dma_alloc_coherent() sibling can be called.

The main potential downside of removing this is that gadget drivers
wouldn't have specific knowledge that the controller drivers have:
endpoints that aren't dma-capable don't need any dma mappings at all.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:42 -07:00
David Brownell 9d8bab58b7 usb gadget stack: remove usb_ep_*_buffer(), part 1
Remove usb_ep_{alloc,free}_buffer() calls, for small dma-coherent buffers.
This patch just removes the interface and its users; later patches will
remove controller driver support.

  - This interface is invariably not implemented correctly in the
    controller drivers (e.g. using dma pools, a mechanism which
    post-dates the interface by several years).

  - At this point no gadget driver really *needs* to use it.  In
    current kernels, any driver that needs such a mechanism could
    allocate a dma pool themselves.

Removing this interface is thus a simplification and improvement.

Note that the gmidi.c driver had a bug in this area; fixed.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:42 -07:00
David Brownell ad8c623f4f USB: pxa2xx_udc -- cleanups, mostly removing dma hooks
Cleanups to the pxa2xx_udc code:

  - Primarily removing unused DMA hooks.
  - One "sparse" warning removed
  - Remove some Lubbock-only LED hooks (for debugging)

That DMA code was never really completed.  It worked, mostly, for IN
transfers (to the host) if they were fortuitously aligned, but that
code was never fully tested.  And it was never coded for OUT transfers
(which is where DMA would really help) ... because of chip errata on
essentially every chip other than the pxa255, and because of design
botches (nothing automated data toggle).  So it's effectively been
dead code for several years now ... no point in keeping it around.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:42 -07:00
Milan Svoboda 9068a4c646 USB: pxa2xx_udc: use generic gpio layer
This patch lets the pxa2xx_udc use the generic gpio layer,
on the relevant PXA and IXP systems.

Signed-off-by: Milan Svoboda <msvoboda@ra.rockwell.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:42 -07:00
Oliver Neukum e4f747373c USB: quirk for samsung printer
this printer does not survive suspension.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:42 -07:00
David Brownell fbf54dd320 USB: usb/dma doc updates
This patch updates some of the documentation about DMA buffer management
for USB, and ways to avoid extra copying.  Our understanding of the issues
has improved over time.

 - Most drivers should *avoid* the dma-coherent allocators.  There are
   a few exceptions (like the HID driver).

 - Some methods are currently commented out; it seems folk writing
   USB drivers aren't doing performance tuning at that level yet.

 - Just avoid highmem; there's no good way to pass an "I can do highmem
   DMA" capability through a driver stack.  This is easy, everything
   already avoids highmem.  But it'd be nice if x86_32 systems with much
   physical memory could use it directly with network adapters and mass
   storage devices.  (Patch, anyone?)

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:42 -07:00
S.Caglar Onur c0e0c19cc9 USB: drivers/usb/storage/unusual_devs.h whitespace cleanup
Following patch removes trailing whitespaces at the ends of lines and converts
smarttabs/whitespaces into real tabs.

Signed-off-by: S.Caglar Onur <caglar@pardus.org.tr>
Signed-off-by: Phil Dibowitz <phil@ipom.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:41 -07:00
Robert P. J. Day a603c66551 USB: remove Makefile reference to obsolete OHCI_AT91
Signed-off-by: Robert P. J. Day <rpjday@mindspring.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:41 -07:00
Alan Cox 6dc7310243 USB: io_*: remove bogus termios no change checks
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>
2007-07-12 16:34:41 -07:00
Alan Cox eb58c0c5f2 USB: mos7720: remove bogus no termios change check
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>
2007-07-12 16:34:41 -07:00
Alan Cox 9a64f25132 USB: visor and whiteheat: remove bogus termios change checks
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>
2007-07-12 16:34:41 -07:00
Alan Cox e0c79f512c USB: pl2303: remove bogus checks and fix speed support to use tty_get_baud_rate()
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>
2007-07-12 16:34:41 -07:00
Alan Cox 31473aae5a USB: mos7840.c: turn this into a serial driver
The MOS driver is "interesting", in a bad kind of 'how the hell did this
get merged' kind of way

- Remove the bogus termios change check
- Remove the duplicate code for half the ioctls
- Remove the supporting code to duplicate the ioctl code

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>
2007-07-12 16:34:41 -07:00
Yinghai Lu 70f458f668 USB: make the usb_device numa_node get assigned from controller
So we can use dev_to_node(&usb_dev->dev) later in kmalloc_node to dma buffer

Signed-off-by: Yinghai Lu <yinghai.lu@sun.com>
Cc: Andi Kleen <ak@suse.de>
Acked-by: Christoph Lameter <clameter@sgi.com>
Cc: David Rientjes <rientjes@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:41 -07:00
Oliver Neukum 0ffbbe25a7 USB: ftdi_sio: fix oops due to processing workarounds too early
Fix an oops that happens in relation with applying work arounds for buggy
ftdi_sio devices.  The quirks were handled too early because due to changes in
the initialisation of usb serial devices the device was not fully initialised
when the old hook was called.

Addresses bug 8564

Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:40 -07:00
Jan Engelhardt acb11c8b80 USB: fix gregkh-usb-usb-use-menuconfig-objects
Generally, Jens Axboe was against 'default y', so I'll have some patches to
remove it.

Cc: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:40 -07:00
Venki Pallipadi 8d6d5fd050 USB: Make usb-autosuspend timer 1 sec jiffy aligned
Make usb autosuspend timers 1sec jiffy aligned.

This helps to reduce the frequency at which the CPU must be taken out of a
lower-power state.

Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:40 -07:00
Jeremy Katz 8e80e753ea USB: Don't autosuspend Blackberry devices.
Blackberry devices charge over USB.  By autosuspending the port, they are
not able to charge reliably.

Signed-off-by: Jeremy Katz <katzj@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:40 -07:00
Jeremy Katz 49bb607fa0 USB: Support Blackberry Pearl with berry_charge
The Blackberry Pearl (8100) needs similar tweaks as older Blackberry models
to be able to charge when connected via USB.  The Pearl also adds an
additional need to go into a separate mode for fully accessing the device;
do that by default as well.

Changes based on the changes from bcharge in the barry project
(http://barry.sf.net)

Signed-off-by: Jeremy Katz <katzj@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:40 -07:00
Craig W. Nadler 165fe97ed6 USB: add IAD support to usbfs and sysfs
USB_IAD: Adds support for USB Interface Association Descriptors.

This patch adds support to the USB host stack for parsing, storing, and
displaying Interface Association Descriptors. In /proc/bus/usb/devices
lines starting with A: show the fields in an IAD. In sysfs if an
interface on a USB device is referenced by an IAD the following files
will be added to the sysfs directory for that interface:
iad_bFirstInterface, iad_bInterfaceCount, iad_bFunctionClass, and
iad_bFunctionSubClass, iad_bFunctionProtocol

Signed-off-by: Craig W. Nadler <craig@nadler.us>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:40 -07:00
Greg Kroah-Hartman 50d2dc7266 USB: mos7720: change developer email addresses
Update the original developer's email addresses at their request.


Cc: Vijaya Kumar <vijaykumar.gn@gmail.com>
Cc: Ajay Kumar <naanuajay@yahoo.com>
Cc: Gurudeva <ngurudeva@yahoo.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:40 -07:00
Alan Stern 8ccef0df54 USB: Fix off-by-1 error in the scatter-gather library
The loop in usb_sg_wait() is structured in a way that makes it hard to
tell, when the loop exits, whether or not the last URB submission
succeeded.  This patch (as928) changes it from a "for" loop to a
"while" loop and keeps "i" always equal to the number of successful
submissions.  This fixes an off-by-one error which can show up when
the first URB submission fails.

The patch also removes a couple of lines that initialize fields which
don't need to be initialized.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:39 -07:00
Alan Stern cfa59dab27 USB: Don't resume root hub if the controller is suspended
Root hubs can't be resumed if their parent controller device is still
suspended.  This patch (as925) adds a check for that condition in
hcd_bus_resume() and prevents it from being treated as a fatal
controller failure.

ehci-hcd is updated to add the corresponding test.  Unnecessary
debugging messages are removed from uhci-hcd and dummy-hcd.  The
error return code from dummy-hcd is changed to -ESHUTDOWN, the same as
the others.  ohci-hcd doesn't need any changes.

Suspend handling in the non-PCI host drivers is somewhat hit-and-miss.
This patch shouldn't have any effect on them.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:39 -07:00
Alan Stern e7e6da9eb1 USB: Remove usages of dev->power.power_state
This patch (as922) removes all but one of the remaining vestiges of
dev->power.power_state from usbcore.  The only usage left must remain
until the deprecated "power/state" sysfs attribute is gone.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:39 -07:00
Pete Zaitcev 317c67b8f7 USB: usblp: add dynamic URBs, fix races
This patch's main bulk aims to make usblp the premier driver for code
pillaging once again. The code is as streamlined as possible and is bug-free
as possible. The usb-skeleton performs the same function, but is somewhat
abstract. The usblp is usb-skeleton which is actually used by many.

Since I combed a few small bugs away, this also fixes the small races we
had in usblp for a while. For example, now it's possible for several threads
to make write(2) calls (sounds silly, but consider a printer for paper
record, where every line of text is self-contained and thus it's all right
to have them interleaved). Also gone are issues with interrupts using
barriers dangerously.

This patch makes use of Oliver's anchor, and so it must trail the anchor
patch on the way to Linus.

Signed-off-by: Pete Zaitcev <zaitcev@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:39 -07:00
Li Yang 7542548fd8 USB: fsl_usb2_udc: fix bug for portsc bit masking
Fix a bug that PORT_TYPE and PORT_WIDTH aren't masked correctly in portsc.

Signed-off-by: Christopher Cason <chris.cason@nec.com.au>
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:38 -07:00
Oliver Neukum 7bbe990c98 USB: autosuspend for usblcd
this patch implements autosuspend for the usblcd driver. It uses
the new usb_anchor infrastructure. Many thanks to Georges for testing.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Cc: Georges Toth <g.toth@e-biz.lu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:38 -07:00
Haavard Skinnemoen 55b3fd41b0 usb gadget: Rename husb2dev -> usba
husb2dev was the internal name of the USB Device Controller on
AT32AP7000. Rename it to "atmel_usba", which is closer to the official
name used in documentation and marketing material.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:38 -07:00
Marcel Holtmann 8b3b01c898 USB: Add URB_FREE_BUFFER flag and the logic behind it
USB: Add URB_FREE_BUFFER flag for freeing the transfer buffer

In some cases it is not needed that the driver keeps track of the
transfer buffer of an URB. It can be simply freed along with the
URB itself when the reference count goes down to zero. The new
flag URB_FREE_BUFFER enables this behavior.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:38 -07:00
Laurent Pinchart 300871cd96 USB: Fix up full-speed bInterval values in high-speed interrupt descriptor
Many device manufacturers are using full-speed bInterval values in high-speed
interrupt endpoint descriptors. If the bInterval value is greater than 16,
assume the device uses full-speed descriptors and fix the value accordingly.

Signed-off-by: Laurent Pinchart <laurent.pinchart@skynet.be>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:37 -07:00
Oliver Neukum 87d093e25d USB: usb-skeleton: use anchors in pre/post reset
use anchors in pre/post_reset

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:37 -07:00
Oliver Neukum 758f7e161b USB: usb-skeleton" use anchors in suspend/resume handling
use anchors in suspend/resume handling

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:37 -07:00
Oliver Neukum e73c7247b8 USB: usb-skeleton: use anchors in disconnect handling
use anchors in disconnect handling

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:37 -07:00
Alan Cox a6ea438b6d USB: serial: ir_usb: Clean up the worst of it, remove exciting 'crash on open' feature
- Drivers don't call ldisc termios methods. They certainly don't call
them the way this one does - remove wrong call
- The tty buffer code isn't designed to be abused from IRQ handlers and
the new buffering removes the need for the uglies involved - fix them
- Style
- Remove incorrect baud and change handling for termios changes

The driver now has some style, but not a lot - it goes insane if you have
two dongles for example as it continues to use global variables for per
dongle state. That bit isn't my problem.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:37 -07:00
Alan Cox 9a8baec772 USB: serial: belkin_sa: Various needed fixes
Use the baud rate stuff from the kernel don't parse CBAUD directly
Remove pointless and wrong 'no change' check

Could do with some good testing as well but again better than adding &&
BROKEN

(The use of BELKIN_SA_BAUD() might seem a bit odd but x/a = b and x/b =
a (rounded for integers)).



Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:37 -07:00
Alan Cox 568c24adea USB: serial: ark3116.c: Mixed fixups
o	Don't parse the cflag for baud rates, its not valid to do so
	any more and this driver got it wrong anyway
o	Don't do clever termios change checks in drivers and get them
	wrong (arguably we should do some smart ones in the tty core but
	stty to change nothing is *not* a common or critical path

I don't have the hardware so if you can test this carefully please do. I
thought fixing it up this far was better than marking it and other bits of
USB serial && BROKEN

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:37 -07:00
Greg Kroah-Hartman 9e85c5f632 USB: sierra: cleanup the startup and shutdown path
This removes the ugly code that was copied from the keyspan driver and
allocates the in urbs in a much shorter code path that can be understood
easier.

Also turned off the interrupt urb when no port was open as it's not nice
to keep the bus busy for no good reason at all (this should be a power
savings.)

All in all, this saved over 40 lines of code and cleaned things up
better.

Cc: Kevin Lloyd <linux@sierrawireless.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:37 -07:00
Greg Kroah-Hartman 17c2327419 USB: sierra: remove incorrect usage of the urb status field
You can't rely on the fact that the status really is correct like it was.

Also simplified the write path and now we allocate the urb and data on
the fly, instead of trying to do that really odd timeout check which I
am guessing doesn't really work properly.  This should speed up the
device by keeping the hardware queue full easier.

As a benefit, this reduces the size of the driver.

Cc: Kevin Lloyd <linux@sierrawireless.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:37 -07:00
Greg Kroah-Hartman 0540001369 USB: serial: whiteheat: clean up urb->status usage
This done in anticipation of removal of urb->status, which will make
that patch easier to review and apply in the future.


Cc: <linux-usb-devel@lists.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:36 -07:00
Greg Kroah-Hartman 38e8c910ff USB: serial: visor: clean up urb->status usage
This done in anticipation of removal of urb->status, which will make
that patch easier to review and apply in the future.


Cc: <linux-usb-devel@lists.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:36 -07:00
Greg Kroah-Hartman 52171b4808 USB: serial: ti_usb_3410_5052: clean up urb->status usage
This done in anticipation of removal of urb->status, which will make
that patch easier to review and apply in the future.


Cc: <linux-usb-devel@lists.sourceforge.net>
Cc: Al Borchers <alborchers@steinerpoint.com>
Cc: Peter Berger <pberger@brimson.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:36 -07:00
Greg Kroah-Hartman 17dd2215ad USB: serial: sierra: clean up urb->status usage
This done in anticipation of removal of urb->status, which will make
that patch easier to review and apply in the future.


Cc: <linux-usb-devel@lists.sourceforge.net>
Cc: Kevin Lloyd <linux@sierrawireless.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:36 -07:00
Greg Kroah-Hartman 3a75ab9436 USB: serial: safe_serial: clean up urb->status usage
This done in anticipation of removal of urb->status, which will make
that patch easier to review and apply in the future.


Cc: <linux-usb-devel@lists.sourceforge.net>
Cc: Stuart Lynne <sl@lineo.com>
Cc: Tom Rushworth <tbr@lineo.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:36 -07:00
Greg Kroah-Hartman 461d696aee USB: serial: pl2303: clean up urb->status usage
This done in anticipation of removal of urb->status, which will make
that patch easier to review and apply in the future.


Cc: <linux-usb-devel@lists.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:36 -07:00
Greg Kroah-Hartman 78c26aebd9 USB: serial: oti6858: clean up urb->status usage
This done in anticipation of removal of urb->status, which will make
that patch easier to review and apply in the future.


Cc: <linux-usb-devel@lists.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:36 -07:00
Greg Kroah-Hartman d6977b51d5 USB: serial: option: clean up urb->status usage
This done in anticipation of removal of urb->status, which will make
that patch easier to review and apply in the future.


Cc: <linux-usb-devel@lists.sourceforge.net>
Cc: Matthias Urlichs <smurf@smurf.noris.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:36 -07:00
Greg Kroah-Hartman fdc2deb389 USB: serial: omninet: clean up urb->status usage
This done in anticipation of removal of urb->status, which will make
that patch easier to review and apply in the future.


Cc: <linux-usb-devel@lists.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:35 -07:00
Greg Kroah-Hartman 9965d61263 USB: serial: navman: clean up urb->status usage
This done in anticipation of removal of urb->status, which will make
that patch easier to review and apply in the future.


Cc: <linux-usb-devel@lists.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:35 -07:00
Greg Kroah-Hartman 0643c72435 USB: serial: mos7840: clean up urb->status usage
This done in anticipation of removal of urb->status, which will make
that patch easier to review and apply in the future.


Cc: <linux-usb-devel@lists.sourceforge.net>
Cc: Paul Schroeder <pschroeder@uplogix.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:35 -07:00
Greg Kroah-Hartman 8110598484 USB: serial: mos7720: clean up urb->status usage
This done in anticipation of removal of urb->status, which will make
that patch easier to review and apply in the future.


Cc: <linux-usb-devel@lists.sourceforge.net>
Cc: VijayaKumar G.N. <vijaykumar@aspirecom.net>
Cc: AjayKumar <ajay@aspirecom.net>
Cc: Gurudeva N. <gurudev@aspirecom.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:35 -07:00
Greg Kroah-Hartman e96da398ce USB: serial: mct_u232: clean up urb->status usage
This done in anticipation of removal of urb->status, which will make
that patch easier to review and apply in the future.


Cc: <linux-usb-devel@lists.sourceforge.net>
Cc: Wolfgang Grandegger <wolfgang@ces.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:35 -07:00
Greg Kroah-Hartman 6fcdcf04e3 USB: serial: kobil_sct: clean up urb->status usage
This done in anticipation of removal of urb->status, which will make
that patch easier to review and apply in the future.


Cc: <linux-usb-devel@lists.sourceforge.net>
Cc: Thomas Wahrenbruch <linuxusb@kobil.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:35 -07:00
Greg Kroah-Hartman 17c1b35a46 USB: serial: kl5kusb105: clean up urb->status usage
This done in anticipation of removal of urb->status, which will make
that patch easier to review and apply in the future.


Cc: <linux-usb-devel@lists.sourceforge.net>
Cc: Utz-Uwe Haus <haus@uuhaus.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:35 -07:00
Greg Kroah-Hartman 23189aee76 USB: serial: keyspan_pda: clean up urb->status usage
This done in anticipation of removal of urb->status, which will make
that patch easier to review and apply in the future.


Cc: <linux-usb-devel@lists.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:35 -07:00
Greg Kroah-Hartman 95b9345480 USB: serial: keyspan: clean up urb->status usage
This done in anticipation of removal of urb->status, which will make
that patch easier to review and apply in the future.


Cc: <linux-usb-devel@lists.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:35 -07:00
Greg Kroah-Hartman 3152b74f92 USB: serial: ir-usb: clean up urb->status usage
This done in anticipation of removal of urb->status, which will make
that patch easier to review and apply in the future.


Cc: <linux-usb-devel@lists.sourceforge.net>
Cc: Gary Brubaker <xavyer@ix.netcom.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:33 -07:00
Greg Kroah-Hartman b4a1579772 USB: serial: ipw: clean up urb->status usage
This done in anticipation of removal of urb->status, which will make
that patch easier to review and apply in the future.


Cc: <linux-usb-devel@lists.sourceforge.net>
Cc: Roelf Diedericks <roelfd@inet.co.za>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:33 -07:00
Greg Kroah-Hartman 2362deb578 USB: serial: ipaq: clean up urb->status usage
This done in anticipation of removal of urb->status, which will make
that patch easier to review and apply in the future.


Cc: <linux-usb-devel@lists.sourceforge.net>
Cc: Ganesh Varadarajan <ganesh@veritas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:33 -07:00
Greg Kroah-Hartman ee337c212a USB: serial: io_ti: clean up urb->status usage
This done in anticipation of removal of urb->status, which will make
that patch easier to review and apply in the future.


Cc: <linux-usb-devel@lists.sourceforge.net>
Cc: Al Borchers <alborchers@steinerpoint.com>
Cc: Peter Berger <pberger@brimson.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:33 -07:00
Greg Kroah-Hartman 2a393f5fd8 USB: serial: io_edgeport: clean up urb->status usage
This done in anticipation of removal of urb->status, which will make
that patch easier to review and apply in the future.


Cc: <linux-usb-devel@lists.sourceforge.net>
Cc: Al Borchers <alborchers@steinerpoint.com>
Cc: Peter Berger <pberger@brimson.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:33 -07:00
Greg Kroah-Hartman fbd272254b USB: serial: generic: clean up urb->status usage
This done in anticipation of removal of urb->status, which will make
that patch easier to review and apply in the future.


Cc: <linux-usb-devel@lists.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:33 -07:00
Greg Kroah-Hartman f9feb517fa USB: serial: garmin_gps: clean up urb->status usage
This done in anticipation of removal of urb->status, which will make
that patch easier to review and apply in the future.


Cc: <linux-usb-devel@lists.sourceforge.net>
Cc: Hermann Kneissel <herkne@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:32 -07:00
Greg Kroah-Hartman 0fb0aa188d USB: serial: ftdi_sio: clean up urb->status usage
This done in anticipation of removal of urb->status, which will make
that patch easier to review and apply in the future.


Cc: <linux-usb-devel@lists.sourceforge.net>
Cc: Kuba Ober <kuba@mareimbrium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:32 -07:00
Greg Kroah-Hartman 335202f44a USB: serial: empeg: clean up urb->status usage
This done in anticipation of removal of urb->status, which will make
that patch easier to review and apply in the future.


Cc: <linux-usb-devel@lists.sourceforge.net>
Cc: Gary Brubaker <xavyer@ix.netcom.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:32 -07:00
Greg Kroah-Hartman 85d7510711 USB: serial: digi_acceleport: clean up urb->status usage
This done in anticipation of removal of urb->status, which will make
that patch easier to review and apply in the future.


Cc: <linux-usb-devel@lists.sourceforge.net>
Cc: Peter Berger <pberger@brimson.com>
Cc: Al Borchers <borchers@steinerpoint.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:32 -07:00
Greg Kroah-Hartman 8d7bc55ecf USB: serial: cypress_m8: clean up urb->status usage
This done in anticipation of removal of urb->status, which will make
that patch easier to review and apply in the future.


Cc: <linux-usb-devel@lists.sourceforge.net>
Cc: Lonnie Mendez <dignome@gmail.com>
Cc: Neil Whelchel <koyama@firstlight.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:32 -07:00
Greg Kroah-Hartman 7dcc85cd9b USB: serial: cyberjack: clean up urb->status usage
This done in anticipation of removal of urb->status, which will make
that patch easier to review and apply in the future.


Cc: <linux-usb-devel@lists.sourceforge.net>
Cc: <support@reiner-sct.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:32 -07:00
Greg Kroah-Hartman f26aad25d2 USB: serial: belkin_sa: clean up urb->status usage
This done in anticipation of removal of urb->status, which will make
that patch easier to review and apply in the future.


Cc: <linux-usb-devel@lists.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:32 -07:00
Greg Kroah-Hartman d3434cf691 USB: serial: airprime: clean up urb->status usage
This done in anticipation of removal of urb->status, which will make
that patch easier to review and apply in the future.


Cc: <linux-usb-devel@lists.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:32 -07:00
Greg Kroah-Hartman 1373dbbca5 USB: serial: aircable: clean up urb->status usage
This done in anticipation of removal of urb->status, which will make
that patch easier to review and apply in the future.


Cc: <linux-usb-devel@lists.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:31 -07:00
Greg Kroah-Hartman 4d0dce3e0b USB: fix up license wording on some of my usb-serial drivers
Also update the copyright date on the pl2303 driver, as it was out of date.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:31 -07:00
Pete Zaitcev 9f6a93f7bb usb: free DMA mappings if enqueue fails
This patch releases DMA resources if enqueue fails in the HCD.

Linux had this bug ever since we converted from virt_to_bus for 2.4.
It is difficult to hit. A user would need a significant memory pressure
or some other unusual condition.

It was reported to me by IBM. They ran a management application for
RSA II adapters which sent Bulk requests to an Interrupt endpoint.
Submissions got rejected by HCD due to an invalid interval value
and the swiotlb pool became depleted in the matter of hours.

We fixed the invalid interval issue in devio.c separately, but this
seems to be a bug worth fixing as well.

Signed-off-by: Pete Zaitcev <zaitcev@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:31 -07:00
Alan Stern 60aac1ec26 USB: Handle bogus low-speed Bulk endpoints
A noticeable number of low-speed devices mistakenly include
descriptors for Bulk endpoints, which is forbidden by the USB spec.
In an attempt to make such devices more usable, this patch (as924)
converts the descriptors to Interrupt with an interval of 1 ms.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:31 -07:00
Benny Halevy 52f6b5e1f1 synchronization in usb_serial_put
I think there is a race between usb_serial_put() and
usb_serial_get_by_index() (and get_free_serial()) with regards
to handling the serial port refcount.

usb_serial_get_by_index() gets a reference on the serial port under
table_lock while return_serial releases all the returned ports
from the table under the same lock.  However, the table_lock is not
taken around the call to kref_put, theoretically allowing to sneak
in and grab a reference after kref_put has already determined that
the reference count is zero (and before calling destroy_serial)
causing use after free.

Signed-off-by: Benny Halevy <bhalevy@ns1.bhalevy.com>
Cc: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:31 -07:00
Oliver Neukum efdff60885 USB: io_ti: sleep with spinlock held detected by automatic tool
this fixes the sleep found with the automatic tool.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:31 -07:00
Christian Engelmayer 756aa6b3d5 ehci-hub: improved over-current recovery
According to the USB Specification Revision 2.0 chapter 11.12.5
a hub experiencing an over-current condition must place all
affected ports in the powered-off state. It seems that some root
hubs need port power to be cycled by software in order to get back
to normal functionality after an over-current condition ... like
the EHCI implementation on an MPC8343E.

Signed-off-by: Christian Engelmayer <christian.engelmayer@frequentis.com>
Signed-off-by: David Brownell <david-b@pacbell.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:31 -07:00
David Brownell 648dcfc805 USB: usb host side can be configured given PCMCIA
Platforms with PCMCIA support can implement host-side USB with "sl811_cs",
so make sure this menu shows up on platforms with PCMCIA.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:31 -07:00
Alan Stern ed76cacbea USB: usb-storage: use kthread_stop() for the control thread
This patch (as923) makes usb-storage's control thread use
kthread_should_stop()/kthread_stop().  The scanning thread can't be
similarly converted until the core kthread implementation allows
threads to call do_exit().

The advantage of this change is that we can now be certain the control
thread has terminated before storage_disconnect() returns.  This will
simplify the locking requirements when autosuspend support is added.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Matthew Dharm <mdharm-usb@one-eyed-alien.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:31 -07:00
Arnaud Patard 3fc154b6b8 USB Gadget driver for Samsung s3c2410 ARM SoC
This patch adds the support for the Usb Device Controller on Samsung
S3C24xx SoCs.  This driver passes all tests from testusb (including #13)
and has been tested on S3C2410, S3C24212, and S3C2440 SoCs.

Whitespace updates, minor cleanups by David

Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Cc: Herbert Pötzl <herbert@13thfloor.at>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:30 -07:00
Geoff Levand 7a4eb7fd50 USB: PS3: USB system-bus rework
USB HCD glue updates to reflect the new PS3 unifed device support.
 - Fixed remove() routine.
 - Added shutdown() routine.
 - Added request_mem_region() call.
 - Fixed MODULE_ALIAS().
 - Made a proper fix for the hack done to support muti-platform in commit
   48fda45120.

Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
Cc: Paul Mackerras <paulus@samba.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:30 -07:00
Alan Stern 59c2afa072 USB: option: fix usage of urb->status abuse
Might fix bug 8561

On Mon, 4 Jun 2007, Paulo Pereira wrote:

> The patch that you send is not resolving the problem... :(
> I stil have Kernel panic after 45/60 min of work with Ktorrent/Amule...
>
> The Drump is:
>
> Call Trace:
> [<c055fb36>] usb_hcd_submit+0xb1/0x763
> [<f9276488>] ipt_do_table+0x2c7/0x2ef [ip_tables]
> [<f929a6d7>] nf_ct_deliver_cached_events+0x41/0x96 [nf_conntrak]
> [<f9288254>] ipv4_confirm+0x36/0c3b [nf_conntrack_ipv4]
> [<c05ce7c2>] tcp_v4_rcv+0x827/0x899
> [<c05afcc0>] nf_hook_slow+0x4d/0xb5
> [<c042826f>] irq_enter+0x19/0x23
> [<c042826f>] irq_enter+0x19/0x23
> [<c040794c>] do_IRQ+0xbd/0xd1
> [<f90893c9>] option_write+0xa7/0xef [option]

Okay, from this it looks like there's a problem in the option.c serial
driver.  Glancing at the code, it's obvious why: The thing totally
abuses the USB API.

Try applying this patch; it should help.

From: Alan Stern <stern@rowland.harvard.edu>
Cc: Paulo Pereira <pfmp.404@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:30 -07:00
Li Yang 4365831dad USB: fsl_usb2_udc: Get max ep number from DCCPARAMS register
Currently the driver is expecting max ep number in platform
data which isn't passing this information.  This patch fix
the problem by reading it from DCCPARAMS(Device Controller
Capability Parameters) register.  The change also need some
reordering of the probe code.

Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:30 -07:00
Li Yang 37b5453dd4 USB: fsl_usb2_udc: replace deprecated irq flag
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:30 -07:00
Alan Stern b41a60eca8 USB: add power/persist device attribute
This patch (as920) adds an extra level of protection to the
USB-Persist facility.  Now it will apply by default only to hubs; for
all other devices the user must enable it explicitly by setting the
power/persist device attribute.

The disconnect_all_children() routine in hub.c has been removed and
its code placed inline.  This is the way it was originally as part of
hub_pre_reset(); the revised usage in hub_reset_resume() is
sufficiently different that the code can no longer be shared.
Likewise, mark_children_for_reset() is now inline as part of
hub_reset_resume().  The end result looks much cleaner than before.

The sysfs interface is updated to add the new attribute file, and
there are corresponding documentation updates.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:30 -07:00
Alan Stern 54515fe528 USB: unify reset_resume and normal resume
This patch (as919) unifies the code paths used for normal resume and
for reset-resume.  Earlier I had failed to note a section in the USB
spec which requires the host to resume a suspended port before
resetting it if the attached device is enabled for remote wakeup.
Since the port has to be resumed anyway, we might as well reuse the
existing code.

The main changes are:

	usb_reset_suspended_device() is eliminated.

	usb_root_hub_lost_power() is moved down next to the
	hub_reset_resume() routine, to which it is logically
	related.

	finish_port_resume() does a port reset() if the device's
	reset_resume flag is set.

	usb_port_resume() doesn't check whether the port is initially
	enabled if this is a USB-Persist sort of resume.

	Code to perform the port reset is added to the resume pathway
	for the non-CONFIG_USB_SUSPEND case.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:30 -07:00
Alan Stern f07600cf9e USB: add reset_resume method
This patch (as918) introduces a new USB driver method: reset_resume.
It is called when a device needs to be reset as part of a resume
procedure (whether because of a device quirk or because of the
USB-Persist facility), thereby taking over a role formerly assigned to
the post_reset method.  As a consequence, post_reset no longer needs
an argument indicating whether it is being called as part of a
reset-resume.  This separation of functions makes the code clearer.

In addition, the pre_reset and post_reset method return types are
changed; they now must return an error code.  The return value is
unused at present, but at some later time we may unbind drivers and
re-probe if they encounter an error during reset handling.

The existing pre_reset and post_reset methods in the usbhid,
usb-storage, and hub drivers are updated to match the new
requirements.  For usbhid the post_reset routine is also used for
reset_resume (duplicate method pointers); for the other drivers a new
reset_resume routine is added.  The change to hub.c looks bigger than
it really is, because mark_children_for_reset_resume() gets moved down
next to the new hub_reset_resume() routine.

A minor change to usb-storage makes the usb_stor_report_bus_reset()
routine acquire the host lock instead of requiring the caller to hold
it already.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
CC: Matthew Dharm <mdharm-usb@one-eyed-alien.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:30 -07:00
Alan Stern 624d6c0732 USB: remove excess code from hub.c
This patch (as917) removes a now-unnecessary level of subroutine
nesting from hub.c.  Since usb_port_suspend() does nothing but call
hub_port_suspend(), and usb_port_resume() does nothing but call
hub_port_resume(), there's no reason to keep the routines separate.

Also included in the patch are a few cosmetic changes involving
whitespace and use of braces.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:29 -07:00
Alan Stern 686314cfbd USB: separate root and non-root suspend/resume
This patch (as916) completes the separation of code paths for suspend
and resume of root hubs as opposed to non-root devices.  Root hubs
will be power-managed through their bus_suspend and bus_resume
methods, whereas normal devices will use usb_port_suspend() and
usb_port_resume().

Changes to the hcd_bus_{suspend,resume} routines mostly represent
motion of code that was already present elsewhere.  They include:

	Adding debugging log messages,

	Setting the device state appropriately, and

	Adding a resume recovery time delay.

Changes to the port-suspend and port-resume routines in hub.c include:

	Removal of checks for root devices (since they will never
	be triggered), and

	Removal of checks for NULL or invalid device pointers (these
	were left over from earlier kernel versions and aren't needed
	at all).

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:29 -07:00
Alan Stern 4956eccdd6 USB: remove __usb_port_suspend
This patch (as915b) combines the public routine usb_port_suspend() and
the private routine __usb_port_suspend() into a single function.

By removing the explicit mention of otg_port in the call to
__usb_port_suspend(), we prevent a possible error in which the system
tries to perform HNP on the wrong port when a non-targeted device is
plugged into a non-OTG port.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:29 -07:00
Michael Hanselmann d576bb9f27 USB: Fix NEC OHCI chip silicon bug
This patch fixes a silicon bug in some NEC OHCI chips. The bug appears
at random times and is very, very difficult to reproduce. Without the
following patch, Linux would shut the chip and its associated devices
down. In Apple PowerBooks this leads to an unusable keyboard and mouse
(SSH still working). The idea of restarting the chip is taken from
public Darwin code.

Signed-off-by: Michael Hanselmann <linux-kernel@hansmi.ch>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:29 -07:00
Tony Lindgren 020363384a USB: Disable file_storage USB_CONFIG_ATT_WAKEUP
Disable file_storage USB_CONFIG_ATT_WAKEUP as it requires
user interaction during Chapter 9 tests.

Signed-off-by: Tony Lindgren <tony@atomide.com
Signed-off-by: Felipe Balbi <felipe.lima@indt.org.br>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Acked-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:29 -07:00
Vladimir Barinov d23a13779f USB: EHCI: Safe endianness for transfer buffers after reset in case of HUB with TT
This patch fixes the endianness select for transfer buffers in EHCI
controllers that have Transaction Translator built in the hub.  Also I
cleaned it up to make rid of magic numbers.

Signed-off-by: Vladimir Barinov <vbarinov@ru.mvista.com>
Cc: <david-b@pacbell.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:29 -07:00
Al Borchers 5fea2a4dab USB: digi_acceleport further buffer clean up
Some further cleanup after Oliver's patch to update the tty
buffering.  The input buffer is not used at all anymore, so
I removed it.

Signed-off-by: Al Borchers <alborchers@steinerpoint.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:29 -07:00
Oliver Neukum 08a2b3b610 USB: whiteheat driver update
this is an update of the whiteheat driver. It fixes:

- switch from spinlocks to mutexes to prevent sleeping with a spinlock held
- locking to stop races with disconnect
- error handling for commands that time out

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:28 -07:00
Oliver Neukum 403dfb58c3 USB: usb-skeleton: usb anchor to implement flush
This patch set introduces usb_anchor and uses it to implement all modern
APIs in the skeleton driver.

- proper error reporting in the skeleton driver
- implementation of flush()

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:34:28 -07:00
Oliver Neukum 51a2f077c4 USB: introduce usb_anchor
- introduction of usb_anchor and its methods

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:29:51 -07:00
Vikram Pandita ffcdc18d64 USB Core: hub.c: prevent re-enumeration on HNP
Patch is to prevent the OTG host of doing 3 times enumeration of
device when the Host suspends for HNP.  The error code used in
this case is ENOTSUPP.

Signed-off-by: Vikram Pandita <vikram.pandita@ti.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Acked-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:29:51 -07:00
David Brownell b29dbbd811 USB: usb serial gadget, sparse fixes
Fix a few serial gadget issues reported by the latest "sparse":
some functions should have been defined as static, not just
declared that way.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:29:51 -07:00
t.sefzick 715f9527c1 USB: flow control fix for pl2303
in order to be able to switch back to 'flow-control none'
after having activated 'flow-control rts/cts', I made
a small change to 'pl2303.c'.


Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:29:51 -07:00
Oliver Neukum 1abdeeb1d5 USB: generic usb serial to new buffering scheme
the generic driver also had its own buffering.

Signed-off-by: Oliver Neukum <oneukum@suse.de_
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:29:51 -07:00
Oliver Neukum 39892da44b USB: Digi AccelePort adapted to new tty buffering
this fixes the flushing trouble due to its own buffering for this driver.


Signed-off-by: Oliver Neukum <oneukum@suse.de>
Cc: Al Borchers <alborchers@steinerpoint.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:29:51 -07:00
Oliver Neukum b308e74d9c USB: visor driver adapted to new tty buffering
the new tty buffering code allows usb drivers to stop private buffering.
In fact we must do so to allow flushing to work correctly. This does so
for the visor driver.


Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:29:51 -07:00
David Brownell a5262dcfda USB: export <linux/usb_gadgetfs> as <linux/usb/gadgetfs.h>
Make sure gadgetfs userspace interface is properly exported:

 - Move <linux/usb_gadgetfs.h> to <linux/usb/gadgetfs.h>;
 - Export it using Kbuild;
 - Add an #include guard;
 - Correct some internal documentation;
 - Update struct layout so it's the same on 32/64 bit kernels.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:29:50 -07:00
David Rientjes 8234509c39 USB: use function attribute __maybe_unused
Substitute USB instances of __attribute__ ((unused)) functions with the
newly introduced __maybe_unused.

Signed-off-by: David Rientjes <rientjes@google.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:29:50 -07:00
Li Yang ba02978a48 USB: ehci_fsl update for MPC831x support
For MPC831x support, change the ehci-fsl driver to preserve
bits set in platform code.  Add a common CONFIG_USB_EHCI_FSL
to indicate presence of Freescale EHCI SOC.  Add FSL_USB2_DR_OTG
operating mode support, thus both host and device can work for the
mini-ab receptacle.  Note: this doesn't enable OTG protocol
support.

Signed-off-by: Li Yang <leoli@freescale.com>
Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:29:50 -07:00
Stefan Roese 4d68c0be69 USB: Set CONFIG_USB_EHCI_BIG_ENDIAN_MMIO/_DESC in usb/host/Kconfig
Now select the big-endian configuration options
CONFIG_USB_EHCI_BIG_ENDIAN_MMIO and CONFIG_USB_EHCI_BIG_ENDIAN_DESC in
the usb host Kconfig file and not in the platform Kconfig files.

Signed-off-by: Stefan Roese <sr@denx.de>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:29:50 -07:00
Stefan Roese fc65a15f1f USB: EHCI big endian data structures support (for 440EPx)
This patch adds support for the AMCC 440EPx EHCI controller whose
in-memory data structures and the registers are represented in big-
endian format.

Signed-off-by: Stefan Roese <sr@denx.de>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:29:50 -07:00
Stepan Moskovchenko 97cd49ebf7 USB: ftdi_sio.c: Allow setting latency timer on FT232RL
The new FT232RL allows setting and getting the value of the latency
timer, like on the FT232BM. However, the driver will not create the
sysfs entries for the RL without this one-line patch. 

I have tested it on two systems with successful results.


From: Stepan Moskovchenko <stevenm86@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:29:50 -07:00
Alan Stern 20dfdad74a USB: rework C++-style comments
This patch (as911) replaces some C++-style commented-out debugging
lines in driver.c with a new "verbose debugging" macro.  It makes the
code look cleaner, and it's easier to turn the debugging on or off.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:29:49 -07:00
Alan Stern d4ead16f50 USB: prevent char device open/deregister race
This patch (as908) adds central protection in usbcore for the
prototypical race between opening and unregistering a char device.
The spinlock used to protect the minor-numbers array is replaced with
an rwsem, which can remain locked across a call to a driver's open()
method.  This guarantees that open() and deregister() will be mutually
exclusive.

The private locks currently used in several individual drivers for
this purpose are no longer necessary, and the patch removes them.  The
following USB drivers are affected: usblcd, idmouse, auerswald,
legousbtower, sisusbvga/sisusb, ldusb, adutux, iowarrior, and
usb-skeleton.

As a side effect of this change, usb_deregister_dev() must not be
called while holding a lock that is acquired by open().  Unfortunately
a number of drivers do this, but luckily the solution is simple: call
usb_deregister_dev() before acquiring the lock.

In addition to these changes (and their consequent code
simplifications), the patch fixes a use-after-free bug in adutux and a
race between open() and release() in iowarrior.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:29:48 -07:00
Mark Lord 55e5fdfa54 USB: hub.c loops forever on resume from ram due to bluetooth
Okay, found it.  The root cause here was a missing CONFIG_USB_SUSPEND=y,
which means the hci_usb device never got marked as USB_STATE_SUSPENDED,
which then caused the loop to go on forever.

The system works fine now with CONFIG_USB_SUSPEND=y in the .config.

Here's the patch to prevent future lockups for this or other causes.
I no longer need it, but it does still seem a good idea.

Signed-off-by: Mark Lord <mlord@pobox.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:29:48 -07:00
David Brownell 7f9985c2e4 USB: usb gadget, dead config cleanup
Remove some dead CONFIG_ symbols, and document the status of a few others.
The "gadget_chips.h" references are by and large to drivers which exist
but haven't yet been submitted for merging to the main 2.6 tree.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:29:48 -07:00
Dave Platt 45b844df5a USB: RTS/CTS handshaking support, DTR fixes for MCT U232 serial adapter
Improvements and fixes to the MCT U232 USB/serial interface driver.
Implement RTS/CTS hardware flow control.  Implement HUPCL.  Bring
handling of DTR and RTS into conformance with other Linux serial
port drivers - assert both signals when opening device, even if
"crtscts" is not currently selected.

Signed-off-by: Dave Platt <dplatt@radagast.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:29:48 -07:00
Arjan van de Ven 01cd081920 USB: Patch to align the various USB timers to fire at the same time
This patch modifies the USB regular 250ms timer to be "perfectly aligned" to
the second and quarters thereof. This change is there to make sure that if
you have multiple USB ports, the timers for all these ports will fire at the
same time rather than all spread out. All spread out wakes the CPU up from
power saving idle a lot more than needed...


Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:29:48 -07:00
Martin K. Petersen fc4cbd755b USB: io_ti: Digi EdgePort update for new devices
This patch adds support for the most recent Digi EdgePort USB serial
devices.

Signed-off-by: Martin K. Petersen <mkp@mkp.net>
Signed-off-by: Mike Swift <mikes@digi.com>
Signed-off-by: Jeremy McBane <jmcbane@digi.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:29:48 -07:00
Alan Stern dd4dd19e8d USB: Make device reset stop retrying after disconnect
This patch (as898) changes the port reset code in the hub driver.  If
a connect change occurs, it is reported the same way as a disconnect
(which of course is what it really is).

It also changes usb_reset_device(), to prevent the routine from futilely
retrying the reset after a disconnect has occurred.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:29:47 -07:00
Alan Stern 3c519b846c USB: EHCI: fix handover for designated full-speed ports
This patch (as895) fixes up a loose end in the port-handover code for
the USB-Persist facility.  A special case occurs when a high-speed
device is attached to a port which the user has designated to run at
full-speed only; the port must be disabled before the handover can
take place.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:29:47 -07:00
Alan Stern 6bc6cff52e USB: add RESET_RESUME device quirk
This patch (as888) adds a new USB device quirk for devices which are
unable to resume correctly.  By using the new code added for the
USB-persist facility, it is a simple matter to reset these devices
instead of resuming them.  To get things kicked off, a quirk entry is
added for the Philips PSC805.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:29:47 -07:00
Alan Stern 383975d765 USB: EHCI, OHCI: handover changes
This patch (as887) changes the way ehci-hcd and ohci-hcd handle a loss
of VBUS power during suspend.  In order for the USB-persist facility
to work correctly, it is necessary for low- and full-speed devices
attached to a high-speed port to be handed back to the companion
controller during resume processing.

This entails three changes: adding code to ehci-hcd to perform the
handover, removing code from ohci-hcd to turn off ports during
root-hub reinit, and adding code to ohci-hcd to turn on ports during
PCI controller resume.  (Other bus glue resume methods for platforms
supporting high-speed controllers would need a similar change, if any
existed.)

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:29:47 -07:00
Alan Stern 0458d5b4c9 USB: add USB-Persist facility
This patch (as886) adds the controversial USB-persist facility,
allowing USB devices to persist across a power loss during system
suspend.

The facility is controlled by a new Kconfig option (with appropriate
warnings about the potential dangers); when the option is off the
behavior will remain the same as it is now.  But when the option is
on, people will be able to use suspend-to-disk and keep their USB
filesystems intact -- something particularly valuable for small
machines where the root filesystem is on a USB device!

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:29:47 -07:00
Pete Zaitcev ce7cd137fc usbmon: Add class for binary interface
Add a class which allows for an easier integration with udev.

This code was originally written by Paolo Abeni, and arrived to my tree
as a part of big patch to add binary API on December 18. As I understand,
Paolo always meant the class to be a part of the whole thing. This is his
udev rule to go along with the patch:

KERNEL=="usbmon[0-9]*", NAME="usbmon%n", MODE="0440",OWNER="root",GROUP="bin"

Signed-off-by: Pete Zaitcev <zaitcev@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:29:47 -07:00
Kees Lemmens 49cdee0ed0 USB: oti6858 usb-serial driver (in Nokia CA-42 cable)
Last week I've been searching for a driver for the CA-42 cable (see usb
 below) that fitted my kernel 2.6.20. I only found an abandoned version for a
 driver on your website that indeed worked on 2.6.18 but wouldn't even
 compile with a more recent 2.6.20 kernel.

I fiddled 2 evenings with the kernel code and have patched it up now to work
with the modifications in the 2.6.20 kernel. The patch is attached hereafter
and it works fine (at least for me :-) ).

Bus 2 Device 13: ID 0ea0:6858 Ours Technology, Inc.

I had to fiddle a little with the settings in .gnokiirc but that also
 occurred with the older 2.6.18 kernel. Nevertheless, on one system with this
 cable and my Nokia 6070 I had best results with :

model = 6510
connection = dku5

while on an other system with the same kernel, cable and phone it only worked
with :

model = AT
connection = serial
serial_write_usleep = 1


From: Kees Lemmens <C.W.J.Lemmens@ewi.tudelft.nl>
Cc: <pawel.kot@gmail.com>
Cc: <bozo@andrews.hu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:29:47 -07:00
David Brownell 9c033e810e USB: ehci refcounts work on ppc7448
Remove atomic operations on the reference counter for EHCI queue heads.
On various platforms (including ppc7448), atomic operations are unusable
with dma-coherent memory.

Signed-off-by: Steven J. Hill <sjhill1@rockwellcollins.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:29:47 -07:00
Jan Engelhardt 04d06ad0f1 USB: Use menuconfig objects
Make a "menuconfig" out of the Kconfig objects "menu, ..., endmenu", so that
the user can disable all the options in that menu at once instead of having to
disable each option separately.

Signed-off-by: Jan Engelhardt <jengelh@gmx.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:29:46 -07:00
Alan Stern e805485422 USB: make hub driver's release more robust
This revised patch (as893c) improves the method used by the hub driver
to release its private data structure.  The current code is non-robust,
relying on a memory region not getting reused by another driver after
it has been freed.  The patch adds a reference count to the structure,
resolving the question of when to release it.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:29:46 -07:00
Alan Stern 06b84e8adc USB: remove "locktree" routine from the hub driver
This patch (as892) removes the "locktree" routine from the hub driver.
It currently is used in only one place, by a single kernel thread;
hence it isn't doing any good.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:29:46 -07:00
Alan Stern f3fd77cd2f USB: remove references to dev.power.power_state
This revised patch (as891b) removes two unnecessary references to
intf->dev.power.power_state from usb-storage, and replaces a reference
to root_hub->dev.power.power_state with a check of hcd->state.  This
is in preparation for the removal of dev.power.power_state, which is
already deprecated.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:29:46 -07:00
Alan Stern 8adb478678 USB: don't unsuspend for a new connection
This patch (as889) prevents the hub driver from trying to resume a
port when there is a new connection.  For one thing, the resume is not
needed -- the upcoming port reset will clear the suspend feature
automatically.  For another, on some systems the resume fails and
causes problems.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:29:46 -07:00
Alan Stern b6f6436da0 USB: move bus_suspend and bus_resume method calls
This patch (as885) moves the root-hub bus_suspend() and bus_resume()
method calls from the hub driver's suspend and resume methods into the
usb_generic driver methods, where they make just as much sense.

Their old locations were not fully correct.  For example, in a kernel
compiled without CONFIG_USB_SUSPEND, if one were to do:

	echo -n 1-0:1.0 >/sys/bus/usb/drivers/hub/unbind

to unbind the hub driver from a root hub, there would then be no way
to suspend that root hub.  Attempts to put the system to sleep would
fail; the USB controller driver would refuse to suspend because the
root hub was still active.

The patch also makes a very slight change in the way devices with no
driver are handled during suspend.  Rather than doing a standard USB
port-suspend directly, now the suspend routine in usb_generic is
called.  In practice this should never affect anyone.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:29:46 -07:00
Alan Stern 4d461095ef USB: Implement PM FREEZE and PRETHAW
This patch (as884) finally implements the time-saving semantics
possible with the Power Management FREEZE and PRETHAW events.  Their
proper handling requires only that devices be quiesced, with
interrupts and DMA turned off; non-root USB devices don't actually
need to be put in a suspended state.  The patch checks and avoids
doing the suspend call when possible.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:29:46 -07:00
Alan Stern 784a6e1cc4 USB: interface PM state
This patch (as880) strives to keep the PM core's idea of a USB
interface's power state in synch with usbcore's own idea.  In the end
this doesn't really matter, but it's better to be consistent.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:29:46 -07:00
Yoshihiro Shimoda f6ace2c99a USB: r8a66597-hcd: fix NULL access
This patch fixes the problem that accesses NULL pointer
when disconnected a cable while play music with usb-speaker.

Signed-off-by: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:29:45 -07:00
Yoshihiro Shimoda 5d3043586d USB: r8a66597-hcd: host controller driver for R8A66597
I would like to submit Renesas R8A66597 USB HCD driver.

R8A66597 is Renesas USB 2.0 host and peripheral combined
controller device originally designed for embedded products.
As a limitation of this device, it does not support externel
hub more than 2 tier, and cannot communicate with a USB
device more than 10. Then this device is not compatible with
EHCI and/or OHCI, I wrote driver support patch based on
sl811 code.

This driver has the following unique specifications:
- Implement transfer timeout to share one pipe with plural endpoint.
- Detach detection of a USB device connected to externel hub.

The driver has been tested external hub, usb-hdd, usb-cdrom,
usb-speaker, mice, keyboard, and usbtest driver.

Signed-off-by : Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:29:45 -07:00
Yoshihiro Shimoda 15a1d5c927 USB: m66592-udc: fix use old interrupt flags
This patch fixes the problem that used SA_* flags.

Signed-off-by: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:29:45 -07:00
Yoshihiro Shimoda 4cf2503c68 USB: m66592-udc: peripheral controller driver for M66592
I would like to submit Renesas M66592 udc driver.

The M66592 is Renesas USB 2.0 peripheral controller.
This controller supports USB high-speed.

The driver has been tested Gadget Zero, Ethernet Gadget,
File-backed Storage Gadget, and passed usbtest script.

Signed-off-by : Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:29:45 -07:00
Lucy McCoy 0ca1268e10 USB Serial Keyspan: add support for USA-49WG & USA-28XG
Add support for Keyspan adapters: USA-49WG and USA-28XG

Signed-off-by: Lucy P. McCoy <lucy@keyspan.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:29:45 -07:00
Simon Arlott 87e71b473e USB: cxacru: Cleanup sysfs attribute code
This changes the format of unknown status values to be less verbose and
uses an array instead of several different snprintf calls. Since only
enum values are assigned to it, poll_state is changed from int to enum.
Use abs() for dB values instead of two almost identical return lines.

Signed-off-by: Simon Arlott <simon@fire.lp0.eu>
Acked-by: Duncan Sands <duncan.sands@math.u-psud.fr>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:29:45 -07:00
Stefan Roese 6dbd682b7c USB: EHCI support for big-endian descriptors
This patch implements supports for EHCI controllers whose in-memory
data structures are represented in big-endian format. This is needed
(unfortunately) for the AMCC PPC440EPx SoC EHCI controller; the EHCI
spec doesn't specify little-endian format, although that's what most
other implementations use.

The guts of the patch are to introduce the hc32 type and change all
references from le32 to hc32.  All access routines are converted from
cpu_to_le32(...) to cpu_to_hc32(ehci, ...) and similar for the other
"direction".  (This is the same approach used with OHCI.)

David fixed:
	Whitespace fixes; refresh against ehci cpufreq patch; move glue
	for that PPC driver to the patch adding it; fix free symbol
	capture bugs in modified "constant" macros; and make "hc32" etc
	be "le32" unless we really need the BE options, so "sparse" can
	do some real good.

Signed-off-by: Stefan Roese <sr@denx.de>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:29:45 -07:00
Stuart_Hayes@Dell.com 196705c9bb USB: EHCI cpufreq fix
EHCI controllers that don't cache enough microframes can get MMF errors
when CPU frequency changes occur between the start and completion of
split interrupt transactions, due to delays in reading main memory
(caused by CPU cache snoop delays).

This patch adds a cpufreq notifier to the EHCI driver that will
inactivate split interrupt transactions during frequency transitions.
It was tested on Intel ICH7 and Serverworks/Broadcom HT1000 EHCI
controllers.

Signed-off-by: Stuart Hayes <stuart_hayes@dell.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:29:45 -07:00
Oliver Neukum ec22559e0b USB: suspend support for usb serial
this implements generic support for suspend/resume for usb serial.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:29:44 -07:00
Linus Torvalds 21ba0f88ae Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/pci-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/pci-2.6: (34 commits)
  PCI: Only build PCI syscalls on architectures that want them
  PCI: limit pci_get_bus_and_slot to domain 0
  PCI: hotplug: acpiphp: avoid acpiphp "cannot get bridge info" PCI hotplug failure
  PCI: hotplug: acpiphp: remove hot plug parameter write to PCI host bridge
  PCI: hotplug: acpiphp: fix slot poweroff problem on systems without _PS3
  PCI: hotplug: pciehp: wait for 1 second after power off slot
  PCI: pci_set_power_state(): check for PM capabilities earlier
  PCI: cpci_hotplug: Convert to use the kthread API
  PCI: add pci_try_set_mwi
  PCI: pcie: remove SPIN_LOCK_UNLOCKED
  PCI: ROUND_UP macro cleanup in drivers/pci
  PCI: remove pci_dac_dma_... APIs
  PCI: pci-x-pci-express-read-control-interfaces cleanups
  PCI: Fix typo in include/linux/pci.h
  PCI: pci_ids, remove double or more empty lines
  PCI: pci_ids, add atheros and 3com_2 vendors
  PCI: pci_ids, reorder some entries
  PCI: i386: traps, change VENDOR to DEVICE
  PCI: ATM: lanai, change VENDOR to DEVICE
  PCI: Change all drivers to use pci_device->revision
  ...
2007-07-12 13:40:57 -07:00
Rafael J. Wysocki 515c535762 PM: Remove prev_state from struct dev_pm_info
The prev_state member of struct dev_pm_info (defined in include/linux/pm.h) is
only used during a resume to check if the device's state before the suspend was
'off', in which case the device is not resumed.  However, in such cases the
decision whether or not to resume the device should be made on the driver level
and the resume callbacks from the device's bus and class should be executed
anyway (the may be needed for some things other than just powering on the
device).

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-11 16:09:02 -07:00
Randy Dunlap 694625c0b3 PCI: add pci_try_set_mwi
As suggested by Andrew, add pci_try_set_mwi(), which does not require
return-value checking.

- add pci_try_set_mwi() without __must_check
- make it return 0 on success, errno if the "try" failed or error
- review callers

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-11 16:02:11 -07:00
Auke Kok 44c10138fd PCI: Change all drivers to use pci_device->revision
Instead of all drivers reading pci config space to get the revision
ID, they can now use the pci_device->revision member.

This exposes some issues where drivers where reading a word or a dword
for the revision number, and adding useless error-handling around the
read. Some drivers even just read it for no purpose of all.

In devices where the revision ID is being copied over and used in what
appears to be the equivalent of hotpath, I have left the copy code
and the cached copy as not to influence the driver's performance.

Compile tested with make all{yes,mod}config on x86_64 and i386.

Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com>
Acked-by: Dave Jones <davej@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-11 16:02:10 -07:00
Yoann Padioleau 0da2f0f164 potential compiler error, irqfunc caller sites update
In 7d12e780e0 David Howells performed
this evolution:
 "IRQ: Maintain regs pointer globally rather than passing to IRQ handlers"

He correctly updated many of the function definitions that were using this
extra regs pointer parameter but forgot to update some caller sites of
those functions.  The reason the modifications was not properly done on all
drivers is that some drivers were rarely compiled because they are for
AMIGA, or that some code sites were inside #ifdefs where the option is not
set or inside #if 0.

Here is the semantic patch that found the occurences
and fixed the problem.

@ rule1 @
identifier fn;
identifier irq, dev_id;
typedef irqreturn_t;
@@

static irqreturn_t fn(int irq, void *dev_id)
{
   ...
}

@@
identifier rule1.fn;
expression E1, E2, E3;
@@

 fn(E1, E2
-   ,E3
   )

Signed-off-by: Yoann Padioleau <padator@wanadoo.fr>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jeff Garzik <jeff@garzik.org>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-07-06 10:23:43 -07:00
Luiz Fernando N. Capitulino d099321bdb USB: ftdio_sio: New IPlus device ID
Reported by Grzegorz Chimosz <gchimi@gmail.com>

Signed-off-by: Luiz Fernando N. Capitulino <lcapitulino@mandriva.com.br>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-06-25 23:38:06 -07:00
Alexander Gattin 46269db99c USB: add new device id to option driver
Cc: Matthias Urlichs <smurf@smurf.noris.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-06-25 23:38:06 -07:00
Oliver Neukum 74ac07e8b8 USB: fix race leading to use after free in io_edgeport
usb_unlink_urb() is asynchronous, therefore an URB's buffer may not
be freed without waiting for the completion handler. This patch switches
to usb_kill_urb(), which is synchronous.
Thanks to Alan for making me look at the remaining users of usb_unlink_urb()


Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Al Borchers <alborchers@steinerpoint.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-06-25 23:38:06 -07:00
Oliver Neukum 5afeb104e7 USB: usblcd doesn't limit memory consumption during write
usblcd currently has no way to limit memory consumption by fast writers.
This is a security problem, as it allows users with write access to this
device to drive the system into oom despite resource limits.
Here's the fix taken from the modern skeleton driver.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-06-25 23:38:06 -07:00
Oliver Neukum fc0f8fc9be USB: memory leak in iowarrior.c
this is a classical memory leak in the ioctl handler. The buffer is simply
never freed. This fixes it the obvious way.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-06-25 23:38:05 -07:00
Oliver Neukum 944dc184f6 USB: ti serial driver sleeps with spinlock held
you are submitting an URB with GFP_KERNEL holding a spinlock.
In this case the spinlock can be dropped earlier.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Cc: Al Borchers <alborchers@steinerpoint.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-06-25 23:38:05 -07:00
Oleg Nesterov 8cfbe7e60d USB: g_file_storage: call allow_signal()
New changes in the signal-handling code require compensating changes
in g_file_storage.  This patch (as913) by Oleg Nesterov makes the
code use allow_signal() instead of sigprocmask().

From: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-06-25 23:38:05 -07:00
Alan Stern 6fd75b1948 OHCI: Fix machine check in ohci_hub_status_data
This patch (as901) fixes an oversight in ohci-hcd.  The
hub_status_data routine must not try to access the controller's
memory-mapped registers if the controller is in a low-power state;
such attempts will cause a crash on some architectures (such as PPC).

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-06-08 16:24:31 -07:00
Alan Stern 615ae11b3b USB: Fix up bogus bInterval values in endpoint descriptors
This patch (as904) adds code to check for endpoint descriptor bInterval
values outside the legal limits.  Illegal values are set to 32 ms, which
seems like a reasonable default.

This fixes Bugzilla #8432.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-06-08 16:24:31 -07:00
Simon Arlott fd209e35b7 USB: cxacru: ignore error trying to start ADSL in atm_start
The sysfs adsl_status attribute ignores (aside from returning -EIO to the
user) any error sending a START/STOP command to the device and there is at
least one firmware which never sends a response but appears to work
regardless.  Therefore atm_start should also continue if an error is received
so that such firmware is usable.

The official Conexant driver doesn't expect a reply either but this is for
another device (E2 router) and a commonly used firmware does respond.

Also, there is no point in changing -ECONNRESET to -ETIMEDOUT since nothing
ever checks for either of these values.

Signed-off-by: Simon Arlott <simon@fire.lp0.eu>
Cc: Duncan Sands <duncan.sands@math.u-psud.fr>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-06-08 16:24:31 -07:00
Simon Arlott da1f82b554 USB: cxacru: create sysfs attributes in atm_start instead of bind
Since usbatm doesn't set the usb_interface driver data until after calling
bind and heavy_init, it would be NULL when the sysfs attributes are read.
Reading the MAC address from atm_dev before atm_dev exists would have been
be possible too.

Calling create_device_file in atm_start will avoid this problem, and the
data is useless until the first status poll runs.  However, it must be
ready before a status poll does a printk on line status change otherwise
userspace could react before the files exist.

For completeness I've moved remove_device_file to atm_stop so it's not
called in unbind when it's not needed.  There's no point starting ADSL if
atm_start could still fail either.

Signed-off-by: Simon Arlott <simon@fire.lp0.eu>
Cc: Duncan Sands <duncan.sands@math.u-psud.fr>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-06-08 16:24:31 -07:00
Ben Collins 67fa10627e USB: UNUSUAL_DEV: Sync up some reported devices from Ubuntu
UNUSUAL_DEV: Sync up some reported devices from Ubuntu

Various unusual dev entries accumulated from Ubuntu bug reports.

Signed-off-by: Ben Collins <bcollins@ubuntu.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Phil Dibowitz <phil@ipom.com>
2007-06-08 16:24:30 -07:00
David Brownell 01ee7d7032 USB: usb gadgets avoid le{16,32}_to_cpup()
It turns out that le16_to_cpup() and le32_to_cpup() aren't always safe
to call with pointers into packed structures, since those are inlined
functions and GCC may lose the "packed" attribute.  So those references
can become unaligned kernel accesses, which are evil on some hardware.

This patch updates uses of those routines in the gadget stack.  The
references into packed structures can just use leXX_to_cpu(*x), which
in most cases is more natural.  Some other uses in RNDIS, mostly in
debug code, were wrong in the first place; those use get_unaligned().

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-06-08 16:24:30 -07:00
Pete Zaitcev 97cb95d1c4 usblp: Don't let suspend to kill ->used
Suspend destroys refcounting for open/release.

Signed-off-by: Pete Zaitcev <zaitcev@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-06-08 16:24:29 -07:00
Kay Sievers dda034bcb5 USB: set default y for CONFIG_USB_DEVICE_CLASS
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Cc: bert hubert <bert.hubert@netherlabs.nl>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-06-08 16:24:29 -07:00