diff mbox series

[4/5] media: imx: imx-mipi-csis: Remove duplicated check

Message ID 20220314103941.46021-5-jacopo@jmondi.org (mailing list archive)
State New, archived
Headers show
Series media: imx: imx-mipi-csis: Additional cleanups | expand

Commit Message

Jacopo Mondi March 14, 2022, 10:39 a.m. UTC
The mipi_csis_log_counters() function already checks for
csis->debug.enable, it is not necessary to do the same in the caller.

Compatc the code in the caller as well by removing an empty line.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
---
 drivers/media/platform/imx/imx-mipi-csis.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

Laurent Pinchart March 15, 2022, 11:30 a.m. UTC | #1
Hi Jacopo,

Thank you for the patch.

On Mon, Mar 14, 2022 at 11:39:40AM +0100, Jacopo Mondi wrote:
> The mipi_csis_log_counters() function already checks for
> csis->debug.enable, it is not necessary to do the same in the caller.

Does it ? It does only to decide whether or not to print counters that
have a zero value.

> Compatc the code in the caller as well by removing an empty line.
> 
> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
> ---
>  drivers/media/platform/imx/imx-mipi-csis.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/media/platform/imx/imx-mipi-csis.c b/drivers/media/platform/imx/imx-mipi-csis.c
> index 4a6152c13d52..4bb469fcb6b3 100644
> --- a/drivers/media/platform/imx/imx-mipi-csis.c
> +++ b/drivers/media/platform/imx/imx-mipi-csis.c
> @@ -913,11 +913,8 @@ static int mipi_csis_s_stream(struct v4l2_subdev *sd, int enable)
>  
>  	if (!enable) {
>  		v4l2_subdev_call(csis->src_sd, video, s_stream, 0);
> -
>  		mipi_csis_stop_stream(csis);
> -		if (csis->debug.enable)
> -			mipi_csis_log_counters(csis, true);
> -
> +		mipi_csis_log_counters(csis, true);
>  		pm_runtime_put(csis->dev);
>  
>  		return 0;
Jacopo Mondi March 15, 2022, 12:27 p.m. UTC | #2
On Tue, Mar 15, 2022 at 01:30:20PM +0200, Laurent Pinchart wrote:
> Hi Jacopo,
>
> Thank you for the patch.
>
> On Mon, Mar 14, 2022 at 11:39:40AM +0100, Jacopo Mondi wrote:
> > The mipi_csis_log_counters() function already checks for
> > csis->debug.enable, it is not necessary to do the same in the caller.
>
> Does it ? It does only to decide whether or not to print counters that
> have a zero value.
>

Roght, I mis-read the condition there.

What is the usage of the counters logger ? Should we make it
conditional to debug.enable ?

Thanks
  j

> > Compatc the code in the caller as well by removing an empty line.
> >
> > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
> > ---
> >  drivers/media/platform/imx/imx-mipi-csis.c | 5 +----
> >  1 file changed, 1 insertion(+), 4 deletions(-)
> >
> > diff --git a/drivers/media/platform/imx/imx-mipi-csis.c b/drivers/media/platform/imx/imx-mipi-csis.c
> > index 4a6152c13d52..4bb469fcb6b3 100644
> > --- a/drivers/media/platform/imx/imx-mipi-csis.c
> > +++ b/drivers/media/platform/imx/imx-mipi-csis.c
> > @@ -913,11 +913,8 @@ static int mipi_csis_s_stream(struct v4l2_subdev *sd, int enable)
> >
> >  	if (!enable) {
> >  		v4l2_subdev_call(csis->src_sd, video, s_stream, 0);
> > -
> >  		mipi_csis_stop_stream(csis);
> > -		if (csis->debug.enable)
> > -			mipi_csis_log_counters(csis, true);
> > -
> > +		mipi_csis_log_counters(csis, true);
> >  		pm_runtime_put(csis->dev);
> >
> >  		return 0;
>
> --
> Regards,
>
> Laurent Pinchart
Laurent Pinchart March 15, 2022, 1:03 p.m. UTC | #3
Hi Jacopo,

On Tue, Mar 15, 2022 at 01:27:48PM +0100, Jacopo Mondi wrote:
> On Tue, Mar 15, 2022 at 01:30:20PM +0200, Laurent Pinchart wrote:
> > On Mon, Mar 14, 2022 at 11:39:40AM +0100, Jacopo Mondi wrote:
> > > The mipi_csis_log_counters() function already checks for
> > > csis->debug.enable, it is not necessary to do the same in the caller.
> >
> > Does it ? It does only to decide whether or not to print counters that
> > have a zero value.
> 
> Roght, I mis-read the condition there.
> 
> What is the usage of the counters logger ? Should we make it
> conditional to debug.enable ?

It's been there from the very beginning, so I'm not sure what the
expected use cases where. I'd be tempted to actually move it to debugfs,
possibly with a single warning message at stream start if any error is
detected.

Rui, what do you think ?

> > > Compatc the code in the caller as well by removing an empty line.
> > >
> > > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
> > > ---
> > >  drivers/media/platform/imx/imx-mipi-csis.c | 5 +----
> > >  1 file changed, 1 insertion(+), 4 deletions(-)
> > >
> > > diff --git a/drivers/media/platform/imx/imx-mipi-csis.c b/drivers/media/platform/imx/imx-mipi-csis.c
> > > index 4a6152c13d52..4bb469fcb6b3 100644
> > > --- a/drivers/media/platform/imx/imx-mipi-csis.c
> > > +++ b/drivers/media/platform/imx/imx-mipi-csis.c
> > > @@ -913,11 +913,8 @@ static int mipi_csis_s_stream(struct v4l2_subdev *sd, int enable)
> > >
> > >  	if (!enable) {
> > >  		v4l2_subdev_call(csis->src_sd, video, s_stream, 0);
> > > -
> > >  		mipi_csis_stop_stream(csis);
> > > -		if (csis->debug.enable)
> > > -			mipi_csis_log_counters(csis, true);
> > > -
> > > +		mipi_csis_log_counters(csis, true);
> > >  		pm_runtime_put(csis->dev);
> > >
> > >  		return 0;
Rui Miguel Silva March 15, 2022, 1:53 p.m. UTC | #4
Hi Laurent,
On Tue Mar 15, 2022 at 1:03 PM WET, Laurent Pinchart wrote:

> Hi Jacopo,
>
> On Tue, Mar 15, 2022 at 01:27:48PM +0100, Jacopo Mondi wrote:
> > On Tue, Mar 15, 2022 at 01:30:20PM +0200, Laurent Pinchart wrote:
> > > On Mon, Mar 14, 2022 at 11:39:40AM +0100, Jacopo Mondi wrote:
> > > > The mipi_csis_log_counters() function already checks for
> > > > csis->debug.enable, it is not necessary to do the same in the caller.
> > >
> > > Does it ? It does only to decide whether or not to print counters that
> > > have a zero value.
> > 
> > Roght, I mis-read the condition there.
> > 
> > What is the usage of the counters logger ? Should we make it
> > conditional to debug.enable ?
>
> It's been there from the very beginning, so I'm not sure what the
> expected use cases where. I'd be tempted to actually move it to debugfs,
> possibly with a single warning message at stream start if any error is
> detected.
>
> Rui, what do you think ?

This were there to trace events when debug is enable or irq_src_errors
where thrown in the irq_handler and report them at start stream.

But, it looks good to move it to debugfs. Thanks for your and Jacopo
work on this to improve it.

Cheers,
     Rui
>
> > > > Compatc the code in the caller as well by removing an empty line.
> > > >
> > > > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
> > > > ---
> > > >  drivers/media/platform/imx/imx-mipi-csis.c | 5 +----
> > > >  1 file changed, 1 insertion(+), 4 deletions(-)
> > > >
> > > > diff --git a/drivers/media/platform/imx/imx-mipi-csis.c b/drivers/media/platform/imx/imx-mipi-csis.c
> > > > index 4a6152c13d52..4bb469fcb6b3 100644
> > > > --- a/drivers/media/platform/imx/imx-mipi-csis.c
> > > > +++ b/drivers/media/platform/imx/imx-mipi-csis.c
> > > > @@ -913,11 +913,8 @@ static int mipi_csis_s_stream(struct v4l2_subdev *sd, int enable)
> > > >
> > > >  	if (!enable) {
> > > >  		v4l2_subdev_call(csis->src_sd, video, s_stream, 0);
> > > > -
> > > >  		mipi_csis_stop_stream(csis);
> > > > -		if (csis->debug.enable)
> > > > -			mipi_csis_log_counters(csis, true);
> > > > -
> > > > +		mipi_csis_log_counters(csis, true);
> > > >  		pm_runtime_put(csis->dev);
> > > >
> > > >  		return 0;
>
> -- 
> Regards,
>
> Laurent Pinchart
diff mbox series

Patch

diff --git a/drivers/media/platform/imx/imx-mipi-csis.c b/drivers/media/platform/imx/imx-mipi-csis.c
index 4a6152c13d52..4bb469fcb6b3 100644
--- a/drivers/media/platform/imx/imx-mipi-csis.c
+++ b/drivers/media/platform/imx/imx-mipi-csis.c
@@ -913,11 +913,8 @@  static int mipi_csis_s_stream(struct v4l2_subdev *sd, int enable)
 
 	if (!enable) {
 		v4l2_subdev_call(csis->src_sd, video, s_stream, 0);
-
 		mipi_csis_stop_stream(csis);
-		if (csis->debug.enable)
-			mipi_csis_log_counters(csis, true);
-
+		mipi_csis_log_counters(csis, true);
 		pm_runtime_put(csis->dev);
 
 		return 0;