Re: [PATCH 30/57] media: atomisp: ov2680: Rework flip ctrls

Andy Shevchenko
2023-01-23T18:33:49Z

On Mon, Jan 23, 2023 at 01:51:38PM +0100, Hans de Goede wrote:
> Rework the flip ctrls to be more like those of mainline (non staging)
> drivers.
>
> This is modelled after the main ov2680 and ov5693 drivers. This also
> introduces __ov2680_get_pad_format() to make the ov2680 code more compliant
> with the mainline v4l2-subdev APIs.
>
> Note the OV2680_FLIP_REG and OV2680_MIRROR_REG defines are renamed to
> OV2680_REG_FORMAT1 and OV2680_REG_FORMAT2 to match the datasheet.

...

> +static inline struct v4l2_subdev *ctrl_to_sd(struct v4l2_ctrl *ctrl)
> +{
> + return &container_of(ctrl->handler, struct ov2680_device,
> + ctrls.handler)->sd;

I would unroll this for better readability.

struct ov2680_device *ovd =
container_of(ctrl->handler, struct ov2680_device, ctrls.handler);

return &ovd->sd;

> +}

--
With Best Regards,
Andy Shevchenko