Re: [PATCH 03/16] media: vimc: Check if the stream is on using ved.stream

From: Helen Koike
Date: Fri Mar 15 2019 - 15:30:33 EST




On 3/15/19 1:43 PM, Andrà Almeida wrote:
> Change the way that the subdevices check if the stream is running in set
> format functions. It uses the *stream in vimc_deb_device, the more
> appropriate pointer. This also makes easier to get rid of the void* and u8*
> in the subdevices structs.

I would just reword this a bit, how about:

Change the way subdevices check if the stream is running.
Verify the stream pointer instead of src_frame.
This makes easier to get rid of the void* and u8* in the subdevices structs.

I also think you can squash this patch with the previous one, and just
mention in the patch you are removing unnecessary checks.

Regards,
Helen

>
> Signed-off-by: Andrà Almeida <andrealmeid@xxxxxxxxxxxxx>
> ---
> drivers/media/platform/vimc/vimc-debayer.c | 2 +-
> drivers/media/platform/vimc/vimc-scaler.c | 4 ++--
> drivers/media/platform/vimc/vimc-sensor.c | 2 +-
> 3 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/media/platform/vimc/vimc-debayer.c b/drivers/media/platform/vimc/vimc-debayer.c
> index 5f84cb38f0f9..f72f888ba5a6 100644
> --- a/drivers/media/platform/vimc/vimc-debayer.c
> +++ b/drivers/media/platform/vimc/vimc-debayer.c
> @@ -270,7 +270,7 @@ static int vimc_deb_set_fmt(struct v4l2_subdev *sd,
>
> if (fmt->which == V4L2_SUBDEV_FORMAT_ACTIVE) {
> /* Do not change the format while stream is on */
> - if (vdeb->src_frame)
> + if (vdeb->ved.stream)
> return -EBUSY;
>
> sink_fmt = &vdeb->sink_fmt;
> diff --git a/drivers/media/platform/vimc/vimc-scaler.c b/drivers/media/platform/vimc/vimc-scaler.c
> index 3102febefd63..6e88328dca5c 100644
> --- a/drivers/media/platform/vimc/vimc-scaler.c
> +++ b/drivers/media/platform/vimc/vimc-scaler.c
> @@ -158,7 +158,7 @@ static int vimc_sca_set_fmt(struct v4l2_subdev *sd,
>
> if (fmt->which == V4L2_SUBDEV_FORMAT_ACTIVE) {
> /* Do not change the format while stream is on */
> - if (vsca->src_frame)
> + if (vsca->ved.stream)
> return -EBUSY;
>
> sink_fmt = &vsca->sink_fmt;
> @@ -334,7 +334,7 @@ static void *vimc_sca_process_frame(struct vimc_ent_device *ved,
> ved);
>
> /* If the stream in this node is not active, just return */
> - if (!vsca->src_frame)
> + if (!ved->stream)
> return ERR_PTR(-EINVAL);
>
> vimc_sca_fill_src_frame(vsca, sink_frame);
> diff --git a/drivers/media/platform/vimc/vimc-sensor.c b/drivers/media/platform/vimc/vimc-sensor.c
> index 44a75099ce7f..e60f1985edb0 100644
> --- a/drivers/media/platform/vimc/vimc-sensor.c
> +++ b/drivers/media/platform/vimc/vimc-sensor.c
> @@ -141,7 +141,7 @@ static int vimc_sen_set_fmt(struct v4l2_subdev *sd,
>
> if (fmt->which == V4L2_SUBDEV_FORMAT_ACTIVE) {
> /* Do not change the format while stream is on */
> - if (vsen->frame)
> + if (vsen->ved.stream)
> return -EBUSY;
>
> mf = &vsen->mbus_format;
>