public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: dgnc: Replace macro with flow control statement by a function
@ 2015-07-05 18:16 Arjun Krishna Babu
  2015-07-06  7:32 ` Dan Carpenter
  2015-07-06 12:15 ` Ravi Teja Darbha
  0 siblings, 2 replies; 7+ messages in thread
From: Arjun Krishna Babu @ 2015-07-05 18:16 UTC (permalink / raw)
  To: lidza.louina, markh
  Cc: gregkh, driverdev-devel, devel, linux-kernel, Arjun Krishna Babu

This patch fixes the checkpatch.pl warning:

WARNING: Macros with flow control statements should be avoided

Replace the macro with a function doing the exact same task as the
macro.

Signed-off-by: Arjun Krishna Babu <arjunkrishnababu96@gmail.com>
---
 drivers/staging/dgnc/dgnc_sysfs.c | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_sysfs.c b/drivers/staging/dgnc/dgnc_sysfs.c
index 44db870..8ab0922 100644
--- a/drivers/staging/dgnc/dgnc_sysfs.c
+++ b/drivers/staging/dgnc/dgnc_sysfs.c
@@ -92,19 +92,17 @@ void dgnc_remove_driver_sysfiles(struct pci_driver *dgnc_driver)
 }
 
 
-#define DGNC_VERIFY_BOARD(p, bd)				\
-	do {							\
-		if (!p)						\
-			return 0;				\
-								\
-		bd = dev_get_drvdata(p);			\
-		if (!bd || bd->magic != DGNC_BOARD_MAGIC)	\
-			return 0;				\
-		if (bd->state != BOARD_READY)			\
-			return 0;				\
-	} while (0)
-
+static int DGNC_VERIFY_BOARD(struct device *p, struct dgnc_board *bd)
+{
+	if (!p)
+		return 0;
 
+	bd = dev_get_drvdata(p);
+	if (!bd || bd->magic != DGNC_BOARD_MAGIC)
+		return 0;
+	if (bd->state != BOARD_READY)
+		return 0;
+}
 
 static ssize_t dgnc_vpd_show(struct device *p, struct device_attribute *attr,
 			     char *buf)
-- 
1.9.1


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

end of thread, other threads:[~2015-07-06 14:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-05 18:16 [PATCH] staging: dgnc: Replace macro with flow control statement by a function Arjun Krishna Babu
2015-07-06  7:32 ` Dan Carpenter
2015-07-06 12:15 ` Ravi Teja Darbha
2015-07-06 12:27   ` Sudip Mukherjee
2015-07-06 13:20     ` Ravi Teja Darbha
2015-07-06 13:28       ` Valdis.Kletnieks
2015-07-06 14:10     ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox