All of lore.kernel.org
 help / color / mirror / Atom feed
From: paul.elder@ideasonboard.com
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: linux-media@vger.kernel.org, Rui Miguel Silva <rmfrfs@gmail.com>,
	Steve Longerbeam <slongerbeam@gmail.com>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	Jacopo Mondi <jacopo@jmondi.org>,
	kernel@pengutronix.de, linux-imx@nxp.com
Subject: Re: [PATCH 1/3] media: imx: imx7-media-csi: Move variable to loop scope
Date: Thu, 8 Sep 2022 12:20:43 +0900	[thread overview]
Message-ID: <20220908032043.GB1140330@pyrite.rasen.tech> (raw)
In-Reply-To: <20220907191547.19255-2-laurent.pinchart@ideasonboard.com>

On Wed, Sep 07, 2022 at 10:15:45PM +0300, Laurent Pinchart wrote:
> The phys variable is only used as a local loop variable in
> imx7_csi_setup_vb2_buf(), with each entry in the array being used in the
> corresponding iteration of the loop only. Move it to loop scope,
> simplifying the array to a single variable.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>

> ---
>  drivers/staging/media/imx/imx7-media-csi.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/media/imx/imx7-media-csi.c b/drivers/staging/media/imx/imx7-media-csi.c
> index 336f746ae324..1aef2cf41745 100644
> --- a/drivers/staging/media/imx/imx7-media-csi.c
> +++ b/drivers/staging/media/imx/imx7-media-csi.c
> @@ -399,21 +399,22 @@ static void imx7_csi_setup_vb2_buf(struct imx7_csi *csi)
>  {
>  	struct imx7_csi_vb2_buffer *buf;
>  	struct vb2_buffer *vb2_buf;
> -	dma_addr_t phys[2];
>  	int i;
>  
>  	for (i = 0; i < 2; i++) {
> +		dma_addr_t phys;
> +
>  		buf = imx7_csi_video_next_buf(csi);
>  		if (buf) {
>  			csi->active_vb2_buf[i] = buf;
>  			vb2_buf = &buf->vbuf.vb2_buf;
> -			phys[i] = vb2_dma_contig_plane_dma_addr(vb2_buf, 0);
> +			phys = vb2_dma_contig_plane_dma_addr(vb2_buf, 0);
>  		} else {
>  			csi->active_vb2_buf[i] = NULL;
> -			phys[i] = csi->underrun_buf.phys;
> +			phys = csi->underrun_buf.phys;
>  		}
>  
> -		imx7_csi_update_buf(csi, phys[i], i);
> +		imx7_csi_update_buf(csi, phys, i);
>  	}
>  }

  reply	other threads:[~2022-09-08  3:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-07 19:15 [PATCH 0/3] media: imx: imx7-media-csi: Small fix and cleanups Laurent Pinchart
2022-09-07 19:15 ` [PATCH 1/3] media: imx: imx7-media-csi: Move variable to loop scope Laurent Pinchart
2022-09-08  3:20   ` paul.elder [this message]
2022-09-07 19:15 ` [PATCH 2/3] media: imx: imx7-media-csi: Rename phys variables to dma_addr Laurent Pinchart
2022-09-08  3:36   ` paul.elder
2022-09-07 19:15 ` [PATCH 3/3] media: imx: imx7-media-csi: Clear BIT_MIPI_DOUBLE_CMPNT for <16b formats Laurent Pinchart
2022-09-08  3:49   ` paul.elder
2022-09-08 15:02 ` [PATCH 0/3] media: imx: imx7-media-csi: Small fix and cleanups Rui Miguel Silva

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220908032043.GB1140330@pyrite.rasen.tech \
    --to=paul.elder@ideasonboard.com \
    --cc=jacopo@jmondi.org \
    --cc=kernel@pengutronix.de \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-imx@nxp.com \
    --cc=linux-media@vger.kernel.org \
    --cc=p.zabel@pengutronix.de \
    --cc=rmfrfs@gmail.com \
    --cc=slongerbeam@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.