All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rob Herring <robh@kernel.org>
To: "Clément Léger" <clement.leger@bootlin.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Paul Mackerras <paulus@samba.org>,
	Frank Rowand <frowand.list@gmail.com>,
	Nathan Lynch <nathanl@linux.ibm.com>,
	Laurent Dufour <ldufour@linux.ibm.com>,
	Daniel Henrique Barboza <danielhb413@gmail.com>,
	David Gibson <david@gibson.dropbear.id.au>,
	Andrew Morton <akpm@linux-foundation.org>,
	David Hildenbrand <david@redhat.com>,
	Ohhoon Kwon <ohoono.kwon@samsung.com>,
	"Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>,
	YueHaibing <yuehaibing@huawei.com>,
	linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
	devicetree@vger.kernel.org,
	Allan Nielsen <allan.nielsen@microchip.com>,
	Horatiu Vultur <horatiu.vultur@microchip.com>,
	Steen Hegelund <steen.hegelund@microchip.com>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Subject: Re: [PATCH 2/3] of: dynamic: add of_node_alloc() and of_node_free()
Date: Thu, 5 May 2022 14:43:54 -0500	[thread overview]
Message-ID: <YnQo+mdDBuoKA6Fq@robh.at.kernel.org> (raw)
In-Reply-To: <20220504154033.750511-3-clement.leger@bootlin.com>

On Wed, May 04, 2022 at 05:40:32PM +0200, Clément Léger wrote:
> Add functions which allows to create and free nodes.
> 
> Signed-off-by: Clément Léger <clement.leger@bootlin.com>
> ---
>  drivers/of/dynamic.c | 59 ++++++++++++++++++++++++++++++++++++--------
>  include/linux/of.h   |  9 +++++++
>  2 files changed, 58 insertions(+), 10 deletions(-)
> 
> 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 property *prop, gfp_t allocflags)
>  				 prop->length, allocflags);
>  }
>  
> +/**
> + * 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);

This shouldn't be needed. Nodes are refcounted, so any caller should 
just do a put.

Rob

WARNING: multiple messages have this Message-ID (diff)
From: Rob Herring <robh@kernel.org>
To: "Clément Léger" <clement.leger@bootlin.com>
Cc: Nathan Lynch <nathanl@linux.ibm.com>,
	devicetree@vger.kernel.org, Ohhoon Kwon <ohoono.kwon@samsung.com>,
	David Hildenbrand <david@redhat.com>,
	Steen Hegelund <steen.hegelund@microchip.com>,
	Daniel Henrique Barboza <danielhb413@gmail.com>,
	YueHaibing <yuehaibing@huawei.com>,
	linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
	Paul Mackerras <paulus@samba.org>,
	"Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	Allan Nielsen <allan.nielsen@microchip.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Laurent Dufour <ldufour@linux.ibm.com>,
	Frank Rowand <frowand.list@gmail.com>,
	Horatiu Vultur <horatiu.vultur@microchip.com>,
	David Gibson <david@gibson.dropbear.id.au>
Subject: Re: [PATCH 2/3] of: dynamic: add of_node_alloc() and of_node_free()
Date: Thu, 5 May 2022 14:43:54 -0500	[thread overview]
Message-ID: <YnQo+mdDBuoKA6Fq@robh.at.kernel.org> (raw)
In-Reply-To: <20220504154033.750511-3-clement.leger@bootlin.com>

On Wed, May 04, 2022 at 05:40:32PM +0200, Clément Léger wrote:
> Add functions which allows to create and free nodes.
> 
> Signed-off-by: Clément Léger <clement.leger@bootlin.com>
> ---
>  drivers/of/dynamic.c | 59 ++++++++++++++++++++++++++++++++++++--------
>  include/linux/of.h   |  9 +++++++
>  2 files changed, 58 insertions(+), 10 deletions(-)
> 
> 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 property *prop, gfp_t allocflags)
>  				 prop->length, allocflags);
>  }
>  
> +/**
> + * 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);

This shouldn't be needed. Nodes are refcounted, so any caller should 
just do a put.

Rob

  parent reply	other threads:[~2022-05-05 19:44 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-04 15:40 [PATCH 0/3] of: add of_property_alloc/free() and of_node_alloc/free() Clément Léger
2022-05-04 15:40 ` Clément Léger
2022-05-04 15:40 ` [PATCH 1/3] of: dynamic: add of_property_alloc() and of_property_free() Clément Léger
2022-05-04 15:40   ` Clément Léger
2022-05-05  7:30   ` Christophe Leroy
2022-05-05  9:47     ` Clément Léger
2022-05-05  9:47       ` Clément Léger
2022-05-05 17:37     ` Rob Herring
2022-05-05 17:37       ` Rob Herring
2022-05-06  7:43       ` Clément Léger
2022-05-06  7:43         ` Clément Léger
2022-05-05 19:37   ` Rob Herring
2022-05-05 19:37     ` Rob Herring
2022-05-06  7:49     ` Clément Léger
2022-05-06  7:49       ` Clément Léger
2022-06-01 22:30     ` Tyrel Datwyler
2022-06-01 22:30       ` Tyrel Datwyler
2022-06-02 14:06       ` Rob Herring
2022-06-02 14:06         ` Rob Herring
2022-06-02 18:07         ` Tyrel Datwyler
2022-06-02 18:07           ` Tyrel Datwyler
2022-05-04 15:40 ` [PATCH 2/3] of: dynamic: add of_node_alloc() and of_node_free() Clément Léger
2022-05-04 15:40   ` Clément Léger
2022-05-05  7:32   ` Christophe Leroy
2022-05-05 19:43   ` Rob Herring [this message]
2022-05-05 19:43     ` Rob Herring
2022-05-06 10:43     ` Clément Léger
2022-05-06 10:43       ` Clément Léger
2022-05-09 16:55       ` Rob Herring
2022-05-09 16:55         ` Rob Herring
2022-05-04 15:40 ` [PATCH 3/3] powerpc/pseries: use of_property_*() and of_node_*() functions Clément Léger
2022-05-04 15:40   ` Clément Léger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YnQo+mdDBuoKA6Fq@robh.at.kernel.org \
    --to=robh@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=allan.nielsen@microchip.com \
    --cc=aneesh.kumar@linux.ibm.com \
    --cc=benh@kernel.crashing.org \
    --cc=clement.leger@bootlin.com \
    --cc=danielhb413@gmail.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=david@redhat.com \
    --cc=devicetree@vger.kernel.org \
    --cc=frowand.list@gmail.com \
    --cc=horatiu.vultur@microchip.com \
    --cc=ldufour@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=nathanl@linux.ibm.com \
    --cc=ohoono.kwon@samsung.com \
    --cc=paulus@samba.org \
    --cc=steen.hegelund@microchip.com \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=yuehaibing@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.