All of lore.kernel.org
 help / color / mirror / Atom feed
From: francescolavra.fl@gmail.com (Francesco Lavra)
To: linux-arm-kernel@lists.infradead.org
Subject: [Linaro-mm-sig] [RFC/PATCH v2 2/2] drivers: dma-contiguous: add initialization from device tree
Date: Wed, 24 Apr 2013 12:30:49 +0200	[thread overview]
Message-ID: <5177B459.1080009@gmail.com> (raw)
In-Reply-To: <1365679330-2514-3-git-send-email-m.szyprowski@samsung.com>

On 04/11/2013 01:22 PM, Marek Szyprowski wrote:
> diff --git a/drivers/base/dma-contiguous.c b/drivers/base/dma-contiguous.c
> index 01fe743..6a8abab 100644
> --- a/drivers/base/dma-contiguous.c
> +++ b/drivers/base/dma-contiguous.c
[...]
> +void scan_cma_nodes(void)

Should be declared static.

> +{
> +	struct device_node *parent = of_find_node_by_path("/chosen/contiguous-memory");
> +	struct device_node *child;
> +
> +	if (!parent)
> +		return;
> +
> +	for_each_child_of_node(parent, child) {
> +		struct cma *cma = NULL;
> +		int i;
> +
> +		for (i=0; i<cma_area_count; i++)
> +			if (strstr(child->full_name, cma_areas[i].full_name))
> +				cma = &cma_areas[i];
> +		if (!cma)
> +			continue;
> +
> +		for (i=0;; i++) {
> +			struct device_node *node;
> +			node = of_parse_phandle(child, "device", i);
> +			if (!node)
> +				break;
> +
> +			cma_maps[cma_map_count].cma = cma;
> +			cma_maps[cma_map_count].node = node;
> +			cma_map_count++;
> +		}

of_parse_phandle() requires of_node_put() to be called when done with
the device node.
Also, of_node_put() should be called on the parent node as well.

> +	}
> +}

--
Francesco

WARNING: multiple messages have this Message-ID (diff)
From: Francesco Lavra <francescolavra.fl@gmail.com>
To: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Grant Likely <grant.likely@secretlab.ca>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Arnd Bergmann <arnd@arndb.de>, Tomasz Figa <t.figa@samsung.com>,
	Michal Nazarewicz <mina86@mina86.com>,
	linaro-mm-sig@lists.linaro.org,
	Kyungmin Park <kyungmin.park@samsung.com>,
	Sylwester Nawrocki <s.nawrocki@samsung.com>,
	Olof Johansson <olof@lixom.net>,
	devicetree-discuss@lists.ozlabs.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [Linaro-mm-sig] [RFC/PATCH v2 2/2] drivers: dma-contiguous: add initialization from device tree
Date: Wed, 24 Apr 2013 12:30:49 +0200	[thread overview]
Message-ID: <5177B459.1080009@gmail.com> (raw)
In-Reply-To: <1365679330-2514-3-git-send-email-m.szyprowski@samsung.com>

On 04/11/2013 01:22 PM, Marek Szyprowski wrote:
> diff --git a/drivers/base/dma-contiguous.c b/drivers/base/dma-contiguous.c
> index 01fe743..6a8abab 100644
> --- a/drivers/base/dma-contiguous.c
> +++ b/drivers/base/dma-contiguous.c
[...]
> +void scan_cma_nodes(void)

Should be declared static.

> +{
> +	struct device_node *parent = of_find_node_by_path("/chosen/contiguous-memory");
> +	struct device_node *child;
> +
> +	if (!parent)
> +		return;
> +
> +	for_each_child_of_node(parent, child) {
> +		struct cma *cma = NULL;
> +		int i;
> +
> +		for (i=0; i<cma_area_count; i++)
> +			if (strstr(child->full_name, cma_areas[i].full_name))
> +				cma = &cma_areas[i];
> +		if (!cma)
> +			continue;
> +
> +		for (i=0;; i++) {
> +			struct device_node *node;
> +			node = of_parse_phandle(child, "device", i);
> +			if (!node)
> +				break;
> +
> +			cma_maps[cma_map_count].cma = cma;
> +			cma_maps[cma_map_count].node = node;
> +			cma_map_count++;
> +		}

of_parse_phandle() requires of_node_put() to be called when done with
the device node.
Also, of_node_put() should be called on the parent node as well.

> +	}
> +}

--
Francesco

  parent reply	other threads:[~2013-04-24 10:30 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-11 11:22 [RFC/PATCH v2 0/2] Device Tree support for CMA (Contiguous Memory Allocator) Marek Szyprowski
2013-04-11 11:22 ` Marek Szyprowski
2013-04-11 11:22 ` [RFC/PATCH v2 1/2] drivers: dma-contiguous: clean source code and prepare for device tree Marek Szyprowski
2013-04-11 11:22   ` Marek Szyprowski
2013-04-11 11:22 ` [RFC/PATCH v2 2/2] drivers: dma-contiguous: add initialization from " Marek Szyprowski
2013-04-11 11:22   ` Marek Szyprowski
2013-04-11 17:56   ` Laura Abbott
2013-04-11 17:56     ` Laura Abbott
2013-04-12 12:28     ` Marek Szyprowski
2013-04-12 12:28       ` Marek Szyprowski
2013-04-24 10:30   ` Francesco Lavra [this message]
2013-04-24 10:30     ` [Linaro-mm-sig] " Francesco Lavra
2013-04-29 21:21   ` Marc C
2013-04-29 21:21     ` Marc C
2013-04-30  8:53     ` Marek Szyprowski
2013-04-30  8:53       ` Marek Szyprowski

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=5177B459.1080009@gmail.com \
    --to=francescolavra.fl@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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.