Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: Use designated initializers for all subdev pad ops

Structures passed to subdev pad operations are all zero-initialized when
declaring variables. In most cases, this is done with designated
initializers to initialize some of the fields to specific values, but in
a minority of cases the structures are zero-initialized by assigning
them to '{ 0 }' or '{ }'.

Improve coding style consistency by using designated initializers where
possible, always initializing the 'which' field.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>

authored by

Laurent Pinchart and committed by
Hans Verkuil
e18a7e9a e3a69496

+12 -8
+3 -2
drivers/media/pci/cobalt/cobalt-v4l2.c
··· 910 910 { 911 911 struct cobalt_stream *s = video_drvdata(file); 912 912 struct v4l2_pix_format *pix = &f->fmt.pix; 913 - struct v4l2_subdev_format sd_fmt = { 0 }; 913 + struct v4l2_subdev_format sd_fmt = { 914 + .which = V4L2_SUBDEV_FORMAT_ACTIVE, 915 + }; 914 916 u32 code; 915 917 916 918 if (cobalt_try_fmt_vid_out(file, priv_fh, f)) ··· 943 941 s->xfer_func = pix->xfer_func; 944 942 s->ycbcr_enc = pix->ycbcr_enc; 945 943 s->quantization = pix->quantization; 946 - sd_fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE; 947 944 v4l2_fill_mbus_format(&sd_fmt.format, pix, code); 948 945 v4l2_subdev_call(s->sd, pad, set_fmt, NULL, &sd_fmt); 949 946 return 0;
+3 -2
drivers/media/platform/microchip/microchip-isc-base.c
··· 858 858 static void isc_try_fse(struct isc_device *isc, 859 859 struct v4l2_subdev_state *sd_state) 860 860 { 861 + struct v4l2_subdev_frame_size_enum fse = { 862 + .which = V4L2_SUBDEV_FORMAT_TRY, 863 + }; 861 864 int ret; 862 - struct v4l2_subdev_frame_size_enum fse = {}; 863 865 864 866 /* 865 867 * If we do not know yet which format the subdev is using, we cannot ··· 871 869 return; 872 870 873 871 fse.code = isc->try_config.sd_format->mbus_code; 874 - fse.which = V4L2_SUBDEV_FORMAT_TRY; 875 872 876 873 ret = v4l2_subdev_call(isc->current_subdev->sd, pad, enum_frame_size, 877 874 sd_state, &fse);
+3 -2
drivers/media/platform/renesas/vsp1/vsp1_drm.c
··· 481 481 struct vsp1_pipeline *pipe) 482 482 { 483 483 struct vsp1_drm_pipeline *drm_pipe = to_vsp1_drm_pipeline(pipe); 484 - struct v4l2_subdev_format format = { 0, }; 484 + struct v4l2_subdev_format format = { 485 + .which = V4L2_SUBDEV_FORMAT_ACTIVE, 486 + }; 485 487 int ret; 486 488 487 - format.which = V4L2_SUBDEV_FORMAT_ACTIVE; 488 489 format.pad = RWPF_PAD_SINK; 489 490 format.format.width = drm_pipe->width; 490 491 format.format.height = drm_pipe->height;
+3 -2
drivers/staging/media/deprecated/atmel/atmel-isc-base.c
··· 824 824 static void isc_try_fse(struct isc_device *isc, 825 825 struct v4l2_subdev_state *sd_state) 826 826 { 827 + struct v4l2_subdev_frame_size_enum fse = { 828 + .which = V4L2_SUBDEV_FORMAT_TRY, 829 + }; 827 830 int ret; 828 - struct v4l2_subdev_frame_size_enum fse = {}; 829 831 830 832 /* 831 833 * If we do not know yet which format the subdev is using, we cannot ··· 837 835 return; 838 836 839 837 fse.code = isc->try_config.sd_format->mbus_code; 840 - fse.which = V4L2_SUBDEV_FORMAT_TRY; 841 838 842 839 ret = v4l2_subdev_call(isc->current_subdev->sd, pad, enum_frame_size, 843 840 sd_state, &fse);