treewide: Convert uses of struct resource to resource_size(ptr)
Several fixes as well where the +1 was missing. Done via coccinelle scripts like: @@ struct resource *ptr; @@ - ptr->end - ptr->start + 1 + resource_size(ptr) and some grep and typing. Mostly uncompiled, no cross-compilers. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This commit is contained in:
@@ -223,7 +223,7 @@ static int __init at32_rtc_probe(struct platform_device *pdev)
|
||||
}
|
||||
|
||||
rtc->irq = irq;
|
||||
rtc->regs = ioremap(regs->start, regs->end - regs->start + 1);
|
||||
rtc->regs = ioremap(regs->start, resource_size(regs));
|
||||
if (!rtc->regs) {
|
||||
ret = -ENOMEM;
|
||||
dev_dbg(&pdev->dev, "could not map I/O memory\n");
|
||||
|
@@ -606,7 +606,7 @@ cmos_do_probe(struct device *dev, struct resource *ports, int rtc_irq)
|
||||
* (needing ioremap etc), not i/o space resources like this ...
|
||||
*/
|
||||
ports = request_region(ports->start,
|
||||
ports->end + 1 - ports->start,
|
||||
resource_size(ports),
|
||||
driver_name);
|
||||
if (!ports) {
|
||||
dev_dbg(dev, "i/o registers already in use\n");
|
||||
@@ -750,7 +750,7 @@ cleanup1:
|
||||
cmos_rtc.dev = NULL;
|
||||
rtc_device_unregister(cmos_rtc.rtc);
|
||||
cleanup0:
|
||||
release_region(ports->start, ports->end + 1 - ports->start);
|
||||
release_region(ports->start, resource_size(ports));
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -779,7 +779,7 @@ static void __exit cmos_do_remove(struct device *dev)
|
||||
cmos->rtc = NULL;
|
||||
|
||||
ports = cmos->iomem;
|
||||
release_region(ports->start, ports->end + 1 - ports->start);
|
||||
release_region(ports->start, resource_size(ports));
|
||||
cmos->iomem = NULL;
|
||||
|
||||
cmos->dev = NULL;
|
||||
|
@@ -343,7 +343,7 @@ static int __devinit ds1286_probe(struct platform_device *pdev)
|
||||
if (!priv)
|
||||
return -ENOMEM;
|
||||
|
||||
priv->size = res->end - res->start + 1;
|
||||
priv->size = resource_size(res);
|
||||
if (!request_mem_region(res->start, priv->size, pdev->name)) {
|
||||
ret = -EBUSY;
|
||||
goto out;
|
||||
|
@@ -490,7 +490,7 @@ ds1511_rtc_probe(struct platform_device *pdev)
|
||||
pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
|
||||
if (!pdata)
|
||||
return -ENOMEM;
|
||||
pdata->size = res->end - res->start + 1;
|
||||
pdata->size = resource_size(res);
|
||||
if (!devm_request_mem_region(&pdev->dev, res->start, pdata->size,
|
||||
pdev->name))
|
||||
return -EBUSY;
|
||||
|
@@ -173,7 +173,7 @@ static int __devinit ds1742_rtc_probe(struct platform_device *pdev)
|
||||
pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
|
||||
if (!pdata)
|
||||
return -ENOMEM;
|
||||
pdata->size = res->end - res->start + 1;
|
||||
pdata->size = resource_size(res);
|
||||
if (!devm_request_mem_region(&pdev->dev, res->start, pdata->size,
|
||||
pdev->name))
|
||||
return -EBUSY;
|
||||
|
@@ -154,7 +154,7 @@ static int __devinit m48t35_probe(struct platform_device *pdev)
|
||||
if (!priv)
|
||||
return -ENOMEM;
|
||||
|
||||
priv->size = res->end - res->start + 1;
|
||||
priv->size = resource_size(res);
|
||||
/*
|
||||
* kludge: remove the #ifndef after ioc3 resource
|
||||
* conflicts are resolved
|
||||
|
@@ -433,7 +433,7 @@ static int __devinit m48t59_rtc_probe(struct platform_device *pdev)
|
||||
|
||||
if (!m48t59->ioaddr) {
|
||||
/* ioaddr not mapped externally */
|
||||
m48t59->ioaddr = ioremap(res->start, res->end - res->start + 1);
|
||||
m48t59->ioaddr = ioremap(res->start, resource_size(res));
|
||||
if (!m48t59->ioaddr)
|
||||
goto out;
|
||||
}
|
||||
|
@@ -332,9 +332,8 @@ vrtc_mrst_do_probe(struct device *dev, struct resource *iomem, int rtc_irq)
|
||||
if (!iomem)
|
||||
return -ENODEV;
|
||||
|
||||
iomem = request_mem_region(iomem->start,
|
||||
iomem->end + 1 - iomem->start,
|
||||
driver_name);
|
||||
iomem = request_mem_region(iomem->start, resource_size(iomem),
|
||||
driver_name);
|
||||
if (!iomem) {
|
||||
dev_dbg(dev, "i/o mem already in use.\n");
|
||||
return -EBUSY;
|
||||
|
@@ -267,9 +267,8 @@ static int puv3_rtc_probe(struct platform_device *pdev)
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
puv3_rtc_mem = request_mem_region(res->start,
|
||||
res->end-res->start+1,
|
||||
pdev->name);
|
||||
puv3_rtc_mem = request_mem_region(res->start, resource_size(res),
|
||||
pdev->name);
|
||||
|
||||
if (puv3_rtc_mem == NULL) {
|
||||
dev_err(&pdev->dev, "failed to reserve memory region\n");
|
||||
|
@@ -455,8 +455,7 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev)
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
s3c_rtc_mem = request_mem_region(res->start,
|
||||
res->end-res->start+1,
|
||||
s3c_rtc_mem = request_mem_region(res->start, resource_size(res),
|
||||
pdev->name);
|
||||
|
||||
if (s3c_rtc_mem == NULL) {
|
||||
@@ -465,7 +464,7 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev)
|
||||
goto err_nores;
|
||||
}
|
||||
|
||||
s3c_rtc_base = ioremap(res->start, res->end - res->start + 1);
|
||||
s3c_rtc_base = ioremap(res->start, resource_size(res));
|
||||
if (s3c_rtc_base == NULL) {
|
||||
dev_err(&pdev->dev, "failed ioremap()\n");
|
||||
ret = -EINVAL;
|
||||
|
Reference in New Issue
Block a user