Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934497AbbEMQhs (ORCPT ); Wed, 13 May 2015 12:37:48 -0400 Received: from mail-yk0-f179.google.com ([209.85.160.179]:36072 "EHLO mail-yk0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934317AbbEMQfB (ORCPT ); Wed, 13 May 2015 12:35:01 -0400 X-Greylist: delayed 9520 seconds by postgrey-1.27 at vger.kernel.org; Wed, 13 May 2015 12:35:01 EDT MIME-Version: 1.0 In-Reply-To: <555364AA.7030703@arm.com> References: <1431452282-10207-1-git-send-email-sudeep.holla@arm.com> <55532186.5060803@arm.com> <555364AA.7030703@arm.com> From: Rob Herring Date: Wed, 13 May 2015 11:34:40 -0500 Message-ID: Subject: Re: [PATCH] of: base: upgrade initcall level of of_init from core to pure To: Sudeep Holla Cc: "linux-kernel@vger.kernel.org" , "devicetree@vger.kernel.org" , "grant.likely@linaro.org" , Rob Herring , Benjamin Herrenschmidt , Greg Kroah-Hartman Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2930 Lines: 105 On Wed, May 13, 2015 at 9:50 AM, Sudeep Holla wrote: > On 13/05/15 14:46, Rob Herring wrote: >> On Wed, May 13, 2015 at 5:03 AM, Sudeep Holla >> wrote: [...] >>> Yes I read and was bit hesitant initially to do this change, but found >>> no better way. I posted mainly to discuss other possibilities to solve >>> the issue. >> >> >> Perhaps of_init should not be an initcall at all and it should go into >> driver_init(). > > > That seems ideal place to me as most of kset and kobjects are created > there. Something like below patch ? However found that PPC had a > function with same name which can conflict and we need to rename one of > these two. It looks like the PPC one is in the boot wrapper. They shouldn't collide. If they do, then how about of_core_init. > > --->8 > > diff --git a/drivers/base/init.c b/drivers/base/init.c > index da033d3bab3c..fa149c7678d2 100644 > --- a/drivers/base/init.c > +++ b/drivers/base/init.c > @@ -8,6 +8,7 @@ > #include > #include > #include > +#include > > #include "base.h" > > @@ -34,4 +35,5 @@ void __init driver_init(void) > cpu_dev_init(); > memory_dev_init(); > container_dev_init(); > + of_init(); > } > diff --git a/drivers/of/base.c b/drivers/of/base.c > index 8c3d6b04c585..927800548b75 100644 > --- a/drivers/of/base.c > +++ b/drivers/of/base.c > @@ -189,7 +189,7 @@ int __of_attach_node_sysfs(struct device_node *np) > return 0; > } > > -static int __init of_init(void) > +int __init of_init(void) You can make this return void. > { > struct device_node *np; > > @@ -210,7 +210,6 @@ static int __init of_init(void) > > return 0; > } > -pure_initcall(of_init); > > static struct property *__of_find_property(const struct device_node *np, > const char *name, int *lenp) > diff --git a/include/linux/of.h b/include/linux/of.h > index ddeaae6d2083..7b68e9248722 100644 > --- a/include/linux/of.h > +++ b/include/linux/of.h > @@ -121,6 +121,8 @@ extern struct device_node *of_stdout; > extern raw_spinlock_t devtree_lock; > > #ifdef CONFIG_OF > +extern int of_init(void); You don't need extern. > + > static inline bool is_of_node(struct fwnode_handle *fwnode) > { > return fwnode && fwnode->type == FWNODE_OF; > @@ -376,6 +378,10 @@ bool of_console_check(struct device_node *dn, char > *name, int index); > > #else /* CONFIG_OF */ > > +static int of_init(void) static inline > +{ > + return 0; > +} > static inline bool is_of_node(struct fwnode_handle *fwnode) > { > return false; -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/