2023-01-03 17:53:39

by Deepak R Varma

[permalink] [raw]
Subject: [PATCH v2] staging: media: imx: change imx_media_fim_set_stream() to return void

At present, the function imx_media_fim_set_stream() always returns 0.
So, convert it to be a function returning void instead. Issue identified
using the returnvar.cocci Coccinelle semantic patch.

Signed-off-by: Deepak R Varma <[email protected]>
---
Changes in v2:
1. Convert the function return type from int to void. Suggested by
Fabio Estevam <[email protected]>
2. Update patch subject and log accordingly.


drivers/staging/media/imx/imx-media-csi.c | 7 ++-----
drivers/staging/media/imx/imx-media-fim.c | 8 +++-----
drivers/staging/media/imx/imx-media.h | 6 +++---
3 files changed, 8 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/media/imx/imx-media-csi.c b/drivers/staging/media/imx/imx-media-csi.c
index 5c3cc7de209d..44d87fe30d52 100644
--- a/drivers/staging/media/imx/imx-media-csi.c
+++ b/drivers/staging/media/imx/imx-media-csi.c
@@ -779,11 +779,8 @@ static int csi_start(struct csi_priv *priv)
goto idmac_stop;

/* start the frame interval monitor */
- if (priv->fim && priv->dest == IPU_CSI_DEST_IDMAC) {
- ret = imx_media_fim_set_stream(priv->fim, output_fi, true);
- if (ret)
- goto idmac_stop;
- }
+ if (priv->fim && priv->dest == IPU_CSI_DEST_IDMAC)
+ imx_media_fim_set_stream(priv->fim, output_fi, true);

ret = ipu_csi_enable(priv->csi);
if (ret) {
diff --git a/drivers/staging/media/imx/imx-media-fim.c b/drivers/staging/media/imx/imx-media-fim.c
index fb6590dcfc36..f456751f100a 100644
--- a/drivers/staging/media/imx/imx-media-fim.c
+++ b/drivers/staging/media/imx/imx-media-fim.c
@@ -368,12 +368,11 @@ void imx_media_fim_eof_monitor(struct imx_media_fim *fim, ktime_t timestamp)
}

/* Called by the subdev in its s_stream callback */
-int imx_media_fim_set_stream(struct imx_media_fim *fim,
- const struct v4l2_fract *fi,
- bool on)
+void imx_media_fim_set_stream(struct imx_media_fim *fim,
+ const struct v4l2_fract *fi,
+ bool on)
{
unsigned long flags;
- int ret = 0;

v4l2_ctrl_lock(fim->ctrl[FIM_CL_ENABLE]);

@@ -393,7 +392,6 @@ int imx_media_fim_set_stream(struct imx_media_fim *fim,
fim->stream_on = on;
out:
v4l2_ctrl_unlock(fim->ctrl[FIM_CL_ENABLE]);
- return ret;
}

int imx_media_fim_add_controls(struct imx_media_fim *fim)
diff --git a/drivers/staging/media/imx/imx-media.h b/drivers/staging/media/imx/imx-media.h
index f679249d82e4..6f9a46573edd 100644
--- a/drivers/staging/media/imx/imx-media.h
+++ b/drivers/staging/media/imx/imx-media.h
@@ -246,9 +246,9 @@ int imx_media_dev_notifier_register(struct imx_media_dev *imxmd,
/* imx-media-fim.c */
struct imx_media_fim;
void imx_media_fim_eof_monitor(struct imx_media_fim *fim, ktime_t timestamp);
-int imx_media_fim_set_stream(struct imx_media_fim *fim,
- const struct v4l2_fract *frame_interval,
- bool on);
+void imx_media_fim_set_stream(struct imx_media_fim *fim,
+ const struct v4l2_fract *frame_interval,
+ bool on);
int imx_media_fim_add_controls(struct imx_media_fim *fim);
struct imx_media_fim *imx_media_fim_init(struct v4l2_subdev *sd);
void imx_media_fim_free(struct imx_media_fim *fim);
--
2.34.1




2023-01-22 19:58:35

by Deepak R Varma

[permalink] [raw]
Subject: Re: [PATCH v2] staging: media: imx: change imx_media_fim_set_stream() to return void

On Tue, Jan 03, 2023 at 11:08:20PM +0530, Deepak R Varma wrote:
> At present, the function imx_media_fim_set_stream() always returns 0.
> So, convert it to be a function returning void instead. Issue identified
> using the returnvar.cocci Coccinelle semantic patch.
>
> Signed-off-by: Deepak R Varma <[email protected]>
> ---
> Changes in v2:
> 1. Convert the function return type from int to void. Suggested by
> Fabio Estevam <[email protected]>
> 2. Update patch subject and log accordingly.

Hello,
May I request a review and feedback comment on this patch proposal please?

Thank you,
./drv

>
>
> drivers/staging/media/imx/imx-media-csi.c | 7 ++-----
> drivers/staging/media/imx/imx-media-fim.c | 8 +++-----
> drivers/staging/media/imx/imx-media.h | 6 +++---
> 3 files changed, 8 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/staging/media/imx/imx-media-csi.c b/drivers/staging/media/imx/imx-media-csi.c
> index 5c3cc7de209d..44d87fe30d52 100644
> --- a/drivers/staging/media/imx/imx-media-csi.c
> +++ b/drivers/staging/media/imx/imx-media-csi.c
> @@ -779,11 +779,8 @@ static int csi_start(struct csi_priv *priv)
> goto idmac_stop;
>
> /* start the frame interval monitor */
> - if (priv->fim && priv->dest == IPU_CSI_DEST_IDMAC) {
> - ret = imx_media_fim_set_stream(priv->fim, output_fi, true);
> - if (ret)
> - goto idmac_stop;
> - }
> + if (priv->fim && priv->dest == IPU_CSI_DEST_IDMAC)
> + imx_media_fim_set_stream(priv->fim, output_fi, true);
>
> ret = ipu_csi_enable(priv->csi);
> if (ret) {
> diff --git a/drivers/staging/media/imx/imx-media-fim.c b/drivers/staging/media/imx/imx-media-fim.c
> index fb6590dcfc36..f456751f100a 100644
> --- a/drivers/staging/media/imx/imx-media-fim.c
> +++ b/drivers/staging/media/imx/imx-media-fim.c
> @@ -368,12 +368,11 @@ void imx_media_fim_eof_monitor(struct imx_media_fim *fim, ktime_t timestamp)
> }
>
> /* Called by the subdev in its s_stream callback */
> -int imx_media_fim_set_stream(struct imx_media_fim *fim,
> - const struct v4l2_fract *fi,
> - bool on)
> +void imx_media_fim_set_stream(struct imx_media_fim *fim,
> + const struct v4l2_fract *fi,
> + bool on)
> {
> unsigned long flags;
> - int ret = 0;
>
> v4l2_ctrl_lock(fim->ctrl[FIM_CL_ENABLE]);
>
> @@ -393,7 +392,6 @@ int imx_media_fim_set_stream(struct imx_media_fim *fim,
> fim->stream_on = on;
> out:
> v4l2_ctrl_unlock(fim->ctrl[FIM_CL_ENABLE]);
> - return ret;
> }
>
> int imx_media_fim_add_controls(struct imx_media_fim *fim)
> diff --git a/drivers/staging/media/imx/imx-media.h b/drivers/staging/media/imx/imx-media.h
> index f679249d82e4..6f9a46573edd 100644
> --- a/drivers/staging/media/imx/imx-media.h
> +++ b/drivers/staging/media/imx/imx-media.h
> @@ -246,9 +246,9 @@ int imx_media_dev_notifier_register(struct imx_media_dev *imxmd,
> /* imx-media-fim.c */
> struct imx_media_fim;
> void imx_media_fim_eof_monitor(struct imx_media_fim *fim, ktime_t timestamp);
> -int imx_media_fim_set_stream(struct imx_media_fim *fim,
> - const struct v4l2_fract *frame_interval,
> - bool on);
> +void imx_media_fim_set_stream(struct imx_media_fim *fim,
> + const struct v4l2_fract *frame_interval,
> + bool on);
> int imx_media_fim_add_controls(struct imx_media_fim *fim);
> struct imx_media_fim *imx_media_fim_init(struct v4l2_subdev *sd);
> void imx_media_fim_free(struct imx_media_fim *fim);
> --
> 2.34.1
>



2023-01-23 09:24:28

by Marco Felsch

[permalink] [raw]
Subject: Re: [PATCH v2] staging: media: imx: change imx_media_fim_set_stream() to return void

Hi,

the patch lgtm.

On 23-01-23, Deepak R Varma wrote:
> On Tue, Jan 03, 2023 at 11:08:20PM +0530, Deepak R Varma wrote:
> > At present, the function imx_media_fim_set_stream() always returns 0.
> > So, convert it to be a function returning void instead. Issue identified
> > using the returnvar.cocci Coccinelle semantic patch.
> >
> > Signed-off-by: Deepak R Varma <[email protected]>

Reviewed-by: Marco Felsch <[email protected]>

> > ---
> > Changes in v2:
> > 1. Convert the function return type from int to void. Suggested by
> > Fabio Estevam <[email protected]>
> > 2. Update patch subject and log accordingly.
>
> Hello,
> May I request a review and feedback comment on this patch proposal please?
>
> Thank you,
> ./drv
>
> >
> >
> > drivers/staging/media/imx/imx-media-csi.c | 7 ++-----
> > drivers/staging/media/imx/imx-media-fim.c | 8 +++-----
> > drivers/staging/media/imx/imx-media.h | 6 +++---
> > 3 files changed, 8 insertions(+), 13 deletions(-)
> >
> > diff --git a/drivers/staging/media/imx/imx-media-csi.c b/drivers/staging/media/imx/imx-media-csi.c
> > index 5c3cc7de209d..44d87fe30d52 100644
> > --- a/drivers/staging/media/imx/imx-media-csi.c
> > +++ b/drivers/staging/media/imx/imx-media-csi.c
> > @@ -779,11 +779,8 @@ static int csi_start(struct csi_priv *priv)
> > goto idmac_stop;
> >
> > /* start the frame interval monitor */
> > - if (priv->fim && priv->dest == IPU_CSI_DEST_IDMAC) {
> > - ret = imx_media_fim_set_stream(priv->fim, output_fi, true);
> > - if (ret)
> > - goto idmac_stop;
> > - }
> > + if (priv->fim && priv->dest == IPU_CSI_DEST_IDMAC)
> > + imx_media_fim_set_stream(priv->fim, output_fi, true);
> >
> > ret = ipu_csi_enable(priv->csi);
> > if (ret) {
> > diff --git a/drivers/staging/media/imx/imx-media-fim.c b/drivers/staging/media/imx/imx-media-fim.c
> > index fb6590dcfc36..f456751f100a 100644
> > --- a/drivers/staging/media/imx/imx-media-fim.c
> > +++ b/drivers/staging/media/imx/imx-media-fim.c
> > @@ -368,12 +368,11 @@ void imx_media_fim_eof_monitor(struct imx_media_fim *fim, ktime_t timestamp)
> > }
> >
> > /* Called by the subdev in its s_stream callback */
> > -int imx_media_fim_set_stream(struct imx_media_fim *fim,
> > - const struct v4l2_fract *fi,
> > - bool on)
> > +void imx_media_fim_set_stream(struct imx_media_fim *fim,
> > + const struct v4l2_fract *fi,
> > + bool on)
> > {
> > unsigned long flags;
> > - int ret = 0;
> >
> > v4l2_ctrl_lock(fim->ctrl[FIM_CL_ENABLE]);
> >
> > @@ -393,7 +392,6 @@ int imx_media_fim_set_stream(struct imx_media_fim *fim,
> > fim->stream_on = on;
> > out:
> > v4l2_ctrl_unlock(fim->ctrl[FIM_CL_ENABLE]);
> > - return ret;
> > }
> >
> > int imx_media_fim_add_controls(struct imx_media_fim *fim)
> > diff --git a/drivers/staging/media/imx/imx-media.h b/drivers/staging/media/imx/imx-media.h
> > index f679249d82e4..6f9a46573edd 100644
> > --- a/drivers/staging/media/imx/imx-media.h
> > +++ b/drivers/staging/media/imx/imx-media.h
> > @@ -246,9 +246,9 @@ int imx_media_dev_notifier_register(struct imx_media_dev *imxmd,
> > /* imx-media-fim.c */
> > struct imx_media_fim;
> > void imx_media_fim_eof_monitor(struct imx_media_fim *fim, ktime_t timestamp);
> > -int imx_media_fim_set_stream(struct imx_media_fim *fim,
> > - const struct v4l2_fract *frame_interval,
> > - bool on);
> > +void imx_media_fim_set_stream(struct imx_media_fim *fim,
> > + const struct v4l2_fract *frame_interval,
> > + bool on);
> > int imx_media_fim_add_controls(struct imx_media_fim *fim);
> > struct imx_media_fim *imx_media_fim_init(struct v4l2_subdev *sd);
> > void imx_media_fim_free(struct imx_media_fim *fim);
> > --
> > 2.34.1
> >
>
>
>
>