* [PATCH 0/2] Fix resource size miscalculations
@ 2011-03-23 19:55 Joe Perches
2011-03-23 19:55 ` [trivial PATCH 1/2] treewide: Fix iomap " Joe Perches
` (2 more replies)
0 siblings, 3 replies; 12+ messages in thread
From: Joe Perches @ 2011-03-23 19:55 UTC (permalink / raw)
To: Jiri Kosina, linux-arm-kernel, linux-arm-msm, linux-watchdog
Cc: linux-kernel, linux-mips, linux-fbdev
Use resource_size a few places
Joe Perches (2):
trivial: treewide: Fix iomap resource size miscalculations
trivial: arm: mach-u300/gpio: Fix mem_region resource size miscalculations
arch/arm/mach-u300/gpio.c | 7 +++----
arch/arm/mach-ux500/mbox-db5500.c | 6 ++----
arch/mips/rb532/gpio.c | 2 +-
drivers/video/msm/mddi.c | 2 +-
drivers/watchdog/bcm63xx_wdt.c | 2 +-
5 files changed, 8 insertions(+), 11 deletions(-)
--
1.7.4.2.g597a6.dirty
^ permalink raw reply [flat|nested] 12+ messages in thread
* [trivial PATCH 1/2] treewide: Fix iomap resource size miscalculations
2011-03-23 19:55 [PATCH 0/2] Fix resource size miscalculations Joe Perches
@ 2011-03-23 19:55 ` Joe Perches
2011-03-23 20:11 ` Linus Walleij
` (5 more replies)
2011-03-23 19:55 ` [trivial PATCH 2/2] arm: mach-u300/gpio: Fix mem_region " Joe Perches
2011-03-24 22:49 ` [PATCH 0/2] Fix " Joe Perches
2 siblings, 6 replies; 12+ messages in thread
From: Joe Perches @ 2011-03-23 19:55 UTC (permalink / raw)
To: Jiri Kosina, Srinidhi Kasagar, Linus Walleij, David Brown,
Daniel Walker, Bryan Huntsman, Wim Van Sebroeck
Cc: Russell King, Ralf Baechle, linux-arm-kernel, linux-kernel,
linux-mips, linux-arm-msm, linux-fbdev, linux-watchdog
Convert off-by-1 r->end - r->start to resource_size(r)
Signed-off-by: Joe Perches <joe@perches.com>
---
arch/arm/mach-ux500/mbox-db5500.c | 6 ++----
arch/mips/rb532/gpio.c | 2 +-
drivers/video/msm/mddi.c | 2 +-
drivers/watchdog/bcm63xx_wdt.c | 2 +-
4 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/arch/arm/mach-ux500/mbox-db5500.c b/arch/arm/mach-ux500/mbox-db5500.c
index a4ffb9f..2b2d51c 100644
--- a/arch/arm/mach-ux500/mbox-db5500.c
+++ b/arch/arm/mach-ux500/mbox-db5500.c
@@ -416,8 +416,7 @@ struct mbox *mbox_setup(u8 mbox_id, mbox_recv_cb_t *mbox_cb, void *priv)
dev_dbg(&(mbox->pdev->dev),
"Resource name: %s start: 0x%X, end: 0x%X\n",
resource->name, resource->start, resource->end);
- mbox->virtbase_peer =
- ioremap(resource->start, resource->end - resource->start);
+ mbox->virtbase_peer = ioremap(resource->start, resource_size(resource));
if (!mbox->virtbase_peer) {
dev_err(&(mbox->pdev->dev), "Unable to ioremap peer mbox\n");
mbox = NULL;
@@ -440,8 +439,7 @@ struct mbox *mbox_setup(u8 mbox_id, mbox_recv_cb_t *mbox_cb, void *priv)
dev_dbg(&(mbox->pdev->dev),
"Resource name: %s start: 0x%X, end: 0x%X\n",
resource->name, resource->start, resource->end);
- mbox->virtbase_local =
- ioremap(resource->start, resource->end - resource->start);
+ mbox->virtbase_local = ioremap(resource->start, resource_size(resource));
if (!mbox->virtbase_local) {
dev_err(&(mbox->pdev->dev), "Unable to ioremap local mbox\n");
mbox = NULL;
diff --git a/arch/mips/rb532/gpio.c b/arch/mips/rb532/gpio.c
index 37de05d..6c47dfe 100644
--- a/arch/mips/rb532/gpio.c
+++ b/arch/mips/rb532/gpio.c
@@ -185,7 +185,7 @@ int __init rb532_gpio_init(void)
struct resource *r;
r = rb532_gpio_reg0_res;
- rb532_gpio_chip->regbase = ioremap_nocache(r->start, r->end - r->start);
+ rb532_gpio_chip->regbase = ioremap_nocache(r->start, resource_size(r));
if (!rb532_gpio_chip->regbase) {
printk(KERN_ERR "rb532: cannot remap GPIO register 0\n");
diff --git a/drivers/video/msm/mddi.c b/drivers/video/msm/mddi.c
index b66d86a..178b072 100644
--- a/drivers/video/msm/mddi.c
+++ b/drivers/video/msm/mddi.c
@@ -679,7 +679,7 @@ static int __devinit mddi_probe(struct platform_device *pdev)
printk(KERN_ERR "mddi: no associated mem resource!\n");
return -ENOMEM;
}
- mddi->base = ioremap(resource->start, resource->end - resource->start);
+ mddi->base = ioremap(resource->start, resource_size(resource));
if (!mddi->base) {
printk(KERN_ERR "mddi: failed to remap base!\n");
ret = -EINVAL;
diff --git a/drivers/watchdog/bcm63xx_wdt.c b/drivers/watchdog/bcm63xx_wdt.c
index 3c5045a..5064e83 100644
--- a/drivers/watchdog/bcm63xx_wdt.c
+++ b/drivers/watchdog/bcm63xx_wdt.c
@@ -248,7 +248,7 @@ static int __devinit bcm63xx_wdt_probe(struct platform_device *pdev)
return -ENODEV;
}
- bcm63xx_wdt_device.regs = ioremap_nocache(r->start, r->end - r->start);
+ bcm63xx_wdt_device.regs = ioremap_nocache(r->start, resource_size(r));
if (!bcm63xx_wdt_device.regs) {
dev_err(&pdev->dev, "failed to remap I/O resources\n");
return -ENXIO;
--
1.7.4.2.g597a6.dirty
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [trivial PATCH 2/2] arm: mach-u300/gpio: Fix mem_region resource size miscalculations
2011-03-23 19:55 [PATCH 0/2] Fix resource size miscalculations Joe Perches
2011-03-23 19:55 ` [trivial PATCH 1/2] treewide: Fix iomap " Joe Perches
@ 2011-03-23 19:55 ` Joe Perches
2011-03-23 20:07 ` Linus Walleij
2011-03-24 22:49 ` [PATCH 0/2] Fix " Joe Perches
2 siblings, 1 reply; 12+ messages in thread
From: Joe Perches @ 2011-03-23 19:55 UTC (permalink / raw)
To: Jiri Kosina, Linus Walleij; +Cc: Russell King, linux-arm-kernel, linux-kernel
Convert off-by-1 r->end - r->start to resource_size(r)
Signed-off-by: Joe Perches <joe@perches.com>
---
arch/arm/mach-u300/gpio.c | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/arch/arm/mach-u300/gpio.c b/arch/arm/mach-u300/gpio.c
index d927901..94837a4 100644
--- a/arch/arm/mach-u300/gpio.c
+++ b/arch/arm/mach-u300/gpio.c
@@ -581,8 +581,7 @@ static int __init gpio_probe(struct platform_device *pdev)
if (!memres)
goto err_no_resource;
- if (request_mem_region(memres->start, memres->end - memres->start, "GPIO Controller")
- == NULL) {
+ if (!request_mem_region(memres->start, resource_size(memres), "GPIO Controller")) {
err = -ENODEV;
goto err_no_ioregion;
}
@@ -640,7 +639,7 @@ static int __init gpio_probe(struct platform_device *pdev)
free_irq(gpio_ports[i].irq, &gpio_ports[i]);
iounmap(virtbase);
err_no_ioremap:
- release_mem_region(memres->start, memres->end - memres->start);
+ release_mem_region(memres->start, resource_size(memres));
err_no_ioregion:
err_no_resource:
clk_disable(clk);
@@ -660,7 +659,7 @@ static int __exit gpio_remove(struct platform_device *pdev)
for (i = 0 ; i < U300_GPIO_NUM_PORTS; i++)
free_irq(gpio_ports[i].irq, &gpio_ports[i]);
iounmap(virtbase);
- release_mem_region(memres->start, memres->end - memres->start);
+ release_mem_region(memres->start, resource_size(memres));
clk_disable(clk);
clk_put(clk);
return 0;
--
1.7.4.2.g597a6.dirty
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [trivial PATCH 2/2] arm: mach-u300/gpio: Fix mem_region resource size miscalculations
2011-03-23 19:55 ` [trivial PATCH 2/2] arm: mach-u300/gpio: Fix mem_region " Joe Perches
@ 2011-03-23 20:07 ` Linus Walleij
2011-04-10 15:07 ` Jiri Kosina
0 siblings, 1 reply; 12+ messages in thread
From: Linus Walleij @ 2011-03-23 20:07 UTC (permalink / raw)
To: Joe Perches; +Cc: Jiri Kosina, Russell King, linux-kernel, linux-arm-kernel
2011/3/23 Joe Perches <joe@perches.com>:
> Convert off-by-1 r->end - r->start to resource_size(r)
>
> Signed-off-by: Joe Perches <joe@perches.com>
Oh man, there was one of these lurking in my own beloved mach-u300.
How embarrassing. Thanks for catching!
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [trivial PATCH 1/2] treewide: Fix iomap resource size miscalculations
2011-03-23 19:55 ` [trivial PATCH 1/2] treewide: Fix iomap " Joe Perches
@ 2011-03-23 20:11 ` Linus Walleij
2011-03-23 20:29 ` Florian Fainelli
` (4 subsequent siblings)
5 siblings, 0 replies; 12+ messages in thread
From: Linus Walleij @ 2011-03-23 20:11 UTC (permalink / raw)
To: Joe Perches
Cc: Jiri Kosina, Srinidhi Kasagar, David Brown, Daniel Walker,
Bryan Huntsman, Wim Van Sebroeck, Russell King, Ralf Baechle,
linux-arm-kernel, linux-kernel, linux-mips, linux-arm-msm,
linux-fbdev, linux-watchdog
2011/3/23 Joe Perches <joe@perches.com>:
> Convert off-by-1 r->end - r->start to resource_size(r)
>
> Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
(for ux500)
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [trivial PATCH 1/2] treewide: Fix iomap resource size miscalculations
2011-03-23 19:55 ` [trivial PATCH 1/2] treewide: Fix iomap " Joe Perches
2011-03-23 20:11 ` Linus Walleij
@ 2011-03-23 20:29 ` Florian Fainelli
2011-03-23 22:42 ` David Brown
` (3 subsequent siblings)
5 siblings, 0 replies; 12+ messages in thread
From: Florian Fainelli @ 2011-03-23 20:29 UTC (permalink / raw)
To: Joe Perches
Cc: Jiri Kosina, Srinidhi Kasagar, Linus Walleij, David Brown,
Daniel Walker, Bryan Huntsman, Wim Van Sebroeck, Russell King,
Ralf Baechle, linux-arm-kernel, linux-kernel, linux-mips,
linux-arm-msm, linux-fbdev, linux-watchdog
On Wednesday 23 March 2011 20:55:36 Joe Perches wrote:
> Convert off-by-1 r->end - r->start to resource_size(r)
>
> Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Florian Fainelli <florian@openwrt.org>
(for rb532 and bcm63xx_wdt)
> ---
> arch/arm/mach-ux500/mbox-db5500.c | 6 ++----
> arch/mips/rb532/gpio.c | 2 +-
> drivers/video/msm/mddi.c | 2 +-
> drivers/watchdog/bcm63xx_wdt.c | 2 +-
> 4 files changed, 5 insertions(+), 7 deletions(-)
>
> diff --git a/arch/arm/mach-ux500/mbox-db5500.c
> b/arch/arm/mach-ux500/mbox-db5500.c index a4ffb9f..2b2d51c 100644
> --- a/arch/arm/mach-ux500/mbox-db5500.c
> +++ b/arch/arm/mach-ux500/mbox-db5500.c
> @@ -416,8 +416,7 @@ struct mbox *mbox_setup(u8 mbox_id, mbox_recv_cb_t
> *mbox_cb, void *priv) dev_dbg(&(mbox->pdev->dev),
> "Resource name: %s start: 0x%X, end: 0x%X\n",
> resource->name, resource->start, resource->end);
> - mbox->virtbase_peer =
> - ioremap(resource->start, resource->end - resource->start);
> + mbox->virtbase_peer = ioremap(resource->start, resource_size(resource));
> if (!mbox->virtbase_peer) {
> dev_err(&(mbox->pdev->dev), "Unable to ioremap peer mbox\n");
> mbox = NULL;
> @@ -440,8 +439,7 @@ struct mbox *mbox_setup(u8 mbox_id, mbox_recv_cb_t
> *mbox_cb, void *priv) dev_dbg(&(mbox->pdev->dev),
> "Resource name: %s start: 0x%X, end: 0x%X\n",
> resource->name, resource->start, resource->end);
> - mbox->virtbase_local =
> - ioremap(resource->start, resource->end - resource->start);
> + mbox->virtbase_local = ioremap(resource->start, resource_size(resource));
> if (!mbox->virtbase_local) {
> dev_err(&(mbox->pdev->dev), "Unable to ioremap local mbox\n");
> mbox = NULL;
> diff --git a/arch/mips/rb532/gpio.c b/arch/mips/rb532/gpio.c
> index 37de05d..6c47dfe 100644
> --- a/arch/mips/rb532/gpio.c
> +++ b/arch/mips/rb532/gpio.c
> @@ -185,7 +185,7 @@ int __init rb532_gpio_init(void)
> struct resource *r;
>
> r = rb532_gpio_reg0_res;
> - rb532_gpio_chip->regbase = ioremap_nocache(r->start, r->end - r->start);
> + rb532_gpio_chip->regbase = ioremap_nocache(r->start, resource_size(r));
>
> if (!rb532_gpio_chip->regbase) {
> printk(KERN_ERR "rb532: cannot remap GPIO register 0\n");
> diff --git a/drivers/video/msm/mddi.c b/drivers/video/msm/mddi.c
> index b66d86a..178b072 100644
> --- a/drivers/video/msm/mddi.c
> +++ b/drivers/video/msm/mddi.c
> @@ -679,7 +679,7 @@ static int __devinit mddi_probe(struct platform_device
> *pdev) printk(KERN_ERR "mddi: no associated mem resource!\n");
> return -ENOMEM;
> }
> - mddi->base = ioremap(resource->start, resource->end - resource->start);
> + mddi->base = ioremap(resource->start, resource_size(resource));
> if (!mddi->base) {
> printk(KERN_ERR "mddi: failed to remap base!\n");
> ret = -EINVAL;
> diff --git a/drivers/watchdog/bcm63xx_wdt.c
> b/drivers/watchdog/bcm63xx_wdt.c index 3c5045a..5064e83 100644
> --- a/drivers/watchdog/bcm63xx_wdt.c
> +++ b/drivers/watchdog/bcm63xx_wdt.c
> @@ -248,7 +248,7 @@ static int __devinit bcm63xx_wdt_probe(struct
> platform_device *pdev) return -ENODEV;
> }
>
> - bcm63xx_wdt_device.regs = ioremap_nocache(r->start, r->end - r->start);
> + bcm63xx_wdt_device.regs = ioremap_nocache(r->start, resource_size(r));
> if (!bcm63xx_wdt_device.regs) {
> dev_err(&pdev->dev, "failed to remap I/O resources\n");
> return -ENXIO;
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [trivial PATCH 1/2] treewide: Fix iomap resource size miscalculations
2011-03-23 19:55 ` [trivial PATCH 1/2] treewide: Fix iomap " Joe Perches
2011-03-23 20:11 ` Linus Walleij
2011-03-23 20:29 ` Florian Fainelli
@ 2011-03-23 22:42 ` David Brown
2011-03-24 8:29 ` Wim Van Sebroeck
` (2 subsequent siblings)
5 siblings, 0 replies; 12+ messages in thread
From: David Brown @ 2011-03-23 22:42 UTC (permalink / raw)
To: Joe Perches
Cc: Jiri Kosina, Srinidhi Kasagar, Linus Walleij, Daniel Walker,
Bryan Huntsman, Wim Van Sebroeck, Russell King, Ralf Baechle,
linux-arm-kernel, linux-kernel, linux-mips, linux-arm-msm,
linux-fbdev, linux-watchdog
On Wed, Mar 23 2011, Joe Perches wrote:
> Convert off-by-1 r->end - r->start to resource_size(r)
>
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
> drivers/video/msm/mddi.c | 2 +-
Acked-by: David Brown <davidb@codeaurora.org>
--
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [trivial PATCH 1/2] treewide: Fix iomap resource size miscalculations
2011-03-23 19:55 ` [trivial PATCH 1/2] treewide: Fix iomap " Joe Perches
` (2 preceding siblings ...)
2011-03-23 22:42 ` David Brown
@ 2011-03-24 8:29 ` Wim Van Sebroeck
2011-03-24 22:27 ` Ralf Baechle
2011-04-10 15:09 ` Jiri Kosina
5 siblings, 0 replies; 12+ messages in thread
From: Wim Van Sebroeck @ 2011-03-24 8:29 UTC (permalink / raw)
To: Joe Perches
Cc: Jiri Kosina, Srinidhi Kasagar, Linus Walleij, David Brown,
Daniel Walker, Bryan Huntsman, Wim Van Sebroeck, Russell King,
Ralf Baechle, linux-arm-kernel, linux-kernel, linux-mips,
linux-arm-msm, linux-fbdev, linux-watchdog
Hi Joe,
> Convert off-by-1 r->end - r->start to resource_size(r)
>
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
> arch/arm/mach-ux500/mbox-db5500.c | 6 ++----
> arch/mips/rb532/gpio.c | 2 +-
> drivers/video/msm/mddi.c | 2 +-
> drivers/watchdog/bcm63xx_wdt.c | 2 +-
> 4 files changed, 5 insertions(+), 7 deletions(-)
Acked-by: Wim Van Sebroeck <wim@iguana.be>
Kind regards,
Wim.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [trivial PATCH 1/2] treewide: Fix iomap resource size miscalculations
2011-03-23 19:55 ` [trivial PATCH 1/2] treewide: Fix iomap " Joe Perches
` (3 preceding siblings ...)
2011-03-24 8:29 ` Wim Van Sebroeck
@ 2011-03-24 22:27 ` Ralf Baechle
2011-04-10 15:09 ` Jiri Kosina
5 siblings, 0 replies; 12+ messages in thread
From: Ralf Baechle @ 2011-03-24 22:27 UTC (permalink / raw)
To: Joe Perches
Cc: Jiri Kosina, Srinidhi Kasagar, Linus Walleij, David Brown,
Daniel Walker, Bryan Huntsman, Wim Van Sebroeck, Russell King,
linux-arm-kernel, linux-kernel, linux-mips, linux-arm-msm,
linux-fbdev, linux-watchdog
On Wed, Mar 23, 2011 at 12:55:36PM -0700, Joe Perches wrote:
Acked-by: Ralf Baechle <ralf@linux-mips.org>
Ralf
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 0/2] Fix resource size miscalculations
2011-03-23 19:55 [PATCH 0/2] Fix resource size miscalculations Joe Perches
2011-03-23 19:55 ` [trivial PATCH 1/2] treewide: Fix iomap " Joe Perches
2011-03-23 19:55 ` [trivial PATCH 2/2] arm: mach-u300/gpio: Fix mem_region " Joe Perches
@ 2011-03-24 22:49 ` Joe Perches
2 siblings, 0 replies; 12+ messages in thread
From: Joe Perches @ 2011-03-24 22:49 UTC (permalink / raw)
To: Jiri Kosina
Cc: linux-arm-kernel, linux-arm-msm, linux-watchdog, linux-kernel,
linux-mips, linux-fbdev
On Wed, 2011-03-23 at 12:55 -0700, Joe Perches wrote:
> Use resource_size a few places
Perhaps this relatively common error is too common.
It seems to be poor style. A possible better style for
struct resource uses could be inline function(s) like:
static inline void __iomem *resource_ioremap(struct resource *r)
{
return ioremap(r->start, resource_size(r));
}
and maybe
static inline struct resource *
resource_request_region(struct resource *r, const char *name)
{
return __request_region(&ioport_resource, r->start, resource_size(r), name, 0);
}
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [trivial PATCH 2/2] arm: mach-u300/gpio: Fix mem_region resource size miscalculations
2011-03-23 20:07 ` Linus Walleij
@ 2011-04-10 15:07 ` Jiri Kosina
0 siblings, 0 replies; 12+ messages in thread
From: Jiri Kosina @ 2011-04-10 15:07 UTC (permalink / raw)
To: Linus Walleij; +Cc: Joe Perches, Russell King, linux-kernel, linux-arm-kernel
On Wed, 23 Mar 2011, Linus Walleij wrote:
> 2011/3/23 Joe Perches <joe@perches.com>:
>
> > Convert off-by-1 r->end - r->start to resource_size(r)
> >
> > Signed-off-by: Joe Perches <joe@perches.com>
>
> Oh man, there was one of these lurking in my own beloved mach-u300.
> How embarrassing. Thanks for catching!
>
> Acked-by: Linus Walleij <linus.walleij@linaro.org>
As I don't see it in today's linux-next, I have picked it up. Thanks,
--
Jiri Kosina
SUSE Labs, Novell Inc.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [trivial PATCH 1/2] treewide: Fix iomap resource size miscalculations
2011-03-23 19:55 ` [trivial PATCH 1/2] treewide: Fix iomap " Joe Perches
` (4 preceding siblings ...)
2011-03-24 22:27 ` Ralf Baechle
@ 2011-04-10 15:09 ` Jiri Kosina
5 siblings, 0 replies; 12+ messages in thread
From: Jiri Kosina @ 2011-04-10 15:09 UTC (permalink / raw)
To: Joe Perches
Cc: Srinidhi Kasagar, Linus Walleij, David Brown, Daniel Walker,
Bryan Huntsman, Wim Van Sebroeck, Russell King, Ralf Baechle,
linux-arm-kernel, linux-kernel, linux-mips, linux-arm-msm,
linux-fbdev, linux-watchdog
On Wed, 23 Mar 2011, Joe Perches wrote:
> Convert off-by-1 r->end - r->start to resource_size(r)
>
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
> arch/arm/mach-ux500/mbox-db5500.c | 6 ++----
> arch/mips/rb532/gpio.c | 2 +-
> drivers/video/msm/mddi.c | 2 +-
> drivers/watchdog/bcm63xx_wdt.c | 2 +-
> 4 files changed, 5 insertions(+), 7 deletions(-)
Applied, thanks
>
> diff --git a/arch/arm/mach-ux500/mbox-db5500.c b/arch/arm/mach-ux500/mbox-db5500.c
> index a4ffb9f..2b2d51c 100644
> --- a/arch/arm/mach-ux500/mbox-db5500.c
> +++ b/arch/arm/mach-ux500/mbox-db5500.c
> @@ -416,8 +416,7 @@ struct mbox *mbox_setup(u8 mbox_id, mbox_recv_cb_t *mbox_cb, void *priv)
> dev_dbg(&(mbox->pdev->dev),
> "Resource name: %s start: 0x%X, end: 0x%X\n",
> resource->name, resource->start, resource->end);
> - mbox->virtbase_peer =
> - ioremap(resource->start, resource->end - resource->start);
> + mbox->virtbase_peer = ioremap(resource->start, resource_size(resource));
> if (!mbox->virtbase_peer) {
> dev_err(&(mbox->pdev->dev), "Unable to ioremap peer mbox\n");
> mbox = NULL;
> @@ -440,8 +439,7 @@ struct mbox *mbox_setup(u8 mbox_id, mbox_recv_cb_t *mbox_cb, void *priv)
> dev_dbg(&(mbox->pdev->dev),
> "Resource name: %s start: 0x%X, end: 0x%X\n",
> resource->name, resource->start, resource->end);
> - mbox->virtbase_local =
> - ioremap(resource->start, resource->end - resource->start);
> + mbox->virtbase_local = ioremap(resource->start, resource_size(resource));
> if (!mbox->virtbase_local) {
> dev_err(&(mbox->pdev->dev), "Unable to ioremap local mbox\n");
> mbox = NULL;
> diff --git a/arch/mips/rb532/gpio.c b/arch/mips/rb532/gpio.c
> index 37de05d..6c47dfe 100644
> --- a/arch/mips/rb532/gpio.c
> +++ b/arch/mips/rb532/gpio.c
> @@ -185,7 +185,7 @@ int __init rb532_gpio_init(void)
> struct resource *r;
>
> r = rb532_gpio_reg0_res;
> - rb532_gpio_chip->regbase = ioremap_nocache(r->start, r->end - r->start);
> + rb532_gpio_chip->regbase = ioremap_nocache(r->start, resource_size(r));
>
> if (!rb532_gpio_chip->regbase) {
> printk(KERN_ERR "rb532: cannot remap GPIO register 0\n");
> diff --git a/drivers/video/msm/mddi.c b/drivers/video/msm/mddi.c
> index b66d86a..178b072 100644
> --- a/drivers/video/msm/mddi.c
> +++ b/drivers/video/msm/mddi.c
> @@ -679,7 +679,7 @@ static int __devinit mddi_probe(struct platform_device *pdev)
> printk(KERN_ERR "mddi: no associated mem resource!\n");
> return -ENOMEM;
> }
> - mddi->base = ioremap(resource->start, resource->end - resource->start);
> + mddi->base = ioremap(resource->start, resource_size(resource));
> if (!mddi->base) {
> printk(KERN_ERR "mddi: failed to remap base!\n");
> ret = -EINVAL;
> diff --git a/drivers/watchdog/bcm63xx_wdt.c b/drivers/watchdog/bcm63xx_wdt.c
> index 3c5045a..5064e83 100644
> --- a/drivers/watchdog/bcm63xx_wdt.c
> +++ b/drivers/watchdog/bcm63xx_wdt.c
> @@ -248,7 +248,7 @@ static int __devinit bcm63xx_wdt_probe(struct platform_device *pdev)
> return -ENODEV;
> }
>
> - bcm63xx_wdt_device.regs = ioremap_nocache(r->start, r->end - r->start);
> + bcm63xx_wdt_device.regs = ioremap_nocache(r->start, resource_size(r));
> if (!bcm63xx_wdt_device.regs) {
> dev_err(&pdev->dev, "failed to remap I/O resources\n");
> return -ENXIO;
> --
> 1.7.4.2.g597a6.dirty
>
--
Jiri Kosina
SUSE Labs, Novell Inc.
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2011-04-10 15:09 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-23 19:55 [PATCH 0/2] Fix resource size miscalculations Joe Perches
2011-03-23 19:55 ` [trivial PATCH 1/2] treewide: Fix iomap " Joe Perches
2011-03-23 20:11 ` Linus Walleij
2011-03-23 20:29 ` Florian Fainelli
2011-03-23 22:42 ` David Brown
2011-03-24 8:29 ` Wim Van Sebroeck
2011-03-24 22:27 ` Ralf Baechle
2011-04-10 15:09 ` Jiri Kosina
2011-03-23 19:55 ` [trivial PATCH 2/2] arm: mach-u300/gpio: Fix mem_region " Joe Perches
2011-03-23 20:07 ` Linus Walleij
2011-04-10 15:07 ` Jiri Kosina
2011-03-24 22:49 ` [PATCH 0/2] Fix " Joe Perches
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).