linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] MIPS: Clean up device_tree_init()
@ 2022-03-10  6:50 Tiezhu Yang
  2022-03-10  6:50 ` [PATCH 1/3] MIPS: Remove redundant check in device_tree_init() Tiezhu Yang
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Tiezhu Yang @ 2022-03-10  6:50 UTC (permalink / raw)
  To: Thomas Bogendoerfer; +Cc: Xuefeng Li, linux-mips, linux-kernel

Tiezhu Yang (3):
  MIPS: Remove redundant check in device_tree_init()
  MIPS: Remove redundant definitions of device_tree_init()
  MIPS: Fix wrong comments in asm/prom.h

 arch/mips/ath79/setup.c          |  5 -----
 arch/mips/include/asm/prom.h     |  4 ++--
 arch/mips/kernel/prom.c          |  5 +++++
 arch/mips/lantiq/prom.c          |  5 -----
 arch/mips/loongson64/setup.c     |  8 --------
 arch/mips/mti-malta/Makefile     |  1 -
 arch/mips/mti-malta/malta-dt.c   | 15 ---------------
 arch/mips/pic32/pic32mzda/init.c |  8 --------
 arch/mips/ralink/of.c            |  5 -----
 9 files changed, 7 insertions(+), 49 deletions(-)
 delete mode 100644 arch/mips/mti-malta/malta-dt.c

-- 
2.1.0


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

* [PATCH 1/3] MIPS: Remove redundant check in device_tree_init()
  2022-03-10  6:50 [PATCH 0/3] MIPS: Clean up device_tree_init() Tiezhu Yang
@ 2022-03-10  6:50 ` Tiezhu Yang
  2022-03-10  6:50 ` [PATCH 2/3] MIPS: Remove redundant definitions of device_tree_init() Tiezhu Yang
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Tiezhu Yang @ 2022-03-10  6:50 UTC (permalink / raw)
  To: Thomas Bogendoerfer; +Cc: Xuefeng Li, linux-mips, linux-kernel

In device_tree_init(), unflatten_and_copy_device_tree() checks
initial_boot_params, so remove the redundant check.

drivers/of/fdt.c
void __init unflatten_and_copy_device_tree(void)
{
	int size;
	void *dt;

	if (!initial_boot_params) {
		pr_warn("No valid device tree found, continuing without\n");
		return;
	}
	...
}

Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
 arch/mips/loongson64/setup.c     | 3 ---
 arch/mips/pic32/pic32mzda/init.c | 3 ---
 2 files changed, 6 deletions(-)

diff --git a/arch/mips/loongson64/setup.c b/arch/mips/loongson64/setup.c
index 6fe3fff..1973eb0 100644
--- a/arch/mips/loongson64/setup.c
+++ b/arch/mips/loongson64/setup.c
@@ -39,8 +39,5 @@ void __init plat_mem_setup(void)
 
 void __init device_tree_init(void)
 {
-	if (!initial_boot_params)
-		return;
-
 	unflatten_and_copy_device_tree();
 }
diff --git a/arch/mips/pic32/pic32mzda/init.c b/arch/mips/pic32/pic32mzda/init.c
index 764f2d0..a1860f2 100644
--- a/arch/mips/pic32/pic32mzda/init.c
+++ b/arch/mips/pic32/pic32mzda/init.c
@@ -80,9 +80,6 @@ void __init prom_init(void)
 
 void __init device_tree_init(void)
 {
-	if (!initial_boot_params)
-		return;
-
 	unflatten_and_copy_device_tree();
 }
 
-- 
2.1.0


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

* [PATCH 2/3] MIPS: Remove redundant definitions of device_tree_init()
  2022-03-10  6:50 [PATCH 0/3] MIPS: Clean up device_tree_init() Tiezhu Yang
  2022-03-10  6:50 ` [PATCH 1/3] MIPS: Remove redundant check in device_tree_init() Tiezhu Yang
@ 2022-03-10  6:50 ` Tiezhu Yang
  2022-03-10  6:50 ` [PATCH 3/3] MIPS: Fix wrong comments in asm/prom.h Tiezhu Yang
  2022-03-14 14:50 ` [PATCH 0/3] MIPS: Clean up device_tree_init() Thomas Bogendoerfer
  3 siblings, 0 replies; 5+ messages in thread
From: Tiezhu Yang @ 2022-03-10  6:50 UTC (permalink / raw)
  To: Thomas Bogendoerfer; +Cc: Xuefeng Li, linux-mips, linux-kernel

There exists many same definitions of device_tree_init() for various
platforms, add a weak function in arch/mips/kernel/prom.c to clean
up the related code.

Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
 arch/mips/ath79/setup.c          |  5 -----
 arch/mips/kernel/prom.c          |  5 +++++
 arch/mips/lantiq/prom.c          |  5 -----
 arch/mips/loongson64/setup.c     |  5 -----
 arch/mips/mti-malta/Makefile     |  1 -
 arch/mips/mti-malta/malta-dt.c   | 15 ---------------
 arch/mips/pic32/pic32mzda/init.c |  5 -----
 arch/mips/ralink/of.c            |  5 -----
 8 files changed, 5 insertions(+), 41 deletions(-)
 delete mode 100644 arch/mips/mti-malta/malta-dt.c

diff --git a/arch/mips/ath79/setup.c b/arch/mips/ath79/setup.c
index 45d4d71..4e18cdc 100644
--- a/arch/mips/ath79/setup.c
+++ b/arch/mips/ath79/setup.c
@@ -269,8 +269,3 @@ void __init arch_init_irq(void)
 {
 	irqchip_init();
 }
-
-void __init device_tree_init(void)
-{
-	unflatten_and_copy_device_tree();
-}
diff --git a/arch/mips/kernel/prom.c b/arch/mips/kernel/prom.c
index 6abebd5..7db6ff9 100644
--- a/arch/mips/kernel/prom.c
+++ b/arch/mips/kernel/prom.c
@@ -64,4 +64,9 @@ int __init __dt_register_buses(const char *bus0, const char *bus1)
 	return 0;
 }
 
+void __weak __init device_tree_init(void)
+{
+	unflatten_and_copy_device_tree();
+}
+
 #endif
diff --git a/arch/mips/lantiq/prom.c b/arch/mips/lantiq/prom.c
index bc9f58f..c731082a 100644
--- a/arch/mips/lantiq/prom.c
+++ b/arch/mips/lantiq/prom.c
@@ -84,11 +84,6 @@ void __init plat_mem_setup(void)
 	__dt_setup_arch(dtb);
 }
 
-void __init device_tree_init(void)
-{
-	unflatten_and_copy_device_tree();
-}
-
 void __init prom_init(void)
 {
 	/* call the soc specific detetcion code and get it to fill soc_info */
diff --git a/arch/mips/loongson64/setup.c b/arch/mips/loongson64/setup.c
index 1973eb0..3cd11c2 100644
--- a/arch/mips/loongson64/setup.c
+++ b/arch/mips/loongson64/setup.c
@@ -36,8 +36,3 @@ void __init plat_mem_setup(void)
 	if (loongson_fdt_blob)
 		__dt_setup_arch(loongson_fdt_blob);
 }
-
-void __init device_tree_init(void)
-{
-	unflatten_and_copy_device_tree();
-}
diff --git a/arch/mips/mti-malta/Makefile b/arch/mips/mti-malta/Makefile
index 94c11f5..13bbd12 100644
--- a/arch/mips/mti-malta/Makefile
+++ b/arch/mips/mti-malta/Makefile
@@ -6,7 +6,6 @@
 # Copyright (C) 2008 Wind River Systems, Inc.
 #   written by Ralf Baechle <ralf@linux-mips.org>
 #
-obj-y				+= malta-dt.o
 obj-y				+= malta-dtshim.o
 obj-y				+= malta-init.o
 obj-y				+= malta-int.o
diff --git a/arch/mips/mti-malta/malta-dt.c b/arch/mips/mti-malta/malta-dt.c
deleted file mode 100644
index d045c91..0000000
--- a/arch/mips/mti-malta/malta-dt.c
+++ /dev/null
@@ -1,15 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2015 Imagination Technologies
- * Author: Paul Burton <paul.burton@mips.com>
- */
-
-#include <linux/clk-provider.h>
-#include <linux/init.h>
-#include <linux/of_fdt.h>
-#include <linux/of_platform.h>
-
-void __init device_tree_init(void)
-{
-	unflatten_and_copy_device_tree();
-}
diff --git a/arch/mips/pic32/pic32mzda/init.c b/arch/mips/pic32/pic32mzda/init.c
index a1860f2..1299156 100644
--- a/arch/mips/pic32/pic32mzda/init.c
+++ b/arch/mips/pic32/pic32mzda/init.c
@@ -78,11 +78,6 @@ void __init prom_init(void)
 	pic32_init_cmdline((int)fw_arg0, (char **)fw_arg1);
 }
 
-void __init device_tree_init(void)
-{
-	unflatten_and_copy_device_tree();
-}
-
 static struct pic32_sdhci_platform_data sdhci_data = {
 	.setup_dma = pic32_set_sdhci_adma_fifo_threshold,
 };
diff --git a/arch/mips/ralink/of.c b/arch/mips/ralink/of.c
index 35a87a2..587c7b9 100644
--- a/arch/mips/ralink/of.c
+++ b/arch/mips/ralink/of.c
@@ -48,11 +48,6 @@ __iomem void *plat_of_remap_node(const char *node)
 	return ioremap(res.start, resource_size(&res));
 }
 
-void __init device_tree_init(void)
-{
-	unflatten_and_copy_device_tree();
-}
-
 void __init plat_mem_setup(void)
 {
 	void *dtb;
-- 
2.1.0


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

* [PATCH 3/3] MIPS: Fix wrong comments in asm/prom.h
  2022-03-10  6:50 [PATCH 0/3] MIPS: Clean up device_tree_init() Tiezhu Yang
  2022-03-10  6:50 ` [PATCH 1/3] MIPS: Remove redundant check in device_tree_init() Tiezhu Yang
  2022-03-10  6:50 ` [PATCH 2/3] MIPS: Remove redundant definitions of device_tree_init() Tiezhu Yang
@ 2022-03-10  6:50 ` Tiezhu Yang
  2022-03-14 14:50 ` [PATCH 0/3] MIPS: Clean up device_tree_init() Thomas Bogendoerfer
  3 siblings, 0 replies; 5+ messages in thread
From: Tiezhu Yang @ 2022-03-10  6:50 UTC (permalink / raw)
  To: Thomas Bogendoerfer; +Cc: Xuefeng Li, linux-mips, linux-kernel

In arch/mips/include/asm/prom.h, it should use "!CONFIG_USE_OF"
after #else and #endif.

Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
 arch/mips/include/asm/prom.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/mips/include/asm/prom.h b/arch/mips/include/asm/prom.h
index c42e076..2d74406 100644
--- a/arch/mips/include/asm/prom.h
+++ b/arch/mips/include/asm/prom.h
@@ -20,9 +20,9 @@ struct boot_param_header;
 extern void __dt_setup_arch(void *bph);
 extern int __dt_register_buses(const char *bus0, const char *bus1);
 
-#else /* CONFIG_OF */
+#else /* !CONFIG_USE_OF */
 static inline void device_tree_init(void) { }
-#endif /* CONFIG_OF */
+#endif /* !CONFIG_USE_OF */
 
 extern char *mips_get_machine_name(void);
 extern void mips_set_machine_name(const char *name);
-- 
2.1.0


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

* Re: [PATCH 0/3] MIPS: Clean up device_tree_init()
  2022-03-10  6:50 [PATCH 0/3] MIPS: Clean up device_tree_init() Tiezhu Yang
                   ` (2 preceding siblings ...)
  2022-03-10  6:50 ` [PATCH 3/3] MIPS: Fix wrong comments in asm/prom.h Tiezhu Yang
@ 2022-03-14 14:50 ` Thomas Bogendoerfer
  3 siblings, 0 replies; 5+ messages in thread
From: Thomas Bogendoerfer @ 2022-03-14 14:50 UTC (permalink / raw)
  To: Tiezhu Yang; +Cc: Xuefeng Li, linux-mips, linux-kernel

On Thu, Mar 10, 2022 at 02:50:09PM +0800, Tiezhu Yang wrote:
> Tiezhu Yang (3):
>   MIPS: Remove redundant check in device_tree_init()
>   MIPS: Remove redundant definitions of device_tree_init()
>   MIPS: Fix wrong comments in asm/prom.h
> 
>  arch/mips/ath79/setup.c          |  5 -----
>  arch/mips/include/asm/prom.h     |  4 ++--
>  arch/mips/kernel/prom.c          |  5 +++++
>  arch/mips/lantiq/prom.c          |  5 -----
>  arch/mips/loongson64/setup.c     |  8 --------
>  arch/mips/mti-malta/Makefile     |  1 -
>  arch/mips/mti-malta/malta-dt.c   | 15 ---------------
>  arch/mips/pic32/pic32mzda/init.c |  8 --------
>  arch/mips/ralink/of.c            |  5 -----
>  9 files changed, 7 insertions(+), 49 deletions(-)
>  delete mode 100644 arch/mips/mti-malta/malta-dt.c

series applied to mips-next.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]

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

end of thread, other threads:[~2022-03-14 14:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-10  6:50 [PATCH 0/3] MIPS: Clean up device_tree_init() Tiezhu Yang
2022-03-10  6:50 ` [PATCH 1/3] MIPS: Remove redundant check in device_tree_init() Tiezhu Yang
2022-03-10  6:50 ` [PATCH 2/3] MIPS: Remove redundant definitions of device_tree_init() Tiezhu Yang
2022-03-10  6:50 ` [PATCH 3/3] MIPS: Fix wrong comments in asm/prom.h Tiezhu Yang
2022-03-14 14:50 ` [PATCH 0/3] MIPS: Clean up device_tree_init() Thomas Bogendoerfer

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 NNTP newsgroup(s).