Skip to contentSkip to conversation

arm: omap: Use resource_size

PATCH New Tobias Klauser 2 participants 3 messages Nov 9, 2009

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm: omap: Use resource_size

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.

---
 arch/arm/mach-omap2/gpmc.c    |    2 +-
 arch/arm/mach-omap2/mailbox.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-omap2/gpmc.c +1 -1
index 004da69..67af370 100644
@@ -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:
arch/arm/mach-omap2/mailbox.c +1 -1
index 46e1f2e..5ba3aa6 100644
@@ -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;
 
Signature · 1 line
1.6.3.3
maintainer
#1 lore raw

PATCH 1/1 arm: omap: Use resource_size

Quoted 5 lines · Tobias Klauser

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.

Quoted 34 lines
---
 arch/arm/mach-omap2/gpmc.c    |    2 +-
 arch/arm/mach-omap2/mailbox.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-omap2/gpmc.c +1 -1
index 004da69..67af370 100644
@@ -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:
arch/arm/mach-omap2/mailbox.c +1 -1
index 46e1f2e..5ba3aa6 100644
@@ -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;
 
Signature · 1 line
1.6.3.3
maintainer
#2 lore raw

PATCH 1/1 arm: omap: Use resource_size

Quoted 8 lines · Tony Lindgren
Quoted 5 lines · Tobias Klauser

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.

Hmm, sorry though this was part of some larger series.. Added to my omap-fixes queue.

Regards,

Tony

Quoted 34 lines
Quoted 34 lines
---
 arch/arm/mach-omap2/gpmc.c    |    2 +-
 arch/arm/mach-omap2/mailbox.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-omap2/gpmc.c +1 -1
index 004da69..67af370 100644
@@ -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:
arch/arm/mach-omap2/mailbox.c +1 -1
index 46e1f2e..5ba3aa6 100644
@@ -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;
 
Signature · 1 line
1.6.3.3