diff options
author | Thierry Reding <thierry.reding@avionic-design.de> | 2013-01-21 05:09:19 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-01-22 14:41:57 -0500 |
commit | 97f4be60178fec663baaa30a09ae102fd33373c2 (patch) | |
tree | 672ee4161bc389ec4840c413e4609ee779edba84 | |
parent | 8cbce1e5f00ec68ee1c99f57db98c892db227629 (diff) |
staging: Convert to devm_ioremap_resource()
Convert all uses of devm_request_and_ioremap() to the newly introduced
devm_ioremap_resource() which provides more consistent error handling.
devm_ioremap_resource() provides its own error messages so all explicit
error messages can be removed from the failure code paths.
Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/iio/adc/mxs-lradc.c | 7 | ||||
-rw-r--r-- | drivers/staging/nvec/nvec.c | 8 | ||||
-rw-r--r-- | drivers/staging/omap-thermal/omap-bandgap.c | 11 |
3 files changed, 11 insertions, 15 deletions
diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c index fb31b457a56a..1c7d2eb7b0e5 100644 --- a/drivers/staging/iio/adc/mxs-lradc.c +++ b/drivers/staging/iio/adc/mxs-lradc.c | |||
@@ -15,6 +15,7 @@ | |||
15 | * GNU General Public License for more details. | 15 | * GNU General Public License for more details. |
16 | */ | 16 | */ |
17 | 17 | ||
18 | #include <linux/err.h> | ||
18 | #include <linux/interrupt.h> | 19 | #include <linux/interrupt.h> |
19 | #include <linux/device.h> | 20 | #include <linux/device.h> |
20 | #include <linux/kernel.h> | 21 | #include <linux/kernel.h> |
@@ -487,9 +488,9 @@ static int mxs_lradc_probe(struct platform_device *pdev) | |||
487 | /* Grab the memory area */ | 488 | /* Grab the memory area */ |
488 | iores = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 489 | iores = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
489 | lradc->dev = &pdev->dev; | 490 | lradc->dev = &pdev->dev; |
490 | lradc->base = devm_request_and_ioremap(dev, iores); | 491 | lradc->base = devm_ioremap_resource(dev, iores); |
491 | if (!lradc->base) { | 492 | if (IS_ERR(lradc->base)) { |
492 | ret = -EADDRNOTAVAIL; | 493 | ret = PTR_ERR(lradc->base); |
493 | goto err_addr; | 494 | goto err_addr; |
494 | } | 495 | } |
495 | 496 | ||
diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c index 2830946860d1..492e0b61f1e7 100644 --- a/drivers/staging/nvec/nvec.c +++ b/drivers/staging/nvec/nvec.c | |||
@@ -759,11 +759,9 @@ static int tegra_nvec_probe(struct platform_device *pdev) | |||
759 | return -ENODEV; | 759 | return -ENODEV; |
760 | } | 760 | } |
761 | 761 | ||
762 | base = devm_request_and_ioremap(&pdev->dev, res); | 762 | base = devm_ioremap_resource(&pdev->dev, res); |
763 | if (!base) { | 763 | if (IS_ERR(base)) |
764 | dev_err(&pdev->dev, "Can't ioremap I2C region\n"); | 764 | return PTR_ERR(base); |
765 | return -ENOMEM; | ||
766 | } | ||
767 | 765 | ||
768 | res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); | 766 | res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); |
769 | if (!res) { | 767 | if (!res) { |
diff --git a/drivers/staging/omap-thermal/omap-bandgap.c b/drivers/staging/omap-thermal/omap-bandgap.c index 8346e3450f83..21fd91bf97b5 100644 --- a/drivers/staging/omap-thermal/omap-bandgap.c +++ b/drivers/staging/omap-thermal/omap-bandgap.c | |||
@@ -820,15 +820,12 @@ static struct omap_bandgap *omap_bandgap_build(struct platform_device *pdev) | |||
820 | res = platform_get_resource(pdev, IORESOURCE_MEM, i); | 820 | res = platform_get_resource(pdev, IORESOURCE_MEM, i); |
821 | if (!res) | 821 | if (!res) |
822 | break; | 822 | break; |
823 | chunk = devm_request_and_ioremap(&pdev->dev, res); | 823 | chunk = devm_ioremap_resource(&pdev->dev, res); |
824 | if (i == 0) | 824 | if (i == 0) |
825 | bg_ptr->base = chunk; | 825 | bg_ptr->base = chunk; |
826 | if (!chunk) { | 826 | if (IS_ERR(chunk)) |
827 | dev_err(&pdev->dev, | 827 | return ERR_CAST(chunk); |
828 | "failed to request the IO (%d:%pR).\n", | 828 | |
829 | i, res); | ||
830 | return ERR_PTR(-EADDRNOTAVAIL); | ||
831 | } | ||
832 | i++; | 829 | i++; |
833 | } while (res); | 830 | } while (res); |
834 | 831 | ||