[media] saa7164: poll mask set incorrectly

list_first_entry() always returns non-null here.  I think the intent was
to test whether there were any entries in the used list.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Cc: Steven Toth <stoth@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
[media] cx23885: restore flushes of cx23885_dev work items

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
[media] videobuf_pages_to_sg: sglist[0] length problem

On function videobuf_pages_to_sg the statement sg_set_page(&sglist[0],
pages[0], PAGE_SIZE - offset, offset) will fail if size is less than
PAGE_SIZE.

Signed-off-by: Newson Edouard <newsondev@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
[media] v4l: Document EACCES in VIDIOC_[GS]_CTRL and VIDIOC_{G, S, TRY}_EXT_CTRLS

VIDIOC_S_CTRL and VIDIOC_S_EXT_CTRLS return EACCES when setting a read-only
control VIDIOC_TRY_EXT_CTRLS when trying a read-only control and
VIDIOC_G_CTRL and VIDIOC_G_EXT_CTRLS when getting a write-only control.
Document this.

Signed-off-by: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
[media] Fix compile warning: Dereferencing type-punned pointer will break strict-aliasing rules

Signed-off-by: Hans Petter Selasky <hselasky@c2i.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
[media] tea575x: convert to control framework

Convert tea575x-tuner to use the new V4L2 control framework. Also add
ext_init() callback that can be used by a card driver for additional
initialization right before registering the video device (for SF16-FMR2).

Also embed struct video_device to struct snd_tea575x to simplify the code.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Acked-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
[media] Make DVB NET configurable in the kernel

Signed-off-by: Hans Petter Selasky <hselasky@c2i.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
dvb_net: Simplify the code if DVB NET is not defined

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
[media] media: Convert vmalloc/memset to vzalloc

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
[media] radio-si470x: fix memory leak in si470x_usb_driver_probe()

radio->int_in_urb is not deallocated on error paths in si470x_usb_driver_probe().

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
[media] itd1000: Don't reuse core macro names

The dbg, warn and info macros are already defined by the USB stack.
Rename these macros to avoid macro redefinition warnings.

Refactor lineshift in printouts.

Signed-off-by: Hans Petter Selasky <hselasky@c2i.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
[media] cx24113: Don't reuse core macro names

The info and err macros are already defined by the USB stack. Rename
these macros to avoid macro redefinition warnings.

Signed-off-by: Hans Petter Selasky <hselasky@c2i.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
[media] radio-sf16fmr2: convert to generic TEA575x interface

Convert radio-sf16fmr2 to use generic TEA575x implementation. Most of the
driver code goes away as SF16-FMR2 is basically just a TEA5757 tuner
connected to ISA bus.
The card can optionally be equipped with PT2254A volume control (equivalent
of TC9154AP) - the volume setting is completely reworked (with balance control
added) and tested.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Acked-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
[media] dvb-usb.h function rc5_scan

The function "rc5_scan" in "dvb_usb.h" is returning invalid value.
The value should be returned "u16" but is returning "u8".

See example below in "drivers/media/dvb/dvb-usb/opera1.c":

        send_key = (send_key & 0xffff) | 0x0100;

        for (i = 0; i < ARRAY_SIZE(rc_map_opera1_table); i++) {
            if (rc5_scan(&rc_map_opera1_table[i]) == (send_key & 0xffff)) {
                *state = REMOTE_KEY_PRESSED;
                *event = rc_map_opera1_table[i].keycode;
                opst->last_key_pressed =
                    rc_map_opera1_table[i].keycode;
                break;
            }
            opst->last_key_pressed = 0;
        }

Signed-off-by: Manoel Pinheiro <pinusdtv@hotmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
[media] V4L/videobuf2-memops: use pr_debug for debug messages

Otherwise they clutter the dmesg buffer even on a production kernel.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
[media] DVB: dvb_frontend: fix dtv_property_dump for DTV_DVBT2_PLP_ID

- Add missing entry to array "dtv_cmds".
- Set array size to DTV_MAX_COMMAND + 1 to avoid future off-by-ones.

Reported-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Andreas Oberritter <obi@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
[media] rc: double unlock in rc_register_device()

If change_protocol() fails and we goto out_raw, then it calls unlock
twice.  I noticed that the other time we called change_protocol() we
held the &dev->lock, so I changed it to hold it here too.

Reviewed-by: Jarod Wilson <jarod@redhat.com>
Acked-by: Jarod Wilson <jarod@redhat.com>
Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
[media] rc/redrat3: dereferencing null pointer

In the original code, if the allocation failed we dereference "rr3"
when it was NULL.

Acked-by: Jarod Wilson <jarod@redhat.com>
Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
[media] rc-core: fix winbond-cir issues

The conversion of winbond-cir to use rc-core seems to have missed a
a few bits and pieces which were in my local tree. Kudos to
Juan Jesús García de Soria Lucena <skandalfo@gmail.com> for noticing.

[mchehab@redhat.com: fix two UTF-8 violations]
Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
[media] mt9v011: Fixed incorrect value for the first valid column

According to the datasheet (page 8), the first optical clear
pixel-column is not at position 14. The correct/recommended value is 20.
Without this patch there is a dark line on the left side of the image.

Tested-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Johannes Obermaier <johannes.obermaier@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>