All of lore.kernel.org
 help / color / mirror / Atom feed
From: Samuel Ortiz <sameo@linux.intel.com>
To: H Hartley Sweeten <hartleys@visionengravers.com>
Cc: kernel list <linux-kernel@vger.kernel.org>,
	Ben Dooks <ben-linux@fluff.org>
Subject: Re: [PATCH] sm501.c: use resource_size()
Date: Tue, 5 Jan 2010 20:02:31 +0100	[thread overview]
Message-ID: <20100105190231.GG4274@sortiz.org> (raw)
In-Reply-To: <BD79186B4FD85F4B8E60E381CAEE190901FB1105@mi8nycmail19.Mi8.com>

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/

      reply	other threads:[~2010-01-05 19:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-11 23:55 [PATCH] sm501.c: use resource_size() H Hartley Sweeten
2010-01-05 19:02 ` Samuel Ortiz [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100105190231.GG4274@sortiz.org \
    --to=sameo@linux.intel.com \
    --cc=ben-linux@fluff.org \
    --cc=hartleys@visionengravers.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.