iommu.lists.linux-foundation.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: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20120518085051.4a0fca863c5ab37cf8d42cb1@nvidia.com>
     [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
     [not found]               ` <20120521124707.GC2604-5C7GfCeVMHo@public.gmane.org>
2012-06-20  7:16                 ` [PATCH 1/5] iommu/tegra: smmu: Add DMA window parser, of_get_dma_window() Hiroshi DOYU
     [not found]                   ` <1340176620-13012-1-git-send-email-hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2012-06-20  7:16                     ` [PATCH 2/5] iommu/tegra: smmu: Add device tree support for SMMU Hiroshi DOYU
     [not found]                       ` <1340176620-13012-2-git-send-email-hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2012-06-21  8:31                         ` [v2 " Hiroshi Doyu
2012-06-20  7:16                     ` [PATCH 3/5] iommu/tegra: smmu: Simplify allocation at once Hiroshi DOYU
2012-06-20  7:16                     ` [PATCH 4/5] iommu/tegra: smmu: Remove unnecessary cleanups with devm_*() Hiroshi DOYU
2012-06-20  7:17                     ` [PATCH 5/5] iommu/tegra: smmu: Fix uninitialized var warning Hiroshi DOYU
2012-06-20 17:11                     ` [PATCH 1/5] iommu/tegra: smmu: Add DMA window parser, of_get_dma_window() Stephen Warren
2012-06-21  6:46                       ` Hiroshi Doyu
     [not found]                         ` <20120621.094611.2108645748323641310.hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2012-06-21  6:57                           ` Stephen Warren
     [not found]                             ` <4FE2C5F3.1010007-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-06-21  8:30                               ` [v2 1/5] iommu: " Hiroshi Doyu
     [not found]                                 ` <20120621.113023.1324461719984328307.hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2012-06-21 16:18                                   ` Stephen Warren
     [not found]                                     ` <4FE34973.1020400-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-06-25  5:15                                       ` Hiroshi Doyu
     [not found]                                         ` <20120625081543.bf25af1f74d7d1057d9cd216-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2012-06-25 10:42                                           ` 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).