Skip to contentSkip to conversation

staging: media: hantro: Rewrite macro function in lower case

PATCH In review Aline Santana Cordeiro 3 participants 9 messages Apr 9, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: media: hantro: Rewrite macro function in lower case

Rewrite macros resembling functions #define HANTRO_PP_REG_WRITE and #define HANTRO_PP_RED_WRITE_S in lower case, according with code style.

---
 drivers/staging/media/hantro/hantro_postproc.c | 34 +++++++++++++-------------
 1 file changed, 17 insertions(+), 17 deletions(-)
drivers/staging/media/hantro/hantro_postproc.c +17 -17
index 6d2a8f2a..06279c0 100644
@@ -12,14 +12,14 @@
 #include "hantro_hw.h"
 #include "hantro_g1_regs.h"
 
-#define HANTRO_PP_REG_WRITE(vpu, reg_name, val) \
+#define hantro_pp_reg_write(vpu, reg_name, val) \
 { \
 	hantro_reg_write(vpu, \
 			 &(vpu)->variant->postproc_regs->reg_name, \
 			 val); \
 }
 
-#define HANTRO_PP_REG_WRITE_S(vpu, reg_name, val) \
+#define hantro_pp_reg_write_s(vpu, reg_name, val) \
 { \
 	hantro_reg_write_s(vpu, \
 			   &(vpu)->variant->postproc_regs->reg_name, \
@@ -61,7 +61,7 @@ void hantro_postproc_enable(struct hantro_ctx *ctx)
 		return;
 
 	/* Turn on pipeline mode. Must be done first. */
-	HANTRO_PP_REG_WRITE_S(vpu, pipeline_en, 0x1);
+	hantro_pp_reg_write_s(vpu, pipeline_en, 0x1);
 
 	src_pp_fmt = VPU_PP_IN_NV12;
 
@@ -79,19 +79,19 @@ void hantro_postproc_enable(struct hantro_ctx *ctx)
 	dst_buf = v4l2_m2m_next_dst_buf(ctx->fh.m2m_ctx);
 	dst_dma = vb2_dma_contig_plane_dma_addr(&dst_buf->vb2_buf, 0);
 
-	HANTRO_PP_REG_WRITE(vpu, clk_gate, 0x1);
-	HANTRO_PP_REG_WRITE(vpu, out_endian, 0x1);
-	HANTRO_PP_REG_WRITE(vpu, out_swap32, 0x1);
-	HANTRO_PP_REG_WRITE(vpu, max_burst, 16);
-	HANTRO_PP_REG_WRITE(vpu, out_luma_base, dst_dma);
-	HANTRO_PP_REG_WRITE(vpu, input_width, MB_WIDTH(ctx->dst_fmt.width));
-	HANTRO_PP_REG_WRITE(vpu, input_height, MB_HEIGHT(ctx->dst_fmt.height));
-	HANTRO_PP_REG_WRITE(vpu, input_fmt, src_pp_fmt);
-	HANTRO_PP_REG_WRITE(vpu, output_fmt, dst_pp_fmt);
-	HANTRO_PP_REG_WRITE(vpu, output_width, ctx->dst_fmt.width);
-	HANTRO_PP_REG_WRITE(vpu, output_height, ctx->dst_fmt.height);
-	HANTRO_PP_REG_WRITE(vpu, orig_width, MB_WIDTH(ctx->dst_fmt.width));
-	HANTRO_PP_REG_WRITE(vpu, display_width, ctx->dst_fmt.width);
+	hantro_pp_reg_write(vpu, clk_gate, 0x1);
+	hantro_pp_reg_write(vpu, out_endian, 0x1);
+	hantro_pp_reg_write(vpu, out_swap32, 0x1);
+	hantro_pp_reg_write(vpu, max_burst, 16);
+	hantro_pp_reg_write(vpu, out_luma_base, dst_dma);
+	hantro_pp_reg_write(vpu, input_width, MB_WIDTH(ctx->dst_fmt.width));
+	hantro_pp_reg_write(vpu, input_height, MB_HEIGHT(ctx->dst_fmt.height));
+	hantro_pp_reg_write(vpu, input_fmt, src_pp_fmt);
+	hantro_pp_reg_write(vpu, output_fmt, dst_pp_fmt);
+	hantro_pp_reg_write(vpu, output_width, ctx->dst_fmt.width);
+	hantro_pp_reg_write(vpu, output_height, ctx->dst_fmt.height);
+	hantro_pp_reg_write(vpu, orig_width, MB_WIDTH(ctx->dst_fmt.width));
+	hantro_pp_reg_write(vpu, display_width, ctx->dst_fmt.width);
 }
 
 void hantro_postproc_free(struct hantro_ctx *ctx)
@@ -146,5 +146,5 @@ void hantro_postproc_disable(struct hantro_ctx *ctx)
 	if (!vpu->variant->postproc_regs)
 		return;
 
-	HANTRO_PP_REG_WRITE_S(vpu, pipeline_en, 0x0);
+	hantro_pp_reg_write_s(vpu, pipeline_en, 0x0);
 }
Signature · 1 line
2.7.4
#1 lore raw

Hi Aline,

Quoted 4 lines · Aline Santana Cordeiro

Rewrite macros resembling functions #define HANTRO_PP_REG_WRITE and #define HANTRO_PP_RED_WRITE_S in lower case, according with code style.

Where is this written in the Coding Style?

Thanks!
Ezequiel

Quoted 75 lines

---
 drivers/staging/media/hantro/hantro_postproc.c | 34 +++++++++++++-------------

 1 file changed, 17 insertions(+), 17 deletions(-)
drivers/staging/media/hantro/hantro_postproc.c +0 -0
index 6d2a8f2a..06279c0 100644
@@ -12,14 +12,14 @@
  #include "hantro_hw.h"
  #include "hantro_g1_regs.h"

drivers/staging/media/hantro/hantro_postproc.c +1 -1
-#define HANTRO_PP_REG_WRITE(vpu, reg_name, val) \
+#define hantro_pp_reg_write(vpu, reg_name, val) \

 { \
        hantro_reg_write(vpu, \
                         &(vpu)->variant->postproc_regs->reg_name, \
                         val); \
 }

drivers/staging/media/hantro/hantro_postproc.c +1 -1
-#define HANTRO_PP_REG_WRITE_S(vpu, reg_name, val) \
+#define hantro_pp_reg_write_s(vpu, reg_name, val) \

 { \
        hantro_reg_write_s(vpu, \
                           &(vpu)->variant->postproc_regs->reg_name, \

drivers/staging/media/hantro/hantro_postproc.c +0 -0
@@ -61,7 +61,7 @@ void hantro_postproc_enable(struct hantro_ctx *ctx)
                 return;


        /* Turn on pipeline mode. Must be done first. */ -       HANTRO_PP_REG_WRITE_S(vpu, pipeline_en, 0x1); +       hantro_pp_reg_write_s(vpu, pipeline_en, 0x1);
        src_pp_fmt = VPU_PP_IN_NV12;

drivers/staging/media/hantro/hantro_postproc.c +0 -0
@@ -79,19 +79,19 @@ void hantro_postproc_enable(struct hantro_ctx *ctx)
         dst_buf = v4l2_m2m_next_dst_buf(ctx->fh.m2m_ctx);
         dst_dma = vb2_dma_contig_plane_dma_addr(&dst_buf->vb2_buf, 0);


-       HANTRO_PP_REG_WRITE(vpu, clk_gate, 0x1);
-       HANTRO_PP_REG_WRITE(vpu, out_endian, 0x1);
-       HANTRO_PP_REG_WRITE(vpu, out_swap32, 0x1);
-       HANTRO_PP_REG_WRITE(vpu, max_burst, 16);
-       HANTRO_PP_REG_WRITE(vpu, out_luma_base, dst_dma);
-       HANTRO_PP_REG_WRITE(vpu, input_width, MB_WIDTH(ctx->dst_fmt.width)); -       HANTRO_PP_REG_WRITE(vpu, input_height, MB_HEIGHT(ctx->dst_fmt.height)); -       HANTRO_PP_REG_WRITE(vpu, input_fmt, src_pp_fmt);
-       HANTRO_PP_REG_WRITE(vpu, output_fmt, dst_pp_fmt);
-       HANTRO_PP_REG_WRITE(vpu, output_width, ctx->dst_fmt.width); -       HANTRO_PP_REG_WRITE(vpu, output_height, ctx->dst_fmt.height); -       HANTRO_PP_REG_WRITE(vpu, orig_width, MB_WIDTH(ctx->dst_fmt.width)); -       HANTRO_PP_REG_WRITE(vpu, display_width, ctx->dst_fmt.width); +       hantro_pp_reg_write(vpu, clk_gate, 0x1);
+       hantro_pp_reg_write(vpu, out_endian, 0x1);
+       hantro_pp_reg_write(vpu, out_swap32, 0x1);
+       hantro_pp_reg_write(vpu, max_burst, 16);
+       hantro_pp_reg_write(vpu, out_luma_base, dst_dma);
+       hantro_pp_reg_write(vpu, input_width, MB_WIDTH(ctx->dst_fmt.width)); +       hantro_pp_reg_write(vpu, input_height, MB_HEIGHT(ctx->dst_fmt.height)); +       hantro_pp_reg_write(vpu, input_fmt, src_pp_fmt);
+       hantro_pp_reg_write(vpu, output_fmt, dst_pp_fmt);
+       hantro_pp_reg_write(vpu, output_width, ctx->dst_fmt.width); +       hantro_pp_reg_write(vpu, output_height, ctx->dst_fmt.height); +       hantro_pp_reg_write(vpu, orig_width, MB_WIDTH(ctx->dst_fmt.width)); +       hantro_pp_reg_write(vpu, display_width, ctx->dst_fmt.width); }

 void hantro_postproc_free(struct hantro_ctx *ctx)

drivers/staging/media/hantro/hantro_postproc.c +0 -0
@@ -146,5 +146,5 @@ void hantro_postproc_disable(struct hantro_ctx *ctx)
         if (!vpu->variant->postproc_regs)
                 return;


-       HANTRO_PP_REG_WRITE_S(vpu, pipeline_en, 0x0); +       hantro_pp_reg_write_s(vpu, pipeline_en, 0x0); }

author
#2 lore raw

Em sex, 2021-04-09 às 13:44 -0300, Ezequiel Garcia escreveu:

Quoted 1 line

Hi Aline,

Hi Ezequiel,

Quoted 8 lines · Aline Santana Cordeiro
Quoted 4 lines

Rewrite macros resembling functions #define HANTRO_PP_REG_WRITE and #define HANTRO_PP_RED_WRITE_S in lower case, according with code style.

Where is this written in the Coding Style?

I found this in section 12, about Macros, Enums and RTL in both references:
https://www.kernel.org/doc/html/latest/process/coding-style.html
https://elixir.bootlin.com/linux/latest/source/Documentation/process/coding-style.rst

Quoted 3 lines

Thanks!
Ezequiel

Thank you!
Aline

Quoted 97 lines
Quoted 95 lines

Signed-off-by: Aline Santana Cordeiro < [email protected]>
---
 drivers/staging/media/hantro/hantro_postproc.c | 34 +++++++++++++-
------------

 1 file changed, 17 insertions(+), 17 deletions(-)
drivers/staging/media/hantro/hantro_postproc.c +0 -0
index 6d2a8f2a..06279c0 100644
@@ -12,14 +12,14 @@
  #include "hantro_hw.h"
  #include "hantro_g1_regs.h"

drivers/staging/media/hantro/hantro_postproc.c +1 -1
-#define HANTRO_PP_REG_WRITE(vpu, reg_name, val) \
+#define hantro_pp_reg_write(vpu, reg_name, val) \

 { \
        hantro_reg_write(vpu, \
                         &(vpu)->variant->postproc_regs->reg_name, \
                         val); \
 }

drivers/staging/media/hantro/hantro_postproc.c +1 -1
-#define HANTRO_PP_REG_WRITE_S(vpu, reg_name, val) \
+#define hantro_pp_reg_write_s(vpu, reg_name, val) \

 { \
        hantro_reg_write_s(vpu, \
                           &(vpu)->variant->postproc_regs-

Quoted 1 line

reg_name, \

drivers/staging/media/hantro/hantro_postproc.c +0 -0
@@ -61,7 +61,7 @@ void hantro_postproc_enable(struct hantro_ctx
 *ctx)
                 return;


        /* Turn on pipeline mode. Must be done first. */ -       HANTRO_PP_REG_WRITE_S(vpu, pipeline_en, 0x1); +       hantro_pp_reg_write_s(vpu, pipeline_en, 0x1);
        src_pp_fmt = VPU_PP_IN_NV12;

drivers/staging/media/hantro/hantro_postproc.c +0 -0
@@ -79,19 +79,19 @@ void hantro_postproc_enable(struct hantro_ctx
 *ctx)
         dst_buf = v4l2_m2m_next_dst_buf(ctx->fh.m2m_ctx);
         dst_dma = vb2_dma_contig_plane_dma_addr(&dst_buf->vb2_buf,
 0);


-       HANTRO_PP_REG_WRITE(vpu, clk_gate, 0x1);
-       HANTRO_PP_REG_WRITE(vpu, out_endian, 0x1); -       HANTRO_PP_REG_WRITE(vpu, out_swap32, 0x1); -       HANTRO_PP_REG_WRITE(vpu, max_burst, 16);
-       HANTRO_PP_REG_WRITE(vpu, out_luma_base, dst_dma); -       HANTRO_PP_REG_WRITE(vpu, input_width, MB_WIDTH(ctx-

Quoted 1 line

dst_fmt.width));

-       HANTRO_PP_REG_WRITE(vpu, input_height, MB_HEIGHT(ctx-

Quoted 1 line

dst_fmt.height));

-       HANTRO_PP_REG_WRITE(vpu, input_fmt, src_pp_fmt); -       HANTRO_PP_REG_WRITE(vpu, output_fmt, dst_pp_fmt); -       HANTRO_PP_REG_WRITE(vpu, output_width, ctx->dst_fmt.width); -       HANTRO_PP_REG_WRITE(vpu, output_height, ctx-

Quoted 1 line

dst_fmt.height);

-       HANTRO_PP_REG_WRITE(vpu, orig_width, MB_WIDTH(ctx-

Quoted 1 line

dst_fmt.width));

-       HANTRO_PP_REG_WRITE(vpu, display_width, ctx-

Quoted 1 line

dst_fmt.width);

+       hantro_pp_reg_write(vpu, clk_gate, 0x1);
+       hantro_pp_reg_write(vpu, out_endian, 0x1); +       hantro_pp_reg_write(vpu, out_swap32, 0x1); +       hantro_pp_reg_write(vpu, max_burst, 16);
+       hantro_pp_reg_write(vpu, out_luma_base, dst_dma); +       hantro_pp_reg_write(vpu, input_width, MB_WIDTH(ctx-

Quoted 1 line

dst_fmt.width));

+       hantro_pp_reg_write(vpu, input_height, MB_HEIGHT(ctx-

Quoted 1 line

dst_fmt.height));

+       hantro_pp_reg_write(vpu, input_fmt, src_pp_fmt); +       hantro_pp_reg_write(vpu, output_fmt, dst_pp_fmt); +       hantro_pp_reg_write(vpu, output_width, ctx->dst_fmt.width); +       hantro_pp_reg_write(vpu, output_height, ctx-

Quoted 1 line

dst_fmt.height);

+       hantro_pp_reg_write(vpu, orig_width, MB_WIDTH(ctx-

Quoted 1 line

dst_fmt.width));

+       hantro_pp_reg_write(vpu, display_width, ctx-

Quoted 1 line

dst_fmt.width);

 }

 void hantro_postproc_free(struct hantro_ctx *ctx)

drivers/staging/media/hantro/hantro_postproc.c +0 -0
@@ -146,5 +146,5 @@ void hantro_postproc_disable(struct hantro_ctx
 *ctx)
         if (!vpu->variant->postproc_regs)
                 return;


-       HANTRO_PP_REG_WRITE_S(vpu, pipeline_en, 0x0); +       hantro_pp_reg_write_s(vpu, pipeline_en, 0x0); }

#3 lore raw
Quoted 11 lines · ascordeiro

Em sex, 2021-04-09 às 13:44 -0300, Ezequiel Garcia escreveu:

Quoted 1 line

Hi Aline,

Hi Ezequiel,

Quoted 7 lines · Aline Santana Cordeiro
Quoted 4 lines

Rewrite macros resembling functions #define HANTRO_PP_REG_WRITE and #define HANTRO_PP_RED_WRITE_S in lower case, according with code style.

Quoted 6 lines
Quoted 1 line

Where is this written in the Coding Style?

I found this in section 12, about Macros, Enums and RTL in both references:
https://www.kernel.org/doc/html/latest/process/coding-style.html
https://elixir.bootlin.com/linux/latest/source/Documentation/process/coding-style.rst

It seems this

"""
CAPITALIZED macro names are appreciated but macros resembling functions may be named in lower case. """

It's just a suggestion, not a big deal. In general, if checkpatch.pl is not complaining, it's not worth the trouble.

So let's skip this fix.

Thanks a lot!
Ezequiel

author
#4 lore raw

Em sex, 2021-04-09 às 14:15 -0300, Ezequiel Garcia escreveu:

Quoted 26 lines · ascordeiro
Quoted 11 lines

Em sex, 2021-04-09 às 13:44 -0300, Ezequiel Garcia escreveu:

Quoted 1 line

Hi Aline,

Hi Ezequiel,

Quoted 7 lines · Aline Santana Cordeiro
Quoted 4 lines

Rewrite macros resembling functions #define HANTRO_PP_REG_WRITE and #define HANTRO_PP_RED_WRITE_S in lower case, according with code style.

Quoted 6 lines
Quoted 1 line

Where is this written in the Coding Style?

I found this in section 12, about Macros, Enums and RTL in both references:
https://www.kernel.org/doc/html/latest/process/coding-style.html
https://elixir.bootlin.com/linux/latest/source/Documentation/process/coding-style.rst

It seems this

"""
CAPITALIZED macro names are appreciated but macros resembling functions may be named in lower case.
"""

Quoted 4 lines

It's just a suggestion, not a big deal. In general, if checkpatch.pl is not complaining, it's not worth the trouble.

So let's skip this fix.

Okay! I'm going to check different problems with the checkpatch.pl

Quoted 4 lines

Thanks a lot!
Ezequiel

Thank you!
Aline

#5 lore raw
In reply to ascordeiro
Quoted 9 lines · ascordeiro

Em sex, 2021-04-09 às 13:44 -0300, Ezequiel Garcia escreveu:

Quoted 1 line

Hi Aline,

Hi Ezequiel,

Quoted 5 lines · Aline Santana Cordeiro
Quoted 3 lines

Rewrite macros resembling functions #define HANTRO_PP_REG_WRITE and #define HANTRO_PP_RED_WRITE_S in lower case, according with code style.

Maybe you can see if these macros can be converted to static inline functions. Macros don't provide any type checking.

julia

Quoted 118 lines
Quoted 3 lines
Quoted 1 line

Where is this written in the Coding Style?

I found this in section 12, about Macros, Enums and RTL in both references:
https://www.kernel.org/doc/html/latest/process/coding-style.html
https://elixir.bootlin.com/linux/latest/source/Documentation/process/coding-style.rst

Quoted 3 lines

Thanks!
Ezequiel

Thank you!
Aline

Quoted 84 lines
Quoted 84 lines

Signed-off-by: Aline Santana Cordeiro < [email protected]>
---
 drivers/staging/media/hantro/hantro_postproc.c | 34 +++++++++++++-
------------

 1 file changed, 17 insertions(+), 17 deletions(-)
drivers/staging/media/hantro/hantro_postproc.c +0 -0
index 6d2a8f2a..06279c0 100644
@@ -12,14 +12,14 @@
  #include "hantro_hw.h"
  #include "hantro_g1_regs.h"

drivers/staging/media/hantro/hantro_postproc.c +1 -1
-#define HANTRO_PP_REG_WRITE(vpu, reg_name, val) \
+#define hantro_pp_reg_write(vpu, reg_name, val) \

 { \
        hantro_reg_write(vpu, \
                         &(vpu)->variant->postproc_regs->reg_name, \
                         val); \
 }

drivers/staging/media/hantro/hantro_postproc.c +1 -1
-#define HANTRO_PP_REG_WRITE_S(vpu, reg_name, val) \
+#define hantro_pp_reg_write_s(vpu, reg_name, val) \

 { \
        hantro_reg_write_s(vpu, \
                           &(vpu)->variant->postproc_regs-

Quoted 1 line

reg_name, \

drivers/staging/media/hantro/hantro_postproc.c +0 -0
@@ -61,7 +61,7 @@ void hantro_postproc_enable(struct hantro_ctx
 *ctx)
                 return;


        /* Turn on pipeline mode. Must be done first. */ -       HANTRO_PP_REG_WRITE_S(vpu, pipeline_en, 0x1); +       hantro_pp_reg_write_s(vpu, pipeline_en, 0x1);
        src_pp_fmt = VPU_PP_IN_NV12;

drivers/staging/media/hantro/hantro_postproc.c +0 -0
@@ -79,19 +79,19 @@ void hantro_postproc_enable(struct hantro_ctx
 *ctx)
         dst_buf = v4l2_m2m_next_dst_buf(ctx->fh.m2m_ctx);
         dst_dma = vb2_dma_contig_plane_dma_addr(&dst_buf->vb2_buf,
 0);


-       HANTRO_PP_REG_WRITE(vpu, clk_gate, 0x1);
-       HANTRO_PP_REG_WRITE(vpu, out_endian, 0x1); -       HANTRO_PP_REG_WRITE(vpu, out_swap32, 0x1); -       HANTRO_PP_REG_WRITE(vpu, max_burst, 16);
-       HANTRO_PP_REG_WRITE(vpu, out_luma_base, dst_dma); -       HANTRO_PP_REG_WRITE(vpu, input_width, MB_WIDTH(ctx-

Quoted 1 line

dst_fmt.width));

-       HANTRO_PP_REG_WRITE(vpu, input_height, MB_HEIGHT(ctx-

Quoted 1 line

dst_fmt.height));

-       HANTRO_PP_REG_WRITE(vpu, input_fmt, src_pp_fmt); -       HANTRO_PP_REG_WRITE(vpu, output_fmt, dst_pp_fmt); -       HANTRO_PP_REG_WRITE(vpu, output_width, ctx->dst_fmt.width); -       HANTRO_PP_REG_WRITE(vpu, output_height, ctx-

Quoted 1 line

dst_fmt.height);

-       HANTRO_PP_REG_WRITE(vpu, orig_width, MB_WIDTH(ctx-

Quoted 1 line

dst_fmt.width));

-       HANTRO_PP_REG_WRITE(vpu, display_width, ctx-

Quoted 1 line

dst_fmt.width);

+       hantro_pp_reg_write(vpu, clk_gate, 0x1);
+       hantro_pp_reg_write(vpu, out_endian, 0x1); +       hantro_pp_reg_write(vpu, out_swap32, 0x1); +       hantro_pp_reg_write(vpu, max_burst, 16);
+       hantro_pp_reg_write(vpu, out_luma_base, dst_dma); +       hantro_pp_reg_write(vpu, input_width, MB_WIDTH(ctx-

Quoted 1 line

dst_fmt.width));

+       hantro_pp_reg_write(vpu, input_height, MB_HEIGHT(ctx-

Quoted 1 line

dst_fmt.height));

+       hantro_pp_reg_write(vpu, input_fmt, src_pp_fmt); +       hantro_pp_reg_write(vpu, output_fmt, dst_pp_fmt); +       hantro_pp_reg_write(vpu, output_width, ctx->dst_fmt.width); +       hantro_pp_reg_write(vpu, output_height, ctx-

Quoted 1 line

dst_fmt.height);

+       hantro_pp_reg_write(vpu, orig_width, MB_WIDTH(ctx-

Quoted 1 line

dst_fmt.width));

+       hantro_pp_reg_write(vpu, display_width, ctx-

Quoted 1 line

dst_fmt.width);

Quoted 13 lines
Quoted 11 lines

 }

 void hantro_postproc_free(struct hantro_ctx *ctx)

drivers/staging/media/hantro/hantro_postproc.c +0 -0
@@ -146,5 +146,5 @@ void hantro_postproc_disable(struct hantro_ctx
 *ctx)
         if (!vpu->variant->postproc_regs)
                 return;


-       HANTRO_PP_REG_WRITE_S(vpu, pipeline_en, 0x0); +       hantro_pp_reg_write_s(vpu, pipeline_en, 0x0); }

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/138794d79c42510d9b6ae744df20216904773032.camel%40gmail.com.

author
#6 lore raw

Em sex, 2021-04-09 às 19:25 +0200, Julia Lawall escreveu:

Quoted 9 lines · ascordeiro
Quoted 6 lines

Em sex, 2021-04-09 às 13:44 -0300, Ezequiel Garcia escreveu:

Quoted 1 line

Hi Aline,

Hi Ezequiel,

Quoted 1 line
Quoted 7 lines
Quoted 4 lines
Quoted 4 lines · Aline Santana Cordeiro
Quoted 3 lines

Rewrite macros resembling functions #define HANTRO_PP_REG_WRITE and #define HANTRO_PP_RED_WRITE_S in lower case, according with code style.

Maybe you can see if these macros can be converted to static inline functions.  Macros don't provide any type checking.

Okay! I'm going to check this option.

Thank you for the advice!
Aline

Quoted 132 lines

julia

Quoted 128 lines
Quoted 3 lines
Quoted 1 line

Where is this written in the Coding Style?

I found this in section 12, about Macros, Enums and RTL in both references:
https://www.kernel.org/doc/html/latest/process/coding-style.html
https://elixir.bootlin.com/linux/latest/source/Documentation/process/coding-style.rst

Quoted 3 lines

Thanks!
Ezequiel

Thank you!
Aline

Quoted 90 lines
Quoted 90 lines

Signed-off-by: Aline Santana Cordeiro < [email protected]>
---
 drivers/staging/media/hantro/hantro_postproc.c | 34
+++++++++++++-
------------

 1 file changed, 17 insertions(+), 17 deletions(-)
drivers/staging/media/hantro/hantro_postproc.c +0 -0
index 6d2a8f2a..06279c0 100644
@@ -12,14 +12,14 @@
  #include "hantro_hw.h"
  #include "hantro_g1_regs.h"

drivers/staging/media/hantro/hantro_postproc.c +1 -1
-#define HANTRO_PP_REG_WRITE(vpu, reg_name, val) \
+#define hantro_pp_reg_write(vpu, reg_name, val) \

 { \
        hantro_reg_write(vpu, \
                         &(vpu)->variant->postproc_regs-

Quoted 1 line

reg_name,

\
                         val); \
 }

drivers/staging/media/hantro/hantro_postproc.c +1 -1
-#define HANTRO_PP_REG_WRITE_S(vpu, reg_name, val) \
+#define hantro_pp_reg_write_s(vpu, reg_name, val) \

 { \
        hantro_reg_write_s(vpu, \
                           &(vpu)->variant->postproc_regs-

Quoted 1 line

reg_name, \

drivers/staging/media/hantro/hantro_postproc.c +0 -0
@@ -61,7 +61,7 @@ void hantro_postproc_enable(struct hantro_ctx
 *ctx)
                 return;


        /* Turn on pipeline mode. Must be done first. */ -       HANTRO_PP_REG_WRITE_S(vpu, pipeline_en, 0x1); +       hantro_pp_reg_write_s(vpu, pipeline_en, 0x1);
        src_pp_fmt = VPU_PP_IN_NV12;

drivers/staging/media/hantro/hantro_postproc.c +0 -0
@@ -79,19 +79,19 @@ void hantro_postproc_enable(struct

hantro_ctx
*ctx)
        dst_buf = v4l2_m2m_next_dst_buf(ctx->fh.m2m_ctx); dst_dma = vb2_dma_contig_plane_dma_addr(&dst_buf-

Quoted 1 line

vb2_buf,

0);

-       HANTRO_PP_REG_WRITE(vpu, clk_gate, 0x1);
-       HANTRO_PP_REG_WRITE(vpu, out_endian, 0x1); -       HANTRO_PP_REG_WRITE(vpu, out_swap32, 0x1); -       HANTRO_PP_REG_WRITE(vpu, max_burst, 16);
-       HANTRO_PP_REG_WRITE(vpu, out_luma_base, dst_dma); -       HANTRO_PP_REG_WRITE(vpu, input_width, MB_WIDTH(ctx-

Quoted 1 line

dst_fmt.width));

-       HANTRO_PP_REG_WRITE(vpu, input_height, MB_HEIGHT(ctx-

Quoted 1 line

dst_fmt.height));

-       HANTRO_PP_REG_WRITE(vpu, input_fmt, src_pp_fmt); -       HANTRO_PP_REG_WRITE(vpu, output_fmt, dst_pp_fmt); -       HANTRO_PP_REG_WRITE(vpu, output_width, ctx-

Quoted 1 line

dst_fmt.width);

-       HANTRO_PP_REG_WRITE(vpu, output_height, ctx-

Quoted 1 line

dst_fmt.height);

-       HANTRO_PP_REG_WRITE(vpu, orig_width, MB_WIDTH(ctx-

Quoted 1 line

dst_fmt.width));

-       HANTRO_PP_REG_WRITE(vpu, display_width, ctx-

Quoted 1 line

dst_fmt.width);

+       hantro_pp_reg_write(vpu, clk_gate, 0x1);
+       hantro_pp_reg_write(vpu, out_endian, 0x1); +       hantro_pp_reg_write(vpu, out_swap32, 0x1); +       hantro_pp_reg_write(vpu, max_burst, 16);
+       hantro_pp_reg_write(vpu, out_luma_base, dst_dma); +       hantro_pp_reg_write(vpu, input_width, MB_WIDTH(ctx-

Quoted 1 line

dst_fmt.width));

+       hantro_pp_reg_write(vpu, input_height, MB_HEIGHT(ctx-

Quoted 1 line

dst_fmt.height));

+       hantro_pp_reg_write(vpu, input_fmt, src_pp_fmt); +       hantro_pp_reg_write(vpu, output_fmt, dst_pp_fmt); +       hantro_pp_reg_write(vpu, output_width, ctx-

Quoted 1 line

dst_fmt.width);

+       hantro_pp_reg_write(vpu, output_height, ctx-

Quoted 1 line

dst_fmt.height);

+       hantro_pp_reg_write(vpu, orig_width, MB_WIDTH(ctx-

Quoted 1 line

dst_fmt.width));

+       hantro_pp_reg_write(vpu, display_width, ctx-

Quoted 1 line

dst_fmt.width);

Quoted 14 lines
Quoted 4 lines

 }

 void hantro_postproc_free(struct hantro_ctx *ctx)

drivers/staging/media/hantro/hantro_postproc.c +0 -0
@@ -146,5 +146,5 @@ void hantro_postproc_disable(struct
Quoted 8 lines

hantro_ctx
*ctx)
        if (!vpu->variant->postproc_regs) return;

-       HANTRO_PP_REG_WRITE_S(vpu, pipeline_en, 0x0); +       hantro_pp_reg_write_s(vpu, pipeline_en, 0x0); }

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit
https://groups.google.com/d/msgid/outreachy-kernel/138794d79c42510d9b6ae744df20216904773032.camel%40gmail.com
.

#7 lore raw
In reply to Julia Lawall
Quoted 9 lines · Julia Lawall
Quoted 5 lines · ascordeiro

Em sex, 2021-04-09 às 13:44 -0300, Ezequiel Garcia escreveu:

Quoted 1 line

Hi Aline,

Hi Ezequiel,

Quoted 1 line
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines · Aline Santana Cordeiro
Quoted 3 lines

Rewrite macros resembling functions #define HANTRO_PP_REG_WRITE and #define HANTRO_PP_RED_WRITE_S in lower case, according with code style.

Maybe you can see if these macros can be converted to static inline functions.  Macros don't provide any type checking.

I'd like to leave these as they are for now, tbh ^_^

A more massive refactoring is needed in this driver, but it needs proper testing and it's a more complex plan.

Thanks!
Ezequiel

author
#8 lore raw

Em sex, 2021-04-09 às 14:42 -0300, Ezequiel Garcia escreveu:

Quoted 18 lines · Julia Lawall
Quoted 17 lines · ascordeiro
Quoted 13 lines

Em sex, 2021-04-09 às 13:44 -0300, Ezequiel Garcia escreveu:

Quoted 1 line

Hi Aline,

Hi Ezequiel,

Quoted 8 lines
Quoted 5 lines · Aline Santana Cordeiro

Rewrite macros resembling functions #define HANTRO_PP_REG_WRITE
and #define HANTRO_PP_RED_WRITE_S in lower case, according with
code style.

Quoted 8 lines
Quoted 3 lines

Maybe you can see if these macros can be converted to static inline functions.  Macros don't provide any type checking.

I'd like to leave these as they are for now, tbh ^_^

A more massive refactoring is needed in this driver, but it needs proper testing and it's a more complex plan.

Okay, thank you for your attention :)

Aline

Quoted 4 lines

Thanks!
Ezequiel