driverdev-devel.linuxdriverproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] staging: greybus: fix coding style of greybus/loopback.c
@ 2021-02-16 11:13 Du Cheng
  2021-02-16 11:25 ` Dan Carpenter
  2021-02-16 11:28 ` Greg Kroah-Hartman
  0 siblings, 2 replies; 4+ messages in thread
From: Du Cheng @ 2021-02-16 11:13 UTC (permalink / raw)
  To: Bryan O'Donoghue; +Cc: devel, Greg Kroah-Hartman, Du Cheng

fix macro gb_loopback_stats_attrs by wrapping its multi-line definition
inside a do {} while(0) block, in compliance to scripts/checkpatch.pl.

Signed-off-by: Du Cheng <ducheng2@gmail.com>
---
changes v2:
* relign backslashes with tabstop=8
* improve description and subject

changes v1:
* fix coding style of the macro

 drivers/staging/greybus/loopback.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/greybus/loopback.c b/drivers/staging/greybus/loopback.c
index 2471448ba42a..24b769688817 100644
--- a/drivers/staging/greybus/loopback.c
+++ b/drivers/staging/greybus/loopback.c
@@ -163,9 +163,11 @@ static ssize_t name##_avg_show(struct device *dev,		\
 static DEVICE_ATTR_RO(name##_avg)
 
 #define gb_loopback_stats_attrs(field)				\
+do {								\
 	gb_loopback_ro_stats_attr(field, min, u);		\
 	gb_loopback_ro_stats_attr(field, max, u);		\
-	gb_loopback_ro_avg_attr(field)
+	gb_loopback_ro_avg_attr(field);				\
+} while (0)
 
 #define gb_loopback_attr(field, type)					\
 static ssize_t field##_show(struct device *dev,				\
-- 
2.27.0

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] staging: greybus: fix coding style of greybus/loopback.c
  2021-02-16 11:13 [PATCH v2] staging: greybus: fix coding style of greybus/loopback.c Du Cheng
@ 2021-02-16 11:25 ` Dan Carpenter
  2021-02-16 11:28 ` Greg Kroah-Hartman
  1 sibling, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2021-02-16 11:25 UTC (permalink / raw)
  To: Du Cheng; +Cc: devel, Greg Kroah-Hartman

On Tue, Feb 16, 2021 at 07:13:53PM +0800, Du Cheng wrote:
> fix macro gb_loopback_stats_attrs by wrapping its multi-line definition
> inside a do {} while(0) block, in compliance to scripts/checkpatch.pl.
> 
> Signed-off-by: Du Cheng <ducheng2@gmail.com>
> ---
> changes v2:
> * relign backslashes with tabstop=8
> * improve description and subject
> 
> changes v1:
> * fix coding style of the macro
> 

This breaks the build.

regards,
dan carpenter

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] staging: greybus: fix coding style of greybus/loopback.c
  2021-02-16 11:13 [PATCH v2] staging: greybus: fix coding style of greybus/loopback.c Du Cheng
  2021-02-16 11:25 ` Dan Carpenter
@ 2021-02-16 11:28 ` Greg Kroah-Hartman
  2021-02-16 13:12   ` Du Cheng
  1 sibling, 1 reply; 4+ messages in thread
From: Greg Kroah-Hartman @ 2021-02-16 11:28 UTC (permalink / raw)
  To: Du Cheng; +Cc: devel

On Tue, Feb 16, 2021 at 07:13:53PM +0800, Du Cheng wrote:
> fix macro gb_loopback_stats_attrs by wrapping its multi-line definition
> inside a do {} while(0) block, in compliance to scripts/checkpatch.pl.
> 
> Signed-off-by: Du Cheng <ducheng2@gmail.com>
> ---
> changes v2:
> * relign backslashes with tabstop=8
> * improve description and subject
> 
> changes v1:
> * fix coding style of the macro
> 
>  drivers/staging/greybus/loopback.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/greybus/loopback.c b/drivers/staging/greybus/loopback.c
> index 2471448ba42a..24b769688817 100644
> --- a/drivers/staging/greybus/loopback.c
> +++ b/drivers/staging/greybus/loopback.c
> @@ -163,9 +163,11 @@ static ssize_t name##_avg_show(struct device *dev,		\
>  static DEVICE_ATTR_RO(name##_avg)
>  
>  #define gb_loopback_stats_attrs(field)				\
> +do {								\
>  	gb_loopback_ro_stats_attr(field, min, u);		\
>  	gb_loopback_ro_stats_attr(field, max, u);		\
> -	gb_loopback_ro_avg_attr(field)
> +	gb_loopback_ro_avg_attr(field);				\
> +} while (0)
>  
>  #define gb_loopback_attr(field, type)					\
>  static ssize_t field##_show(struct device *dev,				\
> -- 
> 2.27.0

Did you successfully build this change?

Please do so...

thanks,

greg k-h
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] staging: greybus: fix coding style of greybus/loopback.c
  2021-02-16 11:28 ` Greg Kroah-Hartman
@ 2021-02-16 13:12   ` Du Cheng
  0 siblings, 0 replies; 4+ messages in thread
From: Du Cheng @ 2021-02-16 13:12 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: devel

On Tue, Feb 16, 2021 at 12:28:01PM +0100, Greg Kroah-Hartman wrote:
> On Tue, Feb 16, 2021 at 07:13:53PM +0800, Du Cheng wrote:
> > fix macro gb_loopback_stats_attrs by wrapping its multi-line definition
> > inside a do {} while(0) block, in compliance to scripts/checkpatch.pl.
> > 
> > Signed-off-by: Du Cheng <ducheng2@gmail.com>
> > ---
> > changes v2:
> > * relign backslashes with tabstop=8
> > * improve description and subject
> > 
> > changes v1:
> > * fix coding style of the macro
> > 
> >  drivers/staging/greybus/loopback.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/staging/greybus/loopback.c b/drivers/staging/greybus/loopback.c
> > index 2471448ba42a..24b769688817 100644
> > --- a/drivers/staging/greybus/loopback.c
> > +++ b/drivers/staging/greybus/loopback.c
> > @@ -163,9 +163,11 @@ static ssize_t name##_avg_show(struct device *dev,		\
> >  static DEVICE_ATTR_RO(name##_avg)
> >  
> >  #define gb_loopback_stats_attrs(field)				\
> > +do {								\
> >  	gb_loopback_ro_stats_attr(field, min, u);		\
> >  	gb_loopback_ro_stats_attr(field, max, u);		\
> > -	gb_loopback_ro_avg_attr(field)
> > +	gb_loopback_ro_avg_attr(field);				\
> > +} while (0)
> >  
> >  #define gb_loopback_attr(field, type)					\
> >  static ssize_t field##_show(struct device *dev,				\
> > -- 
> > 2.27.0
> 
> Did you successfully build this change?
> 
> Please do so...
> 
> thanks,
> 
> greg k-h

I realized I did not enable greybus subsystem in the config.
after the enabling CONFIG_GREYBUS_LOOPBACK=m the make failed with compilation errors.

Then I realized this macro is actually used for function definition, not as statements.
I shall take back this PATCH as the proposed change in not applicable in this case.

Thanks!
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-02-16 13:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-16 11:13 [PATCH v2] staging: greybus: fix coding style of greybus/loopback.c Du Cheng
2021-02-16 11:25 ` Dan Carpenter
2021-02-16 11:28 ` Greg Kroah-Hartman
2021-02-16 13:12   ` Du Cheng

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).