Re: [PATCH] staging: media: meson: vdec: matched alignment with parenthesis
From: Joe Perches
Date: Fri Apr 09 2021 - 04:40:52 EST
On Fri, 2021-04-09 at 09:30 +0200, Hans Verkuil wrote:
> On 09/04/2021 00:19, Mitali Borkar wrote:
> > Matched alignment with open parenthesis to meet linux kernel coding
> > style.
> > Reported by checkpatch
> >
> > Signed-off-by: Mitali Borkar <mitaliborkar810@xxxxxxxxx>
> > ---
> > drivers/staging/media/meson/vdec/codec_mpeg12.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/staging/media/meson/vdec/codec_mpeg12.c b/drivers/staging/media/meson/vdec/codec_mpeg12.c
> > index 48869cc3d973..21e93a13356c 100644
> > --- a/drivers/staging/media/meson/vdec/codec_mpeg12.c
> > +++ b/drivers/staging/media/meson/vdec/codec_mpeg12.c
> > @@ -81,7 +81,7 @@ static int codec_mpeg12_start(struct amvdec_session *sess)
> > }
> >
> >
> > ret = amvdec_set_canvases(sess, (u32[]){ AV_SCRATCH_0, 0 },
> > - (u32[]){ 8, 0 });
> > + (u32[]){ 8, 0 });
>
> The alignment here is because the 2nd and 3rd arguments belong together, so
> the alignment indicates that. In order to keep that I would add a newline
> after 'sess,' as well. Same as is done in meson/vdec/codec_h264.c.
Perhaps better as:
---
drivers/staging/media/meson/vdec/codec_mpeg12.c | 5 +++--
drivers/staging/media/meson/vdec/vdec_helpers.c | 2 +-
drivers/staging/media/meson/vdec/vdec_helpers.h | 2 +-
3 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/media/meson/vdec/codec_mpeg12.c b/drivers/staging/media/meson/vdec/codec_mpeg12.c
index 48869cc3d973..933f1cd16ce1 100644
--- a/drivers/staging/media/meson/vdec/codec_mpeg12.c
+++ b/drivers/staging/media/meson/vdec/codec_mpeg12.c
@@ -65,6 +65,8 @@ static int codec_mpeg12_start(struct amvdec_session *sess)
struct amvdec_core *core = sess->core;
struct codec_mpeg12 *mpeg12;
int ret;
+ static const u32 canvas1[] = { AV_SCRATCH_0, 0 };
+ static const u32 canvas2[] = { 8, 0 };
mpeg12 = kzalloc(sizeof(*mpeg12), GFP_KERNEL);
if (!mpeg12)
@@ -80,8 +82,7 @@ static int codec_mpeg12_start(struct amvdec_session *sess)
goto free_mpeg12;
}
- ret = amvdec_set_canvases(sess, (u32[]){ AV_SCRATCH_0, 0 },
- (u32[]){ 8, 0 });
+ ret = amvdec_set_canvases(sess, canvas1, canvas2);
if (ret)
goto free_workspace;
diff --git a/drivers/staging/media/meson/vdec/vdec_helpers.c b/drivers/staging/media/meson/vdec/vdec_helpers.c
index 7f07a9175815..df5c27266c44 100644
--- a/drivers/staging/media/meson/vdec/vdec_helpers.c
+++ b/drivers/staging/media/meson/vdec/vdec_helpers.c
@@ -177,7 +177,7 @@ static int set_canvas_nv12m(struct amvdec_session *sess,
}
int amvdec_set_canvases(struct amvdec_session *sess,
- u32 reg_base[], u32 reg_num[])
+ const u32 reg_base[], const u32 reg_num[])
{
struct v4l2_m2m_buffer *buf;
u32 pixfmt = sess->pixfmt_cap;
diff --git a/drivers/staging/media/meson/vdec/vdec_helpers.h b/drivers/staging/media/meson/vdec/vdec_helpers.h
index cfaed52ab526..ace8897c34fe 100644
--- a/drivers/staging/media/meson/vdec/vdec_helpers.h
+++ b/drivers/staging/media/meson/vdec/vdec_helpers.h
@@ -17,7 +17,7 @@
* @reg_num: number of contiguous registers after each reg_base (including it)
*/
int amvdec_set_canvases(struct amvdec_session *sess,
- u32 reg_base[], u32 reg_num[]);
+ const u32 reg_base[], const u32 reg_num[]);
/* Helpers to read/write to the various IPs (DOS, PARSER) */
u32 amvdec_read_dos(struct amvdec_core *core, u32 reg);