diff mbox series

[v3,02/18] media: xilinx: Refactor struct xvip_dma

Message ID 20240527-cocci-flexarray-v3-2-cda09c535816@chromium.org
State Accepted
Commit a93506f670de9fe57e40e18e32c84e73121bca55
Headers show
Series [v3,01/18] media: allegro: nal-hevc: Replace array[1] with arrray[N] | expand

Commit Message

Ricardo Ribalda May 27, 2024, 9:08 p.m. UTC
Replace a single element array with a single field.

The following cocci warning is fixed:
drivers/media/platform/xilinx/xilinx-dma.h:100:19-22: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
 drivers/media/platform/xilinx/xilinx-dma.c | 4 ++--
 drivers/media/platform/xilinx/xilinx-dma.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

Comments

Laurent Pinchart May 28, 2024, 2 p.m. UTC | #1
Hi Ricardo,

Thank you for the patch.

On Mon, May 27, 2024 at 09:08:52PM +0000, Ricardo Ribalda wrote:
> Replace a single element array with a single field.
> 
> The following cocci warning is fixed:
> drivers/media/platform/xilinx/xilinx-dma.h:100:19-22: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)
> 
> Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  drivers/media/platform/xilinx/xilinx-dma.c | 4 ++--
>  drivers/media/platform/xilinx/xilinx-dma.h | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/media/platform/xilinx/xilinx-dma.c b/drivers/media/platform/xilinx/xilinx-dma.c
> index a96de5d388a1..a1687b868a44 100644
> --- a/drivers/media/platform/xilinx/xilinx-dma.c
> +++ b/drivers/media/platform/xilinx/xilinx-dma.c
> @@ -348,8 +348,8 @@ static void xvip_dma_buffer_queue(struct vb2_buffer *vb)
>  	}
>  
>  	dma->xt.frame_size = 1;
> -	dma->sgl[0].size = dma->format.width * dma->fmtinfo->bpp;
> -	dma->sgl[0].icg = dma->format.bytesperline - dma->sgl[0].size;
> +	dma->sgl.size = dma->format.width * dma->fmtinfo->bpp;
> +	dma->sgl.icg = dma->format.bytesperline - dma->sgl.size;
>  	dma->xt.numf = dma->format.height;
>  
>  	desc = dmaengine_prep_interleaved_dma(dma->dma, &dma->xt, flags);
> diff --git a/drivers/media/platform/xilinx/xilinx-dma.h b/drivers/media/platform/xilinx/xilinx-dma.h
> index 9c6d4c18d1a9..18f77e1a7b39 100644
> --- a/drivers/media/platform/xilinx/xilinx-dma.h
> +++ b/drivers/media/platform/xilinx/xilinx-dma.h
> @@ -97,7 +97,7 @@ struct xvip_dma {
>  	struct dma_chan *dma;
>  	unsigned int align;
>  	struct dma_interleaved_template xt;
> -	struct data_chunk sgl[1];
> +	struct data_chunk sgl;
>  };
>  
>  #define to_xvip_dma(vdev)	container_of(vdev, struct xvip_dma, video)
diff mbox series

Patch

diff --git a/drivers/media/platform/xilinx/xilinx-dma.c b/drivers/media/platform/xilinx/xilinx-dma.c
index a96de5d388a1..a1687b868a44 100644
--- a/drivers/media/platform/xilinx/xilinx-dma.c
+++ b/drivers/media/platform/xilinx/xilinx-dma.c
@@ -348,8 +348,8 @@  static void xvip_dma_buffer_queue(struct vb2_buffer *vb)
 	}
 
 	dma->xt.frame_size = 1;
-	dma->sgl[0].size = dma->format.width * dma->fmtinfo->bpp;
-	dma->sgl[0].icg = dma->format.bytesperline - dma->sgl[0].size;
+	dma->sgl.size = dma->format.width * dma->fmtinfo->bpp;
+	dma->sgl.icg = dma->format.bytesperline - dma->sgl.size;
 	dma->xt.numf = dma->format.height;
 
 	desc = dmaengine_prep_interleaved_dma(dma->dma, &dma->xt, flags);
diff --git a/drivers/media/platform/xilinx/xilinx-dma.h b/drivers/media/platform/xilinx/xilinx-dma.h
index 9c6d4c18d1a9..18f77e1a7b39 100644
--- a/drivers/media/platform/xilinx/xilinx-dma.h
+++ b/drivers/media/platform/xilinx/xilinx-dma.h
@@ -97,7 +97,7 @@  struct xvip_dma {
 	struct dma_chan *dma;
 	unsigned int align;
 	struct dma_interleaved_template xt;
-	struct data_chunk sgl[1];
+	struct data_chunk sgl;
 };
 
 #define to_xvip_dma(vdev)	container_of(vdev, struct xvip_dma, video)