Oliver Neukum [Thu, 20 Dec 2007 11:23:03 +0000 (12:23 +0100)]
USB: fix NULL pointer dereference on drivers/usb/serial/whiteheat.c
Am Sonntag, 16. Dezember 2007 05:23:47 schrieb Andrew Morton:
> On Sat, 15 Dec 2007 07:08:52 -0800 (PST) bugme-daemon@bugzilla.kernel.org wrote:
>
> > http://bugzilla.kernel.org/show_bug.cgi?id=9573
> > There's a null pointer dereference on drivers/usb/serial/whiteheat.c as
> > follows:
> >
> > (1) line 613: the test "if (port->tty)" implies that null is a legal value
> > for "port->tty" at that point
> >
> > (2) neither firm_open nor firm_purge initialize "port->tty"
drivers/usb/serial/usb-serial::serial_open() sets port->tty
The check for NULL is bogus. This patch removes the check.
Signed-off-by: Oliver Neukum <oneukum@suse.de> Acked-by: Alan Cox <alan@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
David Brownell [Wed, 19 Dec 2007 19:30:39 +0000 (11:30 -0800)]
USB: ehci potential oops fix on ARC/TDI cores
Kernel bugzilla entry #9569 reports a potential OOPS in some code
supporting the integrated root hub TT support used on ARC/TDI
derived cores. (This seems to have been a longstanding issue.)
This patch cleans up usage of urb->dev->tt to avoid that potential
oops and also fixes some overly long lines.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Marcin Slusarz [Sun, 16 Dec 2007 02:25:13 +0000 (03:25 +0100)]
USB: ehci-hcd: fix sparse warning about shadowing 'status' symbol
fix warning:
drivers/usb/host/ehci-hcd.c:832:8: warning: symbol 'status' shadows an earlier one
drivers/usb/host/ehci-hcd.c:790:71: originally declared here
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fix warnings:
drivers/usb/storage/initializers.c:83:26: warning: incorrect type in argument 5 (different signedness)
drivers/usb/storage/initializers.c:83:26: expected unsigned int *act_len
drivers/usb/storage/initializers.c:83:26: got int *<noident>
drivers/usb/storage/initializers.c:89:26: warning: incorrect type in argument 5 (different signedness)
drivers/usb/storage/initializers.c:89:26: expected unsigned int *act_len
drivers/usb/storage/initializers.c:89:26: got int *<noident>
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
David Brownell [Mon, 17 Dec 2007 06:37:40 +0000 (22:37 -0800)]
USB: PS3: Fix EHCI ISO transfer bug
This adds a workaround for an issue reported with ISO transfers
on some EHCI controllers, most recently with VIA KT800 and PS3
EHCI silicon.
The issue is that the silicon doesn't necessarily seem to be done
using ISO DMA descriptors (itd, sitd) when it marks them inactive.
(One theory is that the ill-defined mechanism where hardware caches
periodic transfer descriptors isn't invalidating their state...)
With such silicon, quick re-use of those descriptors makes trouble.
Waiting until the next frame seems to be a sufficient workaround.
This patch ensures that the relevant descriptors aren't available
for immediate re-use. It does so by not recycling them until after
issuing the completion callback which would reuse them by enqueueing
an URB and thus (re)allocating ISO DMA descriptors.
Some boards (like e.g. Tosa) invert the VBUS-detection signal:
it's low when a host is supplying VBUS, and high otherwise.
Allow specifying whether gpio_vbus value is inverted.
Sarah Sharp [Fri, 14 Dec 2007 22:08:35 +0000 (14:08 -0800)]
USB: pl2303: Move pl2303 vendor specific init to probe function.
Without this fix, the pl2303 usb-serial adapter would not suspend properly
unless it had been opened first. A pl2303 type_1 chip will still break if the
system is hibernated while the RS-232 connector is powered by another system.
This was broken before, and a reset resume does not fix it. All other suspend
and autosuspend scenarios work with ATEN pl2303 adaptors with HX and type_1 chips.
Signed-off-by: Sarah Sharp <saharabeara@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Alan Stern [Tue, 11 Dec 2007 21:05:30 +0000 (16:05 -0500)]
USB: EHCI: add separate IAA watchdog timer
This patch (as1028) was mostly written by David Brownell; I made only
a few changes (extra log info and a small bug fix -- which might
account for why David's version had to be reverted). It adds a new
watchdog timer to the ehci-hcd driver to be used exclusively for
detecting lost or missing IAA notifications.
Previously a shared timer had been used, which may have led to some
problems as reported by Christian Hoffmann.
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>
Alan Stern [Tue, 4 Dec 2007 19:35:15 +0000 (14:35 -0500)]
USB: add usbfs stubs for suspend and resume
This patch (as1022b) adds stub methods for suspend and resume to the
usbfs driver. There isn't much they can do since there's no way to
inform a user task about the events. But it's important to have the
stubs, because an upcoming change to usbcore will automatically unbind
drivers that don't have those methods when a suspend occurs.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Alan Stern [Mon, 3 Dec 2007 20:44:29 +0000 (15:44 -0500)]
USB: updates to usb_reset_composite_device()
This patch (as1023) updates the code in usb_reset_composite_device():
Some local variable declarations are moved to inner loops.
The interface locks are not acquired. This isn't necessary
any more; its only reason was to prevent an interface from
being suspended or resumed during the reset. But now
interface power management is controlled by the USB device
lock, not by the interface lock.
The check for whether the interface is registered is removed.
There doesn't seem to be any reason for checking; a driver
for a non-registered interface deserves to be informed of
device resets just as much as any other.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Alan Stern [Mon, 3 Dec 2007 20:42:10 +0000 (15:42 -0500)]
USB: repair USBDEVFS_CONNECT ioctl
For as long as I've known about it, the USBDEVFS_CONNECT ioctl hasn't
done what it's supposed to. The current code reprobes _all_ the
unbound USB interfaces; this patch (as1021) makes it reprobe only the
interface for which it was called.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
usb: Remove OHCI useless masking/unmasking of WDH interrupt
The OHCI driver's IRQ handler, while processing a WDH interrupt, masks
and unmasks it. I believe this is both broken (the write may still be
posted during the donelist processing it's trying to safeguard) and
useless as this IRQ may not be reissued until it's acked (unless this
legacy code is an uncommented workaround for some chip erratum).
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Tony Jones [Tue, 11 Sep 2007 21:07:31 +0000 (14:07 -0700)]
USB: convert ehci debug files to use debugfs instead of sysfs
We should not have multiple line files in sysfs, this moves the data to
debugfs instead, like the UHCI driver.
Signed-off-by: Tony Jones <tonyj@suse.de> Cc: Kay Sievers <kay.sievers@vrfy.org> Cc: David Brownell <david-b@pacbell.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Tony Jones [Tue, 11 Sep 2007 21:07:31 +0000 (14:07 -0700)]
USB: convert ohci debug files to use debugfs instead of sysfs
We should not have multiple line files in sysfs, this moves the data to
debugfs instead, like the UHCI driver.
Signed-off-by: Tony Jones <tonyj@suse.de> Cc: Kay Sievers <kay.sievers@vrfy.org> Cc: David Brownell <david-b@pacbell.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
USB: always announce a device has been added to the system
Distros (like SuSE) want to know this information, to make it easier
to handle support issues. Might as well let everyone benefit from this.
This is also enabled whenever CONFIG_USB_DEBUG is enabled, to help with
debugging.
Alan Stern [Tue, 20 Nov 2007 21:28:55 +0000 (16:28 -0500)]
USB: dummy_hcd: don't register drivers on the platform bus
This patch (as1017) makes dummy_hcd behave more like the other USB
peripheral controller drivers by no longer registering its
gadget driver on the platform bus. Doing that has always been a
mistake, since a usb_gadget_driver isn't a platform_driver. Instead
the gadget driver is left unregistered in sysfs.
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>
Patrik Sevallius [Tue, 20 Nov 2007 17:32:00 +0000 (09:32 -0800)]
USB: usb peripheral controller driver oops avoidance
I'm having problem with oopses when rebooting, if I modprobe g_serial
and rmmod g_serial and do a reboot I get an oops in device_shutdown().
The reason seems to be that usb_gadget_unregister_driver() doesn't do
enough cleanup. With this at91_udc patch I don't get the oops.
Signed-off-by: Patrik Sevallius <patrik.sevallius@enea.com>
[ Same bug was in other peripheral controller drivers; fixed ] Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Sarah Sharp [Wed, 14 Nov 2007 01:10:09 +0000 (17:10 -0800)]
USB: Prepare serial core for autosuspend.
Claim the interface for a USB to serial converter when the tty is open,
and release the interface when the tty is closed.
If a driver doesn't provide a resume function, use the generic resume
instead.
Make sure the generic resume function does not submit the URBs if we're
coming back from autosuspend. On autoresume, we know that the open
function will be called next, which will attempt to submit the URBs. If
we submit them in the resume function, the open will fail.
This works for:
- autosuspend
- suspending with the tty open or closed
- hibernate with the tty closed
A hibernate (or a suspend that causes the USB subsystem to lose power)
has issues. If you have the tty open when you hibernate, a new tty will
be created when the device re-enumerates during resume.
Signed-off-by: Sarah Sharp <sarah.a.sharp@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
David Brownell [Mon, 19 Nov 2007 20:58:36 +0000 (12:58 -0800)]
USB: gadget code switches to pr_err() and friends
We now have pr_err(), pr_warning(), and friends ... start using
them in the gadget stack instead of printk(KERN_ERR) and friends.
This gives us shorter lines and somewhat increased readability.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Alan Stern [Mon, 19 Nov 2007 20:57:45 +0000 (15:57 -0500)]
USB: don't change HC power state for a FREEZE
This patch (as1016) prevents PCI-based host controllers from
undergoing a power-state change during a FREEZE or a PRETHAW. Such
changes are needed only during a SUSPEND.
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>
Alan Stern [Mon, 19 Nov 2007 15:15:02 +0000 (10:15 -0500)]
USB: make ksuspend_usbd thread non-freezable
This patch (as1012b) makes the ksuspend_usbd kernel thread
non-freezable. Since the PM core has been changed to lock all devices
during a system sleep, the thread no longer needs to be frozen. It
won't interfere with a system sleep because before trying to resume a
root hub device, it acquires the device's lock.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Aristeu Rozanski [Tue, 13 Nov 2007 22:22:07 +0000 (17:22 -0500)]
USB: usb_serial_console: allocate fake tty and termios before calling driver open() method
The usb serial method set_termios() is called for the first time from
open() method in order to set up the termios structure with the default
device's settings, ignoring the current settings. Once it's initialized,
the next set_termios() calls will update the device with the
tty->termios settings.
Currently USB serial console code calls the driver open() method without
a tty and after that will allocate a fake tty and termios so the command
line arguments can be applied to the device
(console=ttyUSB0,115200,...). This makes the driver overwrite the
termios with the default settings and not applying the command line
options.
This patch changes usb_console_setup() to allocate the fake tty and
termios before the open() method is called.
Aristeu Rozanski [Mon, 12 Nov 2007 20:15:02 +0000 (15:15 -0500)]
USB: usb_serial: clean tty reference in the last close
When a usb serial adapter is used as console, the usb serial console
driver bumps the open_count on the port struct used but doesn't attach
a real tty to it (only a fake one temporaly). If this port is opened later
using the regular character device interface, the open method won't
initialize the port, which is the expected, and will receive a brand new
tty struct created by tty layer, which will be stored in port->tty.
When the last close is issued, open_count won't be 0 because of the
console usage and the port->tty will still contain the old tty value. This
is the last ttyUSB<n> close so the allocated tty will be freed by the
tty layer. The usb_serial and usb_serial_port are still in use by the
console, so port_free() won't be called (serial_close() ->
usb_serial_put() -> destroy_serial() -> port_free()), so the scheduled
work (port->work, usb_serial_port_work()) will still run. And
usb_serial_port_work() does:
(...)
tty = port->tty;
if (!tty)
return;
Craig W. Nadler [Sun, 11 Nov 2007 23:00:15 +0000 (15:00 -0800)]
USB: add Printer Gadget Driver
G_PRINTER: Adds a USB printer gadget driver for use in printer firmware.
This adds a USB printer gadget driver for use in printer firmware.
The printer gadget channels data between the USB host and a userspace
program driving the print engine. The user space program reads and
writes the device file /dev/g_printer to receive or send printer data.
It can use ioctl calls to the device file to get or set printer status.
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>
Alan Stern [Thu, 8 Nov 2007 20:15:28 +0000 (15:15 -0500)]
USB: usb-storage: new "lockable" subclass 0x07
This patch (as1011) adds a #define for the newly-created Lockable
(i.e., password-protected) subclass 0x07 for USB mass-storage devices.
The private ISD200 entry (which had been mapped to subclass 0x07) is
moved to 0xf0, which is unlikely to conflict with any official
subclass designation.
The US_SC_MIN and US_SC_MAX constants aren't used anywhere, so the
patch removes them.
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>
Kyungmin Park [Wed, 21 Nov 2007 23:13:15 +0000 (15:13 -0800)]
USB: device DMA support on OMAP2
The current omap udc dosen't support the DMA mode and it has some problem
at setup time on OMAP2 with previous patch file. I found that the code
assumes bulk out required the big data transfer. But MODE SELECT(6) sent
the only 24 bytes. it makes a problem. So I implement the small packets
handling for it.
It is tested with both linux and windows.
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Cc: David Brownell <david-b@pacbell.net> Cc: Tony Lindgren <tony@atomide.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
USB: sis FB driver: *_ioctl32_conversion functions do not exist in recent kernels
Remove dead code while at it.
Signed-off-by: Fernando Luis Vazquez Cao <fernando@oss.ntt.co.jp> Cc: Thomas Winischhofer <thomas@winischhofer.net> Cc: Greg KH <greg@kroah.com> Cc: "Antonino A. Daplas" <adaplas@pol.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* add ATA_REG_{ERROR,LCYL,HCYL,STATUS}_OFFSET defines and use them
instead of IDE_{ERROR,LCYL,HCYL,STATUS}_OFFSET from <linux/ide.h>
* remove no longer needed <linux/ide.h> include
* remove incorrect comment added by the last commit:
- isd200.c is not the only user of struct hd_driveid besides IDE
(see drivers/block/xsysace.c and arch/um/drivers/ubd_kern.c)
Some crazy devices in the wild have a vendor id of 0x0000. If we try to
add a module alias with this id, we just can't do it due to a check in
the file2alias.c file. Change the test to verify that both the vendor
and product ids are 0x0000 to show a real "blank" module alias.
Note, the module-init-tools package also needs to be changed to properly
generate the depmod tables.
Cc: Janusz <janumix@poczta.fm> Cc: stable <stable@kernel.org> Cc: Jon Masters <jcm@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Grant Grundler [Thu, 24 Jan 2008 05:31:03 +0000 (21:31 -0800)]
USB: storage: Add unusual_dev for HP r707
Add "FIX_CAPACITY" entry for HP Photosmart r707 Camera in "Disk" mode.
Camera will wedge when /lib/udev/vol_id attempts to access the last sector,
EIO gets reported to dmesg, and block device is marked "offline" (it is).
Reproduced vol_id behavior with:
"dd if=/dev/sda of=/dev/null skip=60800 count=1"
Cc: stable <stable@kernel.org> Signed-off-by: Grant Grundler <grundler@parisc-linux.org> Signed-off-by: Phil Dibowitz <phil@ipom.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Nate Carlson [Thu, 24 Jan 2008 18:45:07 +0000 (12:45 -0600)]
USB: Variant of the Dell Wireless 5520 driver
I've got a Dell wireless 5520 card with a different USB ID - specifically, 8136
instead of 8137. Attached a small patch to add support, and the output of an
'ati3'.
If we could get this in, that'd be sweet. ;) Thanks!
Peter Stark [Tue, 25 Dec 2007 17:32:08 +0000 (18:32 +0100)]
USB: ftdi_sio - enabling multiple ELV devices, adding EM1010PC
I work with a group of people on a free home automation tool called
FHEM. Some of the users own more than one USB-serial device by ELV. The
ftdi_sio driver has most of the ELV devices disabled by default and
needs to be re-enabled every time you get a new kernel. Additionally a
new device (EM 1010 PC - enegry monitor) is missing in the list.
Currently our users have to follow the instructions we provide at
http://www.koeniglich.de/fhem/linux.html ... However, to some users it
is too complicated to compile their own kernel module.
We are aware that you can specify one additional device using the
vendor/product option of the module. But lot's of users own more than
one device.
Cc: stable <stable@kernel.org> Signed-off-by: Peter Stark <peter.stark@t-online.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Damien Stuart [Sun, 6 Jan 2008 18:51:39 +0000 (13:51 -0500)]
USB: Adding YC Cable USB Serial device to pl2303
This simply adds the "YC Cable" as a vendor and its pl2303-based
USB<->Serial adapter as a product. This particular adapter is sold by
Radio Shack. I've done limited testing on a few different systems with
no issues.
Alan Cox [Thu, 3 Jan 2008 16:59:04 +0000 (16:59 +0000)]
USB: keyspan: Fix oops
If we get a data URB back from the hardware after we have put the tty to
bed we go kaboom. Fortunately all we need to do is process the URB
without trying to ram its contents down the throat of an ex-tty.
Linus Torvalds [Fri, 1 Feb 2008 10:48:45 +0000 (21:48 +1100)]
Merge branch 'for-linus' of git://git.kernel.dk/linux-2.6-block
* 'for-linus' of git://git.kernel.dk/linux-2.6-block:
block: kill swap_io_context()
as-iosched: fix inconsistent ioc->lock context
ide-cd: fix leftover data BUG
block: make elevator lib checkpatch compliant
cfq-iosched: make checkpatch compliant
block: make core bits checkpatch compliant
block: new end request handling interface should take unsigned byte counts
unexport add_disk_randomness
block/sunvdc.c:print_version() must be __devinit
splice: always updated atime in direct splice
Greg Ungerer [Fri, 1 Feb 2008 07:38:24 +0000 (17:38 +1000)]
m68knommu: fix 528x ColdFire cache settings
Fix problems with the 528x ColdFire CPU cache setup.
Do not cache the flash region (if present), and make the runtime
settings consistent with the init setting.
Problems pointed out by Bernd Buttner <b.buettner@mkc-gmbh.de>
Greg Ungerer [Fri, 1 Feb 2008 07:38:03 +0000 (17:38 +1000)]
m68knommu: create common DMA table for ColdFire CPUs
Move the ColdFire DMA address table into its own file, and out
of each of the different CPU config files. No need to have a copy
of it in each of the config setup files.
Greg Ungerer [Fri, 1 Feb 2008 07:37:56 +0000 (17:37 +1000)]
m68knommu: modify Makefiles to support common coldfire directory
Modify Makefiles to support separate coldfire platform directory.
Currently the common ColdFire CPU family code sits in the
arch/m68knommu/platform/5307 directory. This is confusing, the files
containing this common code are in no way specific to the 5307 ColdFire.
Create an arch/m68knommu/platform/coldfire directory to contain this
common code. Other m68knommu CPU varients do not need use this code
though, so it doesn't make sense to move it to arch/m68knommu/kernel.
Greg Ungerer [Fri, 1 Feb 2008 07:37:46 +0000 (17:37 +1000)]
m68knommu: move ColdFire vectors.c to its own coldfire directory
Move common ColdFire CPU vectors.c to common coldfire platform directory.
Currently the common ColdFire CPU family code sits in the
arch/m68knommu/platform/5307 directory. This is confusing, the files
containing this common code are in no way specific to the 5307 ColdFire.
Create an arch/m68knommu/platform/coldfire directory to contain this
common code. Other m68knommu CPU varients do not need use this code
though, so it doesn't make sense to move it to arch/m68knommu/kernel.
Greg Ungerer [Fri, 1 Feb 2008 07:37:39 +0000 (17:37 +1000)]
m68knommu: move ColdFire timers.c to its own coldfire directory
Move common ColdFire CPU timers.c to common coldfire platform directory.
Currently the common ColdFire CPU family code sits in the
arch/m68knommu/platform/5307 directory. This is confusing, the files
containing this common code are in no way specific to the 5307 ColdFire.
Create an arch/m68knommu/platform/coldfire directory to contain this
common code. Other m68knommu CPU varients do not need use this code
though, so it doesn't make sense to move it to arch/m68knommu/kernel.