diff options
author | Linus Walleij <linus.walleij@stericsson.com> | 2009-06-07 18:27:31 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2009-06-11 10:36:56 -0400 |
commit | dc890c2dcd63a90de68ee5f0253eefbb89d725f0 (patch) | |
tree | 561a3c58647ae9775f7af0a48f56e2255d6eb22d /drivers | |
parent | 42578c82e0f1810a07ebe29cb05e874893243d8c (diff) |
[ARM] 5544/1: Trust PrimeCell resource sizes
I found the PrimeCell/AMBA Bus drivers distrusting the resource
passed in as part of the struct amba_device abstraction. This
patch removes all hard coded resource sizes found in the PrimeCell
drivers and move the responsibility of this definition back to
the platform/board device definition, which already exist and
appear to be correct for all in-tree users of these drivers.
We do this using the resource_size() inline function which was
also replicated in the only driver using the resource size, so
that has been changed too. The KMI_SIZE was left in kmi.h in case
someone likes it. Test-compiled against Versatile and Integrator
defconfigs, seems to work but I don't posess these boards and
cannot test them.
Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/input/serio/ambakmi.c | 2 | ||||
-rw-r--r-- | drivers/mmc/host/mmci.c | 2 | ||||
-rw-r--r-- | drivers/rtc/rtc-pl030.c | 2 | ||||
-rw-r--r-- | drivers/rtc/rtc-pl031.c | 3 | ||||
-rw-r--r-- | drivers/serial/amba-pl010.c | 2 | ||||
-rw-r--r-- | drivers/serial/amba-pl011.c | 2 | ||||
-rw-r--r-- | drivers/video/amba-clcd.c | 2 |
7 files changed, 7 insertions, 8 deletions
diff --git a/drivers/input/serio/ambakmi.c b/drivers/input/serio/ambakmi.c index a28c06d686e1..89b394183a75 100644 --- a/drivers/input/serio/ambakmi.c +++ b/drivers/input/serio/ambakmi.c | |||
@@ -135,7 +135,7 @@ static int amba_kmi_probe(struct amba_device *dev, struct amba_id *id) | |||
135 | io->dev.parent = &dev->dev; | 135 | io->dev.parent = &dev->dev; |
136 | 136 | ||
137 | kmi->io = io; | 137 | kmi->io = io; |
138 | kmi->base = ioremap(dev->res.start, KMI_SIZE); | 138 | kmi->base = ioremap(dev->res.start, resource_size(&dev->res)); |
139 | if (!kmi->base) { | 139 | if (!kmi->base) { |
140 | ret = -ENOMEM; | 140 | ret = -ENOMEM; |
141 | goto out; | 141 | goto out; |
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index 7d4febdab286..e1aa8471ab1c 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c | |||
@@ -546,7 +546,7 @@ static int __devinit mmci_probe(struct amba_device *dev, struct amba_id *id) | |||
546 | host->mclk = clk_get_rate(host->clk); | 546 | host->mclk = clk_get_rate(host->clk); |
547 | DBG(host, "eventual mclk rate: %u Hz\n", host->mclk); | 547 | DBG(host, "eventual mclk rate: %u Hz\n", host->mclk); |
548 | } | 548 | } |
549 | host->base = ioremap(dev->res.start, SZ_4K); | 549 | host->base = ioremap(dev->res.start, resource_size(&dev->res)); |
550 | if (!host->base) { | 550 | if (!host->base) { |
551 | ret = -ENOMEM; | 551 | ret = -ENOMEM; |
552 | goto clk_disable; | 552 | goto clk_disable; |
diff --git a/drivers/rtc/rtc-pl030.c b/drivers/rtc/rtc-pl030.c index aaf1f75fa293..457231bb1029 100644 --- a/drivers/rtc/rtc-pl030.c +++ b/drivers/rtc/rtc-pl030.c | |||
@@ -117,7 +117,7 @@ static int pl030_probe(struct amba_device *dev, struct amba_id *id) | |||
117 | goto err_rtc; | 117 | goto err_rtc; |
118 | } | 118 | } |
119 | 119 | ||
120 | rtc->base = ioremap(dev->res.start, SZ_4K); | 120 | rtc->base = ioremap(dev->res.start, resource_size(&dev->res)); |
121 | if (!rtc->base) { | 121 | if (!rtc->base) { |
122 | ret = -ENOMEM; | 122 | ret = -ENOMEM; |
123 | goto err_map; | 123 | goto err_map; |
diff --git a/drivers/rtc/rtc-pl031.c b/drivers/rtc/rtc-pl031.c index 451fc13784d1..f41873f98f66 100644 --- a/drivers/rtc/rtc-pl031.c +++ b/drivers/rtc/rtc-pl031.c | |||
@@ -142,8 +142,7 @@ static int pl031_probe(struct amba_device *adev, struct amba_id *id) | |||
142 | goto out; | 142 | goto out; |
143 | } | 143 | } |
144 | 144 | ||
145 | ldata->base = ioremap(adev->res.start, | 145 | ldata->base = ioremap(adev->res.start, resource_size(&adev->res)); |
146 | adev->res.end - adev->res.start + 1); | ||
147 | if (!ldata->base) { | 146 | if (!ldata->base) { |
148 | ret = -ENOMEM; | 147 | ret = -ENOMEM; |
149 | goto out_no_remap; | 148 | goto out_no_remap; |
diff --git a/drivers/serial/amba-pl010.c b/drivers/serial/amba-pl010.c index cdc049d4350f..58a4879c7e48 100644 --- a/drivers/serial/amba-pl010.c +++ b/drivers/serial/amba-pl010.c | |||
@@ -686,7 +686,7 @@ static int pl010_probe(struct amba_device *dev, struct amba_id *id) | |||
686 | goto out; | 686 | goto out; |
687 | } | 687 | } |
688 | 688 | ||
689 | base = ioremap(dev->res.start, PAGE_SIZE); | 689 | base = ioremap(dev->res.start, resource_size(&dev->res)); |
690 | if (!base) { | 690 | if (!base) { |
691 | ret = -ENOMEM; | 691 | ret = -ENOMEM; |
692 | goto free; | 692 | goto free; |
diff --git a/drivers/serial/amba-pl011.c b/drivers/serial/amba-pl011.c index 8c5bda27736c..bf82e28770a9 100644 --- a/drivers/serial/amba-pl011.c +++ b/drivers/serial/amba-pl011.c | |||
@@ -767,7 +767,7 @@ static int pl011_probe(struct amba_device *dev, struct amba_id *id) | |||
767 | goto out; | 767 | goto out; |
768 | } | 768 | } |
769 | 769 | ||
770 | base = ioremap(dev->res.start, PAGE_SIZE); | 770 | base = ioremap(dev->res.start, resource_size(&dev->res)); |
771 | if (!base) { | 771 | if (!base) { |
772 | ret = -ENOMEM; | 772 | ret = -ENOMEM; |
773 | goto free; | 773 | goto free; |
diff --git a/drivers/video/amba-clcd.c b/drivers/video/amba-clcd.c index d1f80bac54f0..fb8163d181ab 100644 --- a/drivers/video/amba-clcd.c +++ b/drivers/video/amba-clcd.c | |||
@@ -351,7 +351,7 @@ static int clcdfb_register(struct clcd_fb *fb) | |||
351 | } | 351 | } |
352 | 352 | ||
353 | fb->fb.fix.mmio_start = fb->dev->res.start; | 353 | fb->fb.fix.mmio_start = fb->dev->res.start; |
354 | fb->fb.fix.mmio_len = 4096; | 354 | fb->fb.fix.mmio_len = resource_size(&fb->dev->res); |
355 | 355 | ||
356 | fb->regs = ioremap(fb->fb.fix.mmio_start, fb->fb.fix.mmio_len); | 356 | fb->regs = ioremap(fb->fb.fix.mmio_start, fb->fb.fix.mmio_len); |
357 | if (!fb->regs) { | 357 | if (!fb->regs) { |