From mboxrd@z Thu Jan 1 00:00:00 1970 From: Grant Likely Subject: Re: [PATCH 1/3] of: remove OF_DYNAMIC config option Date: Sat, 12 Mar 2011 02:00:43 -0700 Message-ID: <20110312090043.GF9347@angua.secretlab.ca> References: <1299716167-9656-1-git-send-email-dilinger@queued.net> <1299716167-9656-2-git-send-email-dilinger@queued.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <1299716167-9656-2-git-send-email-dilinger-pFFUokh25LWsTnJN9+BGXg@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: devicetree-discuss-bounces+gldd-devicetree-discuss=m.gmane.org-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org Sender: devicetree-discuss-bounces+gldd-devicetree-discuss=m.gmane.org-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org To: Andres Salomon Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org, Daniel Drake , linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: devicetree@vger.kernel.org On Wed, Mar 09, 2011 at 04:16:05PM -0800, Andres Salomon wrote: > Make of_attach_node/of_detach_node available without a specific config option. > CONFIG_OF_DYNAMIC wasn't actually set by anything; the drivers that use > of_attach_node (in arch/powerpc/platforms/) didn't actually depend upon > or select CONFIG_OF_DYNAMIC. > > While we're at it, make of_attach_node safe to call with the node's parent > being NULL; the only time this should happen is with the root node. Later > patches will be using of_attach_node to link the root node. > > Signed-off-by: Andres Salomon Looks good to me. g. > --- > drivers/of/Kconfig | 4 ---- > drivers/of/base.c | 17 ++++------------- > include/linux/of.h | 4 +--- > 3 files changed, 5 insertions(+), 20 deletions(-) > > diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig > index d06a637..ba90122 100644 > --- a/drivers/of/Kconfig > +++ b/drivers/of/Kconfig > @@ -26,10 +26,6 @@ config OF_EARLY_FLATTREE > config OF_PROMTREE > bool > > -config OF_DYNAMIC > - def_bool y > - depends on PPC_OF > - > config OF_ADDRESS > def_bool y > depends on !SPARC > diff --git a/drivers/of/base.c b/drivers/of/base.c > index 710b53b..825e6d1 100644 > --- a/drivers/of/base.c > +++ b/drivers/of/base.c > @@ -849,15 +849,6 @@ int prom_update_property(struct device_node *np, > return 0; > } > > -#if defined(CONFIG_OF_DYNAMIC) > -/* > - * Support for dynamic device trees. > - * > - * On some platforms, the device tree can be manipulated at runtime. > - * The routines in this section support adding, removing and changing > - * device tree nodes. > - */ > - > /** > * of_attach_node - Plug a device node into the tree and global list. > */ > @@ -866,9 +857,11 @@ void of_attach_node(struct device_node *np) > unsigned long flags; > > write_lock_irqsave(&devtree_lock, flags); > - np->sibling = np->parent->child; > + if (np->parent) { > + np->sibling = np->parent->child; > + np->parent->child = np; > + } > np->allnext = allnodes; > - np->parent->child = np; > allnodes = np; > write_unlock_irqrestore(&devtree_lock, flags); > } > @@ -917,5 +910,3 @@ void of_detach_node(struct device_node *np) > out_unlock: > write_unlock_irqrestore(&devtree_lock, flags); > } > -#endif /* defined(CONFIG_OF_DYNAMIC) */ > - > diff --git a/include/linux/of.h b/include/linux/of.h > index bfc0ed1..bb36473 100644 > --- a/include/linux/of.h > +++ b/include/linux/of.h > @@ -221,11 +221,9 @@ extern int prom_update_property(struct device_node *np, > struct property *newprop, > struct property *oldprop); > > -#if defined(CONFIG_OF_DYNAMIC) > -/* For updating the device tree at runtime */ > +/* For updating the device tree */ > extern void of_attach_node(struct device_node *); > extern void of_detach_node(struct device_node *); > -#endif > > #else > > -- > 1.7.2.3 >