summaryrefslogtreecommitdiff
path: root/drivers/media/pci/tw5864/tw5864-video.c
AgeCommit message (Collapse)Author
2017-06-24media: tw5864, fc0011: better handle WARN_ON()Mauro Carvalho Chehab
As such macro will check if the expression is true, it may fall through, as warned: In file included from ./include/uapi/linux/stddef.h:1:0, from ./include/linux/stddef.h:4, from ./include/uapi/linux/posix_types.h:4, from ./include/uapi/linux/types.h:13, from ./include/linux/types.h:5, from ./drivers/media/dvb-core/dvb_frontend.h:35, from drivers/media/tuners/fc0011.h:4, from drivers/media/tuners/fc0011.c:20: drivers/media/tuners/fc0011.c: In function 'fc0011_set_params': ./include/linux/compiler.h:179:22: warning: this statement may fall through [-Wimplicit-fallthrough=] # define unlikely(x) __builtin_expect(!!(x), 0) ^~~~~~~~~~~~~~~~~~~~~~~~~~ ./include/asm-generic/bug.h:109:2: note: in expansion of macro 'unlikely' unlikely(__ret_warn_on); \ ^~~~~~~~ drivers/media/tuners/fc0011.c:344:3: note: in expansion of macro 'WARN_ON' WARN_ON(1); ^~~~~~~ drivers/media/tuners/fc0011.c:345:2: note: here case 0: ^~~~ In file included from ./include/uapi/linux/stddef.h:1:0, from ./include/linux/stddef.h:4, from ./include/uapi/linux/posix_types.h:4, from ./include/uapi/linux/types.h:13, from ./include/linux/types.h:5, from ./include/linux/list.h:4, from ./include/linux/module.h:9, from drivers/media/pci/tw5864/tw5864-video.c:17: drivers/media/pci/tw5864/tw5864-video.c: In function 'tw5864_fmt_vid_cap': ./include/linux/compiler.h:179:22: warning: this statement may fall through [-Wimplicit-fallthrough=] # define unlikely(x) __builtin_expect(!!(x), 0) ^~~~~~~~~~~~~~~~~~~~~~~~~~ ./include/asm-generic/bug.h:68:2: note: in expansion of macro 'unlikely' unlikely(__ret_warn_on); \ ^~~~~~~~ drivers/media/pci/tw5864/tw5864-video.c:547:3: note: in expansion of macro 'WARN_ON_ONCE' WARN_ON_ONCE(1); ^~~~~~~~~~~~ drivers/media/pci/tw5864/tw5864-video.c:548:2: note: here case STD_NTSC: ^~~~ On both cases, it means an error, so, let's return an error code, to make gcc happy. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com> Acked-by: Michael Büsch <m@bues.ch> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-03-22[media] tw5864: use dev_warn instead of WARN to shut up warningArnd Bergmann
tw5864_frameinterval_get() only initializes its output when it successfully identifies the video standard in tw5864_input. We get a warning here because gcc can't always track the state if initialized warnings across a WARN() macro, and thinks it might get used incorrectly in tw5864_s_parm: media/pci/tw5864/tw5864-video.c: In function 'tw5864_s_parm': media/pci/tw5864/tw5864-video.c:816:38: error: 'time_base.numerator' may be used uninitialized in this function [-Werror=maybe-uninitialized] media/pci/tw5864/tw5864-video.c:819:31: error: 'time_base.denominator' may be used uninitialized in this function [-Werror=maybe-uninitialized] Using dev_warn() instead of WARN() avoids the __branch_check__() in unlikely and lets the compiler see that the initialization is correct. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Andrey Utkin <andrey.utkin@corp.bluecherry.net> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-03-22[media] tw5864: improve subscribe event handlingGustavo Padovan
We already check for the V4L2_EVENT_CTRL inside v4l2_ctrl_subscribe_event() so just move this function to the default: branch of the switch and let it does the job for us. Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.com> Acked-by: Andrey Utkin <andrey.utkin@corp.bluecherry.net> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-10-24[media] tw5864: crop picture width to 704Andrey Utkin
Previously, width of 720 was used, but it gives 16-pixel wide black bar at right side of encoded picture. Signed-off-by: Andrey Utkin <andrey.utkin@corp.bluecherry.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-09-19[media] tw5864: constify struct video_device templateAndrey Utkin
tw5864_video_template is used for filling of actual video_device structures. It is copied by value, and is not used for anything else. Signed-off-by: Andrey Utkin <andrey.utkin@corp.bluecherry.net> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-09-19[media] tw5864: constify vb2_ops structureAndrey Utkin
Inspired by "[media] pci: constify vb2_ops structures" patch from Julia Lawall (dated 9 Sep 2016). Signed-off-by: Andrey Utkin <andrey.utkin@corp.bluecherry.net> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-08-24[media] tw5864: remove two unused varsMauro Carvalho Chehab
Remove those two vars that aren't used, as reported by smatch: drivers/media/pci/tw5864/tw5864-video.c: In function 'tw5864_prepare_frame_headers': drivers/media/pci/tw5864/tw5864-video.c:1219:16: warning: variable 'space_before_sl_hdr' set but not used [-Wunused-but-set-variable] unsigned long space_before_sl_hdr; ^~~~~~~~~~~~~~~~~~~ drivers/media/pci/tw5864/tw5864-video.c:1218:6: warning: variable 'sl_hdr' set but not used [-Wunused-but-set-variable] u8 *sl_hdr; ^~~~~~ Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-08-24[media] pci: Add tw5864 driverAndrey Utkin
Support for boards based on Techwell TW5864 chip which provides multichannel video & audio grabbing and encoding (H.264, MJPEG, ADPCM G.726). This submission implements only H.264 encoding of all channels at D1 resolution. Thanks to Mark Thompson <sw@jkqxz.net> for help, and for contribution of H.264 startcode emulation prevention code. Signed-off-by: Andrey Utkin <andrey.utkin@corp.bluecherry.net> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>