diff options
author | H Hartley Sweeten <hartleys@visionengravers.com> | 2010-01-05 13:55:54 -0500 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2010-03-07 16:16:52 -0500 |
commit | 311e54c07e784fe63d421f724dcc597d1f82ccad (patch) | |
tree | efcf5179a18bc9082930386a4a022974b9f54b47 /drivers/mfd | |
parent | 08b8499bdd26822df16f962db88215d02e40850a (diff) |
mfd: Use resource_size() in sm501
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>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd')
-rw-r--r-- | drivers/mfd/sm501.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c index 0cc5eeff5ee8..dc9ea95c0561 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) | |||
1430 | } | 1430 | } |
1431 | 1431 | ||
1432 | sm->regs_claim = request_mem_region(sm->io_res->start, | 1432 | sm->regs_claim = request_mem_region(sm->io_res->start, |
1433 | 0x100, "sm501"); | 1433 | resource_size(sm->io_res), "sm501"); |
1434 | 1434 | ||
1435 | if (sm->regs_claim == NULL) { | 1435 | if (sm->regs_claim == NULL) { |
1436 | dev_err(&dev->dev, "cannot claim registers\n"); | 1436 | dev_err(&dev->dev, "cannot claim registers\n"); |
@@ -1440,8 +1440,7 @@ static int __devinit sm501_plat_probe(struct platform_device *dev) | |||
1440 | 1440 | ||
1441 | platform_set_drvdata(dev, sm); | 1441 | platform_set_drvdata(dev, sm); |
1442 | 1442 | ||
1443 | sm->regs = ioremap(sm->io_res->start, | 1443 | sm->regs = ioremap(sm->io_res->start, resource_size(sm->io_res)); |
1444 | (sm->io_res->end - sm->io_res->start) - 1); | ||
1445 | 1444 | ||
1446 | if (sm->regs == NULL) { | 1445 | if (sm->regs == NULL) { |
1447 | dev_err(&dev->dev, "cannot remap registers\n"); | 1446 | dev_err(&dev->dev, "cannot remap registers\n"); |
@@ -1645,7 +1644,7 @@ static int __devinit sm501_pci_probe(struct pci_dev *dev, | |||
1645 | sm->mem_res = &dev->resource[0]; | 1644 | sm->mem_res = &dev->resource[0]; |
1646 | 1645 | ||
1647 | sm->regs_claim = request_mem_region(sm->io_res->start, | 1646 | sm->regs_claim = request_mem_region(sm->io_res->start, |
1648 | 0x100, "sm501"); | 1647 | resource_size(sm->io_res), "sm501"); |
1649 | if (sm->regs_claim == NULL) { | 1648 | if (sm->regs_claim == NULL) { |
1650 | dev_err(&dev->dev, "cannot claim registers\n"); | 1649 | dev_err(&dev->dev, "cannot claim registers\n"); |
1651 | err= -EBUSY; | 1650 | err= -EBUSY; |