All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Staging: board: Fix macro code style error
@ 2017-02-20 17:44 Valentin Huebner
  2017-02-20 17:55 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 3+ messages in thread
From: Valentin Huebner @ 2017-02-20 17:44 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: devel, linux-kernel

Fixes a 'macro with flow control statement' checkpatch code style
error by removing the board_staging() macro and replacing its two
calls

Signed-off-by: Valentin Hübner <valentin.huebner@gmail.com>
---
 drivers/staging/board/armadillo800eva.c | 10 +++++++++-
 drivers/staging/board/board.h           | 11 -----------
 drivers/staging/board/kzm9d.c           | 10 +++++++++-
 3 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/board/armadillo800eva.c b/drivers/staging/board/armadillo800eva.c
index 4de4fd0..2f1613a 100644
--- a/drivers/staging/board/armadillo800eva.c
+++ b/drivers/staging/board/armadillo800eva.c
@@ -101,4 +101,12 @@ static void __init armadillo800eva_init(void)
 				       ARRAY_SIZE(armadillo800eva_devices));
 }
 
-board_staging("renesas,armadillo800eva", armadillo800eva_init);
+static int __init runtime_board_check(void)
+{
+	if (of_machine_is_compatible("renesas,armadillo800eva"))
+		armadillo800eva_init();
+
+	return 0;
+}
+
+device_initcall(runtime_board_check)
diff --git a/drivers/staging/board/board.h b/drivers/staging/board/board.h
index 42ed125..0fa1197 100644
--- a/drivers/staging/board/board.h
+++ b/drivers/staging/board/board.h
@@ -31,15 +31,4 @@ int board_staging_register_device(const struct board_staging_dev *dev);
 void board_staging_register_devices(const struct board_staging_dev *devs,
 				    unsigned int ndevs);
 
-#define board_staging(str, fn)			\
-static int __init runtime_board_check(void)	\
-{						\
-	if (of_machine_is_compatible(str))	\
-		fn();				\
-						\
-	return 0;				\
-}						\
-						\
-device_initcall(runtime_board_check)
-
 #endif /* __BOARD_H__ */
diff --git a/drivers/staging/board/kzm9d.c b/drivers/staging/board/kzm9d.c
index 05a6d43..662501c 100644
--- a/drivers/staging/board/kzm9d.c
+++ b/drivers/staging/board/kzm9d.c
@@ -22,4 +22,12 @@ static void __init kzm9d_init(void)
 	}
 }
 
-board_staging("renesas,kzm9d", kzm9d_init);
+static int __init runtime_board_check(void)
+{
+	if (of_machine_is_compatible("renesas,kzm9d"))
+		kzm9d_init();
+
+	return 0;
+}
+
+device_initcall(runtime_board_check)
-- 
2.7.4

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

* Re: [PATCH] Staging: board: Fix macro code style error
  2017-02-20 17:44 [PATCH] Staging: board: Fix macro code style error Valentin Huebner
@ 2017-02-20 17:55 ` Greg Kroah-Hartman
  2017-02-21 15:21   ` Valentin Hübner
  0 siblings, 1 reply; 3+ messages in thread
From: Greg Kroah-Hartman @ 2017-02-20 17:55 UTC (permalink / raw)
  To: Valentin Huebner; +Cc: devel, linux-kernel

On Mon, Feb 20, 2017 at 05:44:50PM +0000, Valentin Huebner wrote:
> Fixes a 'macro with flow control statement' checkpatch code style
> error by removing the board_staging() macro and replacing its two
> calls

checkpatch is wrong here, you are now adding more lines than you remove:

> Signed-off-by: Valentin Hübner <valentin.huebner@gmail.com>
> ---
>  drivers/staging/board/armadillo800eva.c | 10 +++++++++-
>  drivers/staging/board/board.h           | 11 -----------
>  drivers/staging/board/kzm9d.c           | 10 +++++++++-
>  3 files changed, 18 insertions(+), 13 deletions(-)

See?

There's nothing wrong with the macro as-is, it's like many other macros
we have for module init sequences.  checkpatch is just a hint, you still
have to use your brain :)

sorry,

greg k-h

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

* Re: [PATCH] Staging: board: Fix macro code style error
  2017-02-20 17:55 ` Greg Kroah-Hartman
@ 2017-02-21 15:21   ` Valentin Hübner
  0 siblings, 0 replies; 3+ messages in thread
From: Valentin Hübner @ 2017-02-21 15:21 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: devel, linux-kernel

On Mon, Feb 20, 2017 at 06:55:06PM +0100, Greg Kroah-Hartman wrote:
> checkpatch is wrong here, you are now adding more lines than you remove:

I see, thank you!

Valentin

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

end of thread, other threads:[~2017-02-21 15:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-20 17:44 [PATCH] Staging: board: Fix macro code style error Valentin Huebner
2017-02-20 17:55 ` Greg Kroah-Hartman
2017-02-21 15:21   ` Valentin Hübner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.