Message ID | 20220907191547.19255-2-laurent.pinchart@ideasonboard.com |
---|---|
State | Accepted |
Commit | 2f79df7260cdafbe0cb8fd6fd5b3d8024946f95f |
Headers | show |
Series | media: imx: imx7-media-csi: Small fix and cleanups | expand |
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); > } > }
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); } }
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> --- drivers/staging/media/imx/imx7-media-csi.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)