Skip to contentSkip to conversation

microblaze: remove unecessary of_platform_bus_probe call

PATCH Applied Rob Herring 2 participants 4 messages Jun 19, 2018 – Jun 21, 2018 Microblaze architecture

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 microblaze: remove unecessary of_platform_bus_probe call

The call to of_platform_bus_probe has no effect because the DT core already probes default buses like "simple-bus" before this call. Michal Simek said 'xlnx,compound' hasn't been used in a long time, so that match entry isn't needed.

---
 arch/microblaze/kernel/platform.c | 7 -------
 1 file changed, 7 deletions(-)
arch/microblaze/kernel/platform.c +0 -7
index 2540d60610d9..b9a414552d9b 100644
@@ -14,15 +14,8 @@
 #include <linux/of_platform.h>
 #include <asm/setup.h>
 
-static struct of_device_id xilinx_of_bus_ids[] __initdata = {
-	{ .compatible = "simple-bus", },
-	{ .compatible = "xlnx,compound", },
-	{}
-};
-
 static int __init microblaze_device_probe(void)
 {
-	of_platform_bus_probe(NULL, xilinx_of_bus_ids, NULL);
 	of_platform_reset_gpio_probe();
 	return 0;
 }
Signature · 1 line
2.17.1
#1 lore raw

PATCH 2/2 microblaze: consolidate GPIO reset handling

Now that platform.c only has the GPIO reset handling left, move the initcall to reset.c and remove platform.c.

---
 arch/microblaze/include/asm/setup.h |  2 --
 arch/microblaze/kernel/Makefile     |  2 +-
 arch/microblaze/kernel/platform.c   | 22 ----------------------
 arch/microblaze/kernel/reset.c      | 11 ++++++-----
 4 files changed, 7 insertions(+), 30 deletions(-)
 delete mode 100644 arch/microblaze/kernel/platform.c
arch/microblaze/include/asm/setup.h +0 -2
index d5384f6f36f7..86d2663d3fd0 100644
@@ -26,8 +26,6 @@ void microblaze_setup_heartbeat(void);
 extern void mmu_reset(void);
 #   endif /* CONFIG_MMU */
 
-extern void of_platform_reset_gpio_probe(void);
-
 void time_init(void);
 void init_IRQ(void);
 void machine_early_init(const char *cmdline, unsigned int ram,
arch/microblaze/kernel/Makefile +1 -1
index 7e99cf6984a1..6c4c54826aae 100644
@@ -17,7 +17,7 @@ extra-y := head.o vmlinux.lds
 
 obj-y += dma.o exceptions.o \
 	hw_exception_handler.o irq.o \
-	platform.o process.o prom.o ptrace.o \
+	process.o prom.o ptrace.o \
 	reset.o setup.o signal.o sys_microblaze.o timer.o traps.o unwind.o
 
 obj-y += cpu/
arch/microblaze/kernel/platform.c deleted +0 -22
deleted file mode 100644
index b9a414552d9b..000000000000
@@ -1,22 +0,0 @@
-/*
- * Copyright 2008 Michal Simek <[email protected]>
- *
- * based on virtex.c file
- *
- * Copyright 2007 Secret Lab Technologies Ltd.
- *
- * This file is licensed under the terms of the GNU General Public License
- * version 2. This program is licensed "as is" without any warranty of any
- * kind, whether express or implied.
- */
-
-#include <linux/init.h>
-#include <linux/of_platform.h>
-#include <asm/setup.h>
-
-static int __init microblaze_device_probe(void)
-{
-	of_platform_reset_gpio_probe();
-	return 0;
-}
-device_initcall(microblaze_device_probe);
arch/microblaze/kernel/reset.c +6 -5
index bab4c8330ef4..fcbe1daf6316 100644
@@ -18,7 +18,7 @@
 static int handle; /* reset pin handle */
 static unsigned int reset_val;
 
-void of_platform_reset_gpio_probe(void)
+static int of_platform_reset_gpio_probe(void)
 {
 	int ret;
 	handle = of_get_named_gpio(of_find_node_by_path("/"),
@@ -27,13 +27,13 @@ void of_platform_reset_gpio_probe(void)
 	if (!gpio_is_valid(handle)) {
 		pr_info("Skipping unavailable RESET gpio %d (%s)\n",
 				handle, "reset");
-		return;
+		return -ENODEV;
 	}
 
 	ret = gpio_request(handle, "reset");
 	if (ret < 0) {
 		pr_info("GPIO pin is already allocated\n");
-		return;
+		return ret;
 	}
 
 	/* get current setup value */
@@ -51,11 +51,12 @@ void of_platform_reset_gpio_probe(void)
 
 	pr_info("RESET: Registered gpio device: %d, current val: %d\n",
 							handle, reset_val);
-	return;
+	return 0;
 err:
 	gpio_free(handle);
-	return;
+	return ret;
 }
+device_initcall(of_platform_reset_gpio_probe);
 
 
 static void gpio_system_reset(void)
Signature · 1 line
2.17.1
maintainer Applied
#2 lore raw

Re: [PATCH 2/2] microblaze: consolidate GPIO reset handling

Quoted 102 lines · Rob Herring

Now that platform.c only has the GPIO reset handling left, move the initcall to reset.c and remove platform.c.

---
 arch/microblaze/include/asm/setup.h |  2 --
 arch/microblaze/kernel/Makefile     |  2 +-
 arch/microblaze/kernel/platform.c   | 22 ----------------------
 arch/microblaze/kernel/reset.c      | 11 ++++++-----
 4 files changed, 7 insertions(+), 30 deletions(-)
 delete mode 100644 arch/microblaze/kernel/platform.c
arch/microblaze/include/asm/setup.h +0 -2
index d5384f6f36f7..86d2663d3fd0 100644
@@ -26,8 +26,6 @@ void microblaze_setup_heartbeat(void);
 extern void mmu_reset(void);
 #   endif /* CONFIG_MMU */
 
-extern void of_platform_reset_gpio_probe(void);
-
 void time_init(void);
 void init_IRQ(void);
 void machine_early_init(const char *cmdline, unsigned int ram,
arch/microblaze/kernel/Makefile +1 -1
index 7e99cf6984a1..6c4c54826aae 100644
@@ -17,7 +17,7 @@ extra-y := head.o vmlinux.lds
 
 obj-y += dma.o exceptions.o \
 	hw_exception_handler.o irq.o \
-	platform.o process.o prom.o ptrace.o \
+	process.o prom.o ptrace.o \
 	reset.o setup.o signal.o sys_microblaze.o timer.o traps.o unwind.o
 
 obj-y += cpu/
arch/microblaze/kernel/platform.c deleted +0 -22
deleted file mode 100644
index b9a414552d9b..000000000000
@@ -1,22 +0,0 @@
-/*
- * Copyright 2008 Michal Simek <[email protected]>
- *
- * based on virtex.c file
- *
- * Copyright 2007 Secret Lab Technologies Ltd.
- *
- * This file is licensed under the terms of the GNU General Public License
- * version 2. This program is licensed "as is" without any warranty of any
- * kind, whether express or implied.
- */
-
-#include <linux/init.h>
-#include <linux/of_platform.h>
-#include <asm/setup.h>
-
-static int __init microblaze_device_probe(void)
-{
-	of_platform_reset_gpio_probe();
-	return 0;
-}
-device_initcall(microblaze_device_probe);
arch/microblaze/kernel/reset.c +3 -4
index bab4c8330ef4..fcbe1daf6316 100644
@@ -18,7 +18,7 @@
 static int handle; /* reset pin handle */
 static unsigned int reset_val;
 
-void of_platform_reset_gpio_probe(void)
+static int of_platform_reset_gpio_probe(void)
 {
 	int ret;
 	handle = of_get_named_gpio(of_find_node_by_path("/"),
@@ -27,13 +27,13 @@ void of_platform_reset_gpio_probe(void)
 	if (!gpio_is_valid(handle)) {
 		pr_info("Skipping unavailable RESET gpio %d (%s)\n",
 				handle, "reset");
-		return;
+		return -ENODEV;
 	}
 
 	ret = gpio_request(handle, "reset");
 	if (ret < 0) {
 		pr_info("GPIO pin is already allocated\n");
-		return;
+		return ret;
 	}
 
 	/* get current setup value */
@@ -51,11 +51,12 @@ void of_platform_reset_gpio_probe(void)
 
 	pr_info("RESET: Registered gpio device: %d, current val: %d\n",
 							handle, reset_val);
-	return;

arch/microblaze/kernel/reset.c void of_platform_reset_gpio_probe(void) · line 62

Quoted 10 lines
arch/microblaze/kernel/reset.c +3 -1
+	return 0;
 err:
 	gpio_free(handle);
-	return;
+	return ret;
 }
+device_initcall(of_platform_reset_gpio_probe);
 
 
 static void gpio_system_reset(void)

Applied.

Thanks,
Michal

Signature · 5 lines
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Xilinx Microblaze
Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP ARM64 SoCs
U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP SoCs
maintainer Applied
#3 lore raw
In reply to Rob Herring
Quoted 22 lines · Rob Herring

The call to of_platform_bus_probe has no effect because the DT core already probes default buses like "simple-bus" before this call. Michal Simek said 'xlnx,compound' hasn't been used in a long time, so that match entry isn't needed.

---
 arch/microblaze/kernel/platform.c | 7 -------
 1 file changed, 7 deletions(-)
arch/microblaze/kernel/platform.c +0 -2
index 2540d60610d9..b9a414552d9b 100644
@@ -14,15 +14,8 @@
 #include <linux/of_platform.h>
 #include <asm/setup.h>
 
-static struct of_device_id xilinx_of_bus_ids[] __initdata = {
-	{ .compatible = "simple-bus", },

arch/microblaze/kernel/platform.c line 21

Quoted 10 lines
arch/microblaze/kernel/platform.c +0 -5
-	{ .compatible = "xlnx,compound", },
-	{}
-};
-
 static int __init microblaze_device_probe(void)
 {
-	of_platform_bus_probe(NULL, xilinx_of_bus_ids, NULL);
 	of_platform_reset_gpio_probe();
 	return 0;
 }

Applied.

Thanks,
Michal

Signature · 5 lines
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Xilinx Microblaze
Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP ARM64 SoCs
U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP SoCs