linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sm501.c: use resource_size()
@ 2009-12-11 23:55 H Hartley Sweeten
  2010-01-05 19:02 ` Samuel Ortiz
  0 siblings, 1 reply; 2+ messages in thread
From: H Hartley Sweeten @ 2009-12-11 23:55 UTC (permalink / raw)
  To: kernel list; +Cc: Ben Dooks, sameo

The requested memory region is smaller than the actual ioremap().
Use resource_size() to get the correct size.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ben Dooks <ben-linux@fluff.org>
Cc: Samuel Ortiz <sameo@linux.intel.com>

---

diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c
index 0cc5eef..dc9ea95 100644
--- a/drivers/mfd/sm501.c
+++ b/drivers/mfd/sm501.c
@@ -1430,7 +1430,7 @@ static int __devinit sm501_plat_probe(struct platform_device *dev)
 	}
 
 	sm->regs_claim = request_mem_region(sm->io_res->start,
-					    0x100, "sm501");
+					    resource_size(sm->io_res), "sm501");
 
 	if (sm->regs_claim == NULL) {
 		dev_err(&dev->dev, "cannot claim registers\n");
@@ -1440,8 +1440,7 @@ static int __devinit sm501_plat_probe(struct platform_device *dev)
 
 	platform_set_drvdata(dev, sm);
 
-	sm->regs = ioremap(sm->io_res->start,
-			   (sm->io_res->end - sm->io_res->start) - 1);
+	sm->regs = ioremap(sm->io_res->start, resource_size(sm->io_res));
 
 	if (sm->regs == NULL) {
 		dev_err(&dev->dev, "cannot remap registers\n");
@@ -1645,7 +1644,7 @@ static int __devinit sm501_pci_probe(struct pci_dev *dev,
 	sm->mem_res = &dev->resource[0];
 
 	sm->regs_claim = request_mem_region(sm->io_res->start,
-					    0x100, "sm501");
+					    resource_size(sm->io_res), "sm501");
 	if (sm->regs_claim == NULL) {
 		dev_err(&dev->dev, "cannot claim registers\n");
 		err= -EBUSY; 

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] sm501.c: use resource_size()
  2009-12-11 23:55 [PATCH] sm501.c: use resource_size() H Hartley Sweeten
@ 2010-01-05 19:02 ` Samuel Ortiz
  0 siblings, 0 replies; 2+ messages in thread
From: Samuel Ortiz @ 2010-01-05 19:02 UTC (permalink / raw)
  To: H Hartley Sweeten; +Cc: kernel list, Ben Dooks

On Fri, Dec 11, 2009 at 06:55:41PM -0500, H Hartley Sweeten wrote:
> The requested memory region is smaller than the actual ioremap().
> Use resource_size() to get the correct size.
Patch applied, thanks.

 
> Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
> Cc: Ben Dooks <ben-linux@fluff.org>
> Cc: Samuel Ortiz <sameo@linux.intel.com>
> 
> ---
> 
> diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c
> index 0cc5eef..dc9ea95 100644
> --- a/drivers/mfd/sm501.c
> +++ b/drivers/mfd/sm501.c
> @@ -1430,7 +1430,7 @@ static int __devinit sm501_plat_probe(struct platform_device *dev)
>  	}
>  
>  	sm->regs_claim = request_mem_region(sm->io_res->start,
> -					    0x100, "sm501");
> +					    resource_size(sm->io_res), "sm501");
>  
>  	if (sm->regs_claim == NULL) {
>  		dev_err(&dev->dev, "cannot claim registers\n");
> @@ -1440,8 +1440,7 @@ static int __devinit sm501_plat_probe(struct platform_device *dev)
>  
>  	platform_set_drvdata(dev, sm);
>  
> -	sm->regs = ioremap(sm->io_res->start,
> -			   (sm->io_res->end - sm->io_res->start) - 1);
> +	sm->regs = ioremap(sm->io_res->start, resource_size(sm->io_res));
>  
>  	if (sm->regs == NULL) {
>  		dev_err(&dev->dev, "cannot remap registers\n");
> @@ -1645,7 +1644,7 @@ static int __devinit sm501_pci_probe(struct pci_dev *dev,
>  	sm->mem_res = &dev->resource[0];
>  
>  	sm->regs_claim = request_mem_region(sm->io_res->start,
> -					    0x100, "sm501");
> +					    resource_size(sm->io_res), "sm501");
>  	if (sm->regs_claim == NULL) {
>  		dev_err(&dev->dev, "cannot claim registers\n");
>  		err= -EBUSY; 

-- 
Intel Open Source Technology Centre
http://oss.intel.com/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-01-05 19:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-11 23:55 [PATCH] sm501.c: use resource_size() H Hartley Sweeten
2010-01-05 19:02 ` Samuel Ortiz

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).