All of lore.kernel.org
 help / color / mirror / Atom feed
From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: Felipe Contreras <felipe.contreras@gmail.com>
Cc: linux-omap@vger.kernel.org, Hiroshi DOYU <hiroshi.doyu@nokia.com>,
	Hari Kanigeri <h-kanigeri2@ti.com>,
	linux-arm-kernel@lists.arm.linux.org.uk,
	Felipe Contreras <felipe.contreras@nokia.com>
Subject: Re: [RFC/PATCH 1/3] omap3-iommu: reorganize
Date: Mon, 18 May 2009 13:07:17 +0100	[thread overview]
Message-ID: <20090518120717.GA3067@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <1242468350-23190-2-git-send-email-felipe.contreras@gmail.com>

On Sat, May 16, 2009 at 01:05:48PM +0300, Felipe Contreras wrote:
> +struct iommu_device {
> +	resource_size_t base;
> +	resource_size_t irq;
> +	struct iommu_platform_data pdata;
> +	struct resource res[2];
>  };

The data which is needed per device is:

- base address
- IRQ (no need for this to be resource_size_t - int will do)
- platform data

There's no need for that res[2] being there.

> @@ -63,23 +51,35 @@ static int __init omap3_iommu_init(void)
>  
>  	for (i = 0; i < NR_IOMMU_DEVICES; i++) {
>  		struct platform_device *pdev;
> +		const struct iommu_device *d = &devices[i];
> +		struct resource res[] = {
> +			{ .flags = IORESOURCE_MEM },
> +			{ .flags = IORESOURCE_IRQ },
> +		};

This initialization doesn't buy you anything, in fact quite the opposite.
The compiler actually interprets this as:

static struct resource __initial_res[] = {
	{ .flags = IORESOURCE_MEM },
	{ .flags = IORESOURCE_IRQ },
};
...
	for () {
		struct resource res[...];
		memcpy(res, __initial_res, sizeof(__initial_res));

> +
> +		res[0].start = d->base;
> +		res[0].end = d->base + MMU_REG_SIZE - 1;
> +
> +		res[1].start = d->irq;

It would be far better to initialize the flags element here for both.
And please also set res[1].end as I did in my patch.

> +
> +		err = platform_device_add_resources(pdev, res, ARRAY_SIZE(res));
>  		if (err)
>  			goto err_out;
> -		err = platform_device_add_data(pdev, &omap3_iommu_pdata[i],
> -					       sizeof(omap3_iommu_pdata[0]));
> +
> +		err = platform_device_add_data(pdev, &d->pdata, sizeof(d->pdata));

This will fail checkpatch.

  parent reply	other threads:[~2009-05-18 12:07 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-16 10:05 [RFC/PATCH 0/3] omap3-iommu: cleanups and remote registration Felipe Contreras
2009-05-16 10:05 ` [RFC/PATCH 1/3] omap3-iommu: reorganize Felipe Contreras
2009-05-16 10:05   ` [RFC/PATCH 2/3] omap3-iommu: split init function into omap_iommu_add Felipe Contreras
2009-05-16 10:05     ` [RFC/PATCH 3/3] omap3-iommu: remote registration Felipe Contreras
2009-05-18 12:11       ` Russell King - ARM Linux
2009-05-18 12:46         ` Felipe Contreras
2009-05-18 13:02           ` Russell King - ARM Linux
2009-05-18 13:21             ` Felipe Contreras
2009-05-18 13:40               ` Russell King - ARM Linux
2009-05-18 14:00                 ` Felipe Contreras
2009-05-18 13:35         ` Hiroshi DOYU
2009-05-18 13:52           ` Felipe Contreras
2009-05-18 13:59             ` Hiroshi DOYU
2009-05-18 13:54           ` Hiroshi DOYU
2009-05-18 12:07   ` Russell King - ARM Linux [this message]
2009-05-18 12:59     ` [RFC/PATCH 1/3] omap3-iommu: reorganize Felipe Contreras
2009-05-18 13:03       ` Russell King - ARM Linux
2009-05-16 16:36 ` [RFC/PATCH 0/3] omap3-iommu: cleanups and remote registration Russell King - ARM Linux
2009-05-16 18:32   ` Felipe Contreras
2009-05-18  5:16     ` Hiroshi DOYU
2009-05-18  5:33       ` Hiroshi DOYU
2009-05-18 11:51         ` Felipe Contreras
2009-05-18 11:48       ` Felipe Contreras
2009-05-18 13:48         ` Hiroshi DOYU
2009-06-28  0:18           ` Felipe Contreras
  -- strict thread matches above, loose matches on Subject: below --
2009-05-16 10:41 [RFC/PATCH 1/3] omap3-iommu: reorganize Felipe Contreras
2009-05-07 20:02 [PATCH 3/6] omap iommu: omap3 iommu device registration Felipe Contreras
2009-05-07 20:11 ` [RFC/PATCH 0/3] omap3-iommu: cleanups and remote registration Felipe Contreras
2009-05-07 20:11   ` [RFC/PATCH 1/3] omap3-iommu: reorganize Felipe Contreras
2009-05-07 21:14     ` Felipe Balbi
2009-05-07 22:16       ` Felipe Contreras
2009-05-08  4:15       ` Hiroshi DOYU

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=20090518120717.GA3067@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --cc=felipe.contreras@gmail.com \
    --cc=felipe.contreras@nokia.com \
    --cc=h-kanigeri2@ti.com \
    --cc=hiroshi.doyu@nokia.com \
    --cc=linux-arm-kernel@lists.arm.linux.org.uk \
    --cc=linux-omap@vger.kernel.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.