We dereference "ov" unconditionally throughout the function so there is
no way it can be NULL here. This code has been around for ages so if
it were possible for "ov" to be NULL someone would have complained.
Signed-off-by: Dan Carpenter <error27@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Dan Carpenter [Wed, 5 May 2010 05:58:18 +0000 (02:58 -0300)]
V4L/DVB: dvb/stv6110x: cleanup error handling
The "stv6110x" is NULL so we can just return directly without calling
kfree(). Also I changed the printk() to make checkpatch.pl happy.
Signed-off-by: Dan Carpenter <error27@gmail.com> Reviewed-by: Manu Abraham <manu@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
V4L/DVB: ngene: start separating out DVB functions into separate file
Start moving the dvb specific code to ngene-dvb.c. Note that there is still
stuff in ngene-core.c which could potentially be moved out, but it will require
considerable reworking of the logic in order to continue to properly support
DVB while also being able to support transport streams coming from analog MPEG
encoders.
V4L/DVB: ngene: split out card specific code into a separate file
Split out the card profiles into a new file called ngene-cards.c. This is
part of a larger refactoring of the driver in preparation for adding analog
support.
Note that this patch makes *no* functional change - all I did was cut/paste the
code and add the function prototypes to ngene.h as needed.
V4L/DVB: ngene: split out i2c code into a separate file
Split out the i2c related code from the ngene-core.c into a new file called
ngene-i2c.c. This is part of a larger refactoring of the driver in preparation
for adding analog support.
Note that this patch makes *no* functional change - all I did was cut/paste the
code and add the function prototypes to ngene.h as needed.
V4L/DVB: ngene: add initial support for digital side of Avermedia m780
Add ATSC/QAM support for the Avermedia m780. Note that this patch does
not include any analog support for the board, as the ngene bridge driver does
not yet have analog implemented
V4L/DVB: ngene: properly support boards where channel 0 isn't a TS input
The current code assumes that channel zero is always a TS input, which would
result in an oops if the "one_adapter" modprobe option is 1 (which it is by
default) and the board in question has something else on channel zero (which
is the case for the Avermedia m780, which has it's analog input wired to UVI1)
The code now explicitly tracks the first adapter created and ensures that
other channels cannot accidentially be associated with a NULL adapter.
Also, eliminate what appears to be a typo where all of the channel parameters
are getting associated with stream zero's properties, which will work if you
happen to have a dual stream board with the exact same configuration, but if
they differ then the second stream is going to end up with the first stream's
configuration.
Dan Carpenter [Tue, 4 May 2010 12:31:13 +0000 (09:31 -0300)]
V4L/DVB: media/az6027: handle -EIO failure
If the az6027_usb_in_op() returns a negative errno ret is -EIO and in
that case the value of b[0] may be undefined. The original code
assigned 0 to ret, but since it's already 0 now we can skip that.
Signed-off-by: Dan Carpenter <error27@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Dan Carpenter [Tue, 4 May 2010 12:14:29 +0000 (09:14 -0300)]
V4L/DVB: media/az6027: doing dma on the stack
I changed the dma buffers to use allocated memory instead of stack
memory.
The reason for this is documented in Documentation/DMA-API-HOWTO.txt
under the section: "What memory is DMA'able?" That document was only
added a couple weeks ago and there are still lots of modules which
haven't been corrected yet. Btw. Smatch includes a pretty good test to
find places which use stack memory as a dma buffer. That's how I found
these. (http://smatch.sf.net).
Signed-off-by: Dan Carpenter <error27@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Brian Johnson [Mon, 19 Apr 2010 00:42:40 +0000 (21:42 -0300)]
V4L/DVB: gspca - sn9c20x: HAS_BUTTON flag -> HAS_NO_BUTTON flag
Reverse HAS_BUTTON logic since most webcams either have a button or if
they don't don't bother to send any interrupts. However I have at least
one model that appears to leave the button GPIO floating and can send
a bogus interrupt.
Signed-off-by: Brian Johnson <brijohn@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Hans Verkuil [Sun, 2 May 2010 11:01:04 +0000 (08:01 -0300)]
V4L/DVB: hdpvr: fix disconnect sequence
Disconnecting the HDPVR caused a kernel oops if lockdep was enabled.
In addition, if an app still had video0 open and attempted to call ioctl
when the device was already disconnected the system would crash.
Move the freeing and cleanup code to the release function: that is the
right place for it since you know when you get there that nobody is
using the device.
Also removed usb_set_intfdata: v4l2_device_register sets this already
to v4l2_dev.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Hans Verkuil [Sat, 1 May 2010 11:23:07 +0000 (08:23 -0300)]
V4L/DVB: tvp7002: fix query_dv_preset
If no signal or valid format is detected, then VIDIOC_QUERY_DV_PRESET must
return 0 and set the preset to V4L2_DV_INVALID.
This driver returned an error instead.
Also simplified the kernel messages a bit: change v4l2_err to v4l2_dbg (not
detecting a signal/valid format is not an error, so only print this info when
debug == 1) and do not call v4l_fill_dv_preset_info: it's overkill to do this
just for a debug message.
Thanks to Mats Randgaard for bringing this to my attention.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Hans Verkuil [Sun, 14 Mar 2010 13:49:48 +0000 (10:49 -0300)]
V4L/DVB: cx18: support new vbi ops to set/get VBI format
Also removed the bogus zeroing of fmt.sliced when setting up raw VBI.
This should have been removed in ivtv, but it was just copied-and-pasted
into cx18.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Hans Verkuil [Sun, 14 Mar 2010 13:16:46 +0000 (10:16 -0300)]
V4L/DVB: cx25840: support new vbi ops to set/get VBI format
Also removed the bogus zeroing of fmt.sliced when setting up raw VBI.
Switching between raw and sliced VBI changed in 2.6.28 and this memset
should have been removed at that time. It was never noticed because
the bridge driver will fill in the fmt.vbi values anyway.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Hans Verkuil [Sun, 14 Mar 2010 13:02:50 +0000 (10:02 -0300)]
V4L/DVB: v4l: add new subdev vbi ops to handle raw and sliced vbi
Currently raw and sliced vbi is setup using the video g/s_fmt ops.
However, we want to split off the vbi formatting into separate ops
so the first step is to create those new ops.
The next step will be to convert subdev drivers and bridge drivers
to use the new ops. And in the final step we can start converting
the video g/s_fmt ops to the new (and more appropriate) mediabus
format ops.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Hans Verkuil [Sun, 14 Mar 2010 12:57:30 +0000 (09:57 -0300)]
V4L/DVB: v4l: move vbi-specific video ops to a new vbi ops struct
Only a relatively small number of video receivers and transmitters actually
support VBI. So start moving the vbi specific ops to an ops struct of their
own.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
V4L/DVB: uvcvideo: Flag relative controls as write-only
The UVC relative controls (exposure time, iris, focus, zoom, pan/tilt)
are write-only (despite the UVC specification stating that the GET_CUR
request is mandatory). Mark the controls as such, and report the related
V4L2 controls V4L2_CTRL_FLAG_WRITE_ONLY.
Dmitri Belimov [Tue, 4 May 2010 22:53:50 +0000 (19:53 -0300)]
V4L/DVB: Rework for support xc5000
Set correct GPIO number for BEHOLD_WANDER/VOYAGER
Add xc5000 callback function
Small rework tm6000_cards_setup function
Small rework tm6000_config_tuner, build mode_mask by config information
Rework for support xc5000 silicon tuner
Add some information messages for more better understand an errors.
videobuf_pages_to_sg() and videobuf_vmalloc_to_sg() happen to create
a scatterlist element for every page. However, this is not true for
bus addresses, so other functions shouldn't rely on the length of the
scatter list being equal to nr_pages.
V4L/DVB: videobuf-dma-sg: remove external function videobuf_dma_sync()
While analyzing one of the videobuf patches, I noticed that
videobuf_dma_sync is only used internally inside videobuf-dma-sg.
So, let's remove this function, merging the code at __videobuf_dma_sync()
V4L/DVB: Add a new ERROR flag for DQBUF after recoverable streaming errors
This flag is intended to indicate streaming errors, which might have
resulted in corrupted video data in the buffer, but the buffer can still
be reused and streaming may continue.
Setting this flag and returning 0 is different from returning EIO. The
latter should now indicate more serious (unrecoverable) errors.
This patch also solves a problem with the ioctl handling code in
vl42-ioctl.c, which does not copy buffer identification data back to the
userspace when EIO is returned, so there is no way for applications
to discover on which buffer the operation failed in such cases.
Michael Müller [Tue, 27 Apr 2010 01:18:57 +0000 (22:18 -0300)]
V4L/DVB: Add Elgato EyeTV Diversity to dibcom driver
This patch introduces support for DVB-T for the following dibcom
based card: Elgato EyeTV Diversity (USB-ID: 0fd9:0011)
Support for the Elgato silver IR remote is added too (set parameter
dvb_usb_dib0700_ir_proto=0)
[w.sang@pengutronix.de: rebased to current linuxtv-master] Signed-off-by: Michael Müller <mueller_michael@alice-dsl.net> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de> Signed-off-by: Patrick Boettcher <pboettcher@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
I have 3 IVC-200 cards (with 4 video channels on each).
2 of the cards identify theirselves as 000[0-3]:a155 (ids already in
cardlist) and another one identifies itself as 080[0-3]:a155, which ids
were unknown so far.
Istvan Varga [Sat, 27 Mar 2010 12:47:45 +0000 (09:47 -0300)]
V4L/DVB: cx88: fix setting input when using DVB
In cx88-mpeg.c, there is code that sets core->input to CX88_VMUX_DVB.
However, this may be incorrect, since core->input is actually an
index to core->board.input[], which has not enough elements to be
indexed by the value of CX88_VMUX_DVB. So, the modified code searches
core->board.input[] for an input with a type of CX88_VMUX_DVB, and if
it does not find one, the index is simply set to zero.
The change may not have much effect, though, since it appears the only
case when core->input is actually used is when the current input is
being queried.
Jarod Wilson [Fri, 30 Apr 2010 19:06:12 +0000 (16:06 -0300)]
V4L/DVB: IR/imon: add proper auto-repeat support
Simplified from version 1, in that hacks heisted from ati_remote2.c
aren't actually necessary, the real fix for too many repeats was
from setting too long a timer release value (200ms) on repeats in
mce mode -- this patch drops the release timeout to 33ms, matching
the input subsystem default input_dev->rep[REP_PERIOD].
Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Jarod Wilson [Wed, 28 Apr 2010 17:37:29 +0000 (14:37 -0300)]
V4L/DVB: IR/imon: minor change_protocol fixups
This is a follow-up to my prior patch implementing ir-core's
change_protocol functionality in the imon driver, which eliminates
a false warning when change_protocol is called without a specific
protocol selected yet (i.e., still IR_TYPE_UNKNOWN). It also removes
some extraneous blank lines getting spewn into dmesg.
Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
David Härdeman [Sat, 24 Apr 2010 21:14:00 +0000 (18:14 -0300)]
V4L/DVB: ir-core: remove IR_TYPE_PD
Pulse-distance is not a protocol, it is a line coding (used by some protocols,
like NEC). Looking at the uses of IR_TYPE_PD, the real protocol seems to be
NEC in all cases (drivers/media/video/cx88/cx88-input.c is the only user).
So, remove IR_TYPE_PD while it is still easy to do so.
Signed-off-by: David Härdeman <david@hardeman.nu> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Jarod Wilson [Fri, 23 Apr 2010 05:27:11 +0000 (02:27 -0300)]
V4L/DVB: IR/imon: convert to ir-core protocol change handling
Drop the imon driver's internal protocol definitions in favor of using
those provided by ir-core. Should make ir-keytable Just Work for
switching protocol on the fly on the imon devices that support both the
native imon remotes and mce remotes.
The imon-no-pad-stabilize pseudo-protocol was dropped as a protocol, and
converted to a separate modprobe option (which it probably should have
been in the first place). On the TODO list is to convert this to an as yet
unwritten protocol-specific options framework.
While the mce remotes obviously map to IR_TYPE_RC6, I've yet to look at
what the actual ir signals from the native imon remotes are, so for the
moment, imon native ir is mapped to IR_TYPE_OTHER. Nailing it down more
accurately is also on the TODO list.
Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Randy Dunlap <randy.dunlap@oracle.com> reported a breakage while compiling
drivers/staging/tm6000, due to this change:
commit 1c1b78bee1a94f98deeb9c24b21c4812e191646c
Author: Greg Kroah-Hartman <gregkh@suse.de>
Date: Thu Apr 29 15:46:07 2010 -0700
USB: remove unused usb_buffer_alloc and usb_buffer_free macros
Now that all callers are converted over, remove the compatibility
functions and all is good.
As the function got renamed, the rename should also be applied at
tm6000.
Acked-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
The values for the fourcc format were correct, but applied to the
wrong register. With this change, video is now barely working again with
tm6000.
While here, let's remove, for now, the memset. This way, people can
have some image when testing this device.
Yet to be fixed: parts of the image frame are missed. As we don't clean
the buffers anymore, this is "recovered" by repeating the values from a
previous frame. The quality is bad, since the image pixels will contain
data from some previous frames, generating weird delay artifacts.
V4L/DVB: tm6000: Fix a panic if buffer become NULL
Changing a video standard takes a long time to happen on tm6000, since it
needs to load another firmware, and the i2c implementation on this device
is really slow. When the driver tries to change the video standard, a
kernel panic is produced:
BUG: unable to handle kernel NULL pointer dereference at 0000000000000008
IP: [<ffffffffa0c7b48a>] tm6000_irq_callback+0x57f/0xac2 [tm6000]
...
Kernel panic - not syncing: Fatal exception in interrupt
By inspecting it with gdb:
(gdb) list *tm6000_irq_callback+0x57f
0x348a is in tm6000_irq_callback (drivers/staging/tm6000/tm6000-video.c:202).
197 /* FIXME: move to tm6000-isoc */
198 static int last_line = -2, start_line = -2, last_field = -2;
199
200 /* FIXME: this is the hardcoded window size
201 */
202 unsigned int linewidth = (*buf)->vb.width << 1;
203
204 if (!dev->isoc_ctl.cmd) {
205 c = (header >> 24) & 0xff;
206
Clearly, it was the trial to access *buf, at line 202 that caused the
Panic.
As ioctl is serialized, While S_STD is handled,QBUF/DQBUF won't be called.
So, the driver will run out of the buffers, and *buf will become NULL.
As, on tm6000, the same URB can contain more than one video buffer, it is
likely to hit a condition where no new buffer is available whily copying
the streams. The fix is to leave the URB copy loop, if there's no more buffers
are available.
The same bug could also be produced by an application that is not fast enough
to request new video buffers.
The same bug were reported by Bee Hock Goh <beehock@gmail.com>.
Thanks-to: Bee Hock Goh <beehock@gmail.com> for reporting the bug Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>