]> pilppa.com Git - linux-2.6-omap-h63xx.git/log
linux-2.6-omap-h63xx.git
16 years agowusb: make ep0_reinit available for modules
Inaky Perez-Gonzalez [Tue, 8 Apr 2008 20:24:46 +0000 (13:24 -0700)]
wusb: make ep0_reinit available for modules

We need to be able to call ep0_reinit() [renamed to usb_ep0_reinit()]
from the WUSB security code. The reason is that when we authenticate
the device, it's address changes (from having bit 7 set to having it
cleared). Thus, we need to signal the USB stack to reinitialize EP0,
so the status with the previous address kept at the HCD layer is
cleared and properly reinitialized.

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agowusb: devices dont use a set address
Inaky Perez-Gonzalez [Tue, 8 Apr 2008 20:24:46 +0000 (13:24 -0700)]
wusb: devices dont use a set address

A WUSB device gets his address during the connection phase; later on,
during the authenthication phase (driven from user space) we assign
the final address. So we need to skip in hub_port_init() the actual
setting of the address for WUSB devices.

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agowusb: teach choose_address() about wireless devices
Inaky Perez-Gonzalez [Tue, 8 Apr 2008 20:24:46 +0000 (13:24 -0700)]
wusb: teach choose_address() about wireless devices

Modify choose_address() so it knows about our special scheme of
addressing WUSB devices (1:1 w/ port number).

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agowusb: add link wusb-usb device
Inaky Perez-Gonzalez [Tue, 8 Apr 2008 20:24:46 +0000 (13:24 -0700)]
wusb: add link wusb-usb device

We need to tie the WUSB and USB devices; the USB stack doesn't need to
know the details about the WUSB device, but needs to have a link to
it. This is needed so that the notify call back for Remove Device can
tie both and undo the device setup (sysfs files).

We connect the devices together at the Add Device notifier callback
(the wusb_dev references the usb_dev and stores it, the usb_dev
references the wusb_dev and stores it); then we do create the WUSB
sysfs files at the usb_dev sysfs directory. At Remove Device, we undo
that (thus we need the usb_dev reference).

Cross reference to functions in the WUSB substack:
wusb_dev_{add,rm}_ncb().

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agowusb: add authenticathed bit to usb_dev
Inaky Perez-Gonzalez [Tue, 8 Apr 2008 20:24:46 +0000 (13:24 -0700)]
wusb: add authenticathed bit to usb_dev

This bit indicates the system that the WUSB device has been crypto
authenticated and thus can operate as normal.

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: remove unnecessary type casting of urb->context
Ming Lei [Sun, 24 Feb 2008 10:41:47 +0000 (18:41 +0800)]
USB: remove unnecessary type casting of urb->context

urb->context code cleanup

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agousb serial: more fixes and groundwork for tty changes
Alan Cox [Tue, 8 Apr 2008 16:16:06 +0000 (17:16 +0100)]
usb serial: more fixes and groundwork for tty changes

 - If a termios change fails due to lack of memory we should copy the
   old settings back over as the device has not changed
 - Note various locking problems
 - kl5kusb105 had various remaining tty flag handling problems
 - Make safe_serial use tty_insert_flip_string not open coded loops
 - set termios speed properly in usb_serial

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: replace remaining __FUNCTION__ occurrences
Harvey Harrison [Tue, 4 Mar 2008 00:08:34 +0000 (16:08 -0800)]
USB: replace remaining __FUNCTION__ occurrences

__FUNCTION__ is gcc-specific, use __func__

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: usbfs: export the URB_NO_INTERRUPT flag to userspace
Alan Stern [Thu, 17 Apr 2008 14:18:11 +0000 (10:18 -0400)]
USB: usbfs: export the URB_NO_INTERRUPT flag to userspace

This patch (as1079) cleans up the way URB_* flags are exported in
usbfs.

The URB_NO_INTERRUPT flag is now exported (this is the
only behavioral change).

USBDEVFS_URB_* macros are added for URB_NO_FSBR,
URB_ZERO_PACKET, and URB_NO_INTERRUPT, making explicit the
fact that the kernel accepts them.

The flag matching takes into account that the URB_* values
may change as the kernel evolves, whereas the USBDEVFS_URB_*
values must remain fixed since they are a user API.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: fix compile problems in ehci-hcd
Alan Stern [Fri, 18 Apr 2008 15:11:26 +0000 (11:11 -0400)]
USB: fix compile problems in ehci-hcd

This patch (as1072) fixes some recently-introduced compile problems
that show up in ehci-hcd when CONFIG_PM is turned off.

PORT_WAKE_BITS needs to be defined always.

ehci_port_power() is called during initialization by all the
EHCI variants other than the PCI version, in which it is
"defined but not used".  So add a call to it.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: ehci: qh_completions cleanup and bugfix
David Brownell [Sat, 12 Apr 2008 15:32:05 +0000 (08:32 -0700)]
USB: ehci: qh_completions cleanup and bugfix

Simplify processing of completed qtds, and correct handling of short
reads, by removing two state variables:

 - "qtd_status" wasn't needed.  The current URB's status is either
   OK (-EINPROGRESS) or some fault status.  Once a fault appears,
   the queue halts and any later QTDs are immediately removed, so
   no temporary status is needed.  (Or for typical short reads,
   it's not treated as a fault, so no queue halt is needed.)

 - "do_status" was erroneous.  Because of how the queue is set up,
   short control reads can (and should!) be treated like full size
   reads, and cleaned up the usual way.  The status stage will be
   executed transparently, and usbcore handles the choice of whether
   to report this status as unexected.

The "do_status" problem caused a rather perplexing timing-dependent
problem with usbtest case 10.  Sometimes it would make the controller
skip a dozen transactions while (wrongly) trying to clean up after a
short transfer.  Fortunately, removing a dcache contention issue made
this become trivial to reproduce (on one test rig), so enough clues
finally presented themselves ... I think this has been around for a
very long time, but was worsened by recent urb->status changes.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: cdc-acm: signedness fix
David Brownell [Sun, 13 Apr 2008 21:00:44 +0000 (14:00 -0700)]
USB: cdc-acm: signedness fix

Fix bogus assignment of "unsigned char *" to "char *":  preserve
unsignedness.  These values are used directly as descriptor lengths
when iterating through the buffer, so this *could* cause oddness
that potentially includes oopsing.  (IMO not likely, except as
part of a malicious device...)

Fix the bogus warning in CDC ACM which highlighted this problem
(by showing a negative descriptor type).  It uses the undesirable
legacy err() for something that's not even an error; switch to
use dev_dbg, and show descriptor types in hex notation to match
the convention for such codes.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Acked-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: add documentation about callbacks
Oliver Neukum [Wed, 16 Apr 2008 13:46:37 +0000 (15:46 +0200)]
USB: add documentation about callbacks

Add Documentation about callbacks in USB.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: don't explicitly reenable root-hub status interrupts
Alan Stern [Mon, 14 Apr 2008 16:17:56 +0000 (12:17 -0400)]
USB: don't explicitly reenable root-hub status interrupts

This patch (as1069b) changes the way OHCI root-hub status-change
interrupts are enabled.  Currently a special HCD method,
hub_irq_enable(), is called when the hub driver is finished using a
root hub.  This approach turns out to be subject to races, resulting
in unnecessary polling.

The patch does away with the method entirely.  Instead, the driver
automatically enables the RHSC interrupt when no more status changes
are present.  This scheme is safe with controllers using
level-triggered semantics for their interrupt flags.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: OHCI: turn off RD when remote wakeup is disabled
Alan Stern [Mon, 14 Apr 2008 16:17:49 +0000 (12:17 -0400)]
USB: OHCI: turn off RD when remote wakeup is disabled

This patch (as1068b) disables the RD interrupt flag when an OHCI root
hub is suspended with remote wakeup disabled.  Although the spec
clearly states that this flag permits the controller to issue an
interrupt when a resume request from downstream is detected and not
when a local status change occurs, some controllers mistakenly use it
for both types of event.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: HCDs use the do_remote_wakeup flag
Alan Stern [Mon, 14 Apr 2008 16:17:10 +0000 (12:17 -0400)]
USB: HCDs use the do_remote_wakeup flag

When a USB device is suspended, whether or not it is enabled for
remote wakeup depends on the device_may_wakeup() setting.  The setting
is then saved in the do_remote_wakeup flag.

Later on, however, the device_may_wakeup() value can change because of
user activity.  So when testing whether a suspended device is or
should be enabled for remote wakeup, we should always test
do_remote_wakeup instead of device_may_wakeup().  This patch (as1076)
makes that change for root hubs in several places.

The patch also adjusts uhci-hcd so that when an autostopped controller
is suspended, the remote wakeup setting agrees with the value recorded
in the root hub's do_remote_wakeup flag.

And the patch adjusts ehci-hcd so that wakeup events on selectively
suspended ports (i.e., the bus itself isn't suspended) don't turn on
the PME# wakeup signal.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: g_file_storage: ignore bulk-out data after invalid CBW
Alan Stern [Mon, 14 Apr 2008 15:45:29 +0000 (11:45 -0400)]
USB: g_file_storage: ignore bulk-out data after invalid CBW

This patch (as1061) makes g_file_storage more compliant with the
Bulk-Only Transport specification.  After an invalid CBW is received,
the gadget must ignore any further bulk-OUT data until it is reset.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: serial: remove endpoints setting checks from core and header
Greg Kroah-Hartman [Wed, 16 Apr 2008 16:17:38 +0000 (09:17 -0700)]
USB: serial: remove endpoints setting checks from core and header

Remove the unused check for num_interrupt and friends as well as remove
them from the header file because no usb-serial drivers no longer
reference them.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: serial: remove unneeded number endpoints settings
Greg Kroah-Hartman [Wed, 16 Apr 2008 16:17:38 +0000 (09:17 -0700)]
USB: serial: remove unneeded number endpoints settings

The usb-serial core no longer checks these fields so remove them from
all of the individual drivers.  They will be removed from the usb-serial
core in a patch later in the series.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: option.c: correct DTR behaviour
Chris Collins [Thu, 10 Apr 2008 08:15:53 +0000 (10:15 +0200)]
USB: option.c: correct DTR behaviour

Setting DTR et al. should work for all interfaces
if you actually pass the interface number. :-P

This should help with devices that have important pseudo-serial ports
that aren't on the first interface in the device.

Signed-off-by: Chris Collins <chris@ursys.com.au>
Signed-off-by: Matthias Urlichs <matthias@urlichs.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: add Documentation about usb_anchor
Oliver Neukum [Wed, 9 Apr 2008 13:37:34 +0000 (15:37 +0200)]
USB: add Documentation about usb_anchor

This adds documentation about the new usb anchor infrastructure.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: ehci: qh/qtd cleanup comments
David Brownell [Thu, 10 Apr 2008 21:21:06 +0000 (14:21 -0700)]
USB: ehci: qh/qtd cleanup comments

Provide better comments about qh_completions() and QTD handling.
That code can be *VERY* confusing, since it's evolved over a few
years to cope with both hardware races and silicon quirks.

Remove two unlikely() annotations that match the GCC defaults
(and are thus pointless); add an "else" to highlight code flow.

This patch doesn't change driver behavior.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: log an error message when USB enumeration fails
Alan Stern [Thu, 10 Apr 2008 16:45:34 +0000 (12:45 -0400)]
USB: log an error message when USB enumeration fails

This patch (as1077) logs an error message whenever the kernel is
unable to enumerate a new USB device.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: update comments about usb driver's header
Oliver Neukum [Thu, 10 Apr 2008 13:15:37 +0000 (15:15 +0200)]
USB: update comments about usb driver's header

Comments here are so outdated that they are plain wrong. We cannot expect
people to write correct drivers if the headers have incorrect comments.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: Remove superfluous "depends on USB_SERIAL" from Kconfig.
Robert P. J. Day [Sun, 6 Apr 2008 12:00:30 +0000 (08:00 -0400)]
USB: Remove superfluous "depends on USB_SERIAL" from Kconfig.

Given that most of drivers/usb/serial/Kconfig is wrapped inside:

  if USB_SERIAL
  ...
  endif # USB_SERIAL

remove the consequently redundant dependencies on USB_SERIAL.

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: add extension of anchor API, usb_unlink_anchored_urbs
Oliver Neukum [Thu, 10 Apr 2008 12:07:37 +0000 (14:07 +0200)]
USB: add extension of anchor API, usb_unlink_anchored_urbs

This adds the ability to trigger asynchronous unlinks of anchored URBs. This
is needed for error handling in the comntext of completion handlers, which
cannot sleep.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: r8a66597-hcd: Add support for SH7366 USB host
Yoshihiro Shimoda [Thu, 10 Apr 2008 12:05:58 +0000 (21:05 +0900)]
USB: r8a66597-hcd: Add support for SH7366 USB host

R8A66597 is similar to SH7366 USB 2.0 Host/Function module. It can
support SH7366 USB host by changing several R8A66597 code.

Signed-off-by: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: r8a66597-hcd: fix usb device connection timing
Yoshihiro Shimoda [Thu, 10 Apr 2008 12:05:55 +0000 (21:05 +0900)]
USB: r8a66597-hcd: fix usb device connection timing

Fix the problem that enumeration of a USB device was slow.

Signed-off-by: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: r8a66597-hcd: fix interrupt transfer interval
Yoshihiro Shimoda [Thu, 10 Apr 2008 12:05:47 +0000 (21:05 +0900)]
USB: r8a66597-hcd: fix interrupt transfer interval

This driver ignored the value of bInterval and revised the problem
that performed interrupt transfer.

ASIX USB Ethernet adapter comes to work with this host controller
by applying this patch.

Signed-off-by: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: oti6858: fix TCFLSH ioctl handling
Paulius Zaleckas [Thu, 10 Apr 2008 11:20:08 +0000 (14:20 +0300)]
USB: oti6858: fix TCFLSH ioctl handling

Removes unimplemented TCFLSH handling from oti6858, because it was
preventing TCFLSH handling by upper layer (line discipline) drivers (see
drivers/char/tty_io.c line 3450).

Signed-off-by: Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
Acked-by: Alan Cox <alan@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: ehci shutdown refactored
Sarah Sharp [Tue, 8 Apr 2008 21:30:18 +0000 (14:30 -0700)]
USB: ehci shutdown refactored

This patch refactors some shutdown code so it can be shared between
ehci_stop() and ehci_shutdown().

This also fixes a couple potential bugs:
 - ehci_shutdown() was not locking ehci->lock before halting the HC.
 - ehci_shutdown() didn't disable the watchdog and IAA timers.
 - ehci_stop() was resetting the host controller when it may have been
   running, which the EHCI spec says "may result in undefined behavior".

ehci_stop() was calling port_power() to turn off the ports, which waited
20ms after applying the port change.  The msleep was for the case where
the HC might take 20ms to turn the ports on; since we're shutting them
off, we can avoid the msleep and just use ehci_turn_off_ports().

ehci_stop() doesn't need to clear the intr_enable register or revert
ownership of the companion controllers to the BIOS, because the host
controller reset should have done that.  There might be a buggy host
controller that doesn't follow the reset rules, but for now we assume
it's redundant code and remove it.

[ A subsequent patch will cancel the timers later ... this version
carries forward existing bugs where timers could get re-armed
after they're canceled. ]

Signed-off-by: Sarah Sharp <sarah.a.sharp@intel.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: at91_udc can prefetch data
David Brownell [Mon, 7 Apr 2008 06:32:55 +0000 (23:32 -0700)]
USB: at91_udc can prefetch data

The at91sam9 chip are ARMv5 so they support preload instructions.
Use preloading to load the FIFO a bit faster.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: dummy-hcd: use dynamic allocation for platform_devices
Alan Stern [Mon, 7 Apr 2008 19:03:25 +0000 (15:03 -0400)]
USB: dummy-hcd: use dynamic allocation for platform_devices

This patch (as1075) changes dummy-hcd to dynamically allocate its
platform_device structures, using the core platform_device_alloc()
interface.  This is what it should have done all along, because the
dynamically-allocated structures have a release method in the driver
core and are therefore immune to being released after the module has
been unloaded.

Thanks to Richard Purdie for pointing out the need for this change.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Cc: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: gadget section fixes
David Brownell [Sat, 5 Apr 2008 21:17:14 +0000 (14:17 -0700)]
USB: gadget section fixes

Restore some section annotations:  they were switched to "__devinit"
while they should have been "__init", because of bogus warnings.  The
warnings are now fixed, so the runtime footprint of various drivers
can now shrink a bit.  On ARMv5, it's about 600 bytes except for the
Ethernet gadget, where it can save a bit more.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: rework sysfs removal of interface files
Alan Stern [Sat, 5 Apr 2008 03:46:59 +0000 (23:46 -0400)]
USB: rework sysfs removal of interface files

Removing an interface's sysfs files before unregistering the interface
doesn't work properly, because usb_unbind_interface() will reinstall
altsetting 0 and thereby create new sysfs files.  This patch (as1074)
removes the files after the unregistration is finished.  It's not
quite as clean, but at least it works.

Also, there's no need to check if an interface has been registered
before removing its sysfs files.  If it hasn't been registered then
the files won't have been created, so usb_remove_sysfs_intf_files()
will simply do nothing.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Tested-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agousb: replace remaining __PRETTY_FUNCTION__ occurrences
Harvey Harrison [Fri, 4 Apr 2008 21:28:01 +0000 (14:28 -0700)]
usb: replace remaining __PRETTY_FUNCTION__ occurrences

The kernel is written in C, not C++, use __func__

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: OHCI: host-controller resumes leave root hub suspended
Alan Stern [Thu, 3 Apr 2008 22:03:17 +0000 (18:03 -0400)]
USB: OHCI: host-controller resumes leave root hub suspended

Drivers in the ohci-hcd family should perform certain tasks whenever
their controller device is resumed.  These include checking for loss
of power during suspend, turning on port power, and enabling interrupt
requests.

Until now these jobs have been carried out when the root hub is
resumed, not when the controller is.  Many drivers work around the
resulting awkwardness by automatically resuming their root hub
whenever the controller is resumed.  But this is wasteful and
unnecessary.

To simplify the situation, this patch (as1066) adds a new core
routine, ohci_finish_controller_resume(), which can be used by all the
OHCI-variant drivers.  They can call the new routine instead of
resuming their root hubs.  And ohci-pci.c can call it instead of using
its own special-purpose handler.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: clarify usage of hcd->suspend/resume methods
Alan Stern [Thu, 3 Apr 2008 22:03:06 +0000 (18:03 -0400)]
USB: clarify usage of hcd->suspend/resume methods

The .suspend and .resume method pointers in struct usb_hcd have not
been fully understood by host-controller driver writers.  They are
meant for use with PCI controllers; other platform-specific drivers
generally should not refer to them.

To try and clarify matters, this patch (as1065) renames those methods
to .pci_suspend and .pci_resume.  It eliminates corresponding dead code
and bogus references in the ohci-ssb and u132-hcd drivers.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: root hubs don't lie about their number of TTs
Alan Stern [Thu, 3 Apr 2008 22:02:56 +0000 (18:02 -0400)]
USB: root hubs don't lie about their number of TTs

Currently EHCI root hubs enumerate with a bDeviceProtocol code
indicating that they possess a Transaction Translator.  However the
vast majority of controllers do not; they rely on a companion
controller to handle full- and low-speed communications.  This patch
(as1064) changes the root-hub device descriptor to match the actual
situation.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: convert away from urb->status in xpad driver
Oliver Neukum [Thu, 3 Apr 2008 19:40:59 +0000 (21:40 +0200)]
USB: convert away from urb->status in xpad driver

USB is moving to transfering status as a parameter. To ease the transition
urb->status is to be touched only once in a function. The xpad driver has
been overlooked. Dmitry wants this to go through the USB tree.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: OHCI: fix bug in controller resume
Alan Stern [Thu, 3 Apr 2008 15:35:26 +0000 (11:35 -0400)]
USB: OHCI: fix bug in controller resume

This patch (as1063) fixes a bug in the way ohci-hcd resumes its
controllers.  It leaves the Master Interrupt Enable bit turned off.

If the root hub is resumed immediately this won't matter.  But if the
root hub is suspended (say because no devices are plugged in), it won't
ever wake up by itself.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
CC: David Brownell <david-b@pacbell.net>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: gadget: dummy_hcd.c: fix nested switch statements
Ingo van Lil [Fri, 28 Mar 2008 21:50:26 +0000 (14:50 -0700)]
USB: gadget: dummy_hcd.c: fix nested switch statements

Fix a messed up combination of two nested switch statements in
drivers/usb/gadget/dummy_hcd.c.

According to the USB spec (section 5.8.3) the maximum packet size for bulk
endpoints can be 512 for high-speed devices and 8, 16, 32 or 64 for full-speed
devices.  Low-speed devices must not have bulk endpoints.

Signed-off-by: Ingo van Lil <inguin@gmx.de>
Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: mem leak fixes for AMD 5536 UDC high/full speed USB device controller driver
Jesper Juhl [Fri, 28 Mar 2008 21:50:27 +0000 (14:50 -0700)]
USB: mem leak fixes for AMD 5536 UDC high/full speed USB device controller driver

In drivers/usb/gadget/amd5536udc.c::udc_pci_probe(), sizeof(struct udc)
storage is allocated for 'dev'.

There are many exit points from the function where 'dev' is not free'd but has
also not yet been used for anything.  The following patch free's 'dev' at the
return points where it has not yet been used.

Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Cc: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: usb-storage: use adaptive DMA mask
Alan Stern [Thu, 27 Mar 2008 18:52:57 +0000 (14:52 -0400)]
USB: usb-storage: use adaptive DMA mask

This patch (as1060) makes usb-storage set the DMA alignment mask for
SCSI slaves to match the maxpacket size of the bulk-IN endpoint,
rather than always setting it to 511.  For full-speed devices that
mask is too restrictive, and wireless USB devices can have maxpacket
sizes larger than 512.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: g_printer bugfixes
Craig W. Nadler [Thu, 20 Mar 2008 21:46:26 +0000 (14:46 -0700)]
USB: g_printer bugfixes

G_PRINTER: Bug fix for blocking reads and a fix for a memory leak.

This fixes bugs in blocking IO calls. When the poll() entry point
is called receive transfers will be setup if they have not already
been. Another bug fix is that the poll() entry point now checks the
current receive buffer for data when reporting if any data had been
received. A memory leak was fixed that could have occurred when a
USB reset happened.

Signed-off-by: Craig W. Nadler <craig@nadler.us>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: test for NULL return from platform_get_resource() in ohci_hcd_sm501_drv_remove()
Jesper Juhl [Fri, 21 Mar 2008 21:55:45 +0000 (22:55 +0100)]
USB: test for NULL return from platform_get_resource() in ohci_hcd_sm501_drv_remove()

platform_get_resource() may return null, so although it seems it will never
do so here unless there's a bug elsewhere, it does no harm to be defensive
and test.

Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Acked-by: David Brownell <dbrownell@users.sourceforge.net>
Acked-by: Magnus Damm <magnus.damm@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: serial: Remove obsolete contact addresses
Matti Linnanvuori [Sun, 23 Mar 2008 11:08:01 +0000 (04:08 -0700)]
USB: serial: Remove obsolete contact addresses

Remove obsolete contact addresses.

Signed-off-by: Matti Linnanvuori <mattilinnanvuori@yahoo.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: fix comments of 2 functions in hcd.c
Ming Lei [Sun, 23 Mar 2008 12:58:28 +0000 (20:58 +0800)]
USB: fix comments of 2 functions in hcd.c

Remove useless @type note for rh_string() and @r note for usb_hcd_irq()
since this two parameters were removed.

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agousb: u132-hcd driver: semaphore to mutex
Daniel Walker [Sun, 23 Mar 2008 07:00:02 +0000 (00:00 -0700)]
usb: u132-hcd driver: semaphore to mutex

Signed-off-by: Daniel Walker <dwalker@mvista.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agousb: u132-hcd driver style clean up
Daniel Walker [Sun, 23 Mar 2008 07:00:01 +0000 (00:00 -0700)]
usb: u132-hcd driver style clean up

I was converting a semaphore in this file to a mutex when I noticed that
this file has some fairly rampant style problems. Practically every line
has spaces instead of tabs .. Once I cleared that up, checkpatch.pl showed
a number of other problem.. I think this file might be a good one to review
for new style checks that could be added..

Below are the only two remaining which I didn't remove.

#5083: FILE: drivers/usb/host/u132-hcd.c:2907:
+               error:

WARNING: labels should not be indented
#5087: FILE: drivers/usb/host/u132-hcd.c:2911:
+               stall:

These labels are actually inside a switch statement, and they are right
under "default:". "default:" appears to be exempt and these other label
should be too, or default shouldn't be exempt.

I also deleted a few lines due to single statements inside { } ,

if (is_error()) {
return;
}

becomes,

if (is_error())
return;

with one line deleted.

Signed-off-by: Daniel Walker <dwalker@mvista.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: add usb-serial spcp8x5 driver
Greg Kroah-Hartman [Thu, 7 Feb 2008 22:59:03 +0000 (23:59 +0100)]
USB: add usb-serial spcp8x5 driver

Original version of the driver done by Linxb, changes by Harald, and
lots of cleanups by me in order to get it into a mergable state.

Cc: Linxb <xubin.lin@worldplus.com.cn>
Cc: Harald Klein <hari@vt100.at>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agousb/usb-serial-sierra-add-new-dev-group
Kevin Lloyd [Wed, 2 Apr 2008 18:24:56 +0000 (11:24 -0700)]
usb/usb-serial-sierra-add-new-dev-group

This patch is for the sierra driver and adds support for a new group of
devices that have a new USB configuration.
This targets kernel 2.6.25-rc7

Signed-off-by: Kevin Lloyd <klloyd@sierrawireless.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: Serial: Sierra: C597 fix
Kevin Lloyd [Mon, 31 Mar 2008 17:20:54 +0000 (10:20 -0700)]
USB: Serial: Sierra: C597 fix

This patch is for the sierra driver and fixes a Compass 597 bug that
allows users to access the SD-Card.

This targets kernel 2.6.25-rc7

Signed-off-by: Kevin Lloyd <klloyd@sierrawireless.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: Serial: Sierra: Clean up
Kevin Lloyd [Fri, 28 Mar 2008 17:05:08 +0000 (10:05 -0700)]
USB: Serial: Sierra: Clean up

This patch cleans up some of the sierra driver code. Please package this
with the other patches in this group as I would like the driver version
to reflect their changes as well.

Signed-off-by: Kevin Lloyd <klloyd@sierrawireless.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: increase cdc-acm write throughput
David Engraf [Thu, 20 Mar 2008 09:01:34 +0000 (10:01 +0100)]
USB: increase cdc-acm write throughput

the following patch uses 16 write urbs and a writsize of wMaxPacketSize
* 20.  With this patch I get the maximum througput from my linux system
with 20MB/sec read and 15 MB/sec write (full speed 1 MB/sec both)

I also deleted the flag URB_NO_FSBR for the writeurbs, because this
makes my full speed devices significant slower.

Signed-off-by: David Engraf <david.engraf@netcom.eu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: cdc-acm tell tty layer not to split things up.
David Engraf [Thu, 20 Mar 2008 09:53:52 +0000 (10:53 +0100)]
USB: cdc-acm tell tty layer not to split things up.

It ensures that the tty level do not split
the send buffer into 2KB blocks.

Signed-off-by: David Engraf <david.engraf@netcom.eu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agousbmon: restore mmap
Pete Zaitcev [Thu, 20 Mar 2008 05:29:51 +0000 (22:29 -0700)]
usbmon: restore mmap

Paolo asked to enable the mmap. I kept it off because I'm do not
entirely understand how it workse these days after ->nopage etc.
But it seems like working somewhat at least.

Signed-Off-By: Pete Zaitcev <zaitcev@gmail.com>
Cc: Paolo Abeni <paolo.abeni@email.it>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: Fix "cut and paste" booboo in usbmon Makefile.
Robert P. J. Day [Sun, 9 Mar 2008 17:55:01 +0000 (13:55 -0400)]
USB: Fix "cut and paste" booboo in usbmon Makefile.

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: Remove EXPERIMENTAL designation from USB_EHCI_ROOT_HUB_TT.
Robert P. J. Day [Sat, 8 Mar 2008 08:27:44 +0000 (03:27 -0500)]
USB: Remove EXPERIMENTAL designation from USB_EHCI_ROOT_HUB_TT.

According to David Brownell, this feature doesn't require an
experimental designation any longer.

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: Remove EXPERIMENTAL from dynamic USB minor allocation.
Robert P. J. Day [Sat, 8 Mar 2008 08:12:44 +0000 (03:12 -0500)]
USB: Remove EXPERIMENTAL from dynamic USB minor allocation.

Since this USB feature seems non-experimental, remove that dependency.

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: Remove EXPERIMENTAL designation from USB MDC800 support.
Robert P. J. Day [Sat, 8 Mar 2008 08:04:05 +0000 (03:04 -0500)]
USB: Remove EXPERIMENTAL designation from USB MDC800 support.

Since support for the USB Mustek MDC800 Digital Camera has apparently
been around since the beginning of the git repository, it's safe to
assume it's no longer experimental.

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: Remove EXPERIMENTAL designation from USB serial/ Kconfig entries
Robert P. J. Day [Sat, 8 Mar 2008 08:00:04 +0000 (03:00 -0500)]
USB: Remove EXPERIMENTAL designation from USB serial/ Kconfig entries

Since nothing under the USB serial/ directory seems to be obviously
experimental, remove the EXPERIMENTAL dependency from all of those
Kconfig entries.

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: Remove EXPERIMENTAL designation from USB misc/ Kconfig entries
Robert P. J. Day [Sat, 8 Mar 2008 07:46:57 +0000 (02:46 -0500)]
USB: Remove EXPERIMENTAL designation from USB misc/ Kconfig entries

Since nothing under the USB misc/ seems to be obviously experimental,
remove the EXPERIMENTAL dependency from those Kconfig entries.

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: Remove EXPERIMENTAL tags from some USB gadget Kconfig entries.
Robert P. J. Day [Mon, 10 Mar 2008 19:09:51 +0000 (15:09 -0400)]
USB: Remove EXPERIMENTAL tags from some USB gadget Kconfig entries.

Based on a recent discussion on the Linux USB mailing list, remove the
designation of EXPERIMENTAL from some USB gadget entries, and tag some
of them as DEVELOPMENT.

just for fun, i added a bit of help for gadgetfs, explaining the
race condition.

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Acked-by: David Brownell <dbrownell@users.sourceforge.net>
16 years agoUSB: Remove EXPERIMENTAL designation from USB storage Kconfig entries.
Robert P. J. Day [Sat, 8 Mar 2008 07:17:55 +0000 (02:17 -0500)]
USB: Remove EXPERIMENTAL designation from USB storage Kconfig entries.

Since there seems to be little reason to mark the current USB storage
features as "EXPERIMENTAL," remove that dependency.

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: mass storage: emulation of sat scsi_pass_thru with ATACB
matthieu castet [Wed, 19 Mar 2008 18:40:52 +0000 (19:40 +0100)]
USB: mass storage: emulation of sat scsi_pass_thru with ATACB

I have got a cypress usb-ide bridge and I would like to tune or monitor
my disk with tools like hdparm, hddtemp or smartctl.

My controller support a way to send raw ATA command to the disk with
something call atacb (see
http://download.cypress.com.edgesuite.net/design_resources/datasheets/contents/cy7c68300c_8.pdf).

Atacb support can be added for each application, but there is some disadvantages :
- all application need to be patched
- A race is possible if there other accesses, because the emulation can
be split in 2 atacb scsi transactions. One for sending the command, one
for reading the register (if ck_cond is set).

I have implemented the emulation in usb-storage with a special proto_handler,
and an unsual entry.

Signed-off-by: Matthieu CASTET <castet.matthieu@free.fr>
Signed-off-by: Matthew Dharm <mdharm-usb@one-eyed-alien.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: Standardize inclusion protection and add where missing.
Robert P. J. Day [Fri, 7 Mar 2008 18:45:32 +0000 (13:45 -0500)]
USB: Standardize inclusion protection and add where missing.

For the header files in include/linux/usb, add missing multiple
inclusion protection and standardize what's already there.  The
apparent standards:

  * macro name of __LINUX_USB_headerfile_H
  * inclusion protection placed after leading comment block
  * macro name added as a comment on the final #endif
  * any obvious trivial whitespace cleanup associated with the above

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: usb.h: reduce syslog clutter [v3]
Tilman Schmidt [Thu, 13 Mar 2008 18:51:42 +0000 (19:51 +0100)]
USB: usb.h: reduce syslog clutter [v3]

The the err() / info() / warn() macros in usb.h inserted __FILE__ at
the beginning of the message, which expands to the complete pathname
of the source file within the kernel tree, frequently taking up half
of an 80 character screen line before the actual message even begins.
Use the module name instead.

Signed-off-by: Tilman Schmidt <tilman@imap.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agodrivers/usb/core/devio.c: suppress warning with 64k PAGE_SIZE
Andrew Morton [Wed, 12 Mar 2008 20:32:24 +0000 (13:32 -0700)]
drivers/usb/core/devio.c: suppress warning with 64k PAGE_SIZE

drivers/usb/core/devio.c: In function 'proc_control':
drivers/usb/core/devio.c:657: warning: comparison is always false due to limited range of data type

Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Pete Zaitcev <zaitcev@redhat.com>
Cc: Oliver Neukum <oliver@neukum.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: cypress_m8: Speed handling
Alan Cox [Mon, 10 Mar 2008 21:59:28 +0000 (21:59 +0000)]
USB: cypress_m8: Speed handling

The recent changes to this driver cleaned it up a lot, follow that up
by sorting the speed side of things out as well

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: ehci: paranoia, reject large control transfers
David Brownell [Tue, 4 Mar 2008 23:11:07 +0000 (15:11 -0800)]
USB: ehci: paranoia, reject large control transfers

Some EHCI fault paths with large control transfers aren't coded.  Avoid
problems by rejecting transfers that may need two qTDs (16+ KB).  This is
mostly paranoia; even 4 KB transfers are rare, and most HCDs use lower
limits (so it's unlikely anyone would ever try such a thing).

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: remove dev->power.power_state
Alan Stern [Thu, 6 Mar 2008 22:00:58 +0000 (17:00 -0500)]
USB: remove dev->power.power_state

power.power_state is scheduled for removal.  This patch (as1053)
removes all uses of that field from drivers/usb.  Almost all of them
were write-only, the most significant exceptions being sl811-hcd.c and
u132-hcd.c.

Part of this patch was written by Pavel Machek.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Cc: David Brownell <david-b@pacbell.net>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: ipaq: fix devices having more than one endpoint
Matthias Geissert [Thu, 6 Mar 2008 21:00:33 +0000 (22:00 +0100)]
USB: ipaq: fix devices having more than one endpoint

The ipaq module  supports devices with one endpoint only. Some devices,
e.g. Yakumo Delta 300, have more than one endpoint.

This patch fixes support for devices having up to 2 endpoints which used
to work on older kernel versions.

Signed-off-by: Matthias Geissert <matthias.geissert@web.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: ehci: remove obsolete workaround for bogus IRQs
David Brownell [Thu, 6 Mar 2008 07:37:52 +0000 (23:37 -0800)]
USB: ehci: remove obsolete workaround for bogus IRQs

It was pointed out that we found and fixed the cause of the "bogus"
fatal IRQ reports some time ago ... this patch removes the code
which was working around that bug ("status" got clobbered), and a
comment which needlessly confused folk reading this code.

This also includes a minor cleanup to the code which fixed that bug.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: partial USB embedded host support
Robin Getz [Thu, 6 Mar 2008 07:17:38 +0000 (23:17 -0800)]
USB: partial USB embedded host support

This provides better support for USB "Embedded Host" functionality, which
is a subset of the USB OTG options:

 * External hub support can be disabled;

 * USB peripherals not whitelisted in "otg_whitelist.h" will be rejected
   during enumeration.

These options can allow some savings in software and support.

Signed-off-by: Robin Getz <rgetz@blackfin.uclinux.org>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: io_ti.c: remove unneeded null tty check
Ray Lee [Tue, 4 Mar 2008 23:25:12 +0000 (15:25 -0800)]
USB: io_ti.c: remove unneeded null tty check

The Coverity checker (and Adrian Bunk) spotted an inconsistent NULL check of
port->tty (it's blindly dereferenced later without the check).

Alan Cox confirmed the check can go.

Signed-off-by: Ray Lee <ray-lk@madrabbit.org>
Cc: Adrian Bunk <bunk@kernel.org>
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>
16 years agoUSB: use DIV_ROUND_UP
Julia Lawall [Tue, 4 Mar 2008 23:25:11 +0000 (15:25 -0800)]
USB: use DIV_ROUND_UP

The kernel.h macro DIV_ROUND_UP performs the computation (((n) + (d) - 1) /
(d)) but is perhaps more readable.

An extract of the semantic patch that makes this change is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@haskernel@
@@

#include <linux/kernel.h>

@depends on haskernel@
expression n,d;
@@

(
- (n + d - 1) / d
+ DIV_ROUND_UP(n,d)
|
- (n + (d - 1)) / d
+ DIV_ROUND_UP(n,d)
)

@depends on haskernel@
expression n,d;
@@

- DIV_ROUND_UP((n),d)
+ DIV_ROUND_UP(n,d)

@depends on haskernel@
expression n,d;
@@

- DIV_ROUND_UP(n,(d))
+ DIV_ROUND_UP(n,d)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: io_ti: lock mcr and msr shadows properly
Alan Cox [Wed, 20 Feb 2008 21:38:32 +0000 (21:38 +0000)]
USB: io_ti: lock mcr and msr shadows properly

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: ti_usb_3410_5052: Extend locking to msr and shadow mcr
Alan Cox [Wed, 20 Feb 2008 21:41:40 +0000 (21:41 +0000)]
USB: ti_usb_3410_5052: Extend locking to msr and shadow mcr

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: kobil_sct: Get rid of unneeded priv->line_state
Alan Cox [Wed, 20 Feb 2008 21:40:34 +0000 (21:40 +0000)]
USB: kobil_sct: Get rid of unneeded priv->line_state

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: iuu_phoenix: lock priv->tiostatus properly
Alan Cox [Wed, 20 Feb 2008 21:39:25 +0000 (21:39 +0000)]
USB: iuu_phoenix: lock priv->tiostatus properly

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: serial: Note mos7480 and option don't lock modem status
Alan Cox [Wed, 20 Feb 2008 20:51:45 +0000 (20:51 +0000)]
USB: serial: Note mos7480 and option don't lock modem status

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: ftdi_sio: Note missing locking
Alan Cox [Wed, 20 Feb 2008 20:49:53 +0000 (20:49 +0000)]
USB: ftdi_sio: Note missing locking

The ftdi_sio driver has no internal locking on the dtr/rts state. Flag
that up for someone to fix.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: usb-serial: Prepare for BKL push down
Alan Cox [Wed, 20 Feb 2008 20:47:56 +0000 (20:47 +0000)]
USB: usb-serial: Prepare for BKL push down

Take the lock in usb-serial instead. As it relies on the BKL internally
we can't push it any deeper yet.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: minor ehci xITD simplifications
Karsten Wiese [Tue, 19 Feb 2008 20:31:49 +0000 (12:31 -0800)]
USB: minor ehci xITD simplifications

Remove two (or one) conditional tests in per-urb isochronous
transfer setup code paths.

Signed-off-by: Karsten Wiese <fzu@wemgehoertderstaat.de>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: auerswald: Convert ccp->mutex in a mutex
matthias@kaehlcke.net [Mon, 18 Feb 2008 19:45:36 +0000 (20:45 +0100)]
USB: auerswald: Convert ccp->mutex in a mutex

The semaphore ccp->mutex is used as mutex, convert it to the mutex API

Signed-off-by: Matthias Kaehlcke <matthias@kaehlcke.net>
Cc: Wolfgang Mües <wolfgang@iksw-muees.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: auerswald: Convert ccp->readmutex in a mutex
matthias@kaehlcke.net [Mon, 18 Feb 2008 19:45:35 +0000 (20:45 +0100)]
USB: auerswald: Convert ccp->readmutex in a mutex

The semaphore ccp->readmutex is used as mutex, convert it to the mutex API

Signed-off-by: Matthias Kaehlcke <matthias@kaehlcke.net>
Cc: Wolfgang Mües <wolfgang@iksw-muees.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: auerswald: Convert stats_sem in a mutex
matthias@kaehlcke.net [Mon, 18 Feb 2008 19:45:34 +0000 (20:45 +0100)]
USB: auerswald: Convert stats_sem in a mutex

The semaphore cp->mutex is used as mutex, convert it to the mutex API

Signed-off-by: Matthias Kaehlcke <matthias@kaehlcke.net>
Cc: Wolfgang Mües <wolfgang@iksw-muees.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: cypress_m8: Limit baud rate to <=4800 for USB low speed devices
Mike Isely [Mon, 11 Feb 2008 02:23:32 +0000 (20:23 -0600)]
USB: cypress_m8: Limit baud rate to <=4800 for USB low speed devices

The cypress app note for the M8 states that for the USB low speed
version of the part, throughput is effectively limited to 800
bytes/sec.  So if we were to try a faster baud rate in such cases then
we risk overrun errors on receive.  Best to just identify this case
and limit the rate to 4800 baud or less (by ignoring any request to
set a faster rate).  The old baud rate setting code was somewhat
fragile; this change also hopefully makes it easier in the future to
better checking / limiting.

Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: cypress_m8: Get rid of pointless NULL check
Mike Isely [Mon, 11 Feb 2008 02:23:28 +0000 (20:23 -0600)]
USB: cypress_m8: Get rid of pointless NULL check

Remove a NULL check in cypress_m8; the check is useless in this
context because it is referenced earlier in the same code path thus
the kernel would be oops'ed before reaching this point anyway.  (And
it's really pointless here anyway; if this pointer somehow is NULL the
driver is going to have serious problems in many other places.)

Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: cypress_m8: Don't issue GET_CONFIG for certain devices
Mike Isely [Mon, 11 Feb 2008 02:23:24 +0000 (20:23 -0600)]
USB: cypress_m8: Don't issue GET_CONFIG for certain devices

Earthmate LT-20 devices (both "old" and "new" versions) can't tolerate
a GET_CONFIG command.  The original Earthmate has no trouble with
this.  Presumably other non-Earthmate devices are still OK as well.
This change disables the use of GET_CONFIG for cases where it is known
not to work.

Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: cypress_m8: Packet format is separate from characteristic size
Mike Isely [Mon, 11 Feb 2008 02:23:19 +0000 (20:23 -0600)]
USB: cypress_m8: Packet format is separate from characteristic size

cypress_m8: Packet format is separate from characteristic size

The Cypress app note states that when using an 8 byte packet buffer
size that the packet format is modified (to be more compact).  However
I have since discovered that newer DeLorme Earthmate LT-20 devices
(those that are low speed USB with 8 byte packet size) STILL use the
format that is really supposed to correspond to 32 byte packets.
Further confusing things is the subsequent discovery that there are
actually two different types of LT-20 - older LT-20's use 32 byte
packets which is probably why this issue wasn't originally
encountered.  The solution here is to flag the packet format
separately from the buffer size.  Then at initialization time,
identify the correct combination and set it up.  This is a critical
fix for anyone with a newer LT-20.  Older devices and non-Earthmate
devices should remain unaffected by this change.  (If other devices
behave in this, uh, unexpected manner, it's now just a simple 1 line
change to fix them as well (change the pkt_fmt member for that
device).  Default behavior with this patch is still to drive the
format as per the app-note; of course for Earthmate devices this is
overridden.

Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: cypress_m8: Feature buffer fixes
Mike Isely [Mon, 11 Feb 2008 02:23:14 +0000 (20:23 -0600)]
USB: cypress_m8: Feature buffer fixes

cypress_m8: Feature buffer fixes

From: Mike Isely <isely@pobox.com>

Don't hardcode the feature buffer size; use sizeof() instead.  That
way we can easily specify the size in a single spot.  Speaking of the
feature buffer size, the Cypress app note (and further testing with a
DeLorme Earthmate) suggests that this size should be 5 not 8 bytes.

Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: io_ti.c: remove pointless eye-candy in debug statements
Andrew Morton [Tue, 5 Feb 2008 07:57:50 +0000 (23:57 -0800)]
USB: io_ti.c: remove pointless eye-candy in debug statements

These strings always come up as false positives whenever I'm doing
git-conflict fixups (ie: about 1000 times/day).

I don't think the zillion "<" and ">" characters are very useful and removing
them makes my life that little bit easier.

Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: gadget: Hangup tty on g_serial disconnect
Savin Zlobec [Fri, 15 Feb 2008 12:42:01 +0000 (13:42 +0100)]
USB: gadget: Hangup tty on g_serial disconnect

On USB cable disconnect g_serial doesn't hangup the port tty,
which results in an endless read on the tty device. With the
following patch the read and select behave correctly when
the cable is unplugged.

Tested on at91rm9200

Signed-off-by: Savin Zlobec <savin@epiko.si>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: EHCI: Refactor "if (handshake()) state = HC_STATE_HALT"
Karsten Wiese [Sat, 16 Feb 2008 21:44:42 +0000 (13:44 -0800)]
USB: EHCI: Refactor "if (handshake()) state = HC_STATE_HALT"

Refactor the EHCI "if (handshake()) state = HC_STATE_HALT" idiom,
which appears 4 times, by replacing it with calls to a new function
called handshake_on_error_set_halt().  Saves a few bytes too.

Signed-off-by: Karsten Wiese <fzu@wemgehoertderstaat.de>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: m66592-udc: reduce size of data structure.
Paul Mundt [Wed, 13 Feb 2008 08:02:33 +0000 (17:02 +0900)]
USB: m66592-udc: reduce size of data structure.

Poking around with pahole, we see that m66592 handily shoves a u16 in
between larger types on 2 separate occasions leaving us with 2 2-byte
holes:

struct m66592 {
...

/* size: 1196, cachelines: 38 */
/* sum members: 1192, holes: 2, sum holes: 4 */
/* last cacheline: 12 bytes */
}; /* definitions: 1 */

Pairing them gets back 4-bytes:

struct m66592 {
...

/* size: 1192, cachelines: 38 */
/* last cacheline: 8 bytes */
}; /* definitions: 1 */

Unfortunately it's not enough to save a cacheline with this massive
structure, but every byte helps.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Signed-off-by: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: ehci minor SOC bus glue fixes
David Brownell [Tue, 12 Feb 2008 02:40:46 +0000 (18:40 -0800)]
USB: ehci minor SOC bus glue fixes

Various minor fixes to some SOC bus glue for EHCI:

 - Remove a bogus copyright (by "me"!) which someone added to the FSL
   driver, and an irrelevant comment.

 - Un-break MODULE_ALIAS() directives after platform_bus hotplugging
   acquired a backwards-incompatible change.  (Which didn't fix ANY
   of the in-tree drivers it prevented from hotplugging -- sigh.)

 - Remove some bogus assignments of platform_bus_type; that's done by
   the platform_bus code.

 - Add some FIXMEs for drivers with that pointless two-level idiom for
   probe() and remove() routines.  ("Obfuscation" is a non-goal.)
   That should help avoid future bus glue which copies that idiom.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: ehci tolerates some buggy devices
David Brownell [Fri, 8 Feb 2008 23:08:44 +0000 (15:08 -0800)]
USB: ehci tolerates some buggy devices

This teaches EHCI how to to work around bugs in certain high speed
devices, by accomodating "bulk" packets that exceed the 512 byte
constant value required by the USB 2.0 specification.  (Have a
look at section 5.8.3, paragraphs 1 and 3.)

It also makes the descriptor parsing code warn when it encounters
such bugs.  (We've had reports of maybe two or three such devices,
all pretty recent.)

Such devices are nonconformant.  The proper fix is have the vendors
of those devices do the simple, obvious, and correct thing ... which
will let them be used with USB hosts that don't have workarounds for
this particular vendor bug.  But unless/until they do, we can at least
have one of the high speed HCDs work with such buggy devices.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoUSB: ohci: port reset paranoia timeout
David Brownell [Sat, 2 Feb 2008 10:42:52 +0000 (02:42 -0800)]
USB: ohci: port reset paranoia timeout

This limits how long the OHCI port reset loop waits for the hardware
to do its job, if the controller either (a) dies, or (b) can't finish
the reset.  Such limits are always a good idea.

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