* [PATCH] media: atomisp: pci: sh_css: Replace macro STATS_ENABLED() with function @ 2023-01-19 13:42 Brent Pappas 2023-01-19 14:07 ` Andy Shevchenko 0 siblings, 1 reply; 8+ messages in thread From: Brent Pappas @ 2023-01-19 13:42 UTC (permalink / raw) To: hdegoede Cc: mchehab, sakari.ailus, gregkh, andy, colin.i.king, linux-media, linux-staging, linux-kernel, Brent Pappas Replace the macro STATS_ENABLED() with a static function to conform to Linux coding style standards. Signed-off-by: Brent Pappas <bpappas@pappasbrent.com> --- drivers/staging/media/atomisp/pci/sh_css.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/sh_css.c b/drivers/staging/media/atomisp/pci/sh_css.c index 726cb7aa4ecd..753b3e0fcb07 100644 --- a/drivers/staging/media/atomisp/pci/sh_css.c +++ b/drivers/staging/media/atomisp/pci/sh_css.c @@ -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, -- 2.34.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] media: atomisp: pci: sh_css: Replace macro STATS_ENABLED() with function 2023-01-19 13:42 [PATCH] media: atomisp: pci: sh_css: Replace macro STATS_ENABLED() with function Brent Pappas @ 2023-01-19 14:07 ` Andy Shevchenko 2023-01-19 14:42 ` [PATCH v2] media: atomisp: pci: sh_css: Inline single invocation of macro STATS_ENABLED() Brent Pappas 0 siblings, 1 reply; 8+ messages in thread From: Andy Shevchenko @ 2023-01-19 14:07 UTC (permalink / raw) To: Brent Pappas Cc: hdegoede, mchehab, sakari.ailus, gregkh, andy, colin.i.king, linux-media, linux-staging, linux-kernel On Thu, Jan 19, 2023 at 3:43 PM Brent Pappas <bpappas@pappasbrent.com> wrote: > > 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. -- With Best Regards, Andy Shevchenko ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2] media: atomisp: pci: sh_css: Inline single invocation of macro STATS_ENABLED() 2023-01-19 14:07 ` Andy Shevchenko @ 2023-01-19 14:42 ` Brent Pappas 2023-01-19 14:54 ` Dan Carpenter 0 siblings, 1 reply; 8+ messages in thread From: Brent Pappas @ 2023-01-19 14:42 UTC (permalink / raw) To: andy.shevchenko Cc: andy, bpappas, colin.i.king, gregkh, hdegoede, linux-kernel, linux-media, linux-staging, mchehab, sakari.ailus 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 <bpappas@pappasbrent.com> --- drivers/staging/media/atomisp/pci/sh_css.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/staging/media/atomisp/pci/sh_css.c b/drivers/staging/media/atomisp/pci/sh_css.c index 726cb7aa4ecd..93789500416f 100644 --- a/drivers/staging/media/atomisp/pci/sh_css.c +++ b/drivers/staging/media/atomisp/pci/sh_css.c @@ -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, -- 2.34.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v2] media: atomisp: pci: sh_css: Inline single invocation of macro STATS_ENABLED() 2023-01-19 14:42 ` [PATCH v2] media: atomisp: pci: sh_css: Inline single invocation of macro STATS_ENABLED() Brent Pappas @ 2023-01-19 14:54 ` Dan Carpenter 2023-01-20 17:14 ` [PATCH v3] " Brent Pappas 0 siblings, 1 reply; 8+ messages in thread From: Dan Carpenter @ 2023-01-19 14:54 UTC (permalink / raw) To: Brent Pappas Cc: andy.shevchenko, andy, colin.i.king, gregkh, hdegoede, linux-kernel, linux-media, linux-staging, mchehab, sakari.ailus On Thu, Jan 19, 2023 at 09:42:03AM -0500, Brent Pappas wrote: > 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 <bpappas@pappasbrent.com> > --- Needs a V2: note which says what changed. > drivers/staging/media/atomisp/pci/sh_css.c | 7 +++---- > 1 file changed, 3 insertions(+), 4 deletions(-) > > diff --git a/drivers/staging/media/atomisp/pci/sh_css.c b/drivers/staging/media/atomisp/pci/sh_css.c > index 726cb7aa4ecd..93789500416f 100644 > --- a/drivers/staging/media/atomisp/pci/sh_css.c > +++ b/drivers/staging/media/atomisp/pci/sh_css.c > @@ -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 && ^^^^^^^^ 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 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v3] media: atomisp: pci: sh_css: Inline single invocation of macro STATS_ENABLED() 2023-01-19 14:54 ` Dan Carpenter @ 2023-01-20 17:14 ` Brent Pappas 2023-01-20 17:38 ` Andy Shevchenko ` (2 more replies) 0 siblings, 3 replies; 8+ messages in thread From: Brent Pappas @ 2023-01-20 17:14 UTC (permalink / raw) To: error27 Cc: andy.shevchenko, andy, bpappas, colin.i.king, gregkh, hdegoede, linux-kernel, linux-media, linux-staging, mchehab, sakari.ailus 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 <bpappas@pappasbrent.com> --- 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(-) diff --git a/drivers/staging/media/atomisp/pci/sh_css.c b/drivers/staging/media/atomisp/pci/sh_css.c index 726cb7aa4ecd..93789500416f 100644 --- a/drivers/staging/media/atomisp/pci/sh_css.c +++ b/drivers/staging/media/atomisp/pci/sh_css.c @@ -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 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v3] media: atomisp: pci: sh_css: Inline single invocation of macro STATS_ENABLED() 2023-01-20 17:14 ` [PATCH v3] " Brent Pappas @ 2023-01-20 17:38 ` Andy Shevchenko 2023-01-23 12:04 ` Dan Carpenter 2023-01-23 12:28 ` Hans de Goede 2 siblings, 0 replies; 8+ messages in thread From: Andy Shevchenko @ 2023-01-20 17:38 UTC (permalink / raw) To: Brent Pappas Cc: error27, andy, colin.i.king, gregkh, hdegoede, linux-kernel, linux-media, linux-staging, mchehab, sakari.ailus On Fri, Jan 20, 2023 at 7:14 PM Brent Pappas <bpappas@pappasbrent.com> wrote: > > 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, Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> > Signed-off-by: Brent Pappas <bpappas@pappasbrent.com> > --- > 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(-) > > diff --git a/drivers/staging/media/atomisp/pci/sh_css.c b/drivers/staging/media/atomisp/pci/sh_css.c > index 726cb7aa4ecd..93789500416f 100644 > --- a/drivers/staging/media/atomisp/pci/sh_css.c > +++ b/drivers/staging/media/atomisp/pci/sh_css.c > @@ -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 > -- With Best Regards, Andy Shevchenko ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v3] media: atomisp: pci: sh_css: Inline single invocation of macro STATS_ENABLED() 2023-01-20 17:14 ` [PATCH v3] " Brent Pappas 2023-01-20 17:38 ` Andy Shevchenko @ 2023-01-23 12:04 ` Dan Carpenter 2023-01-23 12:28 ` Hans de Goede 2 siblings, 0 replies; 8+ messages in thread From: Dan Carpenter @ 2023-01-23 12:04 UTC (permalink / raw) To: Brent Pappas Cc: andy.shevchenko, andy, colin.i.king, gregkh, hdegoede, linux-kernel, linux-media, linux-staging, mchehab, sakari.ailus On Fri, Jan 20, 2023 at 12:14:08PM -0500, Brent Pappas wrote: > 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 <bpappas@pappasbrent.com> > --- > Changelog: > V1 -> V2: Inline macro instead of replacing it with a function. > > V2 -> V3: Remove unnecessary check that stage is non-null. > Thanks! Reviewed-by: Dan Carpenter <error27@gmail.com> regards, dan carpenter ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v3] media: atomisp: pci: sh_css: Inline single invocation of macro STATS_ENABLED() 2023-01-20 17:14 ` [PATCH v3] " Brent Pappas 2023-01-20 17:38 ` Andy Shevchenko 2023-01-23 12:04 ` Dan Carpenter @ 2023-01-23 12:28 ` Hans de Goede 2 siblings, 0 replies; 8+ messages in thread From: Hans de Goede @ 2023-01-23 12:28 UTC (permalink / raw) To: Brent Pappas, error27 Cc: andy.shevchenko, andy, colin.i.king, gregkh, linux-kernel, linux-media, linux-staging, mchehab, sakari.ailus Hi, On 1/20/23 18:14, Brent Pappas wrote: > 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 <bpappas@pappasbrent.com> 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 > --- > 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(-) > > diff --git a/drivers/staging/media/atomisp/pci/sh_css.c b/drivers/staging/media/atomisp/pci/sh_css.c > index 726cb7aa4ecd..93789500416f 100644 > --- a/drivers/staging/media/atomisp/pci/sh_css.c > +++ b/drivers/staging/media/atomisp/pci/sh_css.c > @@ -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, ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2023-01-23 12:29 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2023-01-19 13:42 [PATCH] media: atomisp: pci: sh_css: Replace macro STATS_ENABLED() with function Brent Pappas 2023-01-19 14:07 ` Andy Shevchenko 2023-01-19 14:42 ` [PATCH v2] media: atomisp: pci: sh_css: Inline single invocation of macro STATS_ENABLED() Brent Pappas 2023-01-19 14:54 ` Dan Carpenter 2023-01-20 17:14 ` [PATCH v3] " Brent Pappas 2023-01-20 17:38 ` Andy Shevchenko 2023-01-23 12:04 ` Dan Carpenter 2023-01-23 12:28 ` Hans de Goede
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).