diff mbox

ARM: OMAP2+: hwmod: disable hwmods without devicetree entry

Message ID 20170821145647.3701-1-stefan.eichenberger@netmodule.com (mailing list archive)
State New, archived
Headers show

Commit Message

Stefan Eichenberger Aug. 21, 2017, 2:56 p.m. UTC
If a hardware module is not available in devicetree the following
warning is shown:
omap_hwmod: rtc: no dt node
------------[ cut here ]------------
WARNING: CPU: 0 PID: 1 at
map2/omap_hwmod.c:2468 _init.constprop.18+0x1e4/0x4a4
omap_hwmod: rtc: doesn't have mpu register target base
Modules linked in:
CPU: 0 PID: 1 Comm: swapper/0 Not tainted
3-gee20151 #235
Hardware name: Generic AM33XX (Flattened Device Tree)
[<c031152c>] (unwind_backtrace) from [<c030c5a0>]
0/0x14)
[<c030c5a0>] (show_stack) from [<c0ce4c24>]
0/0xa4)
[<c0ce4c24>] (dump_stack) from [<c0342fd8>]
104)
[<c0342fd8>] (__warn) from [<c0343028>]
fmt+0x38/0x48)
[<c0343028>] (warn_slowpath_fmt) from [<c121128c>]
p.18+0x1e4/0x4a4)
[<c121128c>] (_init.constprop.18) from [<c1211a54>]
etup_all+0x40/0x100)
[<c1211a54>] (__omap_hwmod_setup_all) from [<c0301e90>]
l+0x40/0x16c)
[<c0301e90>] (do_one_initcall) from [<c1200dc8>]
eeable+0x144/0x1e0)
[<c1200dc8>] (kernel_init_freeable) from [<c0cf7f48>]
8/0x110)
[<c0cf7f48>] (kernel_init) from [<c0307e58>]
0x14/0x3c)
---[ end trace c2c966b064e3292c ]---

In case that a node is not available the behaviour should be that
the kernel ignores the device completely. This patch will change
the module to disabled immediately after of_dev_hwmod_lookup fails
so that no backtrace will be shown.

Signed-off-by: Stefan Eichenberger <stefan.eichenberger@netmodule.com>
---
 arch/arm/mach-omap2/omap_hwmod.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 3b47ded..6610865 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -2456,8 +2456,11 @@  static int __init _init(struct omap_hwmod *oh, void *data)
 		return -ENODEV;
 
 	r = of_dev_hwmod_lookup(bus, oh, &index, &np);
-	if (r)
+	if (r) {
 		pr_debug("omap_hwmod: %s missing dt data\n", oh->name);
+		oh->_state = _HWMOD_STATE_DISABLED;
+		return 0;
+	}
 	else if (np && index)
 		pr_warn("omap_hwmod: %s using broken dt data from %s\n",
 			oh->name, np->name);