From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paul Kocialkowski Subject: Re: [PATCH v7 06/11] media: cedrus: Cleanup control initialization Date: Mon, 19 Aug 2019 14:31:31 +0200 Message-ID: <20190819123131.GA32182@aptenodytes> References: <20190816160132.7352-1-ezequiel@collabora.com> <20190816160132.7352-7-ezequiel@collabora.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="k1lZvvs/B4yU6o8G" Return-path: Content-Disposition: inline In-Reply-To: <20190816160132.7352-7-ezequiel@collabora.com> Sender: linux-kernel-owner@vger.kernel.org To: Ezequiel Garcia Cc: linux-media@vger.kernel.org, kernel@collabora.com, Nicolas Dufresne , Tomasz Figa , linux-rockchip@lists.infradead.org, Heiko Stuebner , Jonas Karlman , Philipp Zabel , Boris Brezillon , Alexandre Courbot , fbuergisser@chromium.org, linux-kernel@vger.kernel.org List-Id: linux-rockchip.vger.kernel.org --k1lZvvs/B4yU6o8G Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, On Fri 16 Aug 19, 13:01, Ezequiel Garcia wrote: > In order to introduce other controls, the control initialization > needs to support an initial struct v4l2_ctrl_control. >=20 > While here, let's cleanup the control initialization, > removing unneeded fields. Thanks for the change! Acked-by: Paul Kocialkowski Cheers, Paul > Signed-off-by: Ezequiel Garcia > --- > Changes in v7: > * None. > Changes in v6: > * None. > Changes in v5: > * None. > Changes in v4: > * New patch. > --- > drivers/staging/media/sunxi/cedrus/cedrus.c | 45 +++++++++++---------- > drivers/staging/media/sunxi/cedrus/cedrus.h | 3 +- > 2 files changed, 25 insertions(+), 23 deletions(-) >=20 > diff --git a/drivers/staging/media/sunxi/cedrus/cedrus.c b/drivers/stagin= g/media/sunxi/cedrus/cedrus.c > index 370937edfc14..7bdc413bf727 100644 > --- a/drivers/staging/media/sunxi/cedrus/cedrus.c > +++ b/drivers/staging/media/sunxi/cedrus/cedrus.c > @@ -29,44 +29,51 @@ > =20 > static const struct cedrus_control cedrus_controls[] =3D { > { > - .id =3D V4L2_CID_MPEG_VIDEO_MPEG2_SLICE_PARAMS, > - .elem_size =3D sizeof(struct v4l2_ctrl_mpeg2_slice_params), > + .cfg =3D { > + .id =3D V4L2_CID_MPEG_VIDEO_MPEG2_SLICE_PARAMS, > + }, > .codec =3D CEDRUS_CODEC_MPEG2, > .required =3D true, > }, > { > - .id =3D V4L2_CID_MPEG_VIDEO_MPEG2_QUANTIZATION, > - .elem_size =3D sizeof(struct v4l2_ctrl_mpeg2_quantization), > + .cfg =3D { > + .id =3D V4L2_CID_MPEG_VIDEO_MPEG2_QUANTIZATION, > + }, > .codec =3D CEDRUS_CODEC_MPEG2, > .required =3D false, > }, > { > - .id =3D V4L2_CID_MPEG_VIDEO_H264_DECODE_PARAMS, > - .elem_size =3D sizeof(struct v4l2_ctrl_h264_decode_params), > + .cfg =3D { > + .id =3D V4L2_CID_MPEG_VIDEO_H264_DECODE_PARAMS, > + }, > .codec =3D CEDRUS_CODEC_H264, > .required =3D true, > }, > { > - .id =3D V4L2_CID_MPEG_VIDEO_H264_SLICE_PARAMS, > - .elem_size =3D sizeof(struct v4l2_ctrl_h264_slice_params), > + .cfg =3D { > + .id =3D V4L2_CID_MPEG_VIDEO_H264_SLICE_PARAMS, > + }, > .codec =3D CEDRUS_CODEC_H264, > .required =3D true, > }, > { > - .id =3D V4L2_CID_MPEG_VIDEO_H264_SPS, > - .elem_size =3D sizeof(struct v4l2_ctrl_h264_sps), > + .cfg =3D { > + .id =3D V4L2_CID_MPEG_VIDEO_H264_SPS, > + }, > .codec =3D CEDRUS_CODEC_H264, > .required =3D true, > }, > { > - .id =3D V4L2_CID_MPEG_VIDEO_H264_PPS, > - .elem_size =3D sizeof(struct v4l2_ctrl_h264_pps), > + .cfg =3D { > + .id =3D V4L2_CID_MPEG_VIDEO_H264_PPS, > + }, > .codec =3D CEDRUS_CODEC_H264, > .required =3D true, > }, > { > - .id =3D V4L2_CID_MPEG_VIDEO_H264_SCALING_MATRIX, > - .elem_size =3D sizeof(struct v4l2_ctrl_h264_scaling_matrix), > + .cfg =3D { > + .id =3D V4L2_CID_MPEG_VIDEO_H264_SCALING_MATRIX, > + }, > .codec =3D CEDRUS_CODEC_H264, > .required =3D true, > }, > @@ -106,12 +113,8 @@ static int cedrus_init_ctrls(struct cedrus_dev *dev,= struct cedrus_ctx *ctx) > return -ENOMEM; > =20 > for (i =3D 0; i < CEDRUS_CONTROLS_COUNT; i++) { > - struct v4l2_ctrl_config cfg =3D {}; > - > - cfg.elem_size =3D cedrus_controls[i].elem_size; > - cfg.id =3D cedrus_controls[i].id; > - > - ctrl =3D v4l2_ctrl_new_custom(hdl, &cfg, NULL); > + ctrl =3D v4l2_ctrl_new_custom(hdl, &cedrus_controls[i].cfg, > + NULL); > if (hdl->error) { > v4l2_err(&dev->v4l2_dev, > "Failed to create new custom control\n"); > @@ -178,7 +181,7 @@ static int cedrus_request_validate(struct media_reque= st *req) > continue; > =20 > ctrl_test =3D v4l2_ctrl_request_hdl_ctrl_find(hdl, > - cedrus_controls[i].id); > + cedrus_controls[i].cfg.id); > if (!ctrl_test) { > v4l2_info(&ctx->dev->v4l2_dev, > "Missing required codec control\n"); > diff --git a/drivers/staging/media/sunxi/cedrus/cedrus.h b/drivers/stagin= g/media/sunxi/cedrus/cedrus.h > index d8e6777e5e27..2f017a651848 100644 > --- a/drivers/staging/media/sunxi/cedrus/cedrus.h > +++ b/drivers/staging/media/sunxi/cedrus/cedrus.h > @@ -49,8 +49,7 @@ enum cedrus_h264_pic_type { > }; > =20 > struct cedrus_control { > - u32 id; > - u32 elem_size; > + struct v4l2_ctrl_config cfg; > enum cedrus_codec codec; > unsigned char required:1; > }; > --=20 > 2.22.0 >=20 --=20 Paul Kocialkowski, Bootlin Embedded Linux and kernel engineering https://bootlin.com --k1lZvvs/B4yU6o8G Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEJZpWjZeIetVBefti3cLmz3+fv9EFAl1alqMACgkQ3cLmz3+f v9FHGgf9GLCQ3HMQRLLRzQ23YG4MhNKPyvS67MXgy+nC7SUk4wllp+NwI9uTGkXZ my2QXgKSmJZOZL5D6SMa2IRMbfebAUfRcosZSjsu9HBheoMnXnRst06mSaQd+Q0H KoaHiAL65KKGaiWPgkMqVpr1mpJv6qaJ5BpFa+IRqKKPXxfn70CG7A7odiyEzAVN oFe0Ai8iiHlhw7dCL3vxcotf4radt8PivRBp8jRwXtTv54XV1TrYDjRysMCwzmZl pTSS8ioM8QwSyxjDzH45kDFXQH3Hxh4iIUTh1SYAfxUNSWRieaWhN3BGIJ63It1h 3Lgr7cpxBlH/5+y4H35NpZmqgSPLNQ== =C07M -----END PGP SIGNATURE----- --k1lZvvs/B4yU6o8G--