summaryrefslogtreecommitdiffstats
path: root/drivers/media/usb
Commit message (Collapse)AuthorAgeFilesLines
* [media] Revert "[media] media: au0828 change to use Managed Media Controller ↵Mauro Carvalho Chehab2016-03-311-1/+2
| | | | | | | | | | | | | | | | | | API" Extending the lifetime of the media_device struct is not handled well by the core, as it will erase some data from the struct, when media_device_cleanup() is called after unregistering it. While we have a fixup patch for it already, the usage of those new functions are needed only when we share data with other drivers. So, better to revert the changes. This reverts commit 182dde7c5d4c ("[media] media: au0828 change to use Managed Media Controller API") Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] au0828: Fix dev_state handlingMauro Carvalho Chehab2016-03-314-39/+39
| | | | | | | | | | | | | | | | | | | | | | | The au0828 dev_state is actually a bit mask. It should not be checking with "==" but, instead, with a logic and. There are some places where it was doing it wrong. Fix that by replacing the dev_state set/clear/test with the bitops. As reviewed by Shuah: "Looks good. Tested running bind/unbind au0828 loop for 1000 times. Didn't see any problems and the v4l2_querycap() problem has been fixed with this patch. After the above test, ran bind/unbind snd_usb_audio 1000 times. Didn't see any problems. Generated media graph and the graph looks good." Cc: stable@vger.kernel.org Reviewed-by: Shuah Khan <shuahkh@osg.samsung.com> Tested-by: Shuah Khan <shuahkh@osg.samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] au0828: fix au0828_v4l2_close() dev_state race conditionShuah Khan2016-03-311-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | au0828_v4l2_close() check for dev_state == DEV_DISCONNECTED will fail to detect the device disconnected state correctly, if au0828_v4l2_open() runs to set the DEV_INITIALIZED bit. A loop test of bind/unbind found this bug by increasing the likelihood of au0828_v4l2_open() occurring while unbind is in progress. When au0828_v4l2_close() fails to detect that the device is in disconnect state, it attempts to power down the device and fails with the following general protection fault: [ 260.992962] Call Trace: [ 260.993008] [<ffffffffa0f80f0f>] ? xc5000_sleep+0x8f/0xd0 [xc5000] [ 260.993095] [<ffffffffa0f6803c>] ? fe_standby+0x3c/0x50 [tuner] [ 260.993186] [<ffffffffa0ef541c>] au0828_v4l2_close+0x53c/0x620 [au0828] [ 260.993298] [<ffffffffa0d08ec0>] v4l2_release+0xf0/0x210 [videodev] [ 260.993382] [<ffffffff81570f9c>] __fput+0x1fc/0x6c0 [ 260.993449] [<ffffffff815714ce>] ____fput+0xe/0x10 [ 260.993519] [<ffffffff8116eb83>] task_work_run+0x133/0x1f0 [ 260.993602] [<ffffffff810035d0>] exit_to_usermode_loop+0x140/0x170 [ 260.993681] [<ffffffff810061ca>] syscall_return_slowpath+0x16a/0x1a0 [ 260.993754] [<ffffffff82835fb3>] entry_SYSCALL_64_fastpath+0xa6/0xa8 Cc: stable@vger.kernel.org Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] media: au0828 fix to clear enable/disable/change source handlersShuah Khan2016-03-311-0/+5
| | | | | | | | | | | Fix to clear enable/disable/change source handlers in the media device when media device is unregistered in au0828_unregister_media_device(). When au0828 module is removed, snd-usb-audio shouldn't call the handlers. Clearing will ensure snd-usb-audio won't call them once au0828 is removed. [mchehab@osg.samsung.com: fix a compilation breakage] Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] au0828: disable tuner links and cache tuner/decoderMauro Carvalho Chehab2016-03-312-19/+27
| | | | | | | | | | | | | | | For au0828_enable_source() to work, the tuner links should be disabled and the tuner/decoder should be cached at au0828 struct. While here, put dev->decoder cache together with dev->tuner, as it makes easier to drop both latter if/when we move the enable routines to the V4L2 core. Fixes: 9822f4173f84 ('[media] au0828: use v4l2_mc_create_media_graph()') Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com> Reviewed-by: Shuah Khan <shuahkh@osg.samsung.com> Tested-by: Shuah Khan <shuahkh@osg.samsung.com>
* media: au0828 disable tuner to demod link in au0828_media_device_register()Shuah Khan2016-03-101-0/+26
| | | | | | | | | Disable tuner to demod link in au0828_media_device_register(). This step should be done after dvb graph is created. [mchehab@osg.samsung.com: Solve conflictst to apply it upstream] Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] touptek: cast char types on %x printkMauro Carvalho Chehab2016-03-101-2/+2
| | | | | | | | This fixes those two smatch warnings: drivers/media/usb/gspca/touptek.c:206 val_reply() warn: argument 3 to %02x specifier has type 'char' drivers/media/usb/gspca/touptek.c:222 reg_w() warn: argument 4 to %02x specifier has type 'char' Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] touptek: don't DMA at the stackMauro Carvalho Chehab2016-03-101-2/+2
| | | | | | | | | | | As warned by smatch: drivers/media/usb/gspca/touptek.c:220 reg_w() error: doing dma on the stack (buff) drivers/media/usb/gspca/touptek.c:458 configure() error: doing dma on the stack (buff) This can fail, as the stack may not be in a memory that would allod DMA. So, use the usb_buf instead. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] hide unused functions for !MEDIA_CONTROLLERArnd Bergmann2016-03-051-7/+2Star
| | | | | | | | | | | | | | | | Some functions in the au0828 driver are only used when CONFIG_MEDIA_CONTROLLER is enabled, and otherwise defined as empty functions: media/usb/au0828/au0828-core.c:208:13: error: 'au0828_media_graph_notify' defined but not used [-Werror=unused-function] media/usb/au0828/au0828-core.c:262:12: error: 'au0828_enable_source' defined but not used [-Werror=unused-function] media/usb/au0828/au0828-core.c:412:13: error: 'au0828_disable_source' defined but not used [-Werror=unused-function] This moves the #ifdef so the entire definitions are hidden in this case. [mchehab@osg.samsung.com: As pointed by Shuah Khan, a return 0 can be removed] Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] em28xx: fix Terratec Grabby AC97 codec detectionMatthieu Rogez2016-03-051-0/+38
| | | | | | | | | | | | | | | | EMP202 chip inside Terratec Grabby (hw rev 2) seems to require some time before accessing reliably its registers. Otherwise it returns some values previously put on the I2C bus. To account for that period, we delay card setup until we have a proof that accessing AC97 registers is reliable. We get this proof by polling AC97_RESET until the expected value is read. We also check that unrelated registers don't return the same value. This second check handles the case where the expected value is constantly returned no matter which register is accessed. Signed-off-by: Matthieu Rogez <matthieu.rogez@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] media: au0828 audio mixer isn't connected to decoderShuah Khan2016-03-031-9/+45
| | | | | | | | | | | | | | | | When snd_usb_audio gets probed first, audio mixer doesn't get linked to the decoder. Change au0828_media_graph_notify() to handle the mixer entity getting registered before the decoder. Change au0828_media_device_register() to invoke au0828_media_graph_notify() to connect entites that were created prior to registering the notify handler. Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com> Reported-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] dw2102: add support for TeVii S662Olli Salonen2016-03-031-6/+17
| | | | | | | | TeVii S662 is a USB 2.0 DVB-S2 tuner that's identical to TechnoTrend S2-4600 tuner. Add the USB ID to dw2102 driver. Signed-off-by: Olli Salonen <olli.salonen@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] dw2102: ts2020 included twiceOlli Salonen2016-03-031-1/+0Star
| | | | | | | ts2020.h was already included a few lines earlier. Remove the unnecessary entry. Signed-off-by: Olli Salonen <olli.salonen@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] em28xx: add support for Terratec Grabby Record ledMatthieu Rogez2016-03-031-0/+11
| | | | | | | | Terratec Grabby (hw rev 2) Record led is connected to GPIO 3 and its logic is inverted: (PIO3 = 0: on, PIO3 = 1: off). Signed-off-by: Matthieu Rogez <matthieu.rogez@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] em28xx: add support for Terratec Grabby REC buttonMatthieu Rogez2016-03-031-0/+1
| | | | | | | | Terratec Grabby (hw rev 2) REC button uses the standard snapshot button configuration. Signed-off-by: Matthieu Rogez <matthieu.rogez@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] em28xx: restore lost #ifdefArnd Bergmann2016-03-031-0/+2
| | | | | | | | | | | | | | | | | The cleanup that changed the em28xx driver to use v4l2_mc_create_media_graph instead of its own implementation causes a build error when CONFIG_MEDIA_CONTROLLER is disabled: drivers/media/usb/em28xx/em28xx-video.c: In function 'em28xx_v4l2_init': drivers/media/usb/em28xx/em28xx-video.c:2717:38: error: 'struct em28xx' has no member named 'media_dev' This puts the new code inside the same #ifdef that controls the presence of the 'media_dev' member, and that the old code was in. Fixes: de39078779cb ("[media] em2xx: use v4l2_mc_create_media_graph()") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] media: au0828 enable the right media source when input changesShuah Khan2016-03-031-1/+9
| | | | | | | | | | | Change vidioc_s_input() to enable the media source for the newly selected input. v4l2-core enables source before calling au0828's vidioc_s_input() handler. Hence, when input selection changes, media source for the newly selected input needs to be enabled. Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
* [media] dw2102: convert TechnoTrend S2-4600 to use I2C binding for demodOlli Salonen2016-03-031-28/+43
| | | | | | | | Convert the TT S2-4600 USB tuner to use the I2C binding for attaching the demodulator instead of the old m88ds3103_attach method. Signed-off-by: Olli Salonen <olli.salonen@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] rtl2832: improve slave TS controlAntti Palosaari2016-03-031-12/+12
| | | | | | | | Add callback parameter to select enable / disable slave TS and use it when slave demod is in use. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] media: au0828 set ctrl_input in au0828_s_input()Shuah Khan2016-03-031-2/+8
| | | | | | | | | | | | | | | | dev->ctrl_input is set in vidioc_s_input() and doesn't get set in au0828_s_input(). As a result, dev->ctrl_input is left uninitialized until user space calls s_input. It works correctly because the default input value is 0 and which is what dev->ctrl_input gets initialized via kzalloc(). Change to set dev->ctrl_input in au0828_s_input(). Also optimize vidioc_s_input() to return if the new input value is same as the current. Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] Add support for Avermedia AverTV Volar HD 2 (TD110)Philippe Valembois2016-03-031-0/+2
| | | | | | Signed-off-by: Philippe Valembois <lephilousophe@users.sourceforge.net> Reviewed-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] UVC: Add support for R200 depth cameraAviv Greenberg2016-03-032-0/+32
| | | | | | | | | | | | | Add support for Intel R200 depth camera in uvc driver. This includes adding new uvc GUIDs for the new pixel formats, adding new V4L pixel format definition to user api headers, and updating the uvc driver GUID-to-4cc tables with the new formats. Tested-by: Greenberg, Aviv D <aviv.d.greenberg@intel.com> Signed-off-by: Aviv Greenberg <aviv.d.greenberg@intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] au0828: use v4l2_mc_create_media_graph()Mauro Carvalho Chehab2016-03-031-98/+5Star
| | | | | | | There's no reason to implement its own function to create the media graph. So, use the core one. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] au0828: use standard demod pads structMauro Carvalho Chehab2016-03-032-5/+5
| | | | | | | | As we want au0828 to use the core function to create the MC graphs, use enum demod_pad_index instead of enum au8522_media_pads. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] technisat-usb2: don't do DMA on the stackMauro Carvalho Chehab2016-03-011-14/+27
| | | | | | | | | | | | | | As warned by smatch: drivers/media/usb/dvb-usb/technisat-usb2.c:263 technisat_usb2_set_led() error: doing dma on the stack (led) drivers/media/usb/dvb-usb/technisat-usb2.c:280 technisat_usb2_set_led_timer() error: doing dma on the stack (&b) drivers/media/usb/dvb-usb/technisat-usb2.c:341 technisat_usb2_identify_state() error: doing dma on the stack (version) drivers/media/usb/dvb-usb/technisat-usb2.c:609 technisat_usb2_get_ir() error: doing dma on the stack (buf) drivers/media/usb/dvb-usb/technisat-usb2.c:619 technisat_usb2_get_ir() error: doing dma on the stack (buf) Create a buffer at the device state and use it for all the DMA transfers. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] airspy: fix bit set/clean mess on s->flagsMauro Carvalho Chehab2016-03-011-6/+5Star
| | | | | | | | | | | | | | | | | As warned by smatch: drivers/media/usb/airspy/airspy.c:541 airspy_start_streaming() warn: test_bit() takes a bit number drivers/media/usb/airspy/airspy.c:569 airspy_start_streaming() warn: test_bit() takes a bit number drivers/media/usb/airspy/airspy.c:605 airspy_stop_streaming() warn: test_bit() takes a bit number set_bit/clear_bit argument is the bit number, and not 1 << bit. Thankfully, one of the bits was not used (URB_BUF), with would otherwise cause a driver misfunctioning. Clean this mess by always using set_bit/clear_bit/test_bit and removing the unused bit. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] gspca: Remove unused ovfx2_vga_mode/ovfx2_cif_mode arraysHans de Goede2016-03-011-34/+0Star
| | | | | | | | Remove the unused ovfx2_vga_mode/ovfx2_cif_mode arrays from the ov519 driver. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] gspca: Fix ov519 i2c r/w not working when connected to a xhci hostWesley Post2016-03-012-0/+17
| | | | | | | | | | | | | | | | Fix the ov519 driver not working (unable to talk to the sensor) when plugged into a xhci host. The root cause here is that uhci/ohci/ehci hosts typically will send any pending async requests every milli-second and then go to sleep for the rest if the milli-second, where as xhci hosts send them immediately, causing things to go too fast for the ov519 bridge. This commit adds a few delays fixing this. Signed-off-by: Wesley Post <pa4wdh@xs4all.nl> [hdegoede@redhat.com: Also add delays to w996Xcf.c, as that needs them too] Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] media: au0828 video change to use v4l_enable_media_source()Shuah Khan2016-02-271-63/+39Star
| | | | | | | | | | | | | | | | | | Change au0828 to check if tuner is free or not before changing tuner configuration. vidioc_g_tuner(), and au0828_v4l2_close() now call v4l-core interface v4l_enable_media_source() before changing tuner configuration. Remove au0828_enable_analog_tuner() as it is no longer needed because v4l2-core implements common interfaces to check for media source availability. In addition, queue_setup() no longer needs the tuner availability check since v4l2-core does it. Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] media: au0828 add enable, disable source handlersShuah Khan2016-02-273-0/+207
| | | | | | | | | | | | | | Add enable_source and disable_source handlers. The enable source handler is called from v4l2-core, dvb-core, and ALSA drivers to check if the shared media source is free. The disable source handler is called to release the shared media source. [mchehab@osg.samsung.com: fix merge conflicts] Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] media: au0828-core register entity_notify hookShuah Khan2016-02-272-2/+44
| | | | | | | | | | | | | Register entity_notify async hook to create links between existing bridge driver entities and a newly added non-bridge driver entities. For example, this handler creates link between V4L decoder entity and ALSA mixer entity. [mchehab@osg.samsung.com: fix merge conflicts and make au0828_media_graph_notify static to shut up a warning] Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] media: au0828 disable tuner to demod linkShuah Khan2016-02-271-1/+19
| | | | | | | | | Change au0828_create_media_graph() to find and disable tuner and demod link. This helps avoid an additional disable step when tuner is requested by video or audio. Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] media: au0828 create tuner to decoder link in disabled stateShuah Khan2016-02-271-2/+1Star
| | | | | | | | | | Create tuner to demod pad link in disabled state to avoid disable step when tuner resource is requested by dvb. [mchehab@osg.samsung.com: fix a merge conflict] Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] media: au0828 handle media_init and media_register windowShuah Khan2016-02-271-4/+24
| | | | | | | | | | | | | | | | | | Media device initialization and registration steps are split. There is a window between media device init and media device register during usb probe. au0828 bridge driver and snd-usb-audio could try to initialize the media device, if they simply checked, whether the device has been registered. They also need to check whether the device has been initialized. Change the au0828-core to check if media device is already initialized during initialization step and check if media device is already registered during the registration step. [mchehab@osg.samsung.com: fix a merge conflict] Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] media: au0828 change to use Managed Media Controller APIShuah Khan2016-02-271-7/+4Star
| | | | | | | | | | | | | | | | | Change au0828 to use Managed Media Controller API to share media device and coordinate creating/deleting the shared media device with the snd-usb-audio driver. The shared media device is created as device resource of the parent usb device of the two drivers. Populate media device model with USB Device product name instead of au0828 device board name. This change is necessary because, if the media device is registered by the snd-usb-audio driver first, and it doesn't know the au0828 board name. [mchehab@osg.samsung.com: Fix merge conflicts] Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] media: au0828 Use au8522_media_pads enum for pad definesShuah Khan2016-02-271-4/+8
| | | | | | | | | | | | Change au0828-core to use au8522_media_pads enum defines instead of hard-coding the pad values. [mchehab@osg.samsung.com: patch rebased, as the code was moved to au0828-video.c. Also added AU8522_PAD_INPUT to the list of pad number replacements] Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] pvrusb2: don't go past buf arrayMauro Carvalho Chehab2016-02-231-0/+3
| | | | | | | That fixes the following smatch warning: drivers/media/usb/pvrusb2/pvrusb2-hdw.c:4909 pvr2_hdw_state_log_state() error: buffer overflow 'buf' 256 <= 4294967294 Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] pvrusb2-io: no need to check if sp is not NULLMauro Carvalho Chehab2016-02-231-1/+1
| | | | | | | | | | | | | | The buffer_complete() routine assumes that sp is not NULL, otherwise it will fail completely. Btw, this is also assumed at pvr2_buffer_queue(), with is the routine that setups the URB handling. So, remove the bogus for the callback at buffer_complete. This fix this smatch warning: drivers/media/usb/pvrusb2/pvrusb2-io.c:476 buffer_complete() warn: variable dereferenced before check 'sp' (see line 472) Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] media_device: move allocation out of media_device_*_initMauro Carvalho Chehab2016-02-236-16/+28
| | | | | | | | | | Right now, media_device_pci_init and media_device_usb_init does media_device allocation internaly. That preents its usage when the media_device struct is embedded on some other structure. Move memory allocation outside it, to make it more generic. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] media-device: move PCI/USB helper functions from v4l2-mcMauro Carvalho Chehab2016-02-236-12/+12
| | | | | | | | | | | | | | | | | | Those ancillary functions could be called even when compiled without V4L2 support, as warned by ktest build robot: All errors (new ones prefixed by >>): >> ERROR: "__v4l2_mc_usb_media_device_init" [drivers/media/usb/dvb-usb/dvb-usb.ko] undefined! >> ERROR: "__v4l2_mc_usb_media_device_init" [drivers/media/usb/dvb-usb-v2/dvb_usb_v2.ko] undefined! >> ERROR: "__v4l2_mc_usb_media_device_init" [drivers/media/usb/au0828/au0828.ko] undefined! Also, there's nothing there that are specific to V4L2. So, move those ancillary functions to MC core. No functional changes. Just function rename. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] usb/cpia2_core: clean up a min_t() castDan Carpenter2016-02-191-1/+1
| | | | | | | | | | | | It makes sense to make the min_t() cast unsigned here since we don't really want negative sizes. Making it signed causes a static checker warning in Smatch. Smatch knows "fw->size - i" is positive but it doesn't know that fw->size is less than INT_MAX so in theory casting it to int might lead to a negative. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] pvrusb2: correctly handling failed thread runInsu Yun2016-02-191-1/+1
| | | | | | | | | Since kthread_run returns -ENOMEM if failed, it needs to be checked whether it is error, not whether it is null. Signed-off-by: Insu Yun <wuninsu@gmail.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] siano: use generic function to create MC deviceMauro Carvalho Chehab2016-02-161-11/+2Star
| | | | | | | | Currently, it is initializing the driver name using the wrong name ("usb"). Use the generic function, as its logic works best, and avoids repeating the very same code everywhere. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] smsusb: don't sleep while atomicMauro Carvalho Chehab2016-02-161-1/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | smscore_getbuffer() calls internally wait_event(), with can sleep. As smsusb_onresponse() is called on interrupt context, this causes the following warning: BUG: sleeping function called from invalid context at drivers/media/common/siano/smscoreapi.c:1653 in_atomic(): 1, irqs_disabled(): 1, pid: 11084, name: systemd-udevd INFO: lockdep is turned off. irq event stamp: 0 hardirqs last enabled at (0): [< (null)>] (null) hardirqs last disabled at (0): [<ffffffff811480f7>] copy_process.part.7+0x10e7/0x56d0 softirqs last enabled at (0): [<ffffffff81148193>] copy_process.part.7+0x1183/0x56d0 softirqs last disabled at (0): [< (null)>] (null) CPU: 2 PID: 11084 Comm: systemd-udevd Tainted: G B W 4.5.0-rc3+ #47 Hardware name: /NUC5i7RYB, BIOS RYBDWi35.86A.0350.2015.0812.1722 08/12/2015 0000000000000000 ffff8803c6907a80 ffffffff81933901 ffff8802bd916000 ffff8802bd9165c8 ffff8803c6907aa8 ffffffff811c6af5 ffff8802bd916000 ffffffffa0ce9b60 0000000000000675 ffff8803c6907ae8 ffffffff811c6ce5 Call Trace: <IRQ> [<ffffffff81933901>] dump_stack+0x85/0xc4 [<ffffffff811c6af5>] ___might_sleep+0x245/0x3a0 [<ffffffff811c6ce5>] __might_sleep+0x95/0x1a0 [<ffffffffa0ce020a>] ? list_add_locked+0xca/0x140 [smsmdtv] [<ffffffffa0ce3b8d>] smscore_getbuffer+0x7d/0x120 [smsmdtv] [<ffffffff8123819d>] ? trace_hardirqs_off+0xd/0x10 [<ffffffffa0ce3b10>] ? smscore_sendrequest_and_wait.isra.5+0x120/0x120 [smsmdtv] [<ffffffffa0ce020a>] ? list_add_locked+0xca/0x140 [smsmdtv] [<ffffffffa0ce13ca>] ? smscore_putbuffer+0x3a/0x40 [smsmdtv] [<ffffffffa0d107bc>] smsusb_submit_urb+0x2ec/0x4f0 [smsusb] [<ffffffffa0d10e36>] smsusb_onresponse+0x476/0x720 [smsusb] Let's add a work queue to handle the bottom half, preventing this problem. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] cx231xx: get rid of CX231XX_VMUX_DEBUGMauro Carvalho Chehab2016-02-162-3/+1Star
| | | | | | | This macro is not used inside the driver. get rid of it. Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] au0828: get rid of AU0828_VMUX_DEBUGMauro Carvalho Chehab2016-02-162-10/+3Star
| | | | | | | This is not used on the driver. remove it. Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] cx231xx: create connectors at the media graphMauro Carvalho Chehab2016-02-164-1/+55
| | | | | | We need to add connectors to the cx231xx graph. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] cx231xx, em28xx: pass media_device to si2157Mauro Carvalho Chehab2016-02-162-0/+12
| | | | | | | | | | | As si2157 doesn't use the subdev, but has instead a binding logic that doesn't have any core framework, we need to manually pass the media_device struct via platform data on every place it is called. This fixes support for HVR-955Q when MC is enabled. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] cx231xx: use v4l2 core function to create the MC graphMauro Carvalho Chehab2016-02-161-52/+3Star
| | | | | | | Instead of having its own routine, use the one defined at the core, as it is generic enough to handle the cx231xx usecases. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
* [media] em28xx-dvb: create RF connector on DVB-only modeMauro Carvalho Chehab2016-02-162-2/+8
| | | | | | | | | When in analog mode, the RF connector will be created by em28xx-video. However, when the device is in digital mode only, the RF connector is not shown. In this case, let the DVB core to create it for us. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>