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

media: pci: Fill v4l2_fmtdesc with designated initializers

Replace initialization of static const v4l2_fmtdesc instances that
specify every struct member with designated initializers. This allows
not zeroing the reserved fields explicitly, and will avoid a need to
patch these drivers every time a reserved field is repurposed.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>

authored by

Laurent Pinchart and committed by
Mauro Carvalho Chehab
b72f14ee f645e625

+30 -18
+16 -6
drivers/media/pci/cx18/cx18-ioctl.c
··· 466 466 struct v4l2_fmtdesc *fmt) 467 467 { 468 468 static const struct v4l2_fmtdesc formats[] = { 469 - { 0, V4L2_BUF_TYPE_VIDEO_CAPTURE, 0, 470 - "HM12 (YUV 4:1:1)", V4L2_PIX_FMT_HM12, { 0, 0, 0, 0 } 469 + { 470 + .index = 0, 471 + .type = V4L2_BUF_TYPE_VIDEO_CAPTURE, 472 + .description = "HM12 (YUV 4:1:1)", 473 + .pixelformat = V4L2_PIX_FMT_HM12, 471 474 }, 472 - { 1, V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_FMT_FLAG_COMPRESSED, 473 - "MPEG", V4L2_PIX_FMT_MPEG, { 0, 0, 0, 0 } 475 + { 476 + .index = 1, 477 + .type = V4L2_BUF_TYPE_VIDEO_CAPTURE, 478 + .flags = V4L2_FMT_FLAG_COMPRESSED, 479 + .description = "MPEG", 480 + .pixelformat = V4L2_PIX_FMT_MPEG, 474 481 }, 475 - { 2, V4L2_BUF_TYPE_VIDEO_CAPTURE, 0, 476 - "UYVY 4:2:2", V4L2_PIX_FMT_UYVY, { 0, 0, 0, 0 } 482 + { 483 + .index = 2, 484 + .type = V4L2_BUF_TYPE_VIDEO_CAPTURE, 485 + .description = "UYVY 4:2:2", 486 + .pixelformat = V4L2_PIX_FMT_UYVY, 477 487 }, 478 488 }; 479 489
+14 -12
drivers/media/pci/ivtv/ivtv-ioctl.c
··· 920 920 static int ivtv_enum_fmt_vid_cap(struct file *file, void *fh, struct v4l2_fmtdesc *fmt) 921 921 { 922 922 static const struct v4l2_fmtdesc hm12 = { 923 - 0, V4L2_BUF_TYPE_VIDEO_CAPTURE, 0, 924 - "HM12 (YUV 4:2:0)", V4L2_PIX_FMT_HM12, 925 - { 0, 0, 0, 0 } 923 + .type = V4L2_BUF_TYPE_VIDEO_CAPTURE, 924 + .description = "HM12 (YUV 4:2:0)", 925 + .pixelformat = V4L2_PIX_FMT_HM12, 926 926 }; 927 927 static const struct v4l2_fmtdesc mpeg = { 928 - 0, V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_FMT_FLAG_COMPRESSED, 929 - "MPEG", V4L2_PIX_FMT_MPEG, 930 - { 0, 0, 0, 0 } 928 + .type = V4L2_BUF_TYPE_VIDEO_CAPTURE, 929 + .flags = V4L2_FMT_FLAG_COMPRESSED, 930 + .description = "MPEG", 931 + .pixelformat = V4L2_PIX_FMT_MPEG, 931 932 }; 932 933 struct ivtv *itv = fh2id(fh)->itv; 933 934 struct ivtv_stream *s = &itv->streams[fh2id(fh)->type]; ··· 947 946 static int ivtv_enum_fmt_vid_out(struct file *file, void *fh, struct v4l2_fmtdesc *fmt) 948 947 { 949 948 static const struct v4l2_fmtdesc hm12 = { 950 - 0, V4L2_BUF_TYPE_VIDEO_OUTPUT, 0, 951 - "HM12 (YUV 4:2:0)", V4L2_PIX_FMT_HM12, 952 - { 0, 0, 0, 0 } 949 + .type = V4L2_BUF_TYPE_VIDEO_OUTPUT, 950 + .description = "HM12 (YUV 4:2:0)", 951 + .pixelformat = V4L2_PIX_FMT_HM12, 953 952 }; 954 953 static const struct v4l2_fmtdesc mpeg = { 955 - 0, V4L2_BUF_TYPE_VIDEO_OUTPUT, V4L2_FMT_FLAG_COMPRESSED, 956 - "MPEG", V4L2_PIX_FMT_MPEG, 957 - { 0, 0, 0, 0 } 954 + .type = V4L2_BUF_TYPE_VIDEO_OUTPUT, 955 + .flags = V4L2_FMT_FLAG_COMPRESSED, 956 + .description = "MPEG", 957 + .pixelformat = V4L2_PIX_FMT_MPEG, 958 958 }; 959 959 struct ivtv *itv = fh2id(fh)->itv; 960 960 struct ivtv_stream *s = &itv->streams[fh2id(fh)->type];