All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: board: replace macro with function
@ 2019-03-09 17:02 Aarushi Mehta
  2019-03-09 17:08 ` [Outreachy kernel] " Julia Lawall
  2019-03-11 22:58 ` Greg KH
  0 siblings, 2 replies; 3+ messages in thread
From: Aarushi Mehta @ 2019-03-09 17:02 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: gregkh

From b0da5fe54699fd2b4b627344fa5a118d6d985853 Mon Sep 17 00:00:00 2001
From: Aarushi Mehta <mehta.aaru20@gmail.com>
Date: Sat, 9 Mar 2019 22:16:42 +0530
Subject: [PATCH 51/51] staging: board: replace macro with function

Signed-off-by: Aarushi Mehta <mehta.aaru20@gmail.com>
---
 drivers/staging/board/board.h | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/board/board.h b/drivers/staging/board/board.h
index 5609daf4d869..a2119ae1bac1 100644
--- a/drivers/staging/board/board.h
+++ b/drivers/staging/board/board.h
@@ -31,16 +31,15 @@ int board_staging_register_clock(const struct board_staging_clk *bsc);
 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)
+static void board_staging(str, fn)
+{
+	static inline int __init runtime_board_check(void)
+	{
+		if (of_machine_is_compatible(str))
+			fn();
+		return 0;
+	}
+	device_initcall(runtime_board_check)
+}
 
 #endif /* __BOARD_H__ */
-- 
2.17.1




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

* Re: [Outreachy kernel] [PATCH] staging: board: replace macro with function
  2019-03-09 17:02 [PATCH] staging: board: replace macro with function Aarushi Mehta
@ 2019-03-09 17:08 ` Julia Lawall
  2019-03-11 22:58 ` Greg KH
  1 sibling, 0 replies; 3+ messages in thread
From: Julia Lawall @ 2019-03-09 17:08 UTC (permalink / raw)
  To: Aarushi Mehta; +Cc: outreachy-kernel, gregkh



On Sat, 9 Mar 2019, Aarushi Mehta wrote:

> From b0da5fe54699fd2b4b627344fa5a118d6d985853 Mon Sep 17 00:00:00 2001
> From: Aarushi Mehta <mehta.aaru20@gmail.com>
> Date: Sat, 9 Mar 2019 22:16:42 +0530
> Subject: [PATCH 51/51] staging: board: replace macro with function

What is this?

You need to put a log message.

>
> Signed-off-by: Aarushi Mehta <mehta.aaru20@gmail.com>
> ---
>  drivers/staging/board/board.h | 21 ++++++++++-----------
>  1 file changed, 10 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/staging/board/board.h b/drivers/staging/board/board.h
> index 5609daf4d869..a2119ae1bac1 100644
> --- a/drivers/staging/board/board.h
> +++ b/drivers/staging/board/board.h
> @@ -31,16 +31,15 @@ int board_staging_register_clock(const struct board_staging_clk *bsc);
>  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)

The above macro should generate a new function definition.  It can't be
rewritten as a function.

julia

> +static void board_staging(str, fn)
> +{
> +	static inline int __init runtime_board_check(void)
> +	{
> +		if (of_machine_is_compatible(str))
> +			fn();
> +		return 0;
> +	}
> +	device_initcall(runtime_board_check)
> +}
>
>  #endif /* __BOARD_H__ */
> --
> 2.17.1
>
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/0ce45d3e104e179cbf124d6c41aee442d6ed03cb.camel%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>


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

* Re: [PATCH] staging: board: replace macro with function
  2019-03-09 17:02 [PATCH] staging: board: replace macro with function Aarushi Mehta
  2019-03-09 17:08 ` [Outreachy kernel] " Julia Lawall
@ 2019-03-11 22:58 ` Greg KH
  1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2019-03-11 22:58 UTC (permalink / raw)
  To: Aarushi Mehta; +Cc: outreachy-kernel

On Sat, Mar 09, 2019 at 10:32:50PM +0530, Aarushi Mehta wrote:
> >From b0da5fe54699fd2b4b627344fa5a118d6d985853 Mon Sep 17 00:00:00 2001
> From: Aarushi Mehta <mehta.aaru20@gmail.com>
> Date: Sat, 9 Mar 2019 22:16:42 +0530
> Subject: [PATCH 51/51] staging: board: replace macro with function
> 
> Signed-off-by: Aarushi Mehta <mehta.aaru20@gmail.com>
> ---
>  drivers/staging/board/board.h | 21 ++++++++++-----------
>  1 file changed, 10 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/staging/board/board.h b/drivers/staging/board/board.h
> index 5609daf4d869..a2119ae1bac1 100644
> --- a/drivers/staging/board/board.h
> +++ b/drivers/staging/board/board.h
> @@ -31,16 +31,15 @@ int board_staging_register_clock(const struct board_staging_clk *bsc);
>  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)
> +static void board_staging(str, fn)
> +{
> +	static inline int __init runtime_board_check(void)
> +	{
> +		if (of_machine_is_compatible(str))
> +			fn();
> +		return 0;
> +	}
> +	device_initcall(runtime_board_check)
> +}

This will not build properly with some compilers, and really isn't
correct code at all :(

thanks,

greg k-h


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

end of thread, other threads:[~2019-03-11 22:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-09 17:02 [PATCH] staging: board: replace macro with function Aarushi Mehta
2019-03-09 17:08 ` [Outreachy kernel] " Julia Lawall
2019-03-11 22:58 ` Greg KH

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.