mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] staging: board: Remove macro board_staging
@ 2021-01-04  8:55 Song Chen
  2021-01-04  9:07 ` Greg KH
  2021-01-04 10:18 ` Geert Uytterhoeven
  0 siblings, 2 replies; 6+ messages in thread
From: Song Chen @ 2021-01-04  8:55 UTC (permalink / raw)
  To: greg, linux-kernel, geert, sfr; +Cc: abbotti, hsweeten, Song Chen

Macro is not supposed to have flow control in it's
statement, remove.

Signed-off-by: Song Chen <chensong_2000@189.cn>

---
Changes in v2:
1, kzm9d_init and armadillo800eva_init are not compatible
with the definition of device_initcall, fixed.
---
 drivers/staging/board/armadillo800eva.c | 15 ++++++++++-----
 drivers/staging/board/board.h           | 11 -----------
 drivers/staging/board/kzm9d.c           | 23 ++++++++++++++---------
 3 files changed, 24 insertions(+), 25 deletions(-)

diff --git a/drivers/staging/board/armadillo800eva.c b/drivers/staging/board/armadillo800eva.c
index 0225234..9896c7ba 100644
--- a/drivers/staging/board/armadillo800eva.c
+++ b/drivers/staging/board/armadillo800eva.c
@@ -78,11 +78,16 @@ static const struct board_staging_dev armadillo800eva_devices[] __initconst = {
 	},
 };
 
-static void __init armadillo800eva_init(void)
+static int __init armadillo800eva_init(void)
 {
-	board_staging_gic_setup_xlate("arm,pl390", 32);
-	board_staging_register_devices(armadillo800eva_devices,
-				       ARRAY_SIZE(armadillo800eva_devices));
+	if (of_machine_is_compatible("renesas,armadillo800eva")) {
+		board_staging_gic_setup_xlate("arm,pl390", 32);
+		board_staging_register_devices(armadillo800eva_devices,
+					       ARRAY_SIZE(armadillo800eva_devices));
+		return 0;
+	}
+
+	return -ENODEV;
 }
 
-board_staging("renesas,armadillo800eva", armadillo800eva_init);
+device_initcall(armadillo800eva_init);
diff --git a/drivers/staging/board/board.h b/drivers/staging/board/board.h
index 5609daf..f1c233e 100644
--- a/drivers/staging/board/board.h
+++ b/drivers/staging/board/board.h
@@ -32,15 +32,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 d449a83..d48c3ef 100644
--- a/drivers/staging/board/kzm9d.c
+++ b/drivers/staging/board/kzm9d.c
@@ -10,17 +10,22 @@ static struct resource usbs1_res[] __initdata = {
 	DEFINE_RES_IRQ(159),
 };
 
-static void __init kzm9d_init(void)
+static int __init kzm9d_init(void)
 {
-	board_staging_gic_setup_xlate("arm,pl390", 32);
+	if (of_machine_is_compatible("renesas,kzm9d")) {
+		board_staging_gic_setup_xlate("arm,pl390", 32);
 
-	if (!board_staging_dt_node_available(usbs1_res,
-					     ARRAY_SIZE(usbs1_res))) {
-		board_staging_gic_fixup_resources(usbs1_res,
-						  ARRAY_SIZE(usbs1_res));
-		platform_device_register_simple("emxx_udc", -1, usbs1_res,
-						ARRAY_SIZE(usbs1_res));
+		if (!board_staging_dt_node_available(usbs1_res,
+						     ARRAY_SIZE(usbs1_res))) {
+			board_staging_gic_fixup_resources(usbs1_res,
+							  ARRAY_SIZE(usbs1_res));
+			platform_device_register_simple("emxx_udc", -1, usbs1_res,
+							ARRAY_SIZE(usbs1_res));
+			return 0;
+		}
 	}
+
+	return -ENODEV;
 }
 
-board_staging("renesas,kzm9d", kzm9d_init);
+device_initcall(kzm9d_init);
-- 
2.7.4


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

* Re: [PATCH v2] staging: board: Remove macro board_staging
  2021-01-04  8:55 [PATCH v2] staging: board: Remove macro board_staging Song Chen
@ 2021-01-04  9:07 ` Greg KH
  2021-01-04  9:17   ` chensong_2000
  2021-01-04 10:19   ` Geert Uytterhoeven
  2021-01-04 10:18 ` Geert Uytterhoeven
  1 sibling, 2 replies; 6+ messages in thread
From: Greg KH @ 2021-01-04  9:07 UTC (permalink / raw)
  To: Song Chen; +Cc: linux-kernel, geert, sfr, abbotti, hsweeten

On Mon, Jan 04, 2021 at 04:55:46PM +0800, Song Chen wrote:
> Macro is not supposed to have flow control in it's
> statement, remove.
> 
> Signed-off-by: Song Chen <chensong_2000@189.cn>
> 
> ---
> Changes in v2:
> 1, kzm9d_init and armadillo800eva_init are not compatible
> with the definition of device_initcall, fixed.

I already applied v1, so what am I supposed to do here?

thanks,

greg k-h

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

* Re: [PATCH v2] staging: board: Remove macro board_staging
  2021-01-04  9:07 ` Greg KH
@ 2021-01-04  9:17   ` chensong_2000
  2021-01-04  9:49     ` Greg KH
  2021-01-04 10:19   ` Geert Uytterhoeven
  1 sibling, 1 reply; 6+ messages in thread
From: chensong_2000 @ 2021-01-04  9:17 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-kernel, geert, sfr, abbotti, hsweeten



在 2021/1/4 下午5:07, Greg KH 写道:
> On Mon, Jan 04, 2021 at 04:55:46PM +0800, Song Chen wrote:
>> Macro is not supposed to have flow control in it's
>> statement, remove.
>>
>> Signed-off-by: Song Chen <chensong_2000@189.cn>
>>
>> ---
>> Changes in v2:
>> 1, kzm9d_init and armadillo800eva_init are not compatible
>> with the definition of device_initcall, fixed.
> 
> I already applied v1, so what am I supposed to do here?

In https://lore.kernel.org/lkml/20170220175506.GA30142@kroah.com/, it
seems that kernel can live with the checkpatch warning messages of 
"Macro is not supposed to have flow control in it's statement" in
driver/staging/board. If so, please drop the patch.

Sorry for the trouble.

Song
> 
> thanks,
> 
> greg k-h
> 

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

* Re: [PATCH v2] staging: board: Remove macro board_staging
  2021-01-04  9:17   ` chensong_2000
@ 2021-01-04  9:49     ` Greg KH
  0 siblings, 0 replies; 6+ messages in thread
From: Greg KH @ 2021-01-04  9:49 UTC (permalink / raw)
  To: chensong_2000; +Cc: linux-kernel, geert, sfr, abbotti, hsweeten

On Mon, Jan 04, 2021 at 05:17:52PM +0800, chensong_2000@189.cn wrote:
> 
> 
> 在 2021/1/4 下午5:07, Greg KH 写道:
> > On Mon, Jan 04, 2021 at 04:55:46PM +0800, Song Chen wrote:
> > > Macro is not supposed to have flow control in it's
> > > statement, remove.
> > > 
> > > Signed-off-by: Song Chen <chensong_2000@189.cn>
> > > 
> > > ---
> > > Changes in v2:
> > > 1, kzm9d_init and armadillo800eva_init are not compatible
> > > with the definition of device_initcall, fixed.
> > 
> > I already applied v1, so what am I supposed to do here?
> 
> In https://lore.kernel.org/lkml/20170220175506.GA30142@kroah.com/, it
> seems that kernel can live with the checkpatch warning messages of "Macro is
> not supposed to have flow control in it's statement" in
> driver/staging/board. If so, please drop the patch.

I'm confused, maybe I didn't apply the first patch?  Am I confusing this
with a different patch for this code?

greg "I need more coffee..." k-h

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

* Re: [PATCH v2] staging: board: Remove macro board_staging
  2021-01-04  8:55 [PATCH v2] staging: board: Remove macro board_staging Song Chen
  2021-01-04  9:07 ` Greg KH
@ 2021-01-04 10:18 ` Geert Uytterhoeven
  1 sibling, 0 replies; 6+ messages in thread
From: Geert Uytterhoeven @ 2021-01-04 10:18 UTC (permalink / raw)
  To: chensong_2000
  Cc: Greg KH, Linux Kernel Mailing List, Stephen Rothwell, Ian Abbott,
	H Hartley Sweeten

Hi Chen,

Thanks for your patch!

On Mon, Jan 4, 2021 at 9:55 AM Song Chen <chensong_2000@189.cn> wrote:
> Macro is not supposed to have flow control in it's
> statement, remove.

Why not?

>
> Signed-off-by: Song Chen <chensong_2000@189.cn>
>
> ---
> Changes in v2:
> 1, kzm9d_init and armadillo800eva_init are not compatible
> with the definition of device_initcall, fixed.
> ---
>  drivers/staging/board/armadillo800eva.c | 15 ++++++++++-----
>  drivers/staging/board/board.h           | 11 -----------
>  drivers/staging/board/kzm9d.c           | 23 ++++++++++++++---------
>  3 files changed, 24 insertions(+), 25 deletions(-)
>
> diff --git a/drivers/staging/board/armadillo800eva.c b/drivers/staging/board/armadillo800eva.c
> index 0225234..9896c7ba 100644
> --- a/drivers/staging/board/armadillo800eva.c
> +++ b/drivers/staging/board/armadillo800eva.c
> @@ -78,11 +78,16 @@ static const struct board_staging_dev armadillo800eva_devices[] __initconst = {
>         },
>  };
>
> -static void __init armadillo800eva_init(void)
> +static int __init armadillo800eva_init(void)
>  {
> -       board_staging_gic_setup_xlate("arm,pl390", 32);
> -       board_staging_register_devices(armadillo800eva_devices,
> -                                      ARRAY_SIZE(armadillo800eva_devices));
> +       if (of_machine_is_compatible("renesas,armadillo800eva")) {
> +               board_staging_gic_setup_xlate("arm,pl390", 32);
> +               board_staging_register_devices(armadillo800eva_devices,
> +                                              ARRAY_SIZE(armadillo800eva_devices));
> +               return 0;
> +       }
> +
> +       return -ENODEV;
>  }
>
> -board_staging("renesas,armadillo800eva", armadillo800eva_init);
> +device_initcall(armadillo800eva_init);

This change makes it more difficult to have multiple entries sharing
the same init function.  See also the various *OF_DECLARE() macros.

Note that a similar patch was (IMHO rightfully) rejected 3 years ago:
https://lore.kernel.org/lkml/20170220175506.GA30142@kroah.com/

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH v2] staging: board: Remove macro board_staging
  2021-01-04  9:07 ` Greg KH
  2021-01-04  9:17   ` chensong_2000
@ 2021-01-04 10:19   ` Geert Uytterhoeven
  1 sibling, 0 replies; 6+ messages in thread
From: Geert Uytterhoeven @ 2021-01-04 10:19 UTC (permalink / raw)
  To: Greg KH
  Cc: Song Chen, Linux Kernel Mailing List, Stephen Rothwell,
	Ian Abbott, H Hartley Sweeten

Hi Greg,

On Mon, Jan 4, 2021 at 10:05 AM Greg KH <greg@kroah.com> wrote:
> On Mon, Jan 04, 2021 at 04:55:46PM +0800, Song Chen wrote:
> > Macro is not supposed to have flow control in it's
> > statement, remove.
> >
> > Signed-off-by: Song Chen <chensong_2000@189.cn>
> >
> > ---
> > Changes in v2:
> > 1, kzm9d_init and armadillo800eva_init are not compatible
> > with the definition of device_initcall, fixed.
>
> I already applied v1, so what am I supposed to do here?

Please revert v1, it didn't compile.
https://lore.kernel.org/lkml/20210104122653.6f35b9bb@canb.auug.org.au/

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

end of thread, other threads:[~2021-01-04 10:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-04  8:55 [PATCH v2] staging: board: Remove macro board_staging Song Chen
2021-01-04  9:07 ` Greg KH
2021-01-04  9:17   ` chensong_2000
2021-01-04  9:49     ` Greg KH
2021-01-04 10:19   ` Geert Uytterhoeven
2021-01-04 10:18 ` Geert Uytterhoeven

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

all inboxes | Powered by JetHome®