public inbox for linux-staging@lists.linux.dev
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Dileep Sankhla <dileepsankhla.ds@gmail.com>
Cc: greybus-dev@lists.linaro.org, linux-staging@lists.linux.dev,
	linux-kernel@vger.kernel.org, pure.logic@nexus-software.ie,
	johan@kernel.org, elder@kernel.org
Subject: Re: [PATCH] staging: greybus: put macro in a do - while loop
Date: Sun, 25 Feb 2024 09:56:01 +0100	[thread overview]
Message-ID: <2024022538-buffoon-praising-f748@gregkh> (raw)
In-Reply-To: <20240225084017.418773-1-dileepsankhla.ds@gmail.com>

On Sun, Feb 25, 2024 at 02:10:17PM +0530, Dileep Sankhla wrote:
> Enclose the macro gb_loopback_stats_attrs defined with multiple
> replacement statements in a do - while loop. This avoids possible
> if/else logic defects and clears a checkpatch error.
> 
> ERROR: Macros with multiple statements should be enclosed in a do -
> while loop
> 
> Signed-off-by: Dileep Sankhla <dileepsankhla.ds@gmail.com>
> ---
>  drivers/staging/greybus/loopback.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/staging/greybus/loopback.c b/drivers/staging/greybus/loopback.c
> index bb33379b5297..eb5a7a20f5a3 100644
> --- a/drivers/staging/greybus/loopback.c
> +++ b/drivers/staging/greybus/loopback.c
> @@ -162,9 +162,11 @@ static ssize_t name##_avg_show(struct device *dev,		\
>  static DEVICE_ATTR_RO(name##_avg)
>  
>  #define gb_loopback_stats_attrs(field)				\
> -	gb_loopback_ro_stats_attr(field, min, u);		\
> -	gb_loopback_ro_stats_attr(field, max, u);		\
> -	gb_loopback_ro_avg_attr(field)
> +	do {							\
> +		gb_loopback_ro_stats_attr(field, min, u);	\
> +		gb_loopback_ro_stats_attr(field, max, u);	\
> +		gb_loopback_ro_avg_attr(field);			\
> +	} while (0)

Did you test build this?

>  #define gb_loopback_attr(field, type)					\
>  static ssize_t field##_show(struct device *dev,				\

Why did you only change one if you thought this was a valid change?

thanks,

greg k-h

  reply	other threads:[~2024-02-25  8:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-25  8:40 [PATCH] staging: greybus: put macro in a do - while loop Dileep Sankhla
2024-02-25  8:56 ` Greg KH [this message]
2024-02-25  9:49   ` Dileep Sankhla
2024-03-04 17:59     ` Alex Elder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2024022538-buffoon-praising-f748@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=dileepsankhla.ds@gmail.com \
    --cc=elder@kernel.org \
    --cc=greybus-dev@lists.linaro.org \
    --cc=johan@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=pure.logic@nexus-software.ie \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox