From: Dileep Sankhla <dileepsankhla.ds@gmail.com>
To: greybus-dev@lists.linaro.org, linux-staging@lists.linux.dev,
linux-kernel@vger.kernel.org
Cc: pure.logic@nexus-software.ie, johan@kernel.org, elder@kernel.org,
gregkh@linuxfoundation.org,
Dileep Sankhla <dileepsankhla.ds@gmail.com>
Subject: [PATCH] staging: greybus: put macro in a do - while loop
Date: Sun, 25 Feb 2024 14:10:17 +0530 [thread overview]
Message-ID: <20240225084017.418773-1-dileepsankhla.ds@gmail.com> (raw)
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)
#define gb_loopback_attr(field, type) \
static ssize_t field##_show(struct device *dev, \
--
2.40.1
next reply other threads:[~2024-02-25 8:41 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-25 8:40 Dileep Sankhla [this message]
2024-02-25 8:56 ` [PATCH] staging: greybus: put macro in a do - while loop Greg KH
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=20240225084017.418773-1-dileepsankhla.ds@gmail.com \
--to=dileepsankhla.ds@gmail.com \
--cc=elder@kernel.org \
--cc=gregkh@linuxfoundation.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).