* [PATCH] arm: omap: Use resource_size
@ 2009-11-09 17:44 Tobias Klauser
2009-11-09 21:05 ` Tony Lindgren
0 siblings, 1 reply; 3+ messages in thread
From: Tobias Klauser @ 2009-11-09 17:44 UTC (permalink / raw)
To: linux-arm-kernel
Use the resource_size function instead of manually calculating the
resource size. This reduces the chance of introducing off-by-one errors
and actually fixes one in mailbox.c.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
---
arch/arm/mach-omap2/gpmc.c | 2 +-
arch/arm/mach-omap2/mailbox.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
index 004da69..67af370 100644
--- a/arch/arm/mach-omap2/gpmc.c
+++ b/arch/arm/mach-omap2/gpmc.c
@@ -366,7 +366,7 @@ int gpmc_cs_request(int cs, unsigned long size, unsigned long *base)
if (r < 0)
goto out;
- gpmc_cs_enable_mem(cs, res->start, res->end - res->start + 1);
+ gpmc_cs_enable_mem(cs, res->start, resource_size(res));
*base = res->start;
gpmc_cs_set_reserved(cs, 1);
out:
diff --git a/arch/arm/mach-omap2/mailbox.c b/arch/arm/mach-omap2/mailbox.c
index 46e1f2e..5ba3aa6 100644
--- a/arch/arm/mach-omap2/mailbox.c
+++ b/arch/arm/mach-omap2/mailbox.c
@@ -300,7 +300,7 @@ static int __devinit omap2_mbox_probe(struct platform_device *pdev)
dev_err(&pdev->dev, "invalid mem resource\n");
return -ENODEV;
}
- mbox_base = ioremap(res->start, res->end - res->start);
+ mbox_base = ioremap(res->start, resource_size(res));
if (!mbox_base)
return -ENOMEM;
--
1.6.3.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH] arm: omap: Use resource_size
2009-11-09 17:44 [PATCH] arm: omap: Use resource_size Tobias Klauser
@ 2009-11-09 21:05 ` Tony Lindgren
2009-11-09 21:08 ` Tony Lindgren
0 siblings, 1 reply; 3+ messages in thread
From: Tony Lindgren @ 2009-11-09 21:05 UTC (permalink / raw)
To: linux-arm-kernel
* Tobias Klauser <tklauser@distanz.ch> [091109 09:44]:
> Use the resource_size function instead of manually calculating the
> resource size. This reduces the chance of introducing off-by-one errors
> and actually fixes one in mailbox.c.
>
> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Acked-by: Tony Lindgren <tony@atomide.com>
> ---
> arch/arm/mach-omap2/gpmc.c | 2 +-
> arch/arm/mach-omap2/mailbox.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
> index 004da69..67af370 100644
> --- a/arch/arm/mach-omap2/gpmc.c
> +++ b/arch/arm/mach-omap2/gpmc.c
> @@ -366,7 +366,7 @@ int gpmc_cs_request(int cs, unsigned long size, unsigned long *base)
> if (r < 0)
> goto out;
>
> - gpmc_cs_enable_mem(cs, res->start, res->end - res->start + 1);
> + gpmc_cs_enable_mem(cs, res->start, resource_size(res));
> *base = res->start;
> gpmc_cs_set_reserved(cs, 1);
> out:
> diff --git a/arch/arm/mach-omap2/mailbox.c b/arch/arm/mach-omap2/mailbox.c
> index 46e1f2e..5ba3aa6 100644
> --- a/arch/arm/mach-omap2/mailbox.c
> +++ b/arch/arm/mach-omap2/mailbox.c
> @@ -300,7 +300,7 @@ static int __devinit omap2_mbox_probe(struct platform_device *pdev)
> dev_err(&pdev->dev, "invalid mem resource\n");
> return -ENODEV;
> }
> - mbox_base = ioremap(res->start, res->end - res->start);
> + mbox_base = ioremap(res->start, resource_size(res));
> if (!mbox_base)
> return -ENOMEM;
>
> --
> 1.6.3.3
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] arm: omap: Use resource_size
2009-11-09 21:05 ` Tony Lindgren
@ 2009-11-09 21:08 ` Tony Lindgren
0 siblings, 0 replies; 3+ messages in thread
From: Tony Lindgren @ 2009-11-09 21:08 UTC (permalink / raw)
To: linux-arm-kernel
* Tony Lindgren <tony@atomide.com> [091109 13:05]:
> * Tobias Klauser <tklauser@distanz.ch> [091109 09:44]:
> > Use the resource_size function instead of manually calculating the
> > resource size. This reduces the chance of introducing off-by-one errors
> > and actually fixes one in mailbox.c.
> >
> > Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
>
> Acked-by: Tony Lindgren <tony@atomide.com>
Hmm, sorry though this was part of some larger series.. Added to
my omap-fixes queue.
Regards,
Tony
> > ---
> > arch/arm/mach-omap2/gpmc.c | 2 +-
> > arch/arm/mach-omap2/mailbox.c | 2 +-
> > 2 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
> > index 004da69..67af370 100644
> > --- a/arch/arm/mach-omap2/gpmc.c
> > +++ b/arch/arm/mach-omap2/gpmc.c
> > @@ -366,7 +366,7 @@ int gpmc_cs_request(int cs, unsigned long size, unsigned long *base)
> > if (r < 0)
> > goto out;
> >
> > - gpmc_cs_enable_mem(cs, res->start, res->end - res->start + 1);
> > + gpmc_cs_enable_mem(cs, res->start, resource_size(res));
> > *base = res->start;
> > gpmc_cs_set_reserved(cs, 1);
> > out:
> > diff --git a/arch/arm/mach-omap2/mailbox.c b/arch/arm/mach-omap2/mailbox.c
> > index 46e1f2e..5ba3aa6 100644
> > --- a/arch/arm/mach-omap2/mailbox.c
> > +++ b/arch/arm/mach-omap2/mailbox.c
> > @@ -300,7 +300,7 @@ static int __devinit omap2_mbox_probe(struct platform_device *pdev)
> > dev_err(&pdev->dev, "invalid mem resource\n");
> > return -ENODEV;
> > }
> > - mbox_base = ioremap(res->start, res->end - res->start);
> > + mbox_base = ioremap(res->start, resource_size(res));
> > if (!mbox_base)
> > return -ENOMEM;
> >
> > --
> > 1.6.3.3
> >
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-11-09 21:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-09 17:44 [PATCH] arm: omap: Use resource_size Tobias Klauser
2009-11-09 21:05 ` Tony Lindgren
2009-11-09 21:08 ` Tony Lindgren
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).