Arnd Bergmann [Thu, 9 Feb 2017 15:09:08 +0000 (13:09 -0200)]
[media] coda/imx-vdoa: platform_driver should not be const
The device driver platform is actually written to during registration,
for setting the owner field, so platform_driver_register() does not
take a const pointer:
drivers/media/platform/coda/imx-vdoa.c: In function 'vdoa_driver_init':
drivers/media/platform/coda/imx-vdoa.c:333:213: error: passing argument 1 of '__platform_driver_register' discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
module_platform_driver(vdoa_driver);
In file included from drivers/media/platform/coda/imx-vdoa.c:22:0:
include/linux/platform_device.h:199:12: note: expected 'struct platform_driver *' but argument is of type 'const struct platform_driver *'
extern int __platform_driver_register(struct platform_driver *,
^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/media/platform/coda/imx-vdoa.c: In function 'vdoa_driver_exit':
drivers/media/platform/coda/imx-vdoa.c:333:626: error: passing argument 1 of 'platform_driver_unregister' discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
Remove the modifier again.
Fixes:
d2fe28feaebb ("[media] coda/imx-vdoa: constify structs")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Stefan Brüns [Sun, 12 Feb 2017 15:02:13 +0000 (13:02 -0200)]
[media] dvb-usb-firmware: don't do DMA on stack
The buffer allocation for the firmware data was changed in
commit
43fab9793c1f ("[media] dvb-usb: don't use stack for firmware load")
but the same applies for the reset value.
Fixes:
43fab9793c1f ("[media] dvb-usb: don't use stack for firmware load")
Cc: stable@vger.kernel.org
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Kieran Bingham [Fri, 3 Mar 2017 09:31:48 +0000 (06:31 -0300)]
[media] v4l: vsp1: Adapt vsp1_du_setup_lif() interface to use a structure
The interface to configure the LIF in the VSP1 requires adapting the
function prototype for any changes. This makes extending the interface
difficult.
Change the function prototype to pass a structure which can be easily
extended.
This changes the means of disabling the pipeline, by now passing a NULL
configuration rather than passing either a 0 width or height.
[Fixed kerneldoc, made vsp1_du_setup_lif() cfg argument const]
Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Jonathan McDowell [Wed, 15 Feb 2017 20:29:15 +0000 (18:29 -0200)]
[media] dw2102: don't do DMA on stack
On Kernel 4.9, WARNINGs about doing DMA on stack are hit at
the dw2102 driver: one in su3000_power_ctrl() and the other in tt_s2_4600_frontend_attach().
Both were due to the use of buffers on the stack as parameters to
dvb_usb_generic_rw() and the resulting attempt to do DMA with them.
The device was non-functional as a result.
So, switch this driver over to use a buffer within the device state
structure, as has been done with other DVB-USB drivers.
Tested with TechnoTrend TT-connect S2-4600.
[mchehab@osg.samsung.com: fixed a warning at su3000_i2c_transfer() that
state var were dereferenced before check 'd']
Signed-off-by: Jonathan McDowell <noodles@earth.li>
Cc: <stable@vger.kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Sean Young [Thu, 23 Feb 2017 09:11:21 +0000 (06:11 -0300)]
[media] rc: protocol is not set on register for raw IR devices
ir_raw_event_register() sets up change_protocol(), and without that set,
rc_setup_rx_device() does not set the protocol for the device on register.
The standard udev rules run ir-keytable, which writes to the protocols
file again, which hides this problem.
Fixes:
7ff2c2b ("[media] rc-main: split setup and unregister functions")
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Sean Young [Wed, 22 Feb 2017 21:48:01 +0000 (18:48 -0300)]
[media] rc: raw decoder for keymap protocol is not loaded on register
When the protocol is set via the sysfs protocols attribute, the
decoder is loaded. However, when it is not when a device is first
plugged in or registered.
Fixes:
acc1c3c ("[media] media: rc: load decoder modules on-demand")
Signed-off-by: Sean Young <sean@mess.org>
Cc: <stable@vger.kernel.org> # v4.5+
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Heiner Kallweit [Sun, 12 Feb 2017 17:01:22 +0000 (15:01 -0200)]
[media] rc: nuvoton: fix deadlock in nvt_write_wakeup_codes
nvt_write_wakeup_codes acquires the same lock as the ISR but doesn't
disable interrupts on the local CPU. This caused the following
deadlock. Fix this by using spin_lock_irqsave.
[ 432.362008] ================================
[ 432.362074] WARNING: inconsistent lock state
[ 432.362144] 4.10.0-rc7-next-
20170210 #1 Not tainted
[ 432.362219] --------------------------------
[ 432.362286] inconsistent {HARDIRQ-ON-W} -> {IN-HARDIRQ-W} usage.
[ 432.362379] swapper/0/0 [HC1[1]:SC0[0]:HE0:SE1] takes:
[ 432.362457] (&(&nvt->lock)->rlock){?.+...}, at: [<
ffffffffa016b17d>] nvt_cir_isr+0x2d/0x520 [nuvoton_cir]
[ 432.362611] {HARDIRQ-ON-W} state was registered at:
[ 432.362686]
[ 432.362698] [<
ffffffff810adb7c>] __lock_acquire+0x5dc/0x1260
[ 432.362812]
[ 432.362817] [<
ffffffff810aec29>] lock_acquire+0xe9/0x1d0
[ 432.362927]
[ 432.362934] [<
ffffffff81609f63>] _raw_spin_lock+0x33/0x50
[ 432.363045]
[ 432.363051] [<
ffffffffa016b822>] nvt_write_wakeup_codes.isra.12+0x22/0xe0 [nuvoton_cir]
[ 432.363193]
[ 432.363199] [<
ffffffffa016b9bf>] wakeup_data_store+0xdf/0xf0 [nuvoton_cir]
[ 432.363327]
[ 432.363333] [<
ffffffff81484223>] dev_attr_store+0x13/0x20
[ 432.363441]
[ 432.363449] [<
ffffffff81232450>] sysfs_kf_write+0x40/0x50
[ 432.363558]
[ 432.363564] [<
ffffffff81231640>] kernfs_fop_write+0x150/0x1e0
[ 432.363676]
[ 432.363685] [<
ffffffff811b36a3>] __vfs_write+0x23/0x120
[ 432.363791]
[ 432.363798] [<
ffffffff811b4d53>] vfs_write+0xc3/0x1e0
[ 432.363902]
[ 432.363909] [<
ffffffff811b6124>] SyS_write+0x44/0xa0
[ 432.364012]
[ 432.364021] [<
ffffffff81002c47>] do_syscall_64+0x57/0x140
[ 432.364129]
[ 432.364135] [<
ffffffff8160a9e4>] return_from_SYSCALL_64+0x0/0x7a
[ 432.364252] irq event stamp: 415118
[ 432.364313] hardirqs last enabled at (415115): [<
ffffffff814fd2eb>] cpuidle_enter_state+0x11b/0x370
[ 432.364445] hardirqs last disabled at (415116): [<
ffffffff8160b2cb>] common_interrupt+0x8b/0x90
[ 432.364573] softirqs last enabled at (415118): [<
ffffffff8106157c>] _local_bh_enable+0x1c/0x50
[ 432.364699] softirqs last disabled at (415117): [<
ffffffff810629a3>] irq_enter+0x43/0x60
[ 432.364814]
other info that might help us debug this:
[ 432.364909] Possible unsafe locking scenario:
[ 432.367821] CPU0
[ 432.370645] ----
[ 432.373432] lock(&(&nvt->lock)->rlock);
[ 432.376228] <Interrupt>
[ 432.378982] lock(&(&nvt->lock)->rlock);
[ 432.381757]
*** DEADLOCK ***
[ 432.389888] no locks held by swapper/0/0.
[ 432.392574]
stack backtrace:
[ 432.397774] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.10.0-rc7-next-
20170210 #1
[ 432.400375] Hardware name: ZOTAC ZBOX-CI321NANO/ZBOX-CI321NANO, BIOS B246P105 06/01/2015
[ 432.403023] Call Trace:
[ 432.405636] <IRQ>
[ 432.408208] dump_stack+0x68/0x93
[ 432.410775] print_usage_bug+0x1dd/0x1f0
[ 432.413334] mark_lock+0x559/0x5c0
[ 432.415871] ? print_shortest_lock_dependencies+0x1a0/0x1a0
[ 432.418431] __lock_acquire+0x6b1/0x1260
[ 432.420941] lock_acquire+0xe9/0x1d0
[ 432.423396] ? nvt_cir_isr+0x2d/0x520 [nuvoton_cir]
[ 432.425844] _raw_spin_lock+0x33/0x50
[ 432.428252] ? nvt_cir_isr+0x2d/0x520 [nuvoton_cir]
[ 432.430670] nvt_cir_isr+0x2d/0x520 [nuvoton_cir]
[ 432.433085] __handle_irq_event_percpu+0x43/0x330
[ 432.435493] handle_irq_event_percpu+0x1e/0x50
[ 432.437884] handle_irq_event+0x34/0x60
[ 432.440236] handle_edge_irq+0x6a/0x150
[ 432.442561] handle_irq+0x15/0x20
[ 432.444854] do_IRQ+0x57/0x110
[ 432.447115] common_interrupt+0x90/0x90
[ 432.449380] RIP: 0010:cpuidle_enter_state+0x120/0x370
[ 432.451653] RSP: 0018:
ffffffff81c03dd8 EFLAGS:
00000206 ORIG_RAX:
ffffffffffffffcc
[ 432.453994] RAX:
ffffffff81c14500 RBX:
0000000000000008 RCX:
00000064aac6f2d2
[ 432.456349] RDX:
0000000000000000 RSI:
0000000000000001 RDI:
ffffffff81c14500
[ 432.458704] RBP:
ffffffff81c03e18 R08:
cccccccccccccccd R09:
0000000000000018
[ 432.461072] R10:
0000000000000000 R11:
0000000000000000 R12:
ffff880100a21260
[ 432.463450] R13:
ffffffff81c7e6f8 R14:
0000000000000008 R15:
ffffffff81c7e6e0
[ 432.465819] </IRQ>
[ 432.468104] ? cpuidle_enter_state+0x11b/0x370
[ 432.470413] cpuidle_enter+0x12/0x20
[ 432.472698] call_cpuidle+0x1e/0x40
[ 432.474967] do_idle+0xe3/0x1c0
[ 432.477172] cpu_startup_entry+0x18/0x20
[ 432.479376] rest_init+0x130/0x140
[ 432.481565] start_kernel+0x3cc/0x3d9
[ 432.483750] x86_64_start_reservations+0x2a/0x2c
[ 432.485980] x86_64_start_kernel+0x178/0x18b
[ 432.488222] start_cpu+0x14/0x14
[ 432.490453] ? start_cpu+0x14/0x14
Fixes:
97c129747af5 "[media] rc: nuvoton-cir: Add support wakeup via sysfs filter callback"
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Sean Young [Mon, 13 Feb 2017 12:35:44 +0000 (10:35 -0200)]
[media] lirc: fix dead lock between open and wakeup_filter
The locking in lirc needs improvement, but for now just fix this potential
deadlock.
======================================================
[ INFO: possible circular locking dependency detected ]
4.10.0-rc1+ #1 Not tainted
-------------------------------------------------------
bash/2502 is trying to acquire lock:
(ir_raw_handler_lock){+.+.+.}, at: [<
ffffffffc06f6a5e>] ir_raw_encode_scancode+0x3e/0xb0 [rc_core]
but task is already holding lock:
(&dev->lock){+.+.+.}, at: [<
ffffffffc06f511f>] store_filter+0x9f/0x240 [rc_core]
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #2 (&dev->lock){+.+.+.}:
[<
ffffffffa110adad>] lock_acquire+0xfd/0x200
[<
ffffffffa1921327>] mutex_lock_nested+0x77/0x6d0
[<
ffffffffc06f436a>] rc_open+0x2a/0x80 [rc_core]
[<
ffffffffc07114ca>] lirc_dev_fop_open+0xda/0x1e0 [lirc_dev]
[<
ffffffffa12975e0>] chrdev_open+0xb0/0x210
[<
ffffffffa128eb5a>] do_dentry_open+0x20a/0x2f0
[<
ffffffffa128ffcc>] vfs_open+0x4c/0x80
[<
ffffffffa12a35ec>] path_openat+0x5bc/0xc00
[<
ffffffffa12a5271>] do_filp_open+0x91/0x100
[<
ffffffffa12903f0>] do_sys_open+0x130/0x220
[<
ffffffffa12904fe>] SyS_open+0x1e/0x20
[<
ffffffffa19278c1>] entry_SYSCALL_64_fastpath+0x1f/0xc2
-> #1 (lirc_dev_lock){+.+.+.}:
[<
ffffffffa110adad>] lock_acquire+0xfd/0x200
[<
ffffffffa1921327>] mutex_lock_nested+0x77/0x6d0
[<
ffffffffc0711f47>] lirc_register_driver+0x67/0x59b [lirc_dev]
[<
ffffffffc06db7f4>] ir_lirc_register+0x1f4/0x260 [ir_lirc_codec]
[<
ffffffffc06f6cac>] ir_raw_handler_register+0x7c/0xb0 [rc_core]
[<
ffffffffc0398010>] 0xffffffffc0398010
[<
ffffffffa1002192>] do_one_initcall+0x52/0x1b0
[<
ffffffffa11ef5c8>] do_init_module+0x5f/0x1fa
[<
ffffffffa11566b5>] load_module+0x2675/0x2b00
[<
ffffffffa1156dcf>] SYSC_finit_module+0xdf/0x110
[<
ffffffffa1156e1e>] SyS_finit_module+0xe/0x10
[<
ffffffffa1003f5c>] do_syscall_64+0x6c/0x1f0
[<
ffffffffa1927989>] return_from_SYSCALL_64+0x0/0x7a
-> #0 (ir_raw_handler_lock){+.+.+.}:
[<
ffffffffa110a7b7>] __lock_acquire+0x10f7/0x1290
[<
ffffffffa110adad>] lock_acquire+0xfd/0x200
[<
ffffffffa1921327>] mutex_lock_nested+0x77/0x6d0
[<
ffffffffc06f6a5e>] ir_raw_encode_scancode+0x3e/0xb0 [rc_core]
[<
ffffffffc0b0f492>] loop_set_wakeup_filter+0x62/0xbd [rc_loopback]
[<
ffffffffc06f522a>] store_filter+0x1aa/0x240 [rc_core]
[<
ffffffffa15e46f8>] dev_attr_store+0x18/0x30
[<
ffffffffa13318e5>] sysfs_kf_write+0x45/0x60
[<
ffffffffa1330b55>] kernfs_fop_write+0x155/0x1e0
[<
ffffffffa1290797>] __vfs_write+0x37/0x160
[<
ffffffffa12921f8>] vfs_write+0xc8/0x1e0
[<
ffffffffa12936e8>] SyS_write+0x58/0xc0
[<
ffffffffa19278c1>] entry_SYSCALL_64_fastpath+0x1f/0xc2
other info that might help us debug this:
Chain exists of:
ir_raw_handler_lock --> lirc_dev_lock --> &dev->lock
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(&dev->lock);
lock(lirc_dev_lock);
lock(&dev->lock);
lock(ir_raw_handler_lock);
*** DEADLOCK ***
4 locks held by bash/2502:
#0: (sb_writers#4){.+.+.+}, at: [<
ffffffffa12922c5>] vfs_write+0x195/0x1e0
#1: (&of->mutex){+.+.+.}, at: [<
ffffffffa1330b1f>] kernfs_fop_write+0x11f/0x1e0
#2: (s_active#215){.+.+.+}, at: [<
ffffffffa1330b28>] kernfs_fop_write+0x128/0x1e0
#3: (&dev->lock){+.+.+.}, at: [<
ffffffffc06f511f>] store_filter+0x9f/0x240 [rc_core]
stack backtrace:
CPU: 3 PID: 2502 Comm: bash Not tainted 4.10.0-rc1+ #1
Hardware name: /DG45ID, BIOS IDG4510H.86A.0135.2011.0225.1100 02/25/2011
Call Trace:
dump_stack+0x86/0xc3
print_circular_bug+0x1be/0x210
__lock_acquire+0x10f7/0x1290
lock_acquire+0xfd/0x200
? ir_raw_encode_scancode+0x3e/0xb0 [rc_core]
? ir_raw_encode_scancode+0x3e/0xb0 [rc_core]
mutex_lock_nested+0x77/0x6d0
? ir_raw_encode_scancode+0x3e/0xb0 [rc_core]
? loop_set_wakeup_filter+0x44/0xbd [rc_loopback]
ir_raw_encode_scancode+0x3e/0xb0 [rc_core]
loop_set_wakeup_filter+0x62/0xbd [rc_loopback]
? loop_set_tx_duty_cycle+0x70/0x70 [rc_loopback]
store_filter+0x1aa/0x240 [rc_core]
dev_attr_store+0x18/0x30
sysfs_kf_write+0x45/0x60
kernfs_fop_write+0x155/0x1e0
__vfs_write+0x37/0x160
? rcu_read_lock_sched_held+0x4a/0x80
? rcu_sync_lockdep_assert+0x2f/0x60
? __sb_start_write+0x10c/0x220
? vfs_write+0x195/0x1e0
? security_file_permission+0x3b/0xc0
vfs_write+0xc8/0x1e0
SyS_write+0x58/0xc0
entry_SYSCALL_64_fastpath+0x1f/0xc2
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Sean Young [Sat, 25 Feb 2017 11:28:16 +0000 (08:28 -0300)]
[media] serial_ir: ensure we're ready to receive interrupts
When the interrupt requested with devm_request_irq(), serial_ir.rcdev
is still null so will cause null deference if the irq handler is called
early on.
Also ensure that timeout_timer is setup.
Link: http://lkml.kernel.org/r/CA+55aFxsh2uF8gi5sN_guY3Z+tiLv7LpJYKBw+y8vqLzp+TsnQ@mail.gmail.com
[mchehab@s-opensource.com: moved serial_ir_probe() back to its original place]
Cc: <stable@vger.kernel.org> # 4.10
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Minghsiu Tsai [Wed, 8 Feb 2017 02:09:51 +0000 (00:09 -0200)]
[media] mtk-vcodec: fix build warnings without DEBUG
After removing DEBUG from mtk_vcodec_util.h, some build warnings are
generated as the following:
.../drivers/media/platform/mtk-vcodec/vdec_vpu_if.c: In function 'vcodec_vpu_send_msg':
.../drivers/media/platform/mtk-vcodec/vdec_vpu_if.c:73:11: warning: unused variable 'msg_id' [-Wunused-variable]
uint32_t msg_id = *(uint32_t *)msg;
^
.../drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c: In function 'vb2ops_vdec_buf_queue':
.../drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c:1129:7: warning: unused variable 'log_level' [-Wunused-variable]
int log_level = ret ? 0 : 1;
^
.../drivers/media/platform/mtk-vcodec/venc_vpu_if.c: In function 'vpu_enc_send_msg':
.../drivers/media/platform/mtk-vcodec/venc_vpu_if.c:82:12: warning: unused variable 'msg_id' [-Wunused-variable]
uint32_t msg_id = *(uint32_t *)msg;
^
It is because mtk_vcodec_debug() and mtk_vcodec_err() are defined as empty
macros. Without DEBUG definition, the variable for debugging is not used
anymore. Fixing build warnings by moving the assignment of the
variable to the argument of mtk_vcodec_debug() and mtk_vcodec_err().
Within the patch, build pass with/without DEBUG definition, and functions
still work fine.
Signed-off-by: Minghsiu Tsai <minghsiu.tsai@mediatek.com>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Arnd Bergmann [Tue, 7 Feb 2017 13:01:41 +0000 (11:01 -0200)]
[media] zd1301: fix building interface driver without demodulator
If the USB driver is enabled but the demodulator is not, we get a link error:
ERROR: "zd1301_demod_get_dvb_frontend" [drivers/media/usb/dvb-usb-v2/zd1301.ko] undefined!
ERROR: "zd1301_demod_get_i2c_adapter" [drivers/media/usb/dvb-usb-v2/zd1301.ko] undefined!
Such a configuration obviously makes no sense, but we should not fail
the build. This tries to mimic what we have for other drivers by turning
the build failure into a runtime failure.
Alternatively we could use an unconditional 'select' or 'depends on' to enforce
a sane configuration.
Fixes:
47d65372b3b6 ("[media] zd1301_demod: ZyDAS ZD1301 DVB-T demodulator driver")
Fixes:
992b39872b80 ("[media] zd1301: ZyDAS ZD1301 DVB USB interface driver")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Lubomir Rintel [Mon, 6 Feb 2017 06:47:36 +0000 (04:47 -0200)]
[media] usbtv: add sharpness control
Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Stefan Brüns [Sun, 5 Feb 2017 14:57:59 +0000 (12:57 -0200)]
[media] cxusb: Use a dma capable buffer also for reading
Commit
17ce039b4e54 ("[media] cxusb: don't do DMA on stack")
added a kmalloc'ed bounce buffer for writes, but missed to do the same
for reads. As the read only happens after the write is finished, we can
reuse the same buffer.
As dvb_usb_generic_rw handles a read length of 0 by itself, avoid calling
it using the dvb_usb_generic_read wrapper function.
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Arnd Bergmann [Thu, 2 Feb 2017 14:51:28 +0000 (12:51 -0200)]
[media] ttpci: address stringop overflow warning
gcc-7.0.1 warns about old code in ttpci:
In file included from drivers/media/pci/ttpci/av7110.c:63:0:
In function 'irdebi.isra.2',
inlined from 'start_debi_dma' at drivers/media/pci/ttpci/av7110.c:376:3,
inlined from 'gpioirq' at drivers/media/pci/ttpci/av7110.c:659:3:
drivers/media/pci/ttpci/av7110_hw.h:406:3: warning: 'memcpy': specified size between
18446744071562067968 and
18446744073709551615 exceeds maximum object size
9223372036854775807 [-Wstringop-overflow=]
memcpy(av7110->debi_virt, (char *) &res, count);
In function 'irdebi.isra.2',
inlined from 'start_debi_dma' at drivers/media/pci/ttpci/av7110.c:376:3,
inlined from 'gpioirq' at drivers/media/pci/ttpci/av7110.c:668:3:
drivers/media/pci/ttpci/av7110_hw.h:406:3: warning: 'memcpy': specified size between
18446744071562067968 and
18446744073709551615 exceeds maximum object size
9223372036854775807 [-Wstringop-overflow=]
memcpy(av7110->debi_virt, (char *) &res, count);
Apparently, 'count' can be negative here, which will then get turned
into a giant size argument for memcpy. Changing the sizes to 'unsigned
int' instead seems safe as we already check for maximum sizes, and it
also simplifies the code a bit.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Arnd Bergmann [Thu, 2 Feb 2017 14:36:01 +0000 (12:36 -0200)]
[media] dvb-usb-v2: avoid use-after-free
I ran into a stack frame size warning because of the on-stack copy of
the USB device structure:
drivers/media/usb/dvb-usb-v2/dvb_usb_core.c: In function 'dvb_usbv2_disconnect':
drivers/media/usb/dvb-usb-v2/dvb_usb_core.c:1029:1: error: the frame size of 1104 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
Copying a device structure like this is wrong for a number of other reasons
too aside from the possible stack overflow. One of them is that the
dev_info() call will print the name of the device later, but AFAICT
we have only copied a pointer to the name earlier and the actual name
has been freed by the time it gets printed.
This removes the on-stack copy of the device and instead copies the
device name using kstrdup(). I'm ignoring the possible failure here
as both printk() and kfree() are able to deal with NULL pointers.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Piotr Oleszczyk [Wed, 1 Feb 2017 20:26:42 +0000 (18:26 -0200)]
[media] add Hama Hybrid DVB-T Stick support
Adding Hama Hybrid DVB-T Stick support. Technically it's the same
device what Terratec Cinergy HT USB XE is.
Signed-off-by: Piotr Oleszczyk <piotr.oleszczyk@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Sakari Ailus [Wed, 1 Feb 2017 12:48:06 +0000 (10:48 -0200)]
[media] et8ek8: Fix compiler / Coccinelle warnings
Fix a compiler warning due to an unused but assigned variable.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Fengguang Wu [Tue, 31 Jan 2017 14:20:27 +0000 (12:20 -0200)]
[media] media: fix semicolon.cocci warnings
drivers/media/i2c/et8ek8/et8ek8_driver.c:1112:3-4: Unneeded semicolon
Remove unneeded semicolon.
Generated by: scripts/coccinelle/misc/semicolon.cocci
CC: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Marek Szyprowski [Tue, 31 Jan 2017 12:05:53 +0000 (10:05 -0200)]
[media] media: exynos4-is: add flags to dummy Exynos IS i2c adapter
Add simple 'functionality' member to dummy Exynos IS i2c adapter to make
i2c core happy and get rid of NULL pointer dereference during Exynos4 IS
probe since v4.10-rc1:
Unable to handle kernel NULL pointer dereference at virtual address
00000000
pgd =
c0004000
[
00000000] *pgd=
00000000
Internal error: Oops:
80000005 [#1] PREEMPT SMP ARM
Modules linked in:
CPU: 1 PID: 100 Comm: kworker/1:2 Not tainted
4.10.0-rc6-next-20170131-00054-g39e6e4233de6 #1921
Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
Workqueue: events deferred_probe_work_func
task:
ef2e0000 task.stack:
ef2ec000
PC is at 0x0
LR is at i2c_register_adapter+0x98/0x5cc
...
[<
c05040bc>] (i2c_register_adapter) from [<
c05379d4>] (fimc_is_i2c_probe+0x84/0xe4)
[<
c05379d4>] (fimc_is_i2c_probe) from [<
c041b5c8>] (platform_drv_probe+0x50/0xb0)
[<
c041b5c8>] (platform_drv_probe) from [<
c0419f48>] (driver_probe_device+0x234/0x2dc)
[<
c0419f48>] (driver_probe_device) from [<
c04184e0>] (bus_for_each_drv+0x44/0x8c)
[<
c04184e0>] (bus_for_each_drv) from [<
c0419c8c>] (__device_attach+0x9c/0x100)
[<
c0419c8c>] (__device_attach) from [<
c0419374>] (bus_probe_device+0x84/0x8c)
[<
c0419374>] (bus_probe_device) from [<
c04178d4>] (device_add+0x380/0x528)
[<
c04178d4>] (device_add) from [<
c05aceb4>] (of_platform_device_create_pdata+0x70/0xa4)
[<
c05aceb4>] (of_platform_device_create_pdata) from [<
c05acfd4>] (of_platform_bus_create+0xec/0x320)
[<
c05acfd4>] (of_platform_bus_create) from [<
c05ad264>] (of_platform_populate+0x5c/0xac)
[<
c05ad264>] (of_platform_populate) from [<
c0533420>] (fimc_is_probe+0x1c0/0x4cc)
[<
c0533420>] (fimc_is_probe) from [<
c041b5c8>] (platform_drv_probe+0x50/0xb0)
[<
c041b5c8>] (platform_drv_probe) from [<
c0419f48>] (driver_probe_device+0x234/0x2dc)
[<
c0419f48>] (driver_probe_device) from [<
c04184e0>] (bus_for_each_drv+0x44/0x8c)
[<
c04184e0>] (bus_for_each_drv) from [<
c0419c8c>] (__device_attach+0x9c/0x100)
[<
c0419c8c>] (__device_attach) from [<
c0419374>] (bus_probe_device+0x84/0x8c)
[<
c0419374>] (bus_probe_device) from [<
c04197a8>] (deferred_probe_work_func+0x60/0x8c)
[<
c04197a8>] (deferred_probe_work_func) from [<
c01329a4>] (process_one_work+0x120/0x31c)
[<
c01329a4>] (process_one_work) from [<
c0132bc8>] (process_scheduled_works+0x28/0x38)
[<
c0132bc8>] (process_scheduled_works) from [<
c0132ddc>] (worker_thread+0x204/0x4ac)
[<
c0132ddc>] (worker_thread) from [<
c01381b8>] (kthread+0xfc/0x134)
[<
c01381b8>] (kthread) from [<
c01078b8>] (ret_from_fork+0x14/0x3c)
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Niklas Söderlund [Tue, 31 Jan 2017 12:08:31 +0000 (10:08 -0200)]
[media] v4l: of: check for unique lanes in data-lanes and clock-lanes
All lanes in data-lanes and clock-lanes properties should be unique. Add
a check for this in v4l2_of_parse_csi_bus() and print a warning if
duplicated lanes are found.
Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Mauro Carvalho Chehab [Tue, 31 Jan 2017 10:14:56 +0000 (08:14 -0200)]
[media] coda/imx-vdoa: constify structs
As warned by checkpatch:
WARNING: struct of_device_id should normally be const
#318: FILE: drivers/media/platform/coda/imx-vdoa.c:318:
+static struct of_device_id vdoa_dt_ids[] = {
So, constify structs.
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Hugues Fruchet [Thu, 2 Feb 2017 14:59:53 +0000 (12:59 -0200)]
[media] st-delta: debug: trace stream/frame information & summary
Adds some trace points showing input compressed stream or
output decoded frame information.
Adds an unconditional trace point when streaming starts showing
the compressed stream and the decoded frame information.
Adds an unconditional trace point at instance closure summarizing
into a single line the decoding process (stream information, decoded
and output frames number, potential errors observed).
Acked-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Hugues Fruchet [Thu, 2 Feb 2017 14:59:52 +0000 (12:59 -0200)]
[media] st-delta: add mjpeg support
Adds support of DELTA MJPEG video decoder back-end,
implemented by calling JPEG_DECODER_HW0 firmware
using RPMSG IPC communication layer.
Acked-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Hugues Fruchet [Thu, 2 Feb 2017 14:59:51 +0000 (12:59 -0200)]
[media] st-delta: EOS (End Of Stream) support
EOS (End Of Stream) support allows user to get
all the potential decoded frames remaining in decoder
pipeline after having reached the end of video bitstream.
To do so, user calls VIDIOC_DECODER_CMD(V4L2_DEC_CMD_STOP)
which will drain the decoder and get the drained frames
that are then returned to user.
User is informed of EOS completion in two ways:
- dequeue of an empty frame flagged to V4L2_BUF_FLAG_LAST
- reception of a V4L2_EVENT_EOS event.
If, unfortunately, no buffer is available on CAPTURE queue
to return the empty frame, EOS is delayed till user queue
one CAPTURE buffer.
Acked-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Hugues Fruchet [Thu, 2 Feb 2017 14:59:50 +0000 (12:59 -0200)]
[media] st-delta: rpmsg ipc support
IPC (Inter Process Communication) support for communication with
DELTA coprocessor firmware using rpmsg kernel framework.
Based on 4 services open/set_stream/decode/close and their associated
rpmsg messages.
The messages structures are duplicated on both host and firmware
side and are packed (use only of 32 bits size fields in messages
structures to ensure packing).
Each service is synchronous; service returns only when firmware
acknowledges the associated command message.
Due to significant parameters size exchanged from host to copro,
parameters are not inserted in rpmsg messages. Instead, parameters are
stored in physical memory shared between host and coprocessor.
Memory is non-cacheable, so no special operation is required
to ensure memory coherency on host and on coprocessor side.
Multi-instance support and re-entrance are ensured using host_hdl and
copro_hdl in message header exchanged between both host and coprocessor.
This avoids to manage tables on both sides to get back the running context
of each instance.
Acked-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Hugues Fruchet [Thu, 2 Feb 2017 14:59:49 +0000 (12:59 -0200)]
[media] st-delta: add memory allocator helper functions
Helper functions used by decoder back-ends to allocate
physically contiguous memory required by hardware video
decoder.
Acked-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Hugues Fruchet [Thu, 2 Feb 2017 14:59:48 +0000 (12:59 -0200)]
[media] st-delta: STiH4xx multi-format video decoder v4l2 driver
This V4L2 driver enables DELTA multi-format video decoder
of STMicroelectronics STiH4xx SoC series.
Acked-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Hugues Fruchet [Thu, 2 Feb 2017 14:59:47 +0000 (12:59 -0200)]
[media] MAINTAINERS: add st-delta driver
Add entry for the STMicroelectronics DELTA driver.
Acked-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Hugues Fruchet [Thu, 2 Feb 2017 14:59:46 +0000 (12:59 -0200)]
[media] ARM: multi_v7_defconfig: enable STMicroelectronics DELTA Support
Enables support of STMicroelectronics STiH4xx SoC series
DELTA multi-format video decoder V4L2 driver.
Acked-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Hugues Fruchet [Thu, 2 Feb 2017 14:59:45 +0000 (12:59 -0200)]
[media] ARM: dts: STiH407-family: add DELTA dt node
This patch adds DT node for STMicroelectronics
DELTA V4L2 video decoder
Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Hugues Fruchet [Thu, 2 Feb 2017 14:59:44 +0000 (12:59 -0200)]
[media] Documentation: DT: add bindings for ST DELTA
This patch adds DT binding documentation for STMicroelectronics
DELTA V4L2 video decoder.
Acked-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Oleh Kravchenko [Sun, 29 Jan 2017 18:07:31 +0000 (16:07 -0200)]
[media] cx231xx: Fix I2C on Internal Master 3 Bus
Internal Master 3 Bus can send and receive only 4 bytes per time.
Signed-off-by: Oleh Kravchenko <oleg@kaa.org.ua>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Oleh Kravchenko [Sun, 29 Jan 2017 18:03:51 +0000 (16:03 -0200)]
[media] cx231xx: Initial support Evromedia USB Full Hybrid Full HD
This patch provide only digital support.
The device is based on Si2168 30-demodulator,
Si2158-20 tuner and CX23102-11Z chipset;
USB id: 1b80:d3b2.
Status:
- DVB-T2 works fine;
- Composite and SVideo works fine;
- Analog not implemented.
Signed-off-by: Oleh Kravchenko <oleg@kaa.org.ua>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Tuukka Toivonen [Fri, 27 Jan 2017 10:32:56 +0000 (08:32 -0200)]
[media] v4l2-async: failing functions shouldn't have side effects
v4l2-async had several functions doing some operations and then
not undoing the operations in a failure situation. For example,
v4l2_async_test_notify() moved a subdev into notifier's done list
even if registering the subdev (v4l2_device_register_subdev) failed.
If the subdev was allocated and v4l2_async_register_subdev() called
from the driver's probe() function, as usually, the probe()
function freed the allocated subdev and returned a failure.
Nevertheless, the subdev was still left into the notifier's done
list, causing an access to already freed memory when the notifier
was later unregistered.
A hand-edited call trace leaving freed subdevs into the notifier:
v4l2_async_register_notifier(notifier, asd)
cameradrv_probe
sd = devm_kzalloc()
v4l2_async_register_subdev(sd)
v4l2_async_test_notify(notifier, sd, asd)
list_move(sd, ¬ifier->done)
v4l2_device_register_subdev(notifier->v4l2_dev, sd)
cameradrv_registered(sd) -> fails
->v4l2_async_register_subdev returns failure
->cameradrv_probe returns failure
->devres frees the allocated sd
->sd was freed but it still remains in the notifier's list.
This patch fixes this and several other cases where a failing
function could leave nodes into a linked list while the caller
might free the node due to a failure.
Signed-off-by: Tuukka Toivonen <tuukka.toivonen@intel.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Dan Carpenter [Fri, 27 Jan 2017 08:06:22 +0000 (06:06 -0200)]
[media] mantis_dvb: fix some error codes in mantis_dvb_init()
We should be returning negative error codes here or it leads to a crash.
This also silences a static checker warning.
drivers/media/pci/mantis/mantis_cards.c:250 mantis_pci_probe()
warn: 'mantis->dmxdev.dvbdev->fops' double freed
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Javier Martinez Canillas [Tue, 24 Jan 2017 21:42:26 +0000 (19:42 -0200)]
[media] exynos-gsc: Avoid spamming the log on VIDIOC_TRY_FMT
There isn't an ioctl to enum the supported field orders, so a user-space
application can call VIDIOC_TRY_FMT using different field orders to know
if one is supported. For example, GStreamer does this so during playback
dozens of the following messages appear in the kernel log buffer:
[ 442.143393] Not supported field order(4)
Instead of printing this as an error, just keep it as debug information.
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Mauro Carvalho Chehab [Tue, 24 Jan 2017 10:13:11 +0000 (08:13 -0200)]
[media] dvb-usb: don't use stack for firmware load
As reported by Marc Duponcheel <marc@offline.be>, firmware load on
dvb-usb is using the stack, with is not allowed anymore on default
Kernel configurations:
[ 1025.958836] dvb-usb: found a 'WideView WT-220U PenType Receiver (based on ZL353)' in cold state, will try to load a firmware
[ 1025.958853] dvb-usb: downloading firmware from file 'dvb-usb-wt220u-zl0353-01.fw'
[ 1025.958855] dvb-usb: could not stop the USB controller CPU.
[ 1025.958856] dvb-usb: error while transferring firmware (transferred size: -11, block size: 3)
[ 1025.958856] dvb-usb: firmware download failed at 8 with -22
[ 1025.958867] usbcore: registered new interface driver dvb_usb_dtt200u
[ 2.789902] dvb-usb: downloading firmware from file 'dvb-usb-wt220u-zl0353-01.fw'
[ 2.789905] ------------[ cut here ]------------
[ 2.789911] WARNING: CPU: 3 PID: 2196 at drivers/usb/core/hcd.c:1584 usb_hcd_map_urb_for_dma+0x430/0x560 [usbcore]
[ 2.789912] transfer buffer not dma capable
[ 2.789912] Modules linked in: btusb dvb_usb_dtt200u(+) dvb_usb_af9035(+) btrtl btbcm dvb_usb dvb_usb_v2 btintel dvb_core bluetooth rc_core rfkill x86_pkg_temp_thermal intel_powerclamp coretemp crc32_pclmul aesni_intel aes_x86_64 glue_helper lrw gf128mul ablk_helper cryptd drm_kms_helper syscopyarea sysfillrect pcspkr i2c_i801 sysimgblt fb_sys_fops drm i2c_smbus i2c_core r8169 lpc_ich mfd_core mii thermal fan rtc_cmos video button acpi_cpufreq processor snd_hda_codec_realtek snd_hda_codec_generic snd_hda_intel snd_hda_codec snd_hwdep snd_hda_core snd_pcm snd_timer snd crc32c_intel ahci libahci libata xhci_pci ehci_pci xhci_hcd ehci_hcd usbcore usb_common dm_mirror dm_region_hash dm_log dm_mod
[ 2.789936] CPU: 3 PID: 2196 Comm: systemd-udevd Not tainted 4.9.0-gentoo #1
[ 2.789937] Hardware name: ASUS All Series/H81I-PLUS, BIOS 0401 07/23/2013
[ 2.789938]
ffffc9000339b690 ffffffff812bd397 ffffc9000339b6e0 0000000000000000
[ 2.789939]
ffffc9000339b6d0 ffffffff81055c86 000006300339b6a0 ffff880116c0c000
[ 2.789941]
0000000000000000 0000000000000000 0000000000000001 ffff880116c08000
[ 2.789942] Call Trace:
[ 2.789945] [<
ffffffff812bd397>] dump_stack+0x4d/0x66
[ 2.789947] [<
ffffffff81055c86>] __warn+0xc6/0xe0
[ 2.789948] [<
ffffffff81055cea>] warn_slowpath_fmt+0x4a/0x50
[ 2.789952] [<
ffffffffa006d460>] usb_hcd_map_urb_for_dma+0x430/0x560 [usbcore]
[ 2.789954] [<
ffffffff814ed5a8>] ? io_schedule_timeout+0xd8/0x110
[ 2.789956] [<
ffffffffa006e09c>] usb_hcd_submit_urb+0x9c/0x980 [usbcore]
[ 2.789958] [<
ffffffff812d0ebf>] ? copy_page_to_iter+0x14f/0x2b0
[ 2.789960] [<
ffffffff81126818>] ? pagecache_get_page+0x28/0x240
[ 2.789962] [<
ffffffff8118c2a0>] ? touch_atime+0x20/0xa0
[ 2.789964] [<
ffffffffa006f7c4>] usb_submit_urb+0x2c4/0x520 [usbcore]
[ 2.789967] [<
ffffffffa006feca>] usb_start_wait_urb+0x5a/0xe0 [usbcore]
[ 2.789969] [<
ffffffffa007000c>] usb_control_msg+0xbc/0xf0 [usbcore]
[ 2.789970] [<
ffffffffa067903d>] usb_cypress_writemem+0x3d/0x40 [dvb_usb]
[ 2.789972] [<
ffffffffa06791cf>] usb_cypress_load_firmware+0x4f/0x130 [dvb_usb]
[ 2.789973] [<
ffffffff8109dbbe>] ? console_unlock+0x2fe/0x5d0
[ 2.789974] [<
ffffffff8109e10c>] ? vprintk_emit+0x27c/0x410
[ 2.789975] [<
ffffffff8109e40a>] ? vprintk_default+0x1a/0x20
[ 2.789976] [<
ffffffff81124d76>] ? printk+0x43/0x4b
[ 2.789977] [<
ffffffffa0679310>] dvb_usb_download_firmware+0x60/0xd0 [dvb_usb]
[ 2.789979] [<
ffffffffa0679898>] dvb_usb_device_init+0x3d8/0x610 [dvb_usb]
[ 2.789981] [<
ffffffffa069e302>] dtt200u_usb_probe+0x92/0xd0 [dvb_usb_dtt200u]
[ 2.789984] [<
ffffffffa007420c>] usb_probe_interface+0xfc/0x270 [usbcore]
[ 2.789985] [<
ffffffff8138bf95>] driver_probe_device+0x215/0x2d0
[ 2.789986] [<
ffffffff8138c0e6>] __driver_attach+0x96/0xa0
[ 2.789987] [<
ffffffff8138c050>] ? driver_probe_device+0x2d0/0x2d0
[ 2.789988] [<
ffffffff81389ffb>] bus_for_each_dev+0x5b/0x90
[ 2.789989] [<
ffffffff8138b7b9>] driver_attach+0x19/0x20
[ 2.789990] [<
ffffffff8138b33c>] bus_add_driver+0x11c/0x220
[ 2.789991] [<
ffffffff8138c91b>] driver_register+0x5b/0xd0
[ 2.789994] [<
ffffffffa0072f6c>] usb_register_driver+0x7c/0x130 [usbcore]
[ 2.789994] [<
ffffffffa06a5000>] ? 0xffffffffa06a5000
[ 2.789996] [<
ffffffffa06a501e>] dtt200u_usb_driver_init+0x1e/0x20 [dvb_usb_dtt200u]
[ 2.789997] [<
ffffffff81000408>] do_one_initcall+0x38/0x140
[ 2.789998] [<
ffffffff8116001c>] ? __vunmap+0x7c/0xc0
[ 2.789999] [<
ffffffff81124fb0>] ? do_init_module+0x22/0x1d2
[ 2.790000] [<
ffffffff81124fe8>] do_init_module+0x5a/0x1d2
[ 2.790002] [<
ffffffff810c96b1>] load_module+0x1e11/0x2580
[ 2.790003] [<
ffffffff810c68b0>] ? show_taint+0x30/0x30
[ 2.790004] [<
ffffffff81177250>] ? kernel_read_file+0x100/0x190
[ 2.790005] [<
ffffffff810c9ffa>] SyS_finit_module+0xba/0xc0
[ 2.790007] [<
ffffffff814f13e0>] entry_SYSCALL_64_fastpath+0x13/0x94
[ 2.790008] ---[ end trace
c78a74e78baec6fc ]---
So, allocate the structure dynamically.
Cc: stable@vger.kernel.org # Kernel 4.9+
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Christophe JAILLET [Mon, 23 Jan 2017 21:16:56 +0000 (19:16 -0200)]
[media] exynos4-is: Add missing 'of_node_put'
It is likely that a "of_node_put(ep)" is missing here.
There is one in the previous error handling code, and one a few lines
below in the normal case as well.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Bhumika Goyal [Sat, 21 Jan 2017 09:45:31 +0000 (07:45 -0200)]
[media] media: dvb-frontends: constify vb2_ops structure
Declare vb2_ops structure as const as it is only stored in
the ops field of a vb2_queue structure. This field is of type
const, so vb2_ops structures having same properties can be made
const too.
Done using Coccinelle:
@r1 disable optional_qualifier@
identifier i;
position p;
@@
static struct vb2_ops i@p={...};
@ok1@
identifier r1.i;
position p;
struct sta2x11_vip vip;
struct vb2_queue q;
@@
(
vip.vb_vidq.ops=&i@p
|
q.ops=&i@p
)
@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p
@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct vb2_ops i;
File size details of media/dvb-frontends/rtl2832_sdr.o file remains the
same before and after applying the patch.
Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Bhumika Goyal [Sat, 21 Jan 2017 09:37:25 +0000 (07:37 -0200)]
[media] media: pci: constify vb2_ops structure
Declare vb2_ops structure as const as it is only stored in
the ops field of a vb2_queue structure. This field is of type
const, so vb2_ops structures having same properties can be made
const too.
Done using Coccinelle:
@r1 disable optional_qualifier@
identifier i;
position p;
@@
static struct vb2_ops i@p={...};
@ok1@
identifier r1.i;
position p;
struct sta2x11_vip vip;
struct vb2_queue q;
@@
(
vip.vb_vidq.ops=&i@p
|
q.ops=&i@p
)
@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p
@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct vb2_ops i;
File size before:
text data bss dec hex filename
8448 440 0 8888 22b8 media/pci/sta2x11/sta2x11_vip.o
File size after:
text data bss dec hex filename
8552 352 0 8904 22c8 media/pci/sta2x11/sta2x11_vip.o
Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Laurent Pinchart [Sun, 15 Jan 2017 19:05:30 +0000 (17:05 -0200)]
[media] v4l: subdev: Clean up properly in subdev devnode registration error path
Set the subdev devnode pointer right after registration to ensure that
later errors won't skip the subdev when unregistering all devnodes.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Baruch Siach [Sun, 15 Jan 2017 10:33:53 +0000 (08:33 -0200)]
[media] coda: add Freescale firmware compatibility location
The Freescale provided imx-vpu looks for firmware files under /lib/firmware/vpu
by default. Make coda look there for firmware files to ease the update path.
Cc: Fabio Estevam <festevam@gmail.com>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Sean Young [Thu, 2 Feb 2017 16:20:36 +0000 (14:20 -0200)]
[media] mce_kbd: add missing keys from UK layout
The UK layout of the Microsoft Remote Keyboard has two missing keys:
the hash key, and the messenger key which is sent using rc6 mce.
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Sean Young [Wed, 1 Feb 2017 22:08:56 +0000 (20:08 -0200)]
[media] lirc: cannot read from tx-only device
Bail out early, otherwise we follow a null pointer.
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Martin Blumenstingl [Tue, 31 Jan 2017 21:13:42 +0000 (19:13 -0200)]
[media] Documentation: devicetree: add the RC map name of the geekbox remote
Keep the list up to date with include/media/rc-map.h
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Martin Blumenstingl [Tue, 31 Jan 2017 21:21:12 +0000 (19:21 -0200)]
[media] Documentation: devicetree: meson-ir: "linux,rc-map-name" is supported
The driver already parses the "linux,rc-map-name" property. Add this
information to the documentation so .dts maintainers don't have to look
it up in the source-code.
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Wei Yongjun [Thu, 12 Jan 2017 15:32:29 +0000 (13:32 -0200)]
[media] gp8psk: make local symbol gp8psk_fe_ops static
Fixes the following sparse warning:
drivers/media/usb/dvb-usb/gp8psk.c:281:28: warning:
symbol 'gp8psk_fe_ops' was not declared. Should it be static?
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Wei Yongjun [Thu, 12 Jan 2017 14:30:47 +0000 (12:30 -0200)]
[media] tm6000: fix typo in parameter description
Fix typo in parameter description.
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Kevin Cheng [Tue, 10 Jan 2017 03:14:29 +0000 (01:14 -0200)]
[media] em28xx: support for Hauppauge WinTV-dualHD 01595 ATSC/QAM
Hauppauge WinTV-dualHD model 01595 is a USB 2.0 dual ATSC/QAM tuner with
the following components:
USB bridge: Empia em28274
Demodulator: 2x LG LGDT3306a at addresses 0xb2 and 0x1c
Tuner: 2x Silicon Labs si2157 at addresses 0xc0 and 0xc4
This patch enables only the first tuner.
Signed-off-by: Kevin Cheng <kcheng@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Kevin Cheng [Tue, 10 Jan 2017 03:14:18 +0000 (01:14 -0200)]
[media] lgdt3306a: support i2c mux for use by em28xx
Adds an i2c mux to the lgdt3306a demodulator. This was done to support
the Hauppauge WinTV-dualHD 01595 USB TV tuner (em28xx), which utilizes two
si2157 tuners behind gate control.
Signed-off-by: Kevin Cheng <kcheng@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Davidlohr Bueso [Mon, 9 Jan 2017 15:41:34 +0000 (13:41 -0200)]
[media] media/usbvision: remove ctrl_urb_wq
While the wakeup path seems to be set up, this waitqueue is actually
never used as no-one enqueues themselves on the list. As such, wakeups
are meaningless without waiters, so lets just get rid of the whole
thing.
Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Baruch Siach [Wed, 4 Jan 2017 13:47:17 +0000 (11:47 -0200)]
[media] v4l2-subdev.h: fix v4l2_subdev_pad_config documentation
The fields of v4l2_subdev_pad_config are not pointers.
Fixes:
21c29de1d09 ("[media] v4l2-subdev.h: Improve documentation")
Cc: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Nicolas Iooss [Mon, 26 Dec 2016 13:31:39 +0000 (11:31 -0200)]
[media] v4l: rcar_fdp1: use %4.4s to format a 4-byte string
Using %4s to format f->fmt.pix_mp.pixelformat in fdp1_try_fmt() and
fdp1_s_fmt() may lead to more characters being printed (when the byte
following field pixelformat is not zero).
Add ".4" to the format specifier to limit the number of printed
characters to four. The resulting format specifier "%4.4s" is also used
by other media drivers to print pixelformat value.
Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
Reviewed-by: Kieran Bingham <kieran@bingham.xyz>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Niels Ole Salscheider [Sun, 25 Dec 2016 15:38:20 +0000 (13:38 -0200)]
[media] cx23885: attach md88ds3103 driver via i2c_client for DVBSky S952
With this patch we use the new style to attach the frontend.
Signed-off-by: Niels Ole Salscheider <niels_ole@salscheider-online.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Cao jin [Mon, 19 Dec 2016 06:49:53 +0000 (04:49 -0200)]
[media] ngene: drop ngene_link_reset()
In AER recovery, pci_error_handlers.link_reset() is never called,
drop it now.
Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
devendra sharma [Sun, 18 Dec 2016 13:52:55 +0000 (11:52 -0200)]
[media] media: dvb: dmx: fixed coding style issues of spacing
Fixed coding style issues of spacing
Signed-off-by: Devendra Sharma <devendra.sharma9091@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Mauro Carvalho Chehab [Fri, 3 Feb 2017 13:30:37 +0000 (11:30 -0200)]
[media] stk1160: make some functions static
As warned by gcc:
drivers/media/usb/stk1160/stk1160-ac97.c:117:5: warning: no previous prototype for 'stk1160_has_audio' [-Wmissing-prototypes]
int stk1160_has_audio(struct stk1160 *dev)
^~~~~~~~~~~~~~~~~
drivers/media/usb/stk1160/stk1160-ac97.c:125:5: warning: no previous prototype for 'stk1160_has_ac97' [-Wmissing-prototypes]
int stk1160_has_ac97(struct stk1160 *dev)
^~~~~~~~~~~~~~~~
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Marcel Hasler [Thu, 15 Dec 2016 22:14:03 +0000 (20:14 -0200)]
[media] stk1160: Wait for completion of transfers to and from AC97 codec
The STK1160 needs some time to transfer data to and from the AC97 codec.
The transfer completion is indicated by command read/write bits in the
chip's audio control register. The driver should poll these bits and
wait until they have been cleared by hardware before trying to retrieve
the results of a read operation or setting a new write command.
[mchehab@s-opensource.com: make checkpatch happier]
Signed-off-by: Marcel Hasler <mahasler@gmail.com>
Acked-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Marcel Hasler [Thu, 15 Dec 2016 22:13:34 +0000 (20:13 -0200)]
[media] stk1160: Check whether to use AC97 codec
Some STK1160-based devices use the chip's internal 8-bit ADC. This is
configured through a strap pin. The value of this and other pins can be
read through the POSVA register. If the internal ADC is used, or if
audio is disabled altogether, there's no point trying to setup the AC97
codec.
Signed-off-by: Marcel Hasler <mahasler@gmail.com>
Acked-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Marcel Hasler [Thu, 15 Dec 2016 22:17:26 +0000 (20:17 -0200)]
[media] stk1160: Remove stk1160-mixer and setup internal AC97 codec automatically
Exposing all the channels of the device's internal AC97 codec to
userspace is unnecessary and confusing. Instead the driver should setup
the codec with proper values. This patch removes the mixer and sets up
the codec using optimal values, i.e. the same values set by the Windows
driver. This also makes the device work out-of-the-box, without the need
for the user to reconfigure the device every time it's plugged in.
Signed-off-by: Marcel Hasler <mahasler@gmail.com>
Acked-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Hans Verkuil [Wed, 25 Jan 2017 07:38:07 +0000 (05:38 -0200)]
[media] v4l2-ctrls.c: add NULL check
Check that the control whose events we want to delete is still there.
Normally this will always be the case, but I am not 100% certain if
there aren't any corner cases when a device is forcibly unbound.
In any case, this will satisfy static checkers and simply make it more
robust.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Reported-by: Shaobo <shaobo@cs.utah.edu>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Matej Hulín [Mon, 23 Jan 2017 09:12:30 +0000 (07:12 -0200)]
[media] media: radio-cadet, initialize timer with setup_timer
Stop accessing timer struct members directly and use the setup_timer
helper intended for that use. It makes the code cleaner and will allow
for easier change of the timer struct internals.
Signed-off-by: Matej Hulín <mito.hulin@gmail.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Colin Ian King [Wed, 18 Jan 2017 15:10:57 +0000 (13:10 -0200)]
[media] saa7164: "first image" should be "second image" in error message
The error message when the second image is not available is incorrect,
replace "first image" with "second image".
Fixes CoverityScan CID#
1077508 ("Copy-paste error")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Colin Ian King [Wed, 11 Jan 2017 16:24:33 +0000 (14:24 -0200)]
[media] gspca_stv06xx: remove redundant check for err < 0
The comparison of err < 0 is redundant as err has been previously
been assigned to 0 and has not changed. Remove the redundant check.
Fixes CoverityScan CID#703363 ("Logically dead code")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Mats Randgaard [Tue, 6 Dec 2016 10:24:29 +0000 (08:24 -0200)]
[media] tc358743: ctrl_detect_tx_5v should always be updated
The control for +5V Power detection must also be updated when the EDID is
not present.
Signed-off-by: Mats Randgaard <matrandg@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Mats Randgaard [Tue, 6 Dec 2016 10:24:28 +0000 (08:24 -0200)]
[media] tc358743: Disable HDCP with "manual HDCP authentication" bit
Originally Toshiba told us that the only way to disable HDCP was to
set the receiver in repeater mode, that would make the authentication
fail because of missing software support. It has worked fine with all
the sources we and our customers has used, until it was reported
problems with Apple MacBook (Retina, 12-inch, Early 2015)
(https://support.apple.com/kb/SP712?locale=en_US&viewlocale=en_US)
with Apple A1612 USB type-C multiport adapter
(http://www.apple.com/shop/product/MJ1K2AM/A/usb-c-digital-av-multiport-adapter)
Finally Toshiba came up with a hidden bit that is named "Manual HDCP
authentication". In this patch the original "repeater mode" concept is
removed, and the new bit is set instead.
With his patch HDCP is disabled when connected to the Apple MacBook
and all other sources we have tested so far. The Apple MacBook is
constantly trying to authenticate, but fails and continues to transmit
unencrypted video.
Signed-off-by: Mats Randgaard <matrandg@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Mats Randgaard [Tue, 6 Dec 2016 10:24:27 +0000 (08:24 -0200)]
[media] tc358743: Do not read number of CSI lanes in use from chip
The number of CSI lanes that should be used is set to the CSI_CONTROL
register by indirectly writing to the CSI_CONFW register. When the
number of lanes is read back from the CSI_CONTROL register the value
is usually correct, but we have seen that it suddenly is 1 for a short
moment before the correct value is restored again.
Toshiba have not figured out why that happen, but we have found it
safer to store the value in the driver.
Signed-off-by: Mats Randgaard <matrandg@cisco.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Bhumika Goyal [Wed, 14 Dec 2016 11:11:10 +0000 (09:11 -0200)]
[media] media: platform: s3c-camif: constify v4l2_subdev_ops structures
Check for v4l2_subdev_ops structures that are only passed as an
argument to the function v4l2_subdev_init. This argument is of type
const, so v4l2_subdev_ops structures having this property can also be
declared const.
Done using Coccinelle:
@r1 disable optional_qualifier @
identifier i;
position p;
@@
static struct v4l2_subdev_ops i@p = {...};
@ok1@
identifier r1.i;
position p;
@@
v4l2_subdev_init(...,&i@p)
@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p
@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct v4l2_subdev_ops i;
File size before:
text data bss dec hex filename
17171 1912 20 19103 4a9f
platform/s3c-camif/camif-capture.o
File size after:
text data bss dec hex filename
17235 1848 20 19103 4a9f
platform/s3c-camif/camif-capture.o
Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Martin Wache [Tue, 13 Dec 2016 20:21:41 +0000 (18:21 -0200)]
[media] dib7000p: avoid division by zero
dib7000p_read_word() may return zero on i2c errors, resulting in
dib7000p_get_internal_freq() returning zero.
So don't divide by the result of dib7000p_get_internal_freq()
without checking it for zero in dib7000p_set_dds().
On one of my machines the device
ID 2304:0229 Pinnacle Systems, Inc. PCTV Dual DVB-T 2001e
about once a day/every two days gets into a state, where
most (all?) I2C reads return with an error. Tuning during this
state will result in a divide by zero without this patch.
This patch doesn't fix the root cause for the device getting
into a bad state, but it allows me to unload/reload the drivers,
bringing it back into a usable state.
Signed-off-by: Martin Wache <M.Wache@gmx.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Bhumika Goyal [Tue, 13 Dec 2016 17:31:45 +0000 (15:31 -0200)]
[media] drivers: media: i2c: ml86v7667: constify v4l2_subdev_* structures
v4l2_subdev_{core/video}_ops structures are stored in the
fields of the v4l2_subdev_ops structure which are of type const.
Also, v4l2_subdev_ops structure is passed to a function
having its argument of type const. As these structures are never
modified, so declare them as const.
Done using Coccinelle: (One of the scripts used)
@r1 disable optional_qualifier @
identifier i;
position p;
@@
static struct v4l2_subdev_ops i@p = {...};
@ok1@
identifier r1.i;
position p;
@@
v4l2_i2c_subdev_init(...,&i@p)
@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p
@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct v4l2_subdev_ops i;
File size before:
text data bss dec hex filename
2732 608 8 3348 d14 drivers/media/i2c/ml86v7667.o
File size after:
text data bss dec hex filename
3100 232 8 3340 d0c drivers/media/i2c/ml86v7667.o
Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Bhumika Goyal [Tue, 13 Dec 2016 17:26:13 +0000 (15:26 -0200)]
[media] drivers: media: i2c: ak881x: constify v4l2_subdev_* structures
v4l2_subdev_{core/video}_ops structures are stored in the
fields of the v4l2_subdev_ops structure which are of type const.
Also, v4l2_subdev_ops structure is passed to a function
having its argument of type const. As these structures are never
modified, so declare them as const.
Done using Coccinelle: (One of the scripts used)
@r1 disable optional_qualifier @
identifier i;
position p;
@@
static struct v4l2_subdev_video_ops i@p = {...};
@ok1@
identifier r1.i;
position p;
struct v4l2_subdev_ops obj;
@@
obj.video=&i@p;
@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p
@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct v4l2_subdev_video_ops i;
File size before:
text data bss dec hex filename
1809 872 0 2681 a79 drivers/media/i2c/ak881x.o
File size after:
text data bss dec hex filename
2185 496 0 2681 a79 drivers/media/i2c/ak881x.o
Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Bhumika Goyal [Tue, 13 Dec 2016 11:49:45 +0000 (09:49 -0200)]
[media] media: i2c: m5mols: m5mols_core: constify v4l2_subdev_pad_ops structures
v4l2_subdev_pad_ops structures are stored in the pad field
of the v4l2_subdev_ops structure and this field is of type const.
As the v4l2_subdev_pad_ops structures are never modified, they can be
declared as const.
Done using Coccinelle:
@r1 disable optional_qualifier @
identifier i;
position p;
@@
static struct v4l2_subdev_pad_ops i@p = {...};
@ok1@
identifier r1.i;
position p;
struct v4l2_subdev_ops obj;
@@
obj.pad=&i@p;
@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p
@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct v4l2_subdev_pad_ops i;
File size before:
text data bss dec hex filename
7633 512 20 8165 1fe5 media/i2c/m5mols/m5mols_core.o
File size after:
text data bss dec hex filename
7761 384 20 8165 1fe5 media/i2c/m5mols/m5mols_core.o
Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Nicholas Mc Guire [Tue, 13 Dec 2016 05:34:53 +0000 (03:34 -0200)]
[media] m5mols: set usleep_range delta greater 0
This delay is in non-atomic context and it does not seem to be
time-critical so relax it to allow the timer subsystem to optimize
hrtimers.
Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Laurent Pinchart [Mon, 12 Dec 2016 10:37:42 +0000 (08:37 -0200)]
[media] v4l: vsp1: Add VIDIOC_EXPBUF support
Use the vb2 ioctl handler directly.
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Tested-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Bhumika Goyal [Mon, 12 Dec 2016 07:45:32 +0000 (05:45 -0200)]
[media] drivers: media: i2c: constify v4l2_subdev_* structures
v4l2_subdev_{core/pad/video}_ops structures are stored in the
fields of the v4l2_subdev_ops structure which are of type const.
Also, v4l2_subdev_ops structure is passed to a function
having its argument of type const. As these structures are never
modified, so declare them as const.
Done using Coccinelle: (One of the scripts used)
@r1 disable optional_qualifier @
identifier i;
position p;
@@
static struct v4l2_subdev_video_ops i@p = {...};
@ok1@
identifier r1.i;
position p;
struct v4l2_subdev_ops obj;
@@
obj.video=&i@p;
@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p
@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct v4l2_subdev_video_ops i;
File sizes before:
text data bss dec hex filename
7810 736 16 8562 2172 drivers/media/i2c/mt9p031.o
9652 736 24 10412 28ac drivers/media/i2c/mt9v032.o
4613 552 20 5185 1441 drivers/media/i2c/noon010pc30.o
2615 552 8 3175 c67 drivers/media/i2c/s5k6a3.o
File sizes after:
text data bss dec hex filename
8322 232 16 8570 217a drivers/media/i2c/mt9p031.o
10164 232 24 10420 28b4 drivers/media/i2c/mt9v032.o
4933 232 20 5185 1441 drivers/media/i2c/noon010pc30.o
2935 232 8 3175 c67 drivers/media/i2c/s5k6a3.o
Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Bhumika Goyal [Sun, 11 Dec 2016 09:52:32 +0000 (07:52 -0200)]
[media] media: platform: xilinx: xilinx-tpg: constify v4l2_subdev_* structures
v4l2_subdev_{core/pad/video}_ops structures are stored in the
fields of the v4l2_subdev_ops structure which are of type const.
Also, v4l2_subdev_ops structure is passed to a function
having its argument of type const. As these structures are never
modified, so declare them as const.
Done using Coccinelle: (One of the scripts used)
@r1 disable optional_qualifier @
identifier i;
position p;
@@
static struct v4l2_subdev_video_ops i@p = {...};
@ok1@
identifier r1.i;
position p;
struct v4l2_subdev_ops obj;
@@
obj.video=&i@p;
@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p
@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct v4l2_subdev_video_ops i;
File size before:
text data bss dec hex filename
6170 2752 144 9066 236a media/platform/xilinx/xilinx-tpg.o
File size after:
text data bss dec hex filename
6666 2384 8 9058 2362 media/platform/xilinx/xilinx-tpg.o
Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Markus Elfring [Sat, 10 Dec 2016 19:56:04 +0000 (17:56 -0200)]
[media] bt8xx: Delete unnecessary variable initialisations in ca_send_message()
Two local variables will be set to an appropriate value a bit later.
Thus omit the explicit initialisation at the beginning.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Markus Elfring [Sat, 10 Dec 2016 19:50:58 +0000 (17:50 -0200)]
[media] bt8xx: Delete two error messages for a failed memory allocation
Omit extra messages for a memory allocation failure in two functions.
Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Javi Merino [Mon, 5 Dec 2016 10:09:56 +0000 (08:09 -0200)]
[media] v4l: async: make v4l2 coexist with devicetree nodes in a dt overlay
In asds configured with V4L2_ASYNC_MATCH_OF, the v4l2 subdev can be
part of a devicetree overlay, for example:
&media_bridge {
...
my_port: port@0 {
#address-cells = <1>;
#size-cells = <0>;
reg = <0>;
ep: endpoint@0 {
remote-endpoint = <&camera0>;
};
};
};
/ {
fragment@0 {
target = <&i2c0>;
__overlay__ {
my_cam {
compatible = "foo,bar";
port {
camera0: endpoint {
remote-endpoint = <&my_port>;
...
};
};
};
};
};
};
Each time the overlay is applied, its of_node pointer will be
different. We are not interested in matching the pointer, what we
want to match is that the path is the one we are expecting. Change to
use of_node_cmp() so that we continue matching after the overlay has
been removed and reapplied.
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Javi Merino <javi.merino@kernel.org>
Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com>
Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Pan Bian [Sun, 4 Dec 2016 05:40:06 +0000 (03:40 -0200)]
[media] media: pci: meye: set error code on failures
The value of return variable ret is 0 on some error paths, for example,
when pci_resource_start() returns a NULL pointer. 0 means no error in
this context, which is contrary to the fact. This patch fixes the bug.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=189011
Signed-off-by: Pan Bian <bianpan2016@163.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Pan Bian [Sat, 3 Dec 2016 12:39:33 +0000 (10:39 -0200)]
[media] media: platform: sti: return -ENOMEM on errors
Function bdisp_debugfs_create() returns 0 even on errors. So its caller
cannot detect the errors. It may be better to return "-ENOMEM" on the
exception paths.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=188801
Signed-off-by: Pan Bian <bianpan2016@163.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Tiffany Lin [Fri, 2 Dec 2016 02:38:34 +0000 (00:38 -0200)]
[media] mtk-vcodec: use V4L2_DEC_CMD_STOP to implement flush
Also remove the code using size-0 OUTPUT buffer to flush.
Signed-off-by: Tiffany Lin <tiffany.lin@mediatek.com>
Signed-off-by: Wu-Cheng Li <wuchengli@chromium.org>
Reviewed-by: Kuang-che Wu <kcwu@chromium.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Rasmus Villemoes [Wed, 30 Nov 2016 21:39:12 +0000 (19:39 -0200)]
[media] lmedm04: make lme2510_powerup a little smaller
gcc isn't smart enough to realize it can share most of the argument
buildup and the actual function call between the two branches, so help
it a little.
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Rasmus Villemoes [Wed, 30 Nov 2016 21:39:11 +0000 (19:39 -0200)]
[media] lmedm04: make some string arrays static
It takes more .text to initialize these on the stack than they occupy
in .rodata, so just make them static const.
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Rasmus Villemoes [Wed, 30 Nov 2016 21:39:10 +0000 (19:39 -0200)]
[media] lmedm04: change some static variables to automatic
ibuf and rbuf in lme2510_int_response are always assigned to before they
are read, and their addresses do not escape the function, so they have
no reason to be static.
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Rasmus Villemoes [Wed, 30 Nov 2016 21:39:09 +0000 (19:39 -0200)]
[media] lmedm04: use %phN for hex dump
Using the %ph printf extension for hex dumps like this makes the
generated code quite a bit smaller.
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Shuah Khan [Tue, 29 Nov 2016 23:59:54 +0000 (21:59 -0200)]
[media] media: Protect enable_source and disable_source handler code paths
Drivers might try to access and run enable_source and disable_source
handlers when the driver that implements these handlers is clearing
the handlers during its unregister.
Fix the following race condition:
process 1 process 2
request video streaming unbind au0828
v4l2 checks if tuner is free
... ...
au0828_unregister_media_device()
... ...
(doesn't hold graph_mutex)
mdev->enable_source = NULL;
if (mdev && mdev->enable_source) mdev->disable_source = NULL;
mdev->enable_source()
(enable_source holds graph_mutex)
As shown above enable_source check is done without holding the graph_mutex.
If unbind happens to be in progress, au0828 could clear enable_source and
disable_source handlers leading to null pointer de-reference.
Fix it by protecting enable_source and disable_source set and clear and
protecting enable_source and disable_source handler access and the call
itself.
process 1 process 2
request video streaming unbind au0828
v4l2 checks if tuner is free
... ...
au0828_unregister_media_device()
... ...
(hold graph_mutex while clearing)
mdev->enable_source = NULL;
if (mdev) mdev->disable_source = NULL;
(hold graph_mutex to check and
call enable_source)
if (mdev->enable_source)
mdev->enable_source()
If graph_mutex is held to just heck for handler being null and needs to be
released before calling the handler, there will be another window for the
handlers to be cleared. Hence, enable_source and disable_source handlers
no longer hold the graph_mutex and expect callers to hold it to avoid
forcing them release the graph_mutex before calling the handlers.
Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Nicolas Iooss [Sat, 26 Nov 2016 19:43:50 +0000 (17:43 -0200)]
[media] tw686x: silent -Wformat-security warning
Using sprintf() with a non-literal string makes some compiler complain
when building with -Wformat-security (eg. clang reports "format string
is not a string literal (potentially insecure)").
Here sprintf() format parameter is indirectly a literal string so there
is no security issue. Nevertheless adding a "%s" format string to
silent the warning helps to detect real bugs in the kernel.
Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Dan Carpenter [Fri, 25 Nov 2016 21:28:34 +0000 (19:28 -0200)]
[media] media: ti-vpe: vpdma: fix a timeout loop
The check assumes that we end on zero but actually we end on -1. Change
the post-op to a pre-op so that we do end on zero. Techinically now we
only loop 499 times instead of 500 but that's fine.
Fixes:
dc12b124353b ("[media] media: ti-vpe: vpdma: Add abort channel desc and cleanup APIs")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Shailendra Verma [Fri, 25 Nov 2016 04:52:04 +0000 (02:52 -0200)]
[media] Staging: media: platform: davinci: - Fix for memory leak
Fix to avoid possible memory leak if the decoder initialization got failed.
Free the allocated memory for file handle object before return in case
decoder initialization fails.
Signed-off-by: Shailendra Verma <shailendra.v@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Arnd Bergmann [Thu, 24 Nov 2016 16:25:38 +0000 (14:25 -0200)]
[media] b2c2: use IS_REACHABLE() instead of open-coding it
The FE_SUPPORTED() macro is basically the same as IS_REACHABLE, except
that it causes a warning with gcc-7:
common/b2c2/flexcop-fe-tuner.c:30:1: error: this use of "defined" may not be portable [-Werror=expansion-to-defined]
common/b2c2/flexcop-fe-tuner.c:30:1: error: this use of "defined" may not be portable [-Werror=expansion-to-defined]
common/b2c2/flexcop-fe-tuner.c:30:1: error: this use of "defined" may not be portable [-Werror=expansion-to-defined]
Using IS_REACHABLE() to define it avoids the warning.
Fixes:
3785bc170f79 ("[media] b2c2: break it into common/pci/usb directories")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Mauro Carvalho Chehab [Thu, 24 Nov 2016 11:52:35 +0000 (09:52 -0200)]
[media] ivtv: mark DVB "borrowed" ioctls as deprecated
changeset
da8ec560e3b4 ("[media] ivtv: implement new decoder command
ioctls") implemented proper support for mpeg audio and video control
at V4L2 API. Since then, the usage of the the DVB APIs is deprecated.
However, we never actually marked it as deprecated nor provided any
way to disable it. Let's do it now.
This patch prepares for the removal of this bad usage on a couple
of Kernel versions.
Fixes:
da8ec560e3b4 ("[media] ivtv: implement new decoder command ioctls")
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Antti Palosaari [Fri, 27 Jan 2017 16:51:32 +0000 (14:51 -0200)]
[media] MAINTAINERS: remove hd29l2
Remove unused demod driver. Device that used it never went public.
If someone later decide to add support for a device using this
chipset, it should be easy enough to retrieve it from git
history.
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Antti Palosaari [Fri, 9 Dec 2016 17:11:09 +0000 (15:11 -0200)]
[media] mt2060: implement sleep
I saw from ZyDAS ZD1301 sniffs it sets chip sleeping by using
REG_MISC_CTRL. That has very huge effect for power management, around
0.9W. Sleep is still disabled for all the old hardware just to avoid
possible regression as meaning of register bits are unknown.
I tested it also with some other devices and it seems to be working,
but I still consider it to be too risky to change it default.
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Antti Palosaari [Mon, 27 Jul 2015 11:10:25 +0000 (08:10 -0300)]
[media] MAINTAINERS: add zd1301 DVB USB interface driver
DVB USB interface driver for ZyDAS ZD1301 chip.
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Antti Palosaari [Thu, 23 Jul 2015 21:53:41 +0000 (18:53 -0300)]
[media] zd1301: ZyDAS ZD1301 DVB USB interface driver
ZyDAS ZD1301 is chip having USB interface and DVB-T demodulator
integrated. This driver is for USB interface part.
Device has USB ID 0ace:13a1. Used tuner is MT2060.
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Antti Palosaari [Mon, 27 Jul 2015 11:07:40 +0000 (08:07 -0300)]
[media] MAINTAINERS: add zd1301_demod driver
DVB-T demodulator driver for ZyDAS ZD1301 chip.
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Antti Palosaari [Thu, 23 Jul 2015 21:43:06 +0000 (18:43 -0300)]
[media] zd1301_demod: ZyDAS ZD1301 DVB-T demodulator driver
ZyDAS ZD1301 is chip having USB interface and DVB-T demodulator
integrated. This driver is for demodulator part.
Driver is very reduced, just basic demodulator functionality, no
statistics at all. It registers as a platform driver to driver core.
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Antti Palosaari [Sun, 26 Jul 2015 20:30:07 +0000 (17:30 -0300)]
[media] mt2060: add param to split long i2c writes
Add configuration parameter to split long i2c writes as some I2C
adapters cannot write 10 bytes used as a one go.
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Antti Palosaari [Sun, 26 Jul 2015 21:45:05 +0000 (18:45 -0300)]
[media] mt2060: add i2c bindings
Add proper i2c driver model bindings.
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>