From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 904CBC433F5 for ; Fri, 6 May 2022 10:45:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241654AbiEFKsq (ORCPT ); Fri, 6 May 2022 06:48:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235825AbiEFKsq (ORCPT ); Fri, 6 May 2022 06:48:46 -0400 Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::226]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BAE4F65402; Fri, 6 May 2022 03:45:02 -0700 (PDT) Received: (Authenticated sender: clement.leger@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 7862AC000E; Fri, 6 May 2022 10:44:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1651833901; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aGQDY12wXijcoD4wVlIl8GRaAeVSN1VXTWLT8MFX0sY=; b=BWZ9TvS5I2P+CsVnRy3GTaTxbed2YCuizlO9DVt7xjLsa1wbjLJfkk2Per51Q8scCAULM1 6qaLwEtegTL5lDf+ApWcPZCiFNczIenzAHbHUZDe+ZamGFEmL6lv17FXRnUnvYV3qFpnr/ 2iBYMOhBGTVDOaRfNf/R3vktAEPB14JDOO38aMNYZ6XQ3BU7lgUgLKPhLeDABc5oRpscXJ oYV7askBk05jakApkWgW86E7GTFeI1mPyyGC+CTqnBn+VvoH4f2GpucadX5e66P/pRX+XU cM4E+vDjAi4wNdY7+/gSHbeZ/qeWHeEtZQNia8bcJMcUze7GLHbYAZBmoM+7bQ== Date: Fri, 6 May 2022 12:43:39 +0200 From: =?UTF-8?B?Q2zDqW1lbnQgTMOpZ2Vy?= To: Rob Herring Cc: Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Frank Rowand , Nathan Lynch , Laurent Dufour , Daniel Henrique Barboza , David Gibson , Andrew Morton , David Hildenbrand , Ohhoon Kwon , "Aneesh Kumar K.V" , YueHaibing , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Allan Nielsen , Horatiu Vultur , Steen Hegelund , Thomas Petazzoni Subject: Re: [PATCH 2/3] of: dynamic: add of_node_alloc() and of_node_free() Message-ID: <20220506124339.2c772fa0@fixe.home> In-Reply-To: References: <20220504154033.750511-1-clement.leger@bootlin.com> <20220504154033.750511-3-clement.leger@bootlin.com> Organization: Bootlin X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Le Thu, 5 May 2022 14:43:54 -0500, Rob Herring a =C3=A9crit : > On Wed, May 04, 2022 at 05:40:32PM +0200, Cl=C3=A9ment L=C3=A9ger wrote: > > Add functions which allows to create and free nodes. > >=20 > > Signed-off-by: Cl=C3=A9ment L=C3=A9ger > > --- > > drivers/of/dynamic.c | 59 ++++++++++++++++++++++++++++++++++++-------- > > include/linux/of.h | 9 +++++++ > > 2 files changed, 58 insertions(+), 10 deletions(-) > >=20 > > diff --git a/drivers/of/dynamic.c b/drivers/of/dynamic.c > > index e8700e509d2e..ec28e5ba2969 100644 > > --- a/drivers/of/dynamic.c > > +++ b/drivers/of/dynamic.c > > @@ -455,6 +455,54 @@ struct property *__of_prop_dup(const struct proper= ty *prop, gfp_t allocflags) > > prop->length, allocflags); > > } > > =20 > > +/** > > + * of_node_free - Free a node allocated dynamically. > > + * @node: Node to be freed > > + */ > > +void of_node_free(const struct device_node *node) > > +{ > > + kfree(node->full_name); > > + kfree(node->data); > > + kfree(node); > > +} > > +EXPORT_SYMBOL(of_node_free); =20 >=20 > This shouldn't be needed. Nodes are refcounted, so any caller should=20 > just do a put. Acked. Do you want the name to be allocated as part of the node allocation also ? >=20 > Rob --=20 Cl=C3=A9ment L=C3=A9ger, Embedded Linux and Kernel engineer at Bootlin https://bootlin.com