summaryrefslogtreecommitdiff
path: root/drivers/media/usb/dvb-usb-v2
AgeCommit message (Collapse)AuthorFilesLines
2018-08-08media: rtl28xxu: be sure that it won't go past the array sizeMauro Carvalho Chehab1-1/+1
smatch warns that the RC query code could go past the array size: drivers/media/usb/dvb-usb-v2/rtl28xxu.c:1757 rtl2832u_rc_query() error: buffer overflow 'buf' 128 <= 130 drivers/media/usb/dvb-usb-v2/rtl28xxu.c:1758 rtl2832u_rc_query() error: buffer overflow 'buf' 128 <= 130 The driver logic gets the length of the IR RX buffer with: ret = rtl28xxu_rd_reg(d, IR_RX_BC, &buf[0]); ... len = buf[0]; In thesis, this could range between 0 and 255 [1]. While this should never happen in practice, due to hardware limits, smatch is right when it complains about that, as there's nothing at the logic that would prevent it. So, if for whatever reason, buf[0] gets filled by rtl28xx read functions with a value bigger than 128, it will go past the array. So, add an explicit check. [1] I've no idea why smatch thinks that the maximum value is 130. I double-checked the code several times. Was unable to find any reason for assuming 130. Perhaps smatch is not properly parsing u8 here? Fixes: b5cbaa43a676 ("[media] rtl28xx: initial support for rtl2832u") Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-08-03media: dvb-usb-v2: fix spelling mistake: "completition" -> "completion"Colin Ian King1-2/+2
Trivial fix to spelling mistake in dev_dbg and dev_err messages Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-08-03media: dvb: represent min/max/step/tolerance freqs in HzMauro Carvalho Chehab1-3/+3
Right now, satellite frontend drivers specify frequencies in kHz, while terrestrial/cable ones specify in Hz. That's confusing for developers. However, the main problem is that universal frontends capable of handling both satellite and non-satelite delivery systems are appearing. We end by needing to hack the drivers in order to support such hybrid frontends. So, convert everything to specify frontend frequencies in Hz. Tested-by: Katsuhiro Suzuki <suzuki.katsuhiro@socionext.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-08-02media: dvb: convert tuner_info frequencies to HzMauro Carvalho Chehab1-3/+3
Right now, satellite tuner drivers specify frequencies in kHz, while terrestrial/cable ones specify in Hz. That's confusing for developers. However, the main problem is that universal tuners capable of handling both satellite and non-satelite delivery systems are appearing. We end by needing to hack the drivers in order to support such hybrid tuners. So, convert everything to specify tuner frequencies in Hz. Plese notice that a similar patch is also needed for frontends. Tested-by: Katsuhiro Suzuki <suzuki.katsuhiro@socionext.com> Acked-by: Michael Büsch <m@bues.ch> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-07-30media: dvb-usb/friio, dvb-usb-v2/gl861: decompose friio and merge with gl861Akihiro Tsukada3-1/+476
Friio device contains "gl861" bridge and "tc90522" demod, for which the separate drivers are already in the kernel. But friio driver was monolithic and did not use them, practically copying those features. This patch decomposes friio driver into sub drivers and re-uses existing ones, thus reduces some code. It adds some features to gl861, to support the friio-specific init/config of the devices and implement i2c communications to the tuner via demod with USB vendor requests. [mchehab+samsung@kernel.org: fix merge conflicts] Signed-off-by: Akihiro Tsukada <tskd08@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-07-27media: gl861: fix probe of dvb_usb_gl861Mika Båtsman1-11/+10
Probe of dvb_usb_gl861 was working at least with v4.4. Noticed the issue with v4.13 but according to similar issues the problem started with v4.9. [ 15.288065] transfer buffer not dma capable [ 15.288090] WARNING: CPU: 2 PID: 493 at drivers/usb/core/hcd.c:1595 usb_hcd_map_urb_for_dma+0x4e2/0x640 ...CUT... [ 15.288791] dvb_usb_gl861: probe of 3-7:1.0 failed with error -5 Tested with MSI Mega Sky 580 DVB-T Tuner [GL861] [mchehab+samsung@kernel.org: rebased on the top of upstream] Cc: stable@vger.kernel.org Signed-off-by: Mika Båtsman <mika.batsman@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-06-16media: dvb: point to the location of the old README.dvb-usb fileMauro Carvalho Chehab6-6/+6
This file got renamed, but the references still point to the old place. Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org> Acked-by: Jonathan Corbet <corbet@lwn.net>
2018-06-16media: dvb: fix location of get_dvb_firmware scriptMauro Carvalho Chehab1-1/+1
This script was moved out of Documentation/dvb, but the links weren't updated. Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org> Acked-by: Jonathan Corbet <corbet@lwn.net>
2018-06-16docs: Fix some broken referencesMauro Carvalho Chehab1-1/+1
As we move stuff around, some doc references are broken. Fix some of them via this script: ./scripts/documentation-file-ref-check --fix Manually checked if the produced result is valid, removing a few false-positives. Acked-by: Takashi Iwai <tiwai@suse.de> Acked-by: Masami Hiramatsu <mhiramat@kernel.org> Acked-by: Stephen Boyd <sboyd@kernel.org> Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Acked-by: Mathieu Poirier <mathieu.poirier@linaro.org> Reviewed-by: Coly Li <colyli@suse.de> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org> Acked-by: Jonathan Corbet <corbet@lwn.net>
2018-05-10media: dvbsky: use just one mutex for serializing device R/W opsMauro Carvalho Chehab1-10/+6
Right now, there are two mutexes serializing r/w ops: one "generic" and another one specifically for stream on/off. Clean it a little bit, getting rid of one of the mutexes. Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-05media: dvb-usb-v2/gl861: ensure USB message buffers DMA'ableAkihiro Tsukada1-3/+17
i2c message buf might be on stack. Signed-off-by: Akihiro Tsukada <tskd08@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-05media: dvb-usb-v2/gl861: use usleep_range() for short delayAkihiro Tsukada1-1/+1
As the kernel doc "timers-howto.txt" reads, short delay with msleep() can take much longer. In a case of raspbery-pi platform where CONFIG_HZ_100 was set, it actually affected the init of Friio devices since it issues lots of i2c transactions with short delay. Signed-off-by: Akihiro Tsukada <tskd08@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-04media: dvb-usb-v2: stop using coherent memory for URBsMauro Carvalho Chehab1-13/+4
There's no need to use coherent buffers there. So, let the DVB core do the allocation. That should give some performance gain outside x86. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-04media: dvbsky: fix driver unregister logicMauro Carvalho Chehab1-0/+3
There's a user-after-free there, if the frontend is attached via the new I2C way: [ 112.539806] usbcore: deregistering interface driver dvb_usb_dvbsky [ 112.568489] ================================================================== [ 112.568600] BUG: KASAN: use-after-free in dvb_unregister_frontend+0x18/0xb0 [dvb_core] [ 112.568610] Read of size 8 at addr ffff8803a6f61530 by task rmmod/2246 [ 112.568622] CPU: 0 PID: 2246 Comm: rmmod Not tainted 4.16.0-rc4+ #103 [ 112.568624] Hardware name: /NUC5i7RYB, BIOS RYBDWi35.86A.0364.2017.0511.0949 05/11/2017 [ 112.568625] Call Trace: [ 112.568631] dump_stack+0x5c/0x7c [ 112.568636] print_address_description+0x6a/0x270 [ 112.568640] kasan_report+0x258/0x380 [ 112.568657] ? dvb_unregister_frontend+0x18/0xb0 [dvb_core] [ 112.568673] dvb_unregister_frontend+0x18/0xb0 [dvb_core] [ 112.568681] dvb_usbv2_exit+0x156/0x4a0 [dvb_usb_v2] [ 112.568689] dvb_usbv2_disconnect+0xa0/0x140 [dvb_usb_v2] [ 112.568694] usb_unbind_interface+0xd8/0x3f0 [ 112.568700] device_release_driver_internal+0x1ce/0x2f0 [ 112.568705] driver_detach+0x66/0xc0 [ 112.568709] bus_remove_driver+0x86/0x150 [ 112.568713] usb_deregister+0x90/0x180 [ 112.568718] SyS_delete_module+0x293/0x330 [ 112.568721] ? free_module+0x330/0x330 [ 112.568725] ? _cond_resched+0x16/0x50 [ 112.568729] ? task_work_run+0x7d/0xd0 [ 112.568732] ? mem_cgroup_handle_over_high+0x1c/0xc0 [ 112.568736] ? free_module+0x330/0x330 [ 112.568740] do_syscall_64+0xe7/0x250 [ 112.568744] entry_SYSCALL_64_after_hwframe+0x3d/0xa2 [ 112.568747] RIP: 0033:0x7facafa272a7 [ 112.568749] RSP: 002b:00007fffdea14cc8 EFLAGS: 00000206 ORIG_RAX: 00000000000000b0 [ 112.568753] RAX: ffffffffffffffda RBX: 00007fffdea14d28 RCX: 00007facafa272a7 [ 112.568755] RDX: 000000000000000a RSI: 0000000000000800 RDI: 00005599557337c8 [ 112.568756] RBP: 0000559955733760 R08: 000000000000000a R09: 0000000000000000 [ 112.568758] R10: 00007facafaa0280 R11: 0000000000000206 R12: 00007fffdea14ef0 [ 112.568761] R13: 00007fffdea16eac R14: 0000559955733260 R15: 0000559955733760 [ 112.568808] Allocated by task 638: [ 112.568816] kasan_kmalloc+0xa0/0xd0 [ 112.568820] kmem_cache_alloc_trace+0x114/0x230 [ 112.568826] m88ds3103_probe+0x9a/0x643 [m88ds3103] [ 112.568830] i2c_device_probe+0x2e9/0x3c0 [ 112.568833] driver_probe_device+0x46e/0x6a0 [ 112.568836] bus_for_each_drv+0xd6/0x130 [ 112.568838] __device_attach+0x166/0x1f0 [ 112.568841] bus_probe_device+0xea/0x110 [ 112.568844] device_add+0x6a3/0x9f0 [ 112.568847] i2c_new_device+0x28f/0x5c0 [ 112.568861] dvb_module_probe+0x91/0x110 [dvb_core] [ 112.568867] dvbsky_s960c_attach+0x1c4/0x460 [dvb_usb_dvbsky] [ 112.568873] dvb_usbv2_probe+0x1191/0x1950 [dvb_usb_v2] [ 112.568877] usb_probe_interface+0x1b3/0x430 [ 112.568880] driver_probe_device+0x46e/0x6a0 [ 112.568882] __driver_attach+0xeb/0x110 [ 112.568885] bus_for_each_dev+0xe4/0x140 [ 112.568888] bus_add_driver+0x249/0x380 [ 112.568891] driver_register+0xc6/0x170 [ 112.568893] usb_register_driver+0xec/0x200 [ 112.568896] do_one_initcall+0x8f/0x1ee [ 112.568900] do_init_module+0xde/0x320 [ 112.568902] load_module+0x3ed0/0x4850 [ 112.568905] SYSC_finit_module+0x192/0x1c0 [ 112.568908] do_syscall_64+0xe7/0x250 [ 112.568911] entry_SYSCALL_64_after_hwframe+0x3d/0xa2 [ 112.568916] Freed by task 2246: [ 112.568923] __kasan_slab_free+0x136/0x180 [ 112.568925] kfree+0xa5/0x1e0 [ 112.568931] m88ds3103_remove+0x42/0x60 [m88ds3103] [ 112.568934] i2c_device_remove+0x72/0xd0 [ 112.568937] device_release_driver_internal+0x1ce/0x2f0 [ 112.568940] bus_remove_device+0x197/0x270 [ 112.568942] device_del+0x239/0x550 [ 112.568945] device_unregister+0x16/0x70 [ 112.568949] dvbsky_exit+0x4c/0x70 [dvb_usb_dvbsky] [ 112.568955] dvb_usbv2_disconnect+0x98/0x140 [dvb_usb_v2] [ 112.568958] usb_unbind_interface+0xd8/0x3f0 [ 112.568961] device_release_driver_internal+0x1ce/0x2f0 [ 112.568964] driver_detach+0x66/0xc0 [ 112.568967] bus_remove_driver+0x86/0x150 [ 112.568970] usb_deregister+0x90/0x180 [ 112.568973] SyS_delete_module+0x293/0x330 [ 112.568976] do_syscall_64+0xe7/0x250 [ 112.568979] entry_SYSCALL_64_after_hwframe+0x3d/0xa2 [ 112.568985] The buggy address belongs to the object at ffff8803a6f61100 which belongs to the cache kmalloc-2048 of size 2048 [ 112.568998] The buggy address is located 1072 bytes inside of 2048-byte region [ffff8803a6f61100, ffff8803a6f61900) [ 112.569008] The buggy address belongs to the page: [ 112.569015] page:ffffea000e9bd800 count:1 mapcount:0 mapping:0000000000000000 index:0x0 compound_mapcount: 0 [ 112.569025] flags: 0x17ffe000008100(slab|head) [ 112.569034] raw: 0017ffe000008100 0000000000000000 0000000000000000 00000001000f000f [ 112.569044] raw: ffffea000ee2d000 0000000500000005 ffff880407002a80 0000000000000000 [ 112.569053] page dumped because: kasan: bad access detected [ 112.569062] Memory state around the buggy address: [ 112.569070] ffff8803a6f61400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 112.569079] ffff8803a6f61480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 112.569088] >ffff8803a6f61500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 112.569095] ^ [ 112.569103] ffff8803a6f61580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 112.569112] ffff8803a6f61600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 112.569119] ================================================================== [ 112.569127] Disabling lock debugging due to kernel taint [ 112.571161] dvb_usb_v2: 'DVBSky S960CI:2-2' successfully deinitialized and disconnected Fix it by letting the dvb-usb-v2 core to know that the frontend was already removed. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-05-04media: dvbsky: use the new dvb_module_probe() APIMauro Carvalho Chehab1-279/+127
Instead of repeating countless times a complex logic, use the new dvb_module_probe()/dvb_module_release(), simplifying the module. That reduced about 15% at the module's size: text data bss dec hex filename 7083 1108 12 8203 200b old/drivers/media/usb/dvb-usb-v2/dvbsky.o 5817 1108 12 6937 1b19 new/drivers/media/usb/dvb-usb-v2/dvbsky.o Tested with a DVBSky S960C DVB-S2 tuner (0572:960c) Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-03-23media: dvb-usb-v2: fix a missing dependency of I2C_MUXMauro Carvalho Chehab1-1/+1
Now that af9015 requires I2C_MUX, all drivers that select it should also depend on it. drivers/media/dvb-frontends/af9013.o: In function `af9013_remove': >> drivers/media/dvb-frontends/af9013.c:1560: undefined reference to `i2c_mux_del_adapters' drivers/media/dvb-frontends/af9013.o: In function `af9013_probe': >> drivers/media/dvb-frontends/af9013.c:1488: undefined reference to `i2c_mux_alloc' >> drivers/media/dvb-frontends/af9013.c:1495: undefined reference to `i2c_mux_add_adapter' drivers/media/dvb-frontends/af9013.c:1544: undefined reference to `i2c_mux_del_adapters' Reported-by: kbuild test robot <fengguang.wu@intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2018-03-21media: af9015: correct some coding style issuesAntti Palosaari1-84/+88
Correct coding style issues reported mostly by checkpatch.pl. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2018-03-21media: af9015: convert to regmap apiAntti Palosaari3-97/+115
Use regmap for chip register access. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2018-03-21media: dvb-usb-v2: add probe/disconnect callbacksAntti Palosaari2-4/+24
Add probe and disconnect callbacks that behaves similarly than ones used commonly on Linux driver model. We need those to get early / late access to driver in order to use normal probe time stuff, like regmap, extra bus adapters and so. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2018-03-21media: af9015: enhance streaming configAntti Palosaari2-119/+115
Replace static stream settings by one which enables and disables stream interface when needed (TS streaming control). 1) Configure both TS IF and USB endpoints according to current use case 2) Disable streaming USB endpoints when streaming is stopped and enable when streaming is started. Reduces sleep power consumption slightly. 3) Reduce USB buffersize slightly, from 130848 to 98136 bytes Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2018-03-21media: af9015: refactor copy firmware to slave demodAntti Palosaari1-44/+44
Small improvements. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2018-03-21media: af9015: refactor firmware downloadAntti Palosaari1-22/+17
Small revise, no functional changes. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2018-03-21media: af9015: use af9013 demod pid filtersAntti Palosaari1-31/+18
PID filters are moved to af9013 demod driver as those are property of demod. As pid filters are now implemented correctly by demod driver, we could enable pid filter support for possible slave demod too on dual tuner configuration. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2018-03-21media: af9015: attach demod using i2c bindingAntti Palosaari2-66/+96
af9013 demod driver has i2c binding. Use it. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2018-03-21media: af9015: fix loggingAntti Palosaari1-79/+81
Pass correct device to dev_* logging functions, which allows us to remove redundant KBUILD_MODNAME and __func__ parameters from log format. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-28media: move dvb kAPI headers to include/mediaMauro Carvalho Chehab6-10/+9
Except for DVB, all media kAPI headers are at include/media. Move the headers to it. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-14media: dvbsky: MyGica T230C supportStefan Brüns1-0/+88
Mygica T230 DVB-T/T2/C USB stick support. It uses the same FX2/Si2168 bridge/demodulator combo as the other devices supported by the driver, but uses the Si2141 tuner. Several DVB-T (MPEG2) and DVB-T2 (H.265) channels were tested, as well as the included remote control. Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-11media: mxl111sf: improve error handling logicMauro Carvalho Chehab1-2/+7
As reported by smatch: drivers/media/usb/dvb-usb-v2/mxl111sf-demod.c:485 mxl111sf_demod_read_signal_strength() error: uninitialized symbol 'modulation'. The mxl111sf_demod_read_signal_strength() just ignores if something gets wrong while reading snr or modulation. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-11media: dvbsky: shut up a bogus warningMauro Carvalho Chehab1-2/+2
Smatch gives two bogus warnings on this driver: drivers/media/usb/dvb-usb-v2/dvbsky.c:336 dvbsky_s960_attach() error: uninitialized symbol 'i2c_adapter'. drivers/media/usb/dvb-usb-v2/dvbsky.c:459 dvbsky_s960c_attach() error: uninitialized symbol 'i2c_adapter'. Shut them up. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-11media: dvb-usb-v2: lmedm04: move ts2020 attach to dm04_lme2510_tunerMalcolm Priestley1-7/+6
When the tuner was split from m88rs2000 the attach function is in wrong place. Move to dm04_lme2510_tuner to trap errors on failure and removing a call to lme_coldreset. Prevents driver starting up without any tuner connected. Fixes to trap for ts2020 fail. LME2510(C): FE Found M88RS2000 ts2020: probe of 0-0060 failed with error -11 ... LME2510(C): TUN Found RS2000 tuner kasan: CONFIG_KASAN_INLINE enabled kasan: GPF could be caused by NULL-ptr deref or user memory access general protection fault: 0000 [#1] PREEMPT SMP KASAN Reported-by: Andrey Konovalov <andreyknvl@google.com> Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Tested-by: Andrey Konovalov <andreyknvl@google.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-12-11media: dvb-usb-v2: lmedm04: Improve logic checking of warm startMalcolm Priestley1-8/+18
Warm start has no check as whether a genuine device has connected and proceeds to next execution path. Check device should read 0x47 at offset of 2 on USB descriptor read and it is the amount requested of 6 bytes. Fix for kasan: CONFIG_KASAN_INLINE enabled kasan: GPF could be caused by NULL-ptr deref or user memory access as Reported-by: Andrey Konovalov <andreyknvl@google.com> Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-11-16Merge tag 'media/v4.15-1' of ↵Linus Torvalds3-4/+2
ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media Pull media updates from Mauro Carvalho Chehab: - Documentation for digital TV (both kAPI and uAPI) are now in sync with the implementation (except for legacy/deprecated ioctls). This is a major step, as there were always a gap there - New sensor driver: imx274 - New cec driver: cec-gpio - New platform driver for rockship rga and tegra CEC - New RC driver: tango-ir - Several cleanups at atomisp driver - Core improvements for RC, CEC, V4L2 async probing support and DVB - Lots of drivers cleanup, fixes and improvements. * tag 'media/v4.15-1' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (332 commits) dvb_frontend: don't use-after-free the frontend struct media: dib0700: fix invalid dvb_detach argument media: v4l2-ctrls: Don't validate BITMASK twice media: s5p-mfc: fix lockdep warning media: dvb-core: always call invoke_release() in fe_free() media: usb: dvb-usb-v2: dvb_usb_core: remove redundant code in dvb_usb_fe_sleep media: au0828: make const array addr_list static media: cx88: make const arrays default_addr_list and pvr2000_addr_list static media: drxd: make const array fastIncrDecLUT static media: usb: fix spelling mistake: "synchronuously" -> "synchronously" media: ddbridge: fix build warnings media: av7110: avoid 2038 overflow in debug print media: Don't do DMA on stack for firmware upload in the AS102 driver media: v4l: async: fix unregister for implicitly registered sub-device notifiers media: v4l: async: fix return of unitialized variable ret media: imx274: fix missing return assignment from call to imx274_mode_regs media: camss-vfe: always initialize reg at vfe_set_xbar_cfg() media: atomisp: make function calls cleaner media: atomisp: get rid of storage_class.h media: atomisp: get rid of wrong stddef.h include ...
2017-11-07media: usb: dvb-usb-v2: dvb_usb_core: remove redundant code in dvb_usb_fe_sleepGustavo A. R. Silva1-2/+1
Check on return value and goto instruction is redundant as the code that follows is the goto label err. Addresses-Coverity-ID: 1268783 Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-11-02License cleanup: add SPDX GPL-2.0 license identifier to files with no licenseGreg Kroah-Hartman3-0/+3
Many source files in the tree are missing licensing information, which makes it harder for compliance tools to determine the correct license. By default all files without license information are under the default license of the kernel, which is GPL version 2. Update the files which contain no license information with the 'GPL-2.0' SPDX license identifier. The SPDX identifier is a legally binding shorthand, which can be used instead of the full boiler plate text. This patch is based on work done by Thomas Gleixner and Kate Stewart and Philippe Ombredanne. How this work was done: Patches were generated and checked against linux-4.14-rc6 for a subset of the use cases: - file had no licensing information it it. - file was a */uapi/* one with no licensing information in it, - file was a */uapi/* one with existing licensing information, Further patches will be generated in subsequent months to fix up cases where non-standard license headers were used, and references to license had to be inferred by heuristics based on keywords. The analysis to determine which SPDX License Identifier to be applied to a file was done in a spreadsheet of side by side results from of the output of two independent scanners (ScanCode & Windriver) producing SPDX tag:value files created by Philippe Ombredanne. Philippe prepared the base worksheet, and did an initial spot review of a few 1000 files. The 4.13 kernel was the starting point of the analysis with 60,537 files assessed. Kate Stewart did a file by file comparison of the scanner results in the spreadsheet to determine which SPDX license identifier(s) to be applied to the file. She confirmed any determination that was not immediately clear with lawyers working with the Linux Foundation. Criteria used to select files for SPDX license identifier tagging was: - Files considered eligible had to be source code files. - Make and config files were included as candidates if they contained >5 lines of source - File already had some variant of a license header in it (even if <5 lines). All documentation files were explicitly excluded. The following heuristics were used to determine which SPDX license identifiers to apply. - when both scanners couldn't find any license traces, file was considered to have no license information in it, and the top level COPYING file license applied. For non */uapi/* files that summary was: SPDX license identifier # files ---------------------------------------------------|------- GPL-2.0 11139 and resulted in the first patch in this series. If that file was a */uapi/* path one, it was "GPL-2.0 WITH Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was: SPDX license identifier # files ---------------------------------------------------|------- GPL-2.0 WITH Linux-syscall-note 930 and resulted in the second patch in this series. - if a file had some form of licensing information in it, and was one of the */uapi/* ones, it was denoted with the Linux-syscall-note if any GPL family license was found in the file or had no licensing in it (per prior point). Results summary: SPDX license identifier # files ---------------------------------------------------|------ GPL-2.0 WITH Linux-syscall-note 270 GPL-2.0+ WITH Linux-syscall-note 169 ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21 ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17 LGPL-2.1+ WITH Linux-syscall-note 15 GPL-1.0+ WITH Linux-syscall-note 14 ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5 LGPL-2.0+ WITH Linux-syscall-note 4 LGPL-2.1 WITH Linux-syscall-note 3 ((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3 ((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1 and that resulted in the third patch in this series. - when the two scanners agreed on the detected license(s), that became the concluded license(s). - when there was disagreement between the two scanners (one detected a license but the other didn't, or they both detected different licenses) a manual inspection of the file occurred. - In most cases a manual inspection of the information in the file resulted in a clear resolution of the license that should apply (and which scanner probably needed to revisit its heuristics). - When it was not immediately clear, the license identifier was confirmed with lawyers working with the Linux Foundation. - If there was any question as to the appropriate license identifier, the file was flagged for further research and to be revisited later in time. In total, over 70 hours of logged manual review was done on the spreadsheet to determine the SPDX license identifiers to apply to the source files by Kate, Philippe, Thomas and, in some cases, confirmation by lawyers working with the Linux Foundation. Kate also obtained a third independent scan of the 4.13 code base from FOSSology, and compared selected files where the other two scanners disagreed against that SPDX file, to see if there was new insights. The Windriver scanner is based on an older version of FOSSology in part, so they are related. Thomas did random spot checks in about 500 files from the spreadsheets for the uapi headers and agreed with SPDX license identifier in the files he inspected. For the non-uapi files Thomas did random spot checks in about 15000 files. In initial set of patches against 4.14-rc6, 3 files were found to have copy/paste license identifier errors, and have been fixed to reflect the correct identifier. Additionally Philippe spent 10 hours this week doing a detailed manual inspection and review of the 12,461 patched files from the initial patch version early this week with: - a full scancode scan run, collecting the matched texts, detected license ids and scores - reviewing anything where there was a license detected (about 500+ files) to ensure that the applied SPDX license was correct - reviewing anything where there was no detection but the patch license was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied SPDX license was correct This produced a worksheet with 20 files needing minor correction. This worksheet was then exported into 3 different .csv files for the different types of files to be modified. These .csv files were then reviewed by Greg. Thomas wrote a script to parse the csv files and add the proper SPDX tag to the file, in the format that the file expected. This script was further refined by Greg based on the output to detect more types of files automatically and to distinguish between header and source .c files (which need different comment types.) Finally Greg ran the script using the .csv files to generate the patches. Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org> Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-10-31media: mxl111sf: remove redundant assignment to indexColin Ian King1-1/+0
Variable index is set to zero and then set to zero again a few lines later in a for loop initialization. Remove the redundant setting of index to zero. Cleans up the clang warning: drivers/media/usb/dvb-usb-v2/mxl111sf-i2c.c:519:3: warning: Value stored to 'index' is never read 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>
2017-09-23media: rtl28xxu: make array rc_nec_tab static constColin Ian King1-1/+1
Don't populate the array rc_nec_tab on the stack, instead make it static const. Makes the object code smaller by over 620 bytes: Before: text data bss dec hex filename 49511 17040 64 66615 10437 rtl28xxu.o After: text data bss dec hex filename 48825 17104 64 65993 101c9 rtl28xxu.o Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Hans Verkuil <hansverk@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-08-27media: mxl111sf: Fix potential null pointer dereferenceEugeniu Rosca1-1/+3
Reviewing the delta between cppcheck output of v4.9.39 and v4.9.40 stable updates, I stumbled on the new warning: mxl111sf.c:80: (warning) Possible null pointer dereference: rbuf Since copying state->rcvbuf into rbuf is not needed in the 'write-only' scenario (i.e. calling mxl111sf_ctrl_msg() from mxl111sf_i2c_send_data() or from mxl111sf_write_reg()), bypass memcpy() in this case. Fixes: d90b336f3f65 ("[media] mxl111sf: Fix driver to use heap allocate buffers for USB messages") Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com> Reviewed-by: Michael Ira Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-08-20media: rc: rename RC_TYPE_* to RC_PROTO_* and RC_BIT_* to RC_PROTO_BIT_*Sean Young8-31/+34
RC_TYPE is confusing and it's just the protocol. So rename it. Suggested-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Sean Young <sean@mess.org> Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-08-20media: rc-core: rename input_name to device_nameSean Young1-3/+2
When an ir-spi is registered, you get this message. rc rc0: Unspecified device as /devices/platform/soc/3f215080.spi/spi_master/spi32766/spi32766.128/rc/rc0 "Unspecified device" refers to input_name, which makes no sense for IR TX only devices. So, rename to device_name. Also make driver_name const char* so that no casts are needed anywhere. Now ir-spi reports: rc rc0: IR SPI as /devices/platform/soc/3f215080.spi/spi_master/spi32766/spi32766.128/rc/rc0 Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-08-20media: usb: constify usb_device_idArvind Yadav1-1/+1
usb_device_id are not supposed to change at runtime. All functions working with usb_device_id provided by <linux/usb.h> work with const usb_device_id. So mark the non-const structs as const. 'drivers/media/usb/b2c2/flexcop-usb.c' Fix checkpatch.pl error: ERROR: space prohibited before open square bracket '['. Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-07-20media: Added support for the TerraTec T1 DVB-T USB tuner [IT9135 chipset]Nuno Henriques1-0/+2
Signed-off-by: Nuno Henriques <nuno.amhenriques@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-06-25media: dvb-usb-v2: lmedm04: remove unnecessary variable in ↵Gustavo A. R. Silva1-6/+4
lme2510_stream_restart() Remove unnecessary variable _ret_ and refactor the code. Addresses-Coverity-ID: 1226934 Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-06-20[media] af9015: move 2nd demod power-up wait different locationAntti Palosaari1-3/+3
We need to wait 2nd demod power-up before download firmware. Move that wait to more correct location. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-06-20[media] af9015: enable 2nd TS flow control when dual modeAntti Palosaari1-2/+13
It needs to be enabled in order to get stream from slave af9013 demod. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-06-20[media] af9015: fix and refactor i2c adapter algo logicAntti Palosaari1-74/+79
* fix write+read when write has more than one byte * remove lock, not needed on that case * remove useless i2c msg send loop, as we support only write, read and write+read as one go and nothing more Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-06-20[media] af9015: use correct 7-bit i2c addressesAntti Palosaari2-13/+15
Driver was using wrong "8-bit" i2c addresses for demods and tuners. Internal demod i2c address was not set at all. These are needed to be fixed before proper i2c client binding is used. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-06-06[media] mxl111sf: Fix driver to use heap allocate buffers for USB messagesDevin Heitmueller3-16/+28
The recent changes in 4.9 to mandate USB buffers be heap allocated broke this driver, which was allocating the buffers on the stack. This resulted in the device failing at initialization. Introduce dedicated send/receive buffers as part of the state structure, and add a mutex to protect access to them. Note: we also had to tweak the API to mxl111sf_ctrl_msg to pass the pointer to the state struct rather than the device, since we need it inside the function to access the buffers and the mutex. This patch adjusts the callers to match the API change. Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com> Reported-by: Doug Lung <dlung0@gmail.com> Cc: Michael Ira Krufky <mkrufky@linuxtv.org> Cc: <stable@vger.kernel.org> # for v4.5 and up Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-05-19[media] media drivers: annotate fall-throughMauro Carvalho Chehab2-0/+2
Avoid warnings like those: drivers/media/pci/ddbridge/ddbridge-core.c: In function 'dvb_input_detach': drivers/media/pci/ddbridge/ddbridge-core.c:787:6: warning: this statement may fall through [-Wimplicit-fallthrough=] if (input->fe) { ^ drivers/media/pci/ddbridge/ddbridge-core.c:792:2: note: here case 4: ^~~~ ... On several cases, it is just that gcc 7.1 is not capable of understanding the comment, but on other places, we need an annotation. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-03-03[media] tveeprom: get rid of unused arg on tveeprom_hauppauge_analog()Mauro Carvalho Chehab1-2/+2
tveeprom_hauppauge_analog() used to need the I2C adapter in order to print debug messages. As it now uses pr_foo() facilities since commit 6037b3ca28f4 ("[media] tveeprom: print log messages using pr_foo()"), the first argument of the function is not needed anymore. So, get rid of it. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-03-03[media] mxl111sf: reduce stack usage in init functionArnd Bergmann1-6/+8
mxl111sf uses a lot of kernel stack memory as it puts an i2c_client structure on the stack: drivers/media/usb/dvb-usb-v2/mxl111sf.c: In function 'mxl111sf_init': drivers/media/usb/dvb-usb-v2/mxl111sf.c:953:1: error: the frame size of 1248 bytes is larger than 1152 bytes [-Werror=frame-larger-than=] We can avoid doing this by open-coding the call to i2c_transfer() instead of calling tveeprom_read(), and not passing an i2c_client pointer to tveeprom_hauppauge_analog(), which would ignore that anyway. 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>