devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Warren <swarren@wwwdotorg.org>
To: Hiroshi DOYU <hdoyu@nvidia.com>
Cc: joerg.roedel@amd.com, iommu@lists.linux-foundation.org,
	linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org,
	Grant Likely <grant.likely@secretlab.ca>,
	Rob Herring <rob.herring@calxeda.com>,
	Thierry Reding <thierry.reding@avionic-design.de>,
	devicetree-discuss@lists.ozlabs.org
Subject: Re: [PATCH 1/1] iommu/tegra: smmu: Add DMA window parser
Date: Fri, 18 May 2012 09:15:34 -0600	[thread overview]
Message-ID: <4FB66796.1030007@wwwdotorg.org> (raw)
In-Reply-To: <1337323393-1035-1-git-send-email-hdoyu@nvidia.com>

On 05/18/2012 12:43 AM, Hiroshi DOYU wrote:
> This code was based on:
>     "arch/microblaze/kernel/prom_parse.c"
>     "arch/powerpc/kernel/prom_parse.c"
> 
> Can be promoted as a global function for general use.
> 
> Signed-off-by: Hiroshi DOYU <hdoyu@nvidia.com>

Hiroshi,

Once this is accepted, it might be worth following up on the original
of_get_dma_window thread and noting that once it's approved, an updated
version of the patch will be needed to remove this code at the same time.

A couple comments below though:

> +static int of_get_dma_window(struct device_node *dn,
> +			const char *propname, int index,
> +			unsigned long *busno,
> +			dma_addr_t *addr, size_t *size)
> +{
> +	const __be32 *dma_window, *end;
> +	int bytes, cur_index = 0;

Since bytes is an out parameter from of_get_property, do you need to
wrap the declaration in uninitialized_var() to prevent a compile warning
like the other patch you sent me downstream?

> +	if (!dn || !addr || !size)
> +		return -EINVAL;
> +
> +	if (!propname)
> +		propname = "dma-window";
> +
> +	dma_window = of_get_property(dn, propname, &bytes);
> +	if (!dma_window)
> +		return -ENODEV;
> +	end = dma_window + bytes / sizeof(*dma_window);
> +
> +	while (dma_window < end) {
> +		u32 cells;
> +		const void *prop;
> +
> +		/* busno is always one cell */
> +		if (busno)
> +			*busno = be32_to_cpup(dma_window++);

Shouldn't the ++ happen even if (!busno)?

Once those are fixed, in the interests of fixing the compile error,

Acked-by: Stephen Warren <swarren@wwwdotorg.org>

  reply	other threads:[~2012-05-18 15:15 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1336636221-31575-1-git-send-email-hdoyu@nvidia.com>
2012-05-10  7:50 ` [PATCH 1/2] iommu/tegra: smmu: Add device tree support for SMMU Hiroshi DOYU
2012-05-10 20:08   ` Stephen Warren
     [not found]     ` <4FAC2041.7030405-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-05-10 22:38       ` Grant Likely
2012-05-11  9:46       ` Joerg Roedel
     [not found]         ` <20120511094625.GA11750-5C7GfCeVMHo@public.gmane.org>
2012-05-11 18:04           ` Stephen Warren
     [not found]   ` <1336636221-31575-2-git-send-email-hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2012-05-14 17:41     ` Stephen Warren
     [not found]       ` <4FB143C4.6030502-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-05-17 16:48         ` Stephen Warren
2012-05-18  5:50           ` Hiroshi Doyu
     [not found]             ` <20120518085051.4a0fca863c5ab37cf8d42cb1-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2012-05-18  6:43               ` [PATCH 1/1] iommu/tegra: smmu: Add DMA window parser Hiroshi DOYU
2012-05-18 15:15                 ` Stephen Warren [this message]
     [not found]                   ` <4FB66796.1030007-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-05-18 20:56                     ` Hiroshi Doyu
     [not found]                       ` <20120518.235619.175499431618565933.hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2012-05-21 12:47                         ` joerg.roedel-5C7GfCeVMHo

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=4FB66796.1030007@wwwdotorg.org \
    --to=swarren@wwwdotorg.org \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=grant.likely@secretlab.ca \
    --cc=hdoyu@nvidia.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=joerg.roedel@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=rob.herring@calxeda.com \
    --cc=thierry.reding@avionic-design.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).