If a hwmod with same name is already registered, reroute the links to use the existing one rather than fail. This is needed when hwmod data is made into a separate module, and for example, l3 bus is already registered under different hwmod. The late module init will use an l3 dummy hwmod instead, which will be rerouted to use the real l3 hwmod. Signed-off-by: Tero Kristo <t-kristo@xxxxxx> --- arch/arm/mach-omap2/omap_hwmod.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index 939161e..4fc42c9 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c @@ -2797,6 +2797,8 @@ static int __init _add_link(struct omap_hwmod_ocp_if *oi) */ static int __init _register_link(struct omap_hwmod_ocp_if *oi) { + struct omap_hwmod *oh; + if (!oi || !oi->master || !oi->slave || !oi->user) return -EINVAL; @@ -2810,11 +2812,27 @@ static int __init _register_link(struct omap_hwmod_ocp_if *oi) * Register the connected hwmods, if they haven't been * registered already */ - if (oi->master->_state != _HWMOD_STATE_REGISTERED) - _register(oi->master); + if (oi->master->_state != _HWMOD_STATE_REGISTERED) { + oh = _lookup(oi->master->name); + if (oh) { + pr_debug("%s: remapping %s to %08x\n", __func__, + oh->name, (u32)oh); + oi->master = oh; + } else { + _register(oi->master); + } + } - if (oi->slave->_state != _HWMOD_STATE_REGISTERED) - _register(oi->slave); + if (oi->slave->_state != _HWMOD_STATE_REGISTERED) { + oh = _lookup(oi->slave->name); + if (oh) { + pr_debug("%s: remapping %s to %08x\n", __func__, + oh->name, (u32)oh); + oi->slave = oh; + } else { + _register(oi->slave); + } + } _add_link(oi); -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html