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.
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>
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.
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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.
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.
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>
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>
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>
David Brownell [Fri, 1 Feb 2008 19:42:05 +0000 (11:42 -0800)]
USB: ehci: minor cleanups
Minor cleanups to the EHCI code: revision history is what source
code repositories should have. Switch to a more standard way to
kick in verbose debugging -- don't be EHCI-specific.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
David Brownell [Sun, 10 Feb 2008 20:24:00 +0000 (12:24 -0800)]
USB: defines for USB "Link Power Management" (LPM) ECN
There's a new PM-related change notice for the USB 2.0 specification
called "Link Power Management" (LPM). It defines a new "L1 Suspend"
state which resembles the current (L2) suspend state, except that it
can be entered and exited much more quickly. It should thus be more
useful for runtime PM, even though it doesn't mandate reduced power
draw from VBUS.
This patch provides the relevant #defines for usbcore. Actually
implementing these mechanisms requires host silicon that can generate
new USB packets, plus hubs handling some new requests and peripherals
which understand the new packets.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Pavel Emelyanov [Mon, 11 Feb 2008 12:26:09 +0000 (15:26 +0300)]
USB: usbatm: convert heavy init dances to kthread API
This is an attempt to kill two birds with one stone.
First, we kill one more user of kernel_thread, which is scheduled
for removal. Second - we kill one of the last users of kill_proc -
the function which is also to be removed, because it uses a pid_t
which is not safe now.
Adrian Bunk [Tue, 5 Feb 2008 07:57:45 +0000 (23:57 -0800)]
USB: make USB_STORAGE_ONETOUCH available with PM
As Torsten Kaiser pointed out, it seems the dependency of
USB_STORAGE_ONETOUCH on !PM should have been removed in commit 7931e1c6f8007d5fef8a0bb2dc71bd97315eeae9.
Signed-off-by: Adrian Bunk <bunk@kernel.org> Cc: Matthew Dharm <mdharm-usb@one-eyed-alien.net> Cc: Alan Stern <stern@rowland.harvard.edu> Cc: Greg Kroah-Hartman <gregkh@suse.de> Cc: Torsten Kaiser <just.for.lkml@googlemail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Daniel Walker [Tue, 5 Feb 2008 07:57:42 +0000 (23:57 -0800)]
USB: libusual: locking cleanup
I converted the usu_init_notify semaphore to normal mutex usage, and it
should still prevent the request_module before the init routine is
complete. Before it acted more like a complete, now the mutex protects two
distinct section from running at the same time.
Signed-off-by: Daniel Walker <dwalker@mvista.com> Cc: Pete Zaitcev <zaitcev@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Alan Stern [Thu, 6 Mar 2008 16:04:13 +0000 (11:04 -0500)]
USB: enable USB-PERSIST by default
This patch (as1052) enables USB-PERSIST for all devices by default.
The user won't have to remember to enable it explicitly for devices
containing mounted filesystems.
Eventually userspace tools like hal may be able to set the persist
attribute automatically when a filesystem is mounted on a USB device.
When that time comes this patch can be reverted, if people think it
matters.
This approach has the advantage of giving the user the ability to turn
off USB-PERSIST for devices with mounted filesystems, rather than
making the kernel always assume it should be on.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Alan Stern [Mon, 3 Mar 2008 20:16:04 +0000 (15:16 -0500)]
USB: check serial-number string after device reset
This patch (as1048) extends the descriptor checking after a device is
reset. Now the SerialNumber string descriptor is compared to its old
value, in addition to the device and configuration descriptors.
As a consequence, the kmalloc() call in usb_string() is now on the
error-handling pathway for usb-storage. Hence its allocation type is
changed to GFO_NOIO.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Alan Stern [Mon, 3 Mar 2008 20:15:59 +0000 (15:15 -0500)]
USB: remove CONFIG_USB_PERSIST setting
This patch (as1047) removes the USB_PERSIST Kconfig option, enabling
it permanently. It also prevents the power/persist attribute from
being created for hub devices; there's no point in having it since
USB-PERSIST is always turned on for hubs.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Alan Stern [Mon, 3 Mar 2008 20:15:51 +0000 (15:15 -0500)]
USB: make USB-PERSIST work after every system sleep
This patch (as1046) makes USB-PERSIST work more in accordance with
the documentation. Currently it takes effect only in cases where the
root hub has lost power or been reset, but it is supposed to operate
whenever a power session was dropped during a system sleep.
A new hub_restart() routine carries out the duties required during a
reset or a reset-resume. It checks to see whether occupied ports are
still enabled, and if they aren't then it clears the enable-change and
connect-change features (to prevent interference by khubd) and sets
the child device's reset_resume flag. It also checks ports that are
supposed to be unoccupied to verify that the firmware hasn't left the
port in an enabled state.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Alan Stern [Mon, 3 Mar 2008 20:15:43 +0000 (15:15 -0500)]
USB: reorganize code in hub.c
This patch (as1045) reorganizes some code in the hub driver.
hub_port_status() is moved earlier in the file, and a new hub_stop()
routine is created to do the work currently in hub_preset() (i.e.,
disconnect all child devices and quiesce the hub).
There are no functional changes.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Alan Stern [Mon, 3 Mar 2008 20:15:36 +0000 (15:15 -0500)]
USB: EHCI: carry out port handover during each root-hub resume
This patch (as1044) causes EHCI port handover for non-high-speed
devices to occur during every root-hub resume, not just in cases where
the controller lost power or was reset. This is necessary because:
When some machines go into suspend, they remove power from
on-board USB devices while retaining suspend current for USB
controllers.
The user might well unplug a USB device while the system is
suspended and then plug it back in before resuming.
A corresponding change is made to the core resume routine; now
high-speed root hubs will always be resumed when the system wakes up,
even if they were suspended before the system went to sleep. If this
weren't done then EHCI port handover wouldn't work, since it is called
when the EHCI root hub is resumed.
Finally, a comment is added to the hub driver explaining the khubd has
to be freezable; if it weren't frozen then it could interfere with
port handover.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Commit 2be621498d461b63ca6124f86e3b9582e1a8e722 ("x86: dma-ops on highmem
fix") in Linus' tree introduced a new warning (noticed in the x86_64
allmodconfig build of linux-next):
drivers/pci/intel-iommu.c:2240: warning: initialization from incompatible pointer type
Which points at an instance of map_single that needs updating.
* git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6:
[CIFS] Fix typo in previous commit
[CIFS] Fix define for new proxy cap to match documentation
[CIFS] Fix UNC path prefix on QueryUnixPathInfo to have correct slash
[CIFS] Reserve new proxy cap for WAFS
[CIFS] Add various missing flags and defintions
[CIFS] make cifs_dfs_automount_list_static
[CIFS] Fix oops when slow oplock process races with unmount
[CIFS] Fix acl length when very short ACL being modified by chmod
[CIFS] Fix looping on reconnect to Samba when unexpected tree connect fail on reconnect
[CIFS] minor update to change log
Signed-off-by: Sebastian Siewior <sebastian@breakpoint.cc> Cc: David S. Miller <davem@davemloft.net> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* git://git.linux-nfs.org/projects/trondmy/nfs-2.6: (80 commits)
SUNRPC: Invalidate the RPCSEC_GSS session if the server dropped the request
make nfs_automount_list static
NFS: remove duplicate flags assignment from nfs_validate_mount_data
NFS - fix potential NULL pointer dereference v2
SUNRPC: Don't change the RPCSEC_GSS context on a credential that is in use
SUNRPC: Fix a race in gss_refresh_upcall()
SUNRPC: Don't disconnect more than once if retransmitting NFSv4 requests
SUNRPC: Remove the unused export of xprt_force_disconnect
SUNRPC: remove XS_SENDMSG_RETRY
SUNRPC: Protect creds against early garbage collection
NFSv4: Attempt to use machine credentials in SETCLIENTID calls
NFSv4: Reintroduce machine creds
NFSv4: Don't use cred->cr_ops->cr_name in nfs4_proc_setclientid()
nfs: fix printout of multiword bitfields
nfs: return negative error value from nfs{,4}_stat_to_errno
NLM/lockd: Ensure client locking calls use correct credentials
NFS: Remove the buggy lock-if-signalled case from do_setlk()
NLM/lockd: Fix a race when cancelling a blocking lock
NLM/lockd: Ensure that nlmclnt_cancel() returns results of the CANCEL call
NLM: Remove the signal masking in nlmclnt_proc/nlmclnt_cancel
...
Merge branch 'for-linus' of git://linux-nfs.org/~bfields/linux
* 'for-linus' of git://linux-nfs.org/~bfields/linux: (52 commits)
knfsd: clear both setuid and setgid whenever a chown is done
knfsd: get rid of imode variable in nfsd_setattr
SUNRPC: Use unsigned loop and array index in svc_init_buffer()
SUNRPC: Use unsigned index when looping over arrays
SUNRPC: Update RPC server's TCP record marker decoder
SUNRPC: RPC server still uses 2.4 method for disabling TCP Nagle
NLM: don't let lockd exit on unexpected svc_recv errors (try #2)
NFS: don't let nfs_callback_svc exit on unexpected svc_recv errors (try #2)
Use a zero sized array for raw field in struct fid
nfsd: use static memory for callback program and stats
SUNRPC: remove svc_create_thread()
nfsd: fix comment
lockd: Fix stale nlmsvc_unlink_block comment
NFSD: Strip __KERNEL__ testing from unexported header files.
sunrpc: make token header values less confusing
gss_krb5: consistently use unsigned for seqnum
NFSD: Remove NFSv4 dependency on NFSv3
SUNRPC: Remove PROC_FS dependency
NFSD: Use "depends on" for PROC_FS dependency
nfsd: move most of fh_verify to separate function
...
* git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/v4l-dvb: (452 commits)
V4L/DVB (7731): tuner-xc2028: fix signal strength calculus
V4L/DVB (7730): tuner-xc2028: Fix SCODE load for MTS firmwares
V4L/DVB (7729): Fix VIDIOCGAP corruption in ivtv
V4L/DVB (7728): tea5761: bugzilla #10462: tea5761 autodetection code were broken
V4L/DVB (7726): cx23885: Enable cx23417 support on the HVR1800
V4L/DVB (7725): cx23885: Add generic cx23417 hardware encoder support
V4L/DVB (7723): pvrusb2: Clean up input selection list generation in V4L interface
V4L/DVB (7722): pvrusb2: Implement FM radio support for Gotview USB2.0 DVD 2
V4L/DVB (7721): pvrusb2: Restructure cx23416 firmware loading to have a common exit point
V4L/DVB (7720): pvrusb2: Fix bad error code on cx23416 firmware load failure
V4L/DVB (7719): pvrusb2: Implement input selection enforcement
V4L/DVB (7718): pvrusb2-dvb: update Kbuild selections
V4L/DVB (7717): pvrusb2-dvb: add DVB-T support for Hauppauge pvrusb2 model 73xxx
V4L/DVB (7716): pvrusb2: clean up global functions
V4L/DVB (7715): pvrusb2: Clean out all use of __FUNCTION__
V4L/DVB (7714): pvrusb2: Fix hang on module removal
V4L/DVB (7713): pvrusb2: Implement cleaner DVB kernel thread shutdown
V4L/DVB (7712): pvrusb2: Close connect/disconnect race
V4L/DVB (7711): pvrusb2: Fix race on module unload
V4L/DVB (7710): pvrusb2: Implement critical digital streaming quirk for onair devices
...
SUNRPC: Invalidate the RPCSEC_GSS session if the server dropped the request
RFC 2203 requires the server to drop the request if it believes the
RPCSEC_GSS context is out of sequence. The problem is that we have no way
on the client to know why the server dropped the request. In order to avoid
spinning forever trying to resend the request, the safe approach is
therefore to always invalidate the RPCSEC_GSS context on every major
timeout.
Alan Cox [Sun, 20 Apr 2008 14:27:36 +0000 (11:27 -0300)]
V4L/DVB (7729): Fix VIDIOCGAP corruption in ivtv
Frank Bennett reported that ivtv was causing skype to crash. With help
from one of their developers he showed it was a kernel problem.
VIDIOCGCAP copies a name into a fixed length buffer - ivtv uses names
that are too long and does not truncate them so corrupts a few bytes of
the app data area.
Possibly the names also want trimming but for now this should fix the
corruption case.
Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Adrian Bunk [Fri, 18 Apr 2008 08:38:56 +0000 (05:38 -0300)]
V4L/DVB (7716): pvrusb2: clean up global functions
This patch contains the following cleanups:
- make the following needlessly global function static:
- pvr2_hdw_set_cur_freq()
- #if 0 the following unused global functions:
- pvr2_hdw_get_state_name()
- pvr2_hdw_get_debug_info_unlocked()
- pvr2_hdw_get_debug_info_locked()
Signed-off-by: Adrian Bunk <bunk@kernel.org> Signed-off-by: Mike Isely <isely@pobox.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Mike Isely [Wed, 9 Apr 2008 08:44:57 +0000 (05:44 -0300)]
V4L/DVB (7715): pvrusb2: Clean out all use of __FUNCTION__
Apparently the kernel developers no longer consider it proper
etiquette to use __FUNCTION__; everyone must instead use __func__
(even though it breaks with older compilers). And worse still, actual
effort is being expended to sweep this change throughout the kernel
source tree. Don't these people have better things to do? So...
Completely clean out all use of __FUNCTION__ from the pvrusb2 driver
(it was just in the sysfs interface). I'm not going to use __func__
either. So there.
Signed-off-by: Mike Isely <isely@pobox.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Mike Isely [Wed, 9 Apr 2008 08:14:11 +0000 (05:14 -0300)]
V4L/DVB (7714): pvrusb2: Fix hang on module removal
The pvrusb2 driver was getting had by this scenario:
1. Task A calls kthread_stop() for task B.
2. Before exiting, then Task B calls kthread_stop() for task C.
The problem is, kthread_stop() wants to allocate an internal resource
to itself (i.e. acquire a lock), which won't be released until
kthread_stop() returns. But kthread_stop() won't return until task B
is dead. But task B won't die until it finishes its call to
kthread_stop() for task C, and that will block waiting on the resource
already allocated inside task A. Deadlock.
With the pvrusb2 driver, task A is the caller to pvr_exit(), task B is
the control thread run inside of pvrusb2-context.c, and task C is any
worker thread run inside of pvrusb2-hdw.c.
This problem got introduced by the previous threading setup change,
which was itself an attempt to fix a module tear-down race (which it
actually did fix). The lesson here is that a task being waited on as
part of a kthread_stop() simply cannot be allow to also issue a
kthread_stop() - or we make sure not to issue the enclosing
kthread_stop() until we know that the inner kthread_stop() has
completed first. The solution for the pvrusb2 driver is some hackish
code which changes the main control thread tear down into a two step
process. This then makes it possible to delay issuing the
kthread_stop() on the control thread until after we know that
everything has been torn down first. (And yes, we really need that
kthread_stop() because it's the only way to safely guarantee that a
module-referencing kernel thread has safely returned back out of the
module before we finally remove the module.)
Signed-off-by: Mike Isely <isely@pobox.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Earlier fix to handle DVB feed thread aborts was overly-aggressive.
We can take better advantage of what kthread_stop() can do. This
change simplifies things.
Signed-off-by: Mike Isely <isely@pobox.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Mike Isely [Mon, 7 Apr 2008 05:22:43 +0000 (02:22 -0300)]
V4L/DVB (7712): pvrusb2: Close connect/disconnect race
If a disconnect happens before initialization is completed, the
pvrusb2 driver can accidentally touch dangling pointers. The whole
initialization function must be protected by the big_lock, and once
inside that lock, the initialization function should abort if it is
discovered that a disconnect has already taken place.
Signed-off-by: Mike Isely <isely@pobox.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Mike Isely [Mon, 7 Apr 2008 05:22:04 +0000 (02:22 -0300)]
V4L/DVB (7711): pvrusb2: Fix race on module unload
The pvrusb2 driver - for basically forever - was not enforcing a
proper module tear-down. Kernel threads are used inside the driver
and all must be gone before the module can be safely removed. This
changeset reimplements a chunk of pvrusb2-context.c to enforce this
correctly. Unfortunately this is not a simple fix. The new
implementation also cuts back on kernel thread usage; instead of there
being 1 control thread per instance now it's just 1 control thread
shared by all instances. (By dropping to a single thread then the
module exit function can block on its shutdown and the thread itself
can monitor and cleanly shut down all of the other instances first.)
Signed-off-by: Mike Isely <isely@pobox.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Mike Isely [Sun, 6 Apr 2008 07:04:35 +0000 (04:04 -0300)]
V4L/DVB (7710): pvrusb2: Implement critical digital streaming quirk for onair devices
Implement timed measurement of encoder operation for the first time it
is run. This allows the driver to note when the encoder has been run
successfully for at least 1/4 second. On top of that implement
various bits to ensure that the encoder has been run once before
digital streaming for OnAir devices. This is done via several core
state machine tweaks.
Signed-off-by: Mike Isely <isely@pobox.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Mike Isely [Thu, 3 Apr 2008 07:51:19 +0000 (04:51 -0300)]
V4L/DVB (7709): pvrusb2: New device attribute for encoder usage in digital mode
Some tuners seem to not work in digital mode unless the encoder is
healthy. Implement a device attribute to represent this flag and
modify the core state machines to enforce this requirement.
Signed-off-by: Mike Isely <isely@pobox.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Mike Isely [Sun, 30 Mar 2008 23:36:31 +0000 (20:36 -0300)]
V4L/DVB (7708): pvrusb2-dvb: Fix stuck thread on streaming abort
If the device fails to stream, the feed thread will block forever
waiting for buffers. But while in this state it was not looking for
an exit condition from the driver DVB interface. This caused the
thread to jam. Implement a new stop flag (which will be set
appropriately) to tell the thread to stop.
Signed-off-by: Mike Isely <isely@pobox.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Mike Isely [Fri, 28 Mar 2008 08:43:45 +0000 (05:43 -0300)]
V4L/DVB (7704): pvrusb2: Fix slop involving use of struct which might not be defined
When the DVB interface is not compiled, the pvr2_dvb_props struct is
not available - so it really should be ifdef'ed out as well. This
didn't cause an error because in this context its usage was as an
opaque pointer. But it really shouldn't be present at all if DVB is
not enabled.
Signed-off-by: Mike Isely <isely@pobox.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Mike Isely [Fri, 28 Mar 2008 08:41:19 +0000 (05:41 -0300)]
V4L/DVB (7702): pvrusb2: Rework USB streaming start/stop execution
The commands to start / stop USB streaming for an analog device are
fairly standard, owing to the fact that all supported devices
apparently started from the same common reference design. However
with digital mode, the commands seem to vary by vendor. This change
makes that variance more explicit. It also cleans up a related
problem for OnAir devices which prevented digital mode from working at
all.
Signed-off-by: Mike Isely <isely@pobox.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Mike Isely [Fri, 28 Mar 2008 08:38:54 +0000 (05:38 -0300)]
V4L/DVB (7701): pvrusb2: Centralize handling of simple FX2 commands
Numerous places in the driver need to issue simple commands to the FX2
microcontroller (e.g. only 1 or 2 bytes, no reply needed). Previously
each place that did this, had to take lock, set up a central buffer,
and call the function to perform the handshake. This change puts
these steps into a single spot. This also has the effect of removing
the need to mess with the control lock from numerous places in the
code.
Signed-off-by: Mike Isely <isely@pobox.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Mike Isely [Fri, 28 Mar 2008 08:34:45 +0000 (05:34 -0300)]
V4L/DVB (7699): pvrusb2: Implement statistics for USB I/O performance / tracking
Implement a mechanism in the pvrusb2 driver for gathering statistics
on the stream buffering, including bytes transferred, buffers handled,
buffers in flight, etc. This is useful for debugging certain classes
of streaming issues and for determining if the buffer pool size is
generally correct for the driver.
Signed-off-by: Mike Isely <isely@pobox.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>