media: atomisp: pci: sh_css: Replace macro STATS_ENABLED() with function
Subsystems (4)
PATCH 1/1 media: atomisp: pci: sh_css: Replace macro STATS_ENABLED() with function
Replace the macro STATS_ENABLED() with a static function to conform to Linux coding style standards.
--- drivers/staging/media/atomisp/pci/sh_css.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/staging/media/atomisp/pci/sh_css.c +7 -3
@@ -97,8 +97,12 @@*/ #define JPEG_BYTES (16 * 1024 * 1024) -#define STATS_ENABLED (stage) (stage && stage->binary && stage->binary->info && \ - (stage->binary->info->sp.enable.s3a || stage->binary->info->sp.enable.dis)) +static bool stats_enabled (struct ia_css_pipeline_stage *stage) +{ +return stage && stage->binary && stage->binary->info && + (stage->binary->info->sp.enable.s3a || + stage->binary->info->sp.enable.dis); +}struct sh_css my_css;
@@ -3743,7 +3747,7 @@ ia_css_pipe_enqueue_buffer(struct ia_css_pipe *pipe,* The SP will read the params after it got * empty 3a and dis */ -if (STATS_ENABLED (stage)) { +if (stats_enabled (stage)) {/* there is a stage that needs it */ return_err = ia_css_bufq_enqueue_buffer(thread_id, queue_id,
Signature · 1 line
2.34.1
Quoted 3 lines · Brent Pappas
Replace the macro
STATS_ENABLED()with a static function to conform to Linux coding style standards.
I believe the best approach here is to drop that completely and move its content to be inline in the only caller.
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH v2 1/1 media: atomisp: pci: sh_css: Inline single invocation of macro STATS_ENABLED()
Inline the single invocation of the macro STATS_ENABLED().
The macro abstraction is not necessary because the logic behind it is only used once.
--- drivers/staging/media/atomisp/pci/sh_css.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/staging/media/atomisp/pci/sh_css.c +3 -4
@@ -97,9 +97,6 @@*/ #define JPEG_BYTES (16 * 1024 * 1024) -#define STATS_ENABLED (stage) (stage && stage->binary && stage->binary->info && \ - (stage->binary->info->sp.enable.s3a || stage->binary->info->sp.enable.dis)) -struct sh_css my_css; int __printf(1, 0) (*sh_css_printf)(const char *fmt, va_list args) = NULL;
@@ -3743,7 +3740,9 @@ ia_css_pipe_enqueue_buffer(struct ia_css_pipe *pipe,* The SP will read the params after it got * empty 3a and dis */ -if (STATS_ENABLED (stage)) { +if (stage && stage->binary && stage->binary->info && + (stage->binary->info->sp.enable.s3a || + stage->binary->info->sp.enable.dis)) {/* there is a stage that needs it */ return_err = ia_css_bufq_enqueue_buffer(thread_id, queue_id,
Signature · 1 line
2.34.1
Re: [PATCH v2] media: atomisp: pci: sh_css: Inline single invocation of macro STATS_ENABLED()
Quoted 6 lines · Brent Pappas
Inline the single invocation of the macro
STATS_ENABLED().
The macro abstraction is not necessary because the logic behind it is only used once.Signed-off-by Brent Pappas <[email protected]>---
Needs a V2: note which says what changed.
Quoted 18 lines
drivers/staging/media/atomisp/pci/sh_css.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)drivers/staging/media/atomisp/pci/sh_css.c +0
-3@@ -97,9 +97,6 @@*/ #define JPEG_BYTES (16 * 1024 * 1024) -#define STATS_ENABLED (stage) (stage && stage->binary && stage->binary->info && \ - (stage->binary->info->sp.enable.s3a || stage->binary->info->sp.enable.dis)) -struct sh_css my_css; int __printf(1, 0) (*sh_css_printf)(const char *fmt, va_list args) = NULL;
drivers/staging/media/atomisp/pci/sh_css.c ia_css_pipe_enqueue_buffer(struct ia_css_pipe *pipe, · line 3743
Quoted 5 lines
drivers/staging/media/atomisp/pci/sh_css.c +1
-1@@ -3743,7 +3740,9 @@ ia_css_pipe_enqueue_buffer(struct ia_css_pipe *pipe,* The SP will read the params after it got * empty 3a and dis */ -if (STATS_ENABLED (stage)) { + if (stage && stage->binary && stage->binary->info &&
^^^^^^^^
We know that "stage" must be non-NULL. You should wait over night before resending v2 patches so that we think "This guy spend overnight running tests. He must be very serious." There is no rush.
regards,
dan carpenter
PATCH v3 1/1 media: atomisp: pci: sh_css: Inline single invocation of macro STATS_ENABLED()
Inline the single invocation of the macro STATS_ENABLED().
The macro abstraction is not necessary because the logic behind it is only used once.
---
Changelog:
V1 -> V2: Inline macro instead of replacing it with a function.
V2 -> V3: Remove unnecessary check that stage is non-null.
drivers/staging/media/atomisp/pci/sh_css.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/staging/media/atomisp/pci/sh_css.c +3 -4
@@ -97,9 +97,6 @@*/ #define JPEG_BYTES (16 * 1024 * 1024) -#define STATS_ENABLED (stage) (stage && stage->binary && stage->binary->info && \ - (stage->binary->info->sp.enable.s3a || stage->binary->info->sp.enable.dis)) -struct sh_css my_css; int __printf(1, 0) (*sh_css_printf)(const char *fmt, va_list args) = NULL;
@@ -3743,7 +3740,9 @@ ia_css_pipe_enqueue_buffer(struct ia_css_pipe *pipe,* The SP will read the params after it got * empty 3a and dis */ -if (STATS_ENABLED (stage)) { +if (stage->binary && stage->binary->info && + (stage->binary->info->sp.enable.s3a || + stage->binary->info->sp.enable.dis)) {/* there is a stage that needs it */ return_err = ia_css_bufq_enqueue_buffer(thread_id, queue_id,
Signature · 1 line
2.34.1
Re: [PATCH v3] media: atomisp: pci: sh_css: Inline single invocation of macro STATS_ENABLED()
Quoted 4 lines · Brent Pappas
Inline the single invocation of the macro
STATS_ENABLED().
The macro abstraction is not necessary because the logic behind it is only used once.
LGTM,
Quoted 38 lines
Signed-off-by Brent Pappas <[email protected]>---
Changelog:
V1 -> V2: Inline macro instead of replacing it with a function.V2 -> V3: Remove unnecessary check that stage is non-null.
drivers/staging/media/atomisp/pci/sh_css.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)drivers/staging/media/atomisp/pci/sh_css.c +3
-5@@ -97,9 +97,6 @@*/ #define JPEG_BYTES (16 * 1024 * 1024) -#define STATS_ENABLED (stage) (stage && stage->binary && stage->binary->info && \ - (stage->binary->info->sp.enable.s3a || stage->binary->info->sp.enable.dis)) -struct sh_css my_css; int __printf(1, 0) (*sh_css_printf)(const char *fmt, va_list args) = NULL;@@ -3743,7 +3740,9 @@ ia_css_pipe_enqueue_buffer(struct ia_css_pipe *pipe,* The SP will read the params after it got * empty 3a and dis */ -if (STATS_ENABLED (stage)) { +if (stage->binary && stage->binary->info && + (stage->binary->info->sp.enable.s3a || + stage->binary->info->sp.enable.dis)) {/* there is a stage that needs it */ return_err = ia_css_bufq_enqueue_buffer(thread_id, queue_id, --2.34.1
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH v3] media: atomisp: pci: sh_css: Inline single invocation of macro STATS_ENABLED()
In reply to Brent PappasQuoted 11 lines · Brent Pappas
Inline the single invocation of the macro
STATS_ENABLED().
The macro abstraction is not necessary because the logic behind it is only used once.Signed-off-by Brent Pappas <[email protected]>---
Changelog:
V1 -> V2: Inline macro instead of replacing it with a function.V2 -> V3: Remove unnecessary check that stage is non-null.
Thanks!
regards,
dan carpenter
Re: [PATCH v3] media: atomisp: pci: sh_css: Inline single invocation of macro STATS_ENABLED()
In reply to Brent PappasHi,
Quoted 5 lines · Brent Pappas
Inline the single invocation of the macro
STATS_ENABLED().
The macro abstraction is not necessary because the logic behind it is only used once.Signed-off-by Brent Pappas <[email protected]>
Thank you.
I have added this to my personal git tree now and I will include this in the atomisp driver pull-req which I will send to the media-subsystem maintainer in a couple of weeks.
Regards,
Hans
Quoted 34 lines
---
Changelog:
V1 -> V2: Inline macro instead of replacing it with a function.V2 -> V3: Remove unnecessary check that stage is non-null.
drivers/staging/media/atomisp/pci/sh_css.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)drivers/staging/media/atomisp/pci/sh_css.c +3
-4@@ -97,9 +97,6 @@*/ #define JPEG_BYTES (16 * 1024 * 1024) -#define STATS_ENABLED (stage) (stage && stage->binary && stage->binary->info && \ - (stage->binary->info->sp.enable.s3a || stage->binary->info->sp.enable.dis)) -struct sh_css my_css; int __printf(1, 0) (*sh_css_printf)(const char *fmt, va_list args) = NULL;@@ -3743,7 +3740,9 @@ ia_css_pipe_enqueue_buffer(struct ia_css_pipe *pipe,* The SP will read the params after it got * empty 3a and dis */ -if (STATS_ENABLED (stage)) { +if (stage->binary && stage->binary->info && + (stage->binary->info->sp.enable.s3a || + stage->binary->info->sp.enable.dis)) {/* there is a stage that needs it */ return_err = ia_css_bufq_enqueue_buffer(thread_id, queue_id,