]> git.karo-electronics.de Git - linux-beck.git/log
linux-beck.git
9 years ago[media] marvell-ccic: add planar support to dma-vmalloc
Hans Verkuil [Mon, 9 Mar 2015 19:59:59 +0000 (16:59 -0300)]
[media] marvell-ccic: add planar support to dma-vmalloc

The dma-vmalloc implementation didn't support planar formats, but with
a little bit of refactoring that is easy to fix.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] marvell-ccic: correctly requeue buffers
Hans Verkuil [Thu, 5 Mar 2015 21:00:07 +0000 (18:00 -0300)]
[media] marvell-ccic: correctly requeue buffers

If start_streaming fails or stop_streaming is called, then all queued
buffers need to be given back to vb2.

This prevents vb2 from calling WARN_ON when it detects that this is not
done correctly.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] marvell-ccic: fix streaming issues
Hans Verkuil [Thu, 5 Mar 2015 20:48:39 +0000 (17:48 -0300)]
[media] marvell-ccic: fix streaming issues

- fill in timestamp
- fill in field
- start the sequence counter at 0, not 1

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] marvell-ccic: add DMABUF support for all three DMA modes
Hans Verkuil [Mon, 9 Mar 2015 21:02:23 +0000 (18:02 -0300)]
[media] marvell-ccic: add DMABUF support for all three DMA modes

Add VB2_DMABUF and VIDIOC_EXPBUF support. Also add VB2_USERPTR support
for the vmalloc DMA mode which was missing for no good reason.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] marvell-ccic: add create_bufs support
Hans Verkuil [Thu, 5 Mar 2015 20:37:51 +0000 (17:37 -0300)]
[media] marvell-ccic: add create_bufs support

This fixes the final v4l2-compliance warning.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] marvell-ccic: use vb2 helpers and core locking
Hans Verkuil [Thu, 5 Mar 2015 20:33:17 +0000 (17:33 -0300)]
[media] marvell-ccic: use vb2 helpers and core locking

Use the V4L2 core locking system instead of rolling your own. Switch to
the vb2 fop and ioctl helpers to get rid of a lot of code. This also made
it easy to add VB2_READ to the DMA modes, since you get read() for free
with vb2 and these helpers.

Finally remove the users field: this information is also available from
the core framework, no need to keep track of it in the driver.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] marvell-ccic: implement control events
Hans Verkuil [Thu, 5 Mar 2015 16:05:24 +0000 (13:05 -0300)]
[media] marvell-ccic: implement control events

Now that this driver uses v4l2_fh, it is trivial to add support for
control events. Again, this fixes a v4l2-compliance failure.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] marvell-ccic: switch to struct v4l2_fh
Hans Verkuil [Thu, 5 Mar 2015 16:03:18 +0000 (13:03 -0300)]
[media] marvell-ccic: switch to struct v4l2_fh

Use struct v4l2_fh to represent a filehandle. This fixes the missing
g/s_priority handling of this driver that v4l2-compliance complained
about.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] marvell-ccic: control handler fixes
Hans Verkuil [Thu, 5 Mar 2015 15:00:11 +0000 (12:00 -0300)]
[media] marvell-ccic: control handler fixes

No controls were reported, even though the ov7670 does have controls.

Two reasons for this: the v4l2_ctrl_handler_init() call must come
before the ov7670 is loaded (otherwise the ov7670 won't know that
its controls should be added to the bridge driver), and the
v4l2_ctrl_handler_free() call at the end should only be called if
the ret value is non-zero (otherwise you would just free all the
controls that were just added).

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] marvell-ccic: fill in colorspace
Hans Verkuil [Thu, 5 Mar 2015 08:19:23 +0000 (05:19 -0300)]
[media] marvell-ccic: fill in colorspace

The colorspace field wasn't filled in properly. This fixes a v4l2-compliance
failure.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] ov7670: check for valid width/height in ov7670_enum_frame_interval
Hans Verkuil [Thu, 5 Mar 2015 08:15:30 +0000 (05:15 -0300)]
[media] ov7670: check for valid width/height in ov7670_enum_frame_interval

The width and height should be checked in the enum_frame_interval
op. This fixes a v4l2-compliance failure.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] marvell-ccic: webcam drivers shouldn't support g/s_std
Hans Verkuil [Thu, 5 Mar 2015 08:01:28 +0000 (05:01 -0300)]
[media] marvell-ccic: webcam drivers shouldn't support g/s_std

TV standards make no sense for webcam drivers, so drop these dummy
functions. This stops v4l2-compliance from complaining about this.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] marvell-ccic: fill in bus_info
Hans Verkuil [Thu, 5 Mar 2015 07:57:32 +0000 (04:57 -0300)]
[media] marvell-ccic: fill in bus_info

The bus_info field of struct v4l2_querycap wasn't filled in and
v4l2-compliance complained about that. Fix this.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] marvell-ccic: fix vb2 warning
Hans Verkuil [Tue, 3 Mar 2015 18:07:27 +0000 (15:07 -0300)]
[media] marvell-ccic: fix vb2 warning

We must set timestamp_flags in vb2_queue otherwise vb2 will complain
loudly about it.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] usbtv: fix v4l2-compliance issues
Hans Verkuil [Fri, 24 Apr 2015 07:26:01 +0000 (04:26 -0300)]
[media] usbtv: fix v4l2-compliance issues

Running v4l2-compliance on my usbtv stick revealed two failures:

1) Correct handling of CREATE_BUFS in usbtv_queue_setup was missing. Added this.
2) The sequence counter wasn't reset to 0 when starting streaming.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] cx18: add missing caps for the PCM video device
Hans Verkuil [Fri, 24 Apr 2015 06:55:07 +0000 (03:55 -0300)]
[media] cx18: add missing caps for the PCM video device

The cx18 PCM video device didn't have any capabilities set, which caused a warnings
in the v4l2 core:

[    6.229393] ------------[ cut here ]------------
[    6.229414] WARNING: CPU: 1 PID: 593 at
drivers/media/v4l2-core/v4l2-ioctl.c:1025 v4l_querycap+0x41/0x70
[videodev]()
[    6.229415] Modules linked in: cx18_alsa mxl5005s s5h1409
tuner_simple tuner_types cs5345 tuner intel_rapl iosf_mbi
x86_pkg_temp_thermal coretemp raid1 snd_hda_codec_realtek kvm_intel
snd_hda_codec_generic snd_hda_codec_hdmi kvm snd_oxygen(+) snd_hda_intel
snd_oxygen_lib snd_hda_controller snd_hda_codec snd_mpu401_uart iTCO_wdt
snd_rawmidi iTCO_vendor_support snd_hwdep crct10dif_pclmul crc32_pclmul
crc32c_intel snd_seq cx18 snd_seq_device ghash_clmulni_intel
videobuf_vmalloc tveeprom cx2341x snd_pcm serio_raw videobuf_core vfat
dvb_core fat v4l2_common snd_timer videodev snd lpc_ich i2c_i801 joydev
mfd_core mei_me media soundcore tpm_infineon soc_button_array tpm_tis
mei shpchp tpm nfsd auth_rpcgss nfs_acl lockd grace sunrpc binfmt_misc
i915 nouveau mxm_wmi wmi e1000e ttm i2c_algo_bit drm_kms_helper
[    6.229444]  drm ptp pps_core video
[    6.229446] CPU: 1 PID: 593 Comm: v4l_id Not tainted
3.19.3-200.fc21.x86_64 #1
[    6.229447] Hardware name: Gigabyte Technology Co., Ltd.
Z87-D3HP/Z87-D3HP-CF, BIOS F6 01/20/2014
[    6.229448]  0000000000000000 00000000d12b1131 ffff88042dacfc28
ffffffff8176e215
[    6.229449]  0000000000000000 0000000000000000 ffff88042dacfc68
ffffffff8109bc1a
[    6.229451]  ffffffffa0594000 ffff88042dacfd90 0000000000000000
ffffffffa04e2140
[    6.229452] Call Trace:
[    6.229466]  [<ffffffff8176e215>] dump_stack+0x45/0x57
[    6.229469]  [<ffffffff8109bc1a>] warn_slowpath_common+0x8a/0xc0
[    6.229472]  [<ffffffff8109bd4a>] warn_slowpath_null+0x1a/0x20
[    6.229474]  [<ffffffffa04ca401>] v4l_querycap+0x41/0x70 [videodev]
[    6.229477]  [<ffffffffa04ca6cc>] __video_do_ioctl+0x29c/0x320 [videodev]
[    6.229479]  [<ffffffff81227131>] ? do_last+0x2f1/0x1210
[    6.229491]  [<ffffffffa04cc776>] video_usercopy+0x366/0x5d0 [videodev]
[    6.229494]  [<ffffffffa04ca430>] ? v4l_querycap+0x70/0x70 [videodev]
[    6.229497]  [<ffffffffa04cc9f5>] video_ioctl2+0x15/0x20 [videodev]
[    6.229499]  [<ffffffffa04c6794>] v4l2_ioctl+0x164/0x180 [videodev]
[    6.229501]  [<ffffffff8122e298>] do_vfs_ioctl+0x2f8/0x500
[    6.229502]  [<ffffffff8122e521>] SyS_ioctl+0x81/0xa0
[    6.229505]  [<ffffffff81774a09>] system_call_fastpath+0x12/0x17
[    6.229506] ---[ end trace dacd80d4b19277ea ]---

Added the necessary capabilities to stop this warning.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reported-by: Laura Abbott <labbott@redhat.com>
Cc: <stable@vger.kernel.org> # for v3.19 and up
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years agosaa7164: Fix CodingStyle issues added on previous patches
Mauro Carvalho Chehab [Fri, 1 May 2015 10:30:40 +0000 (07:30 -0300)]
saa7164: Fix CodingStyle issues added on previous patches

The patches that added support for HVR2255 and HVR2205 added
some CodingStyle issues.

Better to fix it sooner than latter.

Cc: Steven Toth <stoth@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] saa7164: fix querycap warning
Hans Verkuil [Fri, 27 Mar 2015 18:17:56 +0000 (15:17 -0300)]
[media] saa7164: fix querycap warning

Fix the VIDIOC_QUERYCAP warning due to the missing device_caps. Don't fill
in the version field, the V4L2 core will do that for you.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Cc: <stable@vger.kernel.org> # for v3.19 and up
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] saa7164: fix HVR2255 ATSC inversion issue
Steven Toth [Sat, 28 Mar 2015 12:07:47 +0000 (09:07 -0300)]
[media] saa7164: fix HVR2255 ATSC inversion issue

QAM mode in the LGDT3306 auto detects inversion. VSB does not.
Forgot to include tis fact in the original patch set.
Tested with QAM and VSB after this patch, working fine.

Signed-off-by: Steven Toth <stoth@kernellabs.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] saa7164: Copyright update
Steven Toth [Mon, 23 Mar 2015 19:08:15 +0000 (16:08 -0300)]
[media] saa7164: Copyright update

Updates the copyright notes at the saa7164 driver.

Signed-off-by: Steven Toth <stoth@kernellabs.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] saa7164: Add Digital TV support for the HVR2255 and HVR2205
Steven Toth [Mon, 23 Mar 2015 18:45:48 +0000 (15:45 -0300)]
[media] saa7164: Add Digital TV support for the HVR2255 and HVR2205

Adding support for the Hauppauge HVR2255 and Hauppauge HVR2205
PCIe cards. Digital TV for DVB-T and ATSC/US-Cable is known to
work. Support for analog RF tuners does not work due to
a lack of analog support in the upstream SI2157 driver.

Signed-off-by: Steven Toth <stoth@kernellabs.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] saa7164: Improvements for I2C handling
Steven Toth [Mon, 23 Mar 2015 18:42:53 +0000 (15:42 -0300)]
[media] saa7164: Improvements for I2C handling

Workaround oddball I2C issues caused by using newer
SILABS devices.

Signed-off-by: Steven Toth <stoth@kernellabs.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] saa7164: Adding additional I2C debug
Steven Toth [Mon, 23 Mar 2015 18:41:03 +0000 (15:41 -0300)]
[media] saa7164: Adding additional I2C debug

Assists with debugging difficult I2C devices.

Signed-off-by: Steven Toth <stoth@kernellabs.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] saa7164: I2C improvements for upcoming HVR2255/2205 boards
Steven Toth [Mon, 23 Mar 2015 18:37:32 +0000 (15:37 -0300)]
[media] saa7164: I2C improvements for upcoming HVR2255/2205 boards

SI2168/SI2157 issue single byte address reads. Add support
for these.

Signed-off-by: Steven Toth <stoth@kernellabs.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] i2c: ov2659: signedness bug inov2659_set_fmt()
Dan Carpenter [Wed, 15 Apr 2015 19:12:18 +0000 (16:12 -0300)]
[media] i2c: ov2659: signedness bug inov2659_set_fmt()

This needs to be signed or there is a risk of hitting a forever loop.

Fixes: c4c0283ab3cd ('[media] media: i2c: add support for omnivision's ov2659 sensor')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Acked-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] vb2: Push mmap_sem down to memops
Jan Kara [Tue, 17 Mar 2015 11:56:31 +0000 (08:56 -0300)]
[media] vb2: Push mmap_sem down to memops

Currently vb2 core acquires mmap_sem just around call to
__qbuf_userptr(). However since commit f035eb4e976ef5 (videobuf2: fix
lockdep warning) it isn't necessary to acquire it so early as we no
longer have to drop queue mutex before acquiring mmap_sem. So push
acquisition of mmap_sem down into .get_userptr and .put_userptr memops
so that the semaphore is acquired for a shorter time and it is clearer
what it is needed for.

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] v4l2-dv-timings: replace hsync magic number with a macro
Prashant Laddha [Wed, 22 Apr 2015 17:32:37 +0000 (14:32 -0300)]
[media] v4l2-dv-timings: replace hsync magic number with a macro

This change will not change timing calculation. In CVT generator
spreadsheet the nominal value of hsync (as a percentage of line)
is 8 percent.

Cc: Martin Bugge <marbugge@cisco.com>
Signed-off-by: Prashant Laddha <prladdha@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] v4l2-dv-timings: add sanity checks in cvt,gtf calculations
Prashant Laddha [Wed, 22 Apr 2015 17:32:36 +0000 (14:32 -0300)]
[media] v4l2-dv-timings: add sanity checks in cvt,gtf calculations

Wrong values of hfreq and image height can lead to strange timings.
Avoid timing calculations for such values.

Suggested By: Martin Bugge <marbugge@cisco.com>

Cc: Martin Bugge <marbugge@cisco.com>
Signed-off-by: Prashant Laddha <prladdha@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] v4l2-dv-timings: fix rounding in hblank and hsync calculation
Prashant Laddha [Wed, 22 Apr 2015 17:32:35 +0000 (14:32 -0300)]
[media] v4l2-dv-timings: fix rounding in hblank and hsync calculation

Changed the rounding calculation for hblank and hsync to match it
to equations in cvt and gtf standards.

In cvt calculation, hsync needs to be rounded down.

In gtf calculations, hblank needs to be rounded to nearest multiple
of twice the cell granularity and hsync needs to be rounded to the
nearest multiple of cell granularity.

Cc: Martin Bugge <marbugge@cisco.com>
Signed-off-by: Prashant Laddha <prladdha@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] v4l2-dv-timings: fix rounding error in vsync_bp calculation
Prashant Laddha [Wed, 22 Apr 2015 17:32:34 +0000 (14:32 -0300)]
[media] v4l2-dv-timings: fix rounding error in vsync_bp calculation

Changed the rounding offsets used in vsync_bp calculation in cvt and
gtf timings. The results for vsync_bp should now match with results
from timing generator spreadsheets for cvt and gtf standards.

In the vsync_bp calculation for cvt, always round down the value of
(CVT_MIN_VSYNC_BP / h_period_est) and then add 1. It thus, reflects
the equation used in timing generator spreadsheet. Using 1999999 as
rounding offset, could pontentially lead to bumping up the vsync_bp
value by extra 1.

In the vsync_bp calculations for gtf, instead of round up or round
down, round the (CVT_MIN_VSYNC_BP / h_period_est) to the nearest
integer.

Thanks to Martin Bugge <marbugge@cisco.com> for validating with
standards and suggestions on equations.

Cc: Martin Bugge <marbugge@cisco.com>
Signed-off-by: Prashant Laddha <prladdha@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] Input: TOUCHSCREEN_SUR40 should depend on HAS_DMA
Geert Uytterhoeven [Thu, 23 Apr 2015 18:09:07 +0000 (15:09 -0300)]
[media] Input: TOUCHSCREEN_SUR40 should depend on HAS_DMA

If NO_DMA=y:

    warning: (TOUCHSCREEN_SUR40 && VIDEO_TW68 && VIDEO_CX23885 && VIDEO_CX25821 && VIDEO_CX88 && VIDEO_SAA7134) selects VIDEOBUF2_DMA_SG which has unmet direct dependencies (MEDIA_SUPPORT && HAS_DMA)

    ERROR: "dma_unmap_sg" [drivers/media/v4l2-core/videobuf2-dma-sg.ko] undefined!
    ERROR: "dma_map_sg" [drivers/media/v4l2-core/videobuf2-dma-sg.ko] undefined!
    ERROR: "dma_sync_sg_for_cpu" [drivers/media/v4l2-core/videobuf2-dma-sg.ko] undefined!

TOUCHSCREEN_SUR40 selects VIDEOBUF2_DMA_SG, which bypasses its
dependency on HAS_DMA.  Make TOUCHSCREEN_SUR40 depend on HAS_DMA to fix
this.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] v4l: VIDEOBUF2_DMA_SG should depend on HAS_DMA
Geert Uytterhoeven [Thu, 23 Apr 2015 18:09:06 +0000 (15:09 -0300)]
[media] v4l: VIDEOBUF2_DMA_SG should depend on HAS_DMA

If NO_DMA=y:

    ERROR: "dma_unmap_sg" [drivers/media/v4l2-core/videobuf2-dma-sg.ko] undefined!
    ERROR: "dma_map_sg" [drivers/media/v4l2-core/videobuf2-dma-sg.ko] undefined!
    ERROR: "dma_sync_sg_for_cpu" [drivers/media/v4l2-core/videobuf2-dma-sg.ko] undefined!

VIDEOBUF2_DMA_SG cannot be enabled manually by the user, it's always
selected automatically by drivers that need it. Several of those drivers
already have an explicit dependency on HAS_DMA.

Make VIDEOBUF2_DMA_SG depend on HAS_DMA. This makes it easier to find
drivers that select VIDEOBUF2_DMA_SG without depending on HAS_DMA, as
Kconfig will give a warning.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] v4l: xilinx: VIDEO_XILINX should depend on HAS_DMA
Geert Uytterhoeven [Thu, 23 Apr 2015 18:09:05 +0000 (15:09 -0300)]
[media] v4l: xilinx: VIDEO_XILINX should depend on HAS_DMA

If NO_DMA=y:

    warning: (VIDEO_XILINX && VIDEO_DM365_VPFE && VIDEO_DT3155 && VIDEO_OMAP4) selects VIDEOBUF2_DMA_CONTIG which has unmet direct dependencies (MEDIA_SUPPORT && HAS_DMA)

    media/v4l2-core/videobuf2-dma-contig.c: In function â€˜vb2_dc_mmap’:
    media/v4l2-core/videobuf2-dma-contig.c:207: error: implicit declaration of function â€˜dma_mmap_coherent’
    media/v4l2-core/videobuf2-dma-contig.c: In function â€˜vb2_dc_get_base_sgt’:
    media/v4l2-core/videobuf2-dma-contig.c:390: error: implicit declaration of function â€˜dma_get_sgtable’

VIDEO_XILINX selects VIDEOBUF2_DMA_CONTIG, which bypasses its dependency
on HAS_DMA.  Make VIDEO_XILINX depend on HAS_DMA to fix this.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] DocBook/media: Improve G_EDID specification
Hans Verkuil [Thu, 23 Apr 2015 06:38:57 +0000 (03:38 -0300)]
[media] DocBook/media: Improve G_EDID specification

When using VIDIOC_G_EDID there is a special case where start_blocks and
blocks are both set to 0. In that case the driver just has to set blocks to
the total number of available blocks and return 0.

Even though the drivers do this right and v4l2-compliance tests for it, it
turned out not to be documented in the spec. Fix this.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reported-by: Mats Randgaard <matrandg@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] DocBook/media: fix typo
Hans Verkuil [Fri, 17 Apr 2015 08:29:08 +0000 (05:29 -0300)]
[media] DocBook/media: fix typo

Fix copy-and-paste errors:

Source -> Process

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] drx-j: Misspelled comment corrected
Cheolhyun Park [Mon, 13 Apr 2015 14:29:09 +0000 (11:29 -0300)]
[media] drx-j: Misspelled comment corrected

Fix several typos inside the driver's comments.

Signed-off-by: Cheolhyun Park <pch851130@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] media: adv7604: Fix masks used for querying timings in ADV7611
jean-michel.hautbois@vodalys.com [Thu, 9 Apr 2015 08:25:46 +0000 (05:25 -0300)]
[media] media: adv7604: Fix masks used for querying timings in ADV7611

All masks for timings are different between ADV7604 and ADV7611.
Most of the values have 1 precision bit more in the latter.
Fix this by adding new fields to the chip_info structure.

Signed-off-by: Jean-Michel Hautbois <jean-michel.hautbois@vodalys.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] radio: fix error return code
Julia Lawall [Sun, 5 Apr 2015 12:06:24 +0000 (09:06 -0300)]
[media] radio: fix error return code

Return a negative error code on failure.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
identifier ret; expression e1,e2;
@@
(
if (\(ret < 0\|ret != 0\))
 { ... return ret; }
|
ret = 0
)
... when != ret = e1
    when != &ret
*if(...)
{
  ... when != ret = e2
      when forall
 return ret;
}
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] as102: fix error return code
Julia Lawall [Sun, 5 Apr 2015 12:06:23 +0000 (09:06 -0300)]
[media] as102: fix error return code

Return a negative error code on failure.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
identifier ret; expression e1,e2;
@@
(
if (\(ret < 0\|ret != 0\))
 { ... return ret; }
|
ret = 0
)
... when != ret = e1
    when != &ret
*if(...)
{
  ... when != ret = e2
      when forall
 return ret;
}
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] si4713: fix error return code
Julia Lawall [Sun, 5 Apr 2015 12:06:22 +0000 (09:06 -0300)]
[media] si4713: fix error return code

Return a negative error code on failure.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
identifier ret; expression e1,e2;
@@
(
if (\(ret < 0\|ret != 0\))
 { ... return ret; }
|
ret = 0
)
... when != ret = e1
    when != &ret
*if(...)
{
  ... when != ret = e2
      when forall
 return ret;
}
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] bttv: fix missing irq after reloading driver
Hans Verkuil [Fri, 3 Apr 2015 11:13:14 +0000 (08:13 -0300)]
[media] bttv: fix missing irq after reloading driver

If pci_disable_device() isn't called when the driver is removed, then
the next time when it is loaded the irq isn't found.

I'm pretty sure this used to work in the past, but calling
pci_disable_device() is clearly the correct method and this makes
it work again.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] cx88: v4l2-compliance fixes
Hans Verkuil [Fri, 3 Apr 2015 10:22:40 +0000 (07:22 -0300)]
[media] cx88: v4l2-compliance fixes

Fix three v4l2-compliance failures:

- the colorspace wasn't set in vidioc_try_fmt_vid_cap().
- the field wasn't set in v4l2_buffer when vb2_buffer_done() was called.
- the sequence wasn't set in v4l2_buffer when vb2_buffer_done() was called.
  This fix also removes the unused buf->count field and starts the count
  at 0 instead of 1.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] vivid: drop format description
Hans Verkuil [Tue, 21 Apr 2015 13:39:49 +0000 (10:39 -0300)]
[media] vivid: drop format description

The format description is now filled in by the core, so we can
drop this in this virtual driver.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] vim2m: drop format description
Hans Verkuil [Tue, 21 Apr 2015 13:39:30 +0000 (10:39 -0300)]
[media] vim2m: drop format description

The format description is now filled in by the core, so we can
drop this in this virtual m2m driver.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] v4l2-pci-skeleton: drop format description
Hans Verkuil [Tue, 21 Apr 2015 13:38:32 +0000 (10:38 -0300)]
[media] v4l2-pci-skeleton: drop format description

The format description is now filled in by the core, so we can
drop this in this skeleton driver.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years agov4l2-ioctl: add a missing break at v4l_fill_fmtdesc()
Mauro Carvalho Chehab [Fri, 1 May 2015 09:54:03 +0000 (06:54 -0300)]
v4l2-ioctl: add a missing break at v4l_fill_fmtdesc()

The changeset ba3002045f8022 added a logic at the core to fill
the format description, however, a break is missing on one of
the formats, as reported by smatch:
drivers/media/v4l2-core/v4l2-ioctl.c:1211 v4l_fill_fmtdesc() warn: missing break? reassigning 'descr'

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] v4l2-ioctl: fill in the description for VIDIOC_ENUM_FMT
Hans Verkuil [Fri, 20 Mar 2015 12:05:22 +0000 (09:05 -0300)]
[media] v4l2-ioctl: fill in the description for VIDIOC_ENUM_FMT

The descriptions used in drivers for the formats returned with ENUM_FMT
are all over the place.

So instead allow the core to fill them in if the driver didn't. This
allows drivers to drop the description and flags.

Based on an earlier patch from Philipp Zabel:
http://comments.gmane.org/gmane.linux.drivers.video-input-infrastructure/81411

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Philipp Zabel <p.zabel@pengutronix.de>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] m2m-deinterlace: remove dead code
Mauro Carvalho Chehab [Wed, 29 Apr 2015 23:32:48 +0000 (20:32 -0300)]
[media] m2m-deinterlace: remove dead code

As reported by smatch:
drivers/media/platform/m2m-deinterlace.c:1063 deinterlace_probe() info: ignoring unreachable code.

There's no need to call v4l2_m2m_release() here, as the last possible
failure in this code is to allocate the m2m struct.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] cx23885: fix bad indentation
Mauro Carvalho Chehab [Wed, 29 Apr 2015 23:29:10 +0000 (20:29 -0300)]
[media] cx23885: fix bad indentation

drivers/media/pci/cx23885/altera-ci.c:762 altera_ci_init() warn: inconsistent indenting

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] vivid: fix bad indenting
Mauro Carvalho Chehab [Wed, 29 Apr 2015 23:24:56 +0000 (20:24 -0300)]
[media] vivid: fix bad indenting

drivers/media/platform/vivid/vivid-vid-out.c:1155 vivid_vid_out_g_parm() warn: inconsistent indenting

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] xirlink_cit: comment unreachable code
Mauro Carvalho Chehab [Wed, 29 Apr 2015 23:22:20 +0000 (20:22 -0300)]
[media] xirlink_cit: comment unreachable code

drivers/media/usb/gspca/xirlink_cit.c:1776 cit_start_model2() info: ignoring unreachable code.
drivers/media/usb/gspca/xirlink_cit.c:1858 cit_start_model2() info: ignoring unreachable code.
drivers/media/usb/gspca/xirlink_cit.c:1910 cit_start_model2() info: ignoring unreachable code.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] dw2102: fix bad indenting
Mauro Carvalho Chehab [Wed, 29 Apr 2015 23:19:20 +0000 (20:19 -0300)]
[media] dw2102: fix bad indenting

drivers/media/usb/dvb-usb/dw2102.c:440 dw2104_i2c_transfer() warn: inconsistent indenting

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] af9005: fix bad indenting
Mauro Carvalho Chehab [Wed, 29 Apr 2015 20:17:24 +0000 (17:17 -0300)]
[media] af9005: fix bad indenting

drivers/media/usb/dvb-usb/af9005-fe.c:484 af9005_fe_read_status() warn: inconsistent indenting

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] dib0700: fix bad indentation
Mauro Carvalho Chehab [Wed, 29 Apr 2015 20:16:27 +0000 (17:16 -0300)]
[media] dib0700: fix bad indentation

drivers/media/usb/dvb-usb/dib0700_devices.c:864 dib7770_set_param_override() warn: inconsistent indenting

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] saa7134: fix bad indenting
Mauro Carvalho Chehab [Wed, 29 Apr 2015 20:14:31 +0000 (17:14 -0300)]
[media] saa7134: fix bad indenting

drivers/media/pci/saa7134/saa7134-dvb.c:1682 dvb_init() warn: inconsistent indenting

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] usbvision: fix bad indentation
Mauro Carvalho Chehab [Wed, 29 Apr 2015 20:11:35 +0000 (17:11 -0300)]
[media] usbvision: fix bad indentation

drivers/media/usb/usbvision/usbvision-core.c:2395 usbvision_init_isoc() warn: inconsistent indenting

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] s5p-mfc: fix bad indentation
Mauro Carvalho Chehab [Wed, 29 Apr 2015 20:10:47 +0000 (17:10 -0300)]
[media] s5p-mfc: fix bad indentation

drivers/media/platform/s5p-mfc/s5p_mfc_opr_v5.c:187 s5p_mfc_alloc_codec_buffers_v5() warn: inconsistent indenting

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] ttusb-dec: fix bad indentation
Mauro Carvalho Chehab [Wed, 29 Apr 2015 20:09:50 +0000 (17:09 -0300)]
[media] ttusb-dec: fix bad indentation

drivers/media/usb/ttusb-dec/ttusb_dec.c:1434 ttusb_dec_init_stb() warn: inconsistent indenting

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] bttv: fix audio hooks
Mauro Carvalho Chehab [Wed, 29 Apr 2015 23:06:07 +0000 (20:06 -0300)]
[media] bttv: fix audio hooks

as reported by smatch:
drivers/media/pci/bt8xx/bttv-audio-hook.c:201 lt9415_audio() warn: bitwise AND condition is false here
drivers/media/pci/bt8xx/bttv-audio-hook.c:241 winfast2000_audio() warn: bitwise AND condition is false here
drivers/media/pci/bt8xx/bttv-audio-hook.c:276 pvbt878p9b_audio() warn: bitwise AND condition is false here
drivers/media/pci/bt8xx/bttv-audio-hook.c:307 fv2000s_audio() warn: bitwise AND condition is false here
drivers/media/pci/bt8xx/bttv-audio-hook.c:334 windvr_audio() warn: bitwise AND condition is false here
drivers/media/pci/bt8xx/bttv-audio-hook.c:371 adtvk503_audio() warn: bitwise AND condition is false here

there are some serious issues at the audio hook implementation.

They're not following what's specified at the DocBook:
http://linuxtv.org/downloads/v4l-dvb-apis/vidioc-g-tuner.html#tuner-audmode

Basically, it was assuming that the audmode (V4L2_TUNER_MODE_foo)
is a variable with a bit maskk. However, it isn't.

The bitmask only applies to rxsubchans field (V4L2_TUNER_SUB_foo).

As the code is also too complex, and not all hooks were returning
both audmode and rxsubchans to a VIDIOC_G_TUNER, rewrite the
functions, in order to fix both for get and set tuner ioctls.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] tda10086: change typecast to u64 to avoid smatch warnings
Mauro Carvalho Chehab [Wed, 29 Apr 2015 18:48:10 +0000 (15:48 -0300)]
[media] tda10086: change typecast to u64 to avoid smatch warnings

drivers/media/dvb-frontends/tda10086.c:476 tda10086_get_frontend() warn: should 'tda10086_read_byte(state, 81) << 8' be a 64 bit type?

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] s5h1420: use only one statement per line
Mauro Carvalho Chehab [Wed, 29 Apr 2015 18:46:24 +0000 (15:46 -0300)]
[media] s5h1420: use only one statement per line

drivers/media/dvb-frontends/s5h1420.c:565 s5h1420_setfec_inversion() warn: inconsistent indenting

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] stv0900: fix bad indenting
Mauro Carvalho Chehab [Wed, 29 Apr 2015 18:41:45 +0000 (15:41 -0300)]
[media] stv0900: fix bad indenting

drivers/media/dvb-frontends/stv0900_sw.c:1559 stv0900_search_srate_fine() warn: inconsistent indenting
drivers/media/dvb-frontends/stv0900_sw.c:2012 stv0900_algo() warn: inconsistent indenting

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] cx25840: fix bad identing
Mauro Carvalho Chehab [Wed, 29 Apr 2015 18:18:20 +0000 (15:18 -0300)]
[media] cx25840: fix bad identing

drivers/media/i2c/cx25840/cx25840-core.c:974 input_change() warn: inconsistent indenting

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] pvrusb2: fix inconsistent indenting
Mauro Carvalho Chehab [Wed, 29 Apr 2015 18:14:40 +0000 (15:14 -0300)]
[media] pvrusb2: fix inconsistent indenting

smatch complains about multiple issues here:
drivers/media/usb/pvrusb2/pvrusb2-context.c:402 pvr2_channel_claim_stream() warn: inconsistent indenting
drivers/media/usb/pvrusb2/pvrusb2-ioread.c:240 pvr2_ioread_setup() warn: inconsistent indenting
drivers/media/usb/pvrusb2/pvrusb2-ioread.c:255 pvr2_ioread_set_enabled() warn: inconsistent indenting
drivers/media/usb/pvrusb2/pvrusb2-ioread.c:485 pvr2_ioread_read() warn: inconsistent indenting
drivers/media/usb/pvrusb2/pvrusb2-io.c:522 pvr2_stream_set_callback() warn: inconsistent indenting
drivers/media/usb/pvrusb2/pvrusb2-io.c:561 pvr2_stream_set_buffer_count() warn: inconsistent indenting
drivers/media/usb/pvrusb2/pvrusb2-io.c:640 pvr2_buffer_queue() warn: inconsistent indenting
drivers/media/usb/pvrusb2/pvrusb2-io.c:667 pvr2_buffer_set_buffer() warn: inconsistent indenting
drivers/media/usb/pvrusb2/pvrusb2-io.c:668 pvr2_buffer_set_buffer() warn: inconsistent indenting
drivers/media/usb/pvrusb2/pvrusb2-hdw.c:2614 pvr2_hdw_create() warn: inconsistent indenting
drivers/media/usb/pvrusb2/pvrusb2-hdw.c:2740 pvr2_hdw_destroy() warn: inconsistent indenting
drivers/media/usb/pvrusb2/pvrusb2-hdw.c:3353 pvr2_hdw_trigger_module_log() warn: inconsistent indenting

Let's get rid of those, in order to cleanup as much as possible the smatch error log.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] stk014: fix bad indenting
Mauro Carvalho Chehab [Wed, 29 Apr 2015 18:06:20 +0000 (15:06 -0300)]
[media] stk014: fix bad indenting

drivers/media/usb/gspca/stk014.c:279 sd_start() warn: inconsistent indenting

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] sonixj: fix bad indenting
Mauro Carvalho Chehab [Wed, 29 Apr 2015 18:05:28 +0000 (15:05 -0300)]
[media] sonixj: fix bad indenting

drivers/media/usb/gspca/sonixj.c:1792 expo_adjust() warn: inconsistent indenting

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] redrat3: change return argument on redrat3_send_cmd() to int
Mauro Carvalho Chehab [Wed, 29 Apr 2015 18:00:30 +0000 (15:00 -0300)]
[media] redrat3: change return argument on redrat3_send_cmd() to int

redrat3_send_cmd() can return an error or the read data. However,
it currently returns an u8, as reported by smatch:
drivers/media/rc/redrat3.c:416 redrat3_send_cmd() warn: signedness bug returning '(-12)'

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] vp702x: comment dead code
Mauro Carvalho Chehab [Wed, 29 Apr 2015 17:56:50 +0000 (14:56 -0300)]
[media] vp702x: comment dead code

Since the first version of this driver, the remote controller
code is disabled, adding an early return inside vp702x_rc_query().

Let's disable the code with #if 0, to remove this warning:

drivers/media/usb/dvb-usb/vp702x.c:268 vp702x_rc_query() info: ignoring unreachable code.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] go7007: Comment some dead code
Mauro Carvalho Chehab [Wed, 29 Apr 2015 15:44:18 +0000 (12:44 -0300)]
[media] go7007: Comment some dead code

drivers/media/usb/go7007/go7007-usb.c:1099 go7007_usb_probe() info: ignoring unreachable code.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] dib0070: Fix indenting
Mauro Carvalho Chehab [Wed, 29 Apr 2015 15:23:49 +0000 (12:23 -0300)]
[media] dib0070: Fix indenting

The indentation on this driver were deadly broken. On lots
of places, it was using 4 spaces instead of tab to indent.
On other parts, it were using tabs.

Also, on several places, it were not even being properly aligned,
as reported by smatch:
drivers/media/dvb-frontends/dib0070.c:179 dib0070_set_bandwidth() warn: inconsistent indenting
drivers/media/dvb-frontends/dib0070.c:198 dib0070_captrim() warn: inconsistent indenting
drivers/media/dvb-frontends/dib0070.c:246 dib0070_set_ctrl_lo5() warn: inconsistent indenting
drivers/media/dvb-frontends/dib0070.c:260 dib0070_ctrl_agc_filter() warn: inconsistent indenting
drivers/media/dvb-frontends/dib0070.c:494 dib0070_tune_digital() warn: inconsistent indenting
drivers/media/dvb-frontends/dib0070.c:498 dib0070_tune_digital() warn: inconsistent indenting
drivers/media/dvb-frontends/dib0070.c:655 dib0070_reset() warn: inconsistent indenting
drivers/media/dvb-frontends/dib0070.c:711 dib0070_reset() warn: curly braces intended?
drivers/media/dvb-frontends/dib0070.c:713 dib0070_reset() warn: inconsistent indenting

My first idea were to leave it as-is or to just touch the above.

However, this won't be fixing anything. So, as painful as it
is, let's fix indentation globally on the driver, and then
address the inconsistencies.

Hopefully, this driver doesn't have much patches, so it likely
won't conflict to any other patch during this merge window.

Besides the big size of this patch, no functional changes
were done.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] dib3000mc: fix bad indenting
Mauro Carvalho Chehab [Wed, 29 Apr 2015 13:06:17 +0000 (10:06 -0300)]
[media] dib3000mc: fix bad indenting

drivers/media/dvb-frontends/dib3000mc.c:149 dib3000mc_setup_pwm_state() warn: inconsistent indenting

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] cx231xx: fix bad indenting
Mauro Carvalho Chehab [Wed, 29 Apr 2015 13:00:39 +0000 (10:00 -0300)]
[media] cx231xx: fix bad indenting

drivers/media/usb/cx231xx/cx231xx-avcore.c:1598 cx231xx_set_DIF_bandpass() warn: inconsistent indenting
drivers/media/usb/cx231xx/cx231xx-core.c:656 cx231xx_demod_reset() warn: inconsistent indenting
drivers/media/usb/cx231xx/cx231xx-core.c:659 cx231xx_demod_reset() warn: inconsistent indenting
drivers/media/usb/cx231xx/cx231xx-core.c:664 cx231xx_demod_reset() warn: inconsistent indenting
drivers/media/usb/cx231xx/cx231xx-core.c:669 cx231xx_demod_reset() warn: inconsistent indenting
drivers/media/usb/cx231xx/cx231xx-core.c:673 cx231xx_demod_reset() warn: inconsistent indenting
drivers/media/usb/cx231xx/cx231xx-417.c:1164 cx231xx_initialize_codec() warn: inconsistent indenting

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] ov7670: check read error also for REG_AECHH on ov7670_s_exp()
Mauro Carvalho Chehab [Wed, 29 Apr 2015 12:50:41 +0000 (09:50 -0300)]
[media] ov7670: check read error also for REG_AECHH on ov7670_s_exp()

ov7670_s_exp() checks read error for 2 registers: REG_COM1
and REG_COM8. But, although it uses the value latter, it
doesn't check errors on REG_AECHH read. Yet, as it is doing
a bitmask operation there, the read operation should succeed.

So, fix the code to also check if this succeeded.

This fixes this smatch report:
drivers/media/i2c/ov7670.c:1366 ov7670_s_exp() warn: inconsistent indenting

Compile-tested only.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] stv0297: change typecast to u64 to avoid smatch warnings
Mauro Carvalho Chehab [Wed, 29 Apr 2015 12:46:24 +0000 (09:46 -0300)]
[media] stv0297: change typecast to u64 to avoid smatch warnings

drivers/media/dvb-frontends/stv0297.c:140 stv0297_get_symbolrate() warn: should 'stv0297_readreg(state, 86) << 8' be a 64 bit type?
drivers/media/dvb-frontends/stv0297.c:141 stv0297_get_symbolrate() warn: should 'stv0297_readreg(state, 87) << 16' be a 64 bit type?
drivers/media/dvb-frontends/stv0297.c:142 stv0297_get_symbolrate() warn: should 'stv0297_readreg(state, 88) << 24' be a 64 bit type?

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] zl10353: fix indenting
Mauro Carvalho Chehab [Wed, 29 Apr 2015 12:42:43 +0000 (09:42 -0300)]
[media] zl10353: fix indenting

drivers/media/dvb-frontends/zl10353.c:536 zl10353_read_ucblocks() warn: inconsistent indenting

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] bttv: fix indenting
Mauro Carvalho Chehab [Wed, 29 Apr 2015 12:41:34 +0000 (09:41 -0300)]
[media] bttv: fix indenting

drivers/media/pci/bt8xx/bttv-driver.c:2679 bttv_s_fbuf() warn: inconsistent indenting

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] r820t: fix identing
Mauro Carvalho Chehab [Wed, 29 Apr 2015 12:40:24 +0000 (09:40 -0300)]
[media] r820t: fix identing

drivers/media/tuners/r820t.c:945 r820t_sysfreq_sel() warn: inconsistent indenting

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] tda1004x: fix identation
Mauro Carvalho Chehab [Wed, 29 Apr 2015 12:38:59 +0000 (09:38 -0300)]
[media] tda1004x: fix identation

drivers/media/dvb-frontends/tda1004x.c:653 tda10046_init() warn: inconsistent indenting

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] mantis: remove dead code
Mauro Carvalho Chehab [Wed, 29 Apr 2015 12:38:06 +0000 (09:38 -0300)]
[media] mantis: remove dead code

drivers/media/pci/mantis/mantis_cards.c:229 mantis_pci_probe() info: ignoring unreachable code.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] qt1010: avoid going past array
Mauro Carvalho Chehab [Wed, 29 Apr 2015 12:33:02 +0000 (09:33 -0300)]
[media] qt1010: avoid going past array

As reported by smatch:
drivers/media/tuners/qt1010.c:357 qt1010_init() error: buffer overflow 'i2c_data' 34 <= 34

This should not happen with the current code, as the i2c_data array
doesn't end with a QT1010_M1, but it doesn't hurt add a BUG_ON
to notify if one modifies it and breaks.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] vivid-radio-rx: Don't go past buffer
Mauro Carvalho Chehab [Tue, 28 Apr 2015 23:00:55 +0000 (20:00 -0300)]
[media] vivid-radio-rx: Don't go past buffer

drivers/media/platform/vivid/vivid-radio-rx.c:198 vivid_radio_rx_s_hw_freq_seek() error: buffer overflow 'vivid_radio_bands' 3 <= 3

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] zc3xx: remove dead code and uneeded gotos
Mauro Carvalho Chehab [Tue, 28 Apr 2015 22:49:07 +0000 (19:49 -0300)]
[media] zc3xx: remove dead code and uneeded gotos

As reported by smatch:
drivers/media/usb/gspca/zc3xx.c:5994 transfer_update() info: ignoring unreachable code.

That happens because there's a return that it is never called,
as the work queue runs an infinite loop, except when the device is
put to sleep or an error happens.

When an error happens, a break statement is enough to go out of
the loop. So, let's remove the goto, as break is the typical
instruction used to end a loop.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] zc3xx: don't go past quality array
Mauro Carvalho Chehab [Tue, 28 Apr 2015 22:39:53 +0000 (19:39 -0300)]
[media] zc3xx: don't go past quality array

drivers/media/usb/gspca/zc3xx.c:6363 zcxx_s_ctrl() error: buffer overflow 'jpeg_qual' 3 <= 3

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] cx24117: fix a buffer overflow when checking userspace params
Mauro Carvalho Chehab [Tue, 28 Apr 2015 22:03:59 +0000 (19:03 -0300)]
[media] cx24117: fix a buffer overflow when checking userspace params

The maximum size for a DiSEqC command is 6, according to the
userspace API. However, the code allows to write up much more values:
drivers/media/dvb-frontends/cx24116.c:983 cx24116_send_diseqc_msg() error: buffer overflow 'd->msg' 6 <= 23

Cc: stable@vger.kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] af9013: Don't accept invalid bandwidth
Mauro Carvalho Chehab [Tue, 28 Apr 2015 22:02:19 +0000 (19:02 -0300)]
[media] af9013: Don't accept invalid bandwidth

If userspace sends an invalid bandwidth, it should either return
EINVAL or switch to auto mode.

This driver will go past an array and program the hardware on a
wrong way if this happens.

Cc: stable@vger.kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] cx24116: fix a buffer overflow when checking userspace params
Mauro Carvalho Chehab [Tue, 28 Apr 2015 21:51:17 +0000 (18:51 -0300)]
[media] cx24116: fix a buffer overflow when checking userspace params

The maximum size for a DiSEqC command is 6, according to the
userspace API. However, the code allows to write up much more values:
drivers/media/dvb-frontends/cx24116.c:983 cx24116_send_diseqc_msg() error: buffer overflow 'd->msg' 6 <= 23

Cc: stable@vger.kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] s5h1420: fix a buffer overflow when checking userspace params
Mauro Carvalho Chehab [Tue, 28 Apr 2015 21:34:40 +0000 (18:34 -0300)]
[media] s5h1420: fix a buffer overflow when checking userspace params

The maximum size for a DiSEqC command is 6, according to the
userspace API. However, the code allows to write up to 7 values:
drivers/media/dvb-frontends/s5h1420.c:193 s5h1420_send_master_cmd() error: buffer overflow 'cmd->msg' 6 <= 7

Cc: stable@vger.kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] stv0288: fix indentation
Mauro Carvalho Chehab [Tue, 28 Apr 2015 21:46:13 +0000 (18:46 -0300)]
[media] stv0288: fix indentation

drivers/media/dvb-frontends/stv0288.c:137 stv0288_set_symbolrate() warn: inconsistent indenting

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] lgdt3306a: fix indentation
Mauro Carvalho Chehab [Tue, 28 Apr 2015 21:31:21 +0000 (18:31 -0300)]
[media] lgdt3306a: fix indentation

drivers/media/dvb-frontends/lgdt3306a.c:2104 lgdt3306a_DumpRegs() warn: inconsistent indenting

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] dib3000mc: Fix indentation
Mauro Carvalho Chehab [Tue, 28 Apr 2015 21:29:05 +0000 (18:29 -0300)]
[media] dib3000mc: Fix indentation

drivers/media/dvb-frontends/dib3000mc.c:134 dib3000mc_setup_pwm_state() warn: inconsistent indenting
drivers/media/dvb-frontends/dib3000mc.c:144 dib3000mc_setup_pwm_state() warn: inconsistent indenting
drivers/media/dvb-frontends/dib3000mc.c:420 dib3000mc_sleep() warn: inconsistent indenting
drivers/media/dvb-frontends/dib3000mc.c:453 dib3000mc_set_channel_cfg() warn: inconsistent indenting

The last one is actually due to a commented code. Let's rework
it, in order to remove the sparse warning without removing the
dead code, as it may be useful in the future.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] bcm3510: fix indentation
Mauro Carvalho Chehab [Tue, 28 Apr 2015 21:25:14 +0000 (18:25 -0300)]
[media] bcm3510: fix indentation

drivers/media/dvb-frontends/bcm3510.c:688 bcm3510_reset() warn: inconsistent indenting
drivers/media/dvb-frontends/bcm3510.c:711 bcm3510_clear_reset() warn: inconsistent indenting

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] benq: fix indentation
Mauro Carvalho Chehab [Tue, 28 Apr 2015 21:18:28 +0000 (18:18 -0300)]
[media] benq: fix indentation

drivers/media/usb/gspca/benq.c:239 sd_isoc_irq() warn: inconsistent indenting

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] go7007: don't use vb before test if it is not NULL
Mauro Carvalho Chehab [Tue, 28 Apr 2015 20:09:23 +0000 (17:09 -0300)]
[media] go7007: don't use vb before test if it is not NULL

As reported by smatch:
drivers/media/usb/go7007/go7007-driver.c:452 frame_boundary() warn: variable dereferenced before check 'vb' (see line 449)

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] qt1010: Reduce text size by using static const
Mauro Carvalho Chehab [Tue, 28 Apr 2015 15:39:02 +0000 (12:39 -0300)]
[media] qt1010: Reduce text size by using static const

Using static const allows the compiler to optimize the code.

Before static const:
   text    data     bss     dec     hex filename
   4982     524    1568    7074    1ba2 drivers/media/tuners/qt1010.o

After static const:
   text    data     bss     dec     hex filename
   4714     524    1568    6806    1a96 drivers/media/tuners/qt1010.o

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] wl128x: fix int type for streg_cbdata
Mauro Carvalho Chehab [Tue, 28 Apr 2015 15:32:25 +0000 (12:32 -0300)]
[media] wl128x: fix int type for streg_cbdata

The streg_cbdata can have a negative error value. So, it should be
an integer, and not u8, as reported by smatch:
drivers/media/radio/wl128x/fmdrv_common.c:1517 fmc_prepare() warn: assigning (-115) to unsigned variable 'fmdev->streg_cbdata'

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] ir-sony-decoder: shutup smatch warnings
Mauro Carvalho Chehab [Tue, 28 Apr 2015 15:23:56 +0000 (12:23 -0300)]
[media] ir-sony-decoder: shutup smatch warnings

There are some false-positive warnings produced by smatch:
drivers/media/rc/ir-sony-decoder.c:129 ir_sony_decode() warn: missing break? reassigning 'data->state'
drivers/media/rc/ir-sony-decoder.c:137 ir_sony_decode() warn: missing break? reassigning 'data->state'
drivers/media/rc/ir-sony-decoder.c:165 ir_sony_decode() warn: missing break? reassigning 'data->state'

This is due to the logic used there to detect the need of a break.

While those are false positives, it is easy to get rid of them without
any drawbacks. The side effect is a cleaner function, with is good.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] s5p_mfc: remove a dead code
Mauro Carvalho Chehab [Tue, 28 Apr 2015 15:16:52 +0000 (12:16 -0300)]
[media] s5p_mfc: remove a dead code

As reported by smatch:
drivers/media/platform/s5p-mfc/s5p_mfc.c:1340 s5p_mfc_runtime_resume() warn: this array is probably non-NULL. 'm_dev->alloc_ctx'

alloc_ctx can never be NULL, as it is embeeded inside the struct
s5p_mfc_dev.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] s3c-camif: Check if fmt is NULL before use
Mauro Carvalho Chehab [Tue, 28 Apr 2015 15:12:09 +0000 (12:12 -0300)]
[media] s3c-camif: Check if fmt is NULL before use

As reported by smatch:
drivers/media/platform/s3c-camif/camif-capture.c:463 queue_setup() warn: variable dereferenced before check 'fmt' (see line 460)

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] zoran: fix indent
Mauro Carvalho Chehab [Tue, 28 Apr 2015 14:13:09 +0000 (11:13 -0300)]
[media] zoran: fix indent

As reported by smatch:
drivers/media/pci/zoran/zoran_device.c:1594 zoran_init_hardware() warn: inconsistent indenting

Fix indent. While here, fix CodingStyle and remove dead code, as it
can always be recovered from git logs.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
9 years ago[media] ivtv: avoid going past input/audio array
Mauro Carvalho Chehab [Tue, 28 Apr 2015 13:35:13 +0000 (10:35 -0300)]
[media] ivtv: avoid going past input/audio array

As reported by smatch:
drivers/media/pci/ivtv/ivtv-driver.c:832 ivtv_init_struct2() error: buffer overflow 'itv->card->video_inputs' 6 <= 6

That happens because nof_inputs and nof_audio_inputs can be initialized
as IVTV_CARD_MAX_VIDEO_INPUTS, instead of IVTV_CARD_MAX_VIDEO_INPUTS - 1.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>