diff options
author | Thierry Reding <thierry.reding@avionic-design.de> | 2013-01-21 05:09:14 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-01-22 14:41:57 -0500 |
commit | 9e0c1fb29a7c257a31c321c2437617b6b4d66168 (patch) | |
tree | ee0b93ff33eb3156339a1e72411c8bbad0c8c415 /drivers/pinctrl | |
parent | 1684789f86cbd6a1aff82970992c711898b19995 (diff) |
pinctrl: 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>
Cc: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/pinctrl')
-rw-r--r-- | drivers/pinctrl/pinctrl-at91.c | 7 | ||||
-rw-r--r-- | drivers/pinctrl/pinctrl-bcm2835.c | 6 | ||||
-rw-r--r-- | drivers/pinctrl/pinctrl-coh901.c | 8 | ||||
-rw-r--r-- | drivers/pinctrl/pinctrl-exynos5440.c | 8 | ||||
-rw-r--r-- | drivers/pinctrl/pinctrl-falcon.c | 13 | ||||
-rw-r--r-- | drivers/pinctrl/pinctrl-imx.c | 6 | ||||
-rw-r--r-- | drivers/pinctrl/pinctrl-nomadik.c | 6 | ||||
-rw-r--r-- | drivers/pinctrl/pinctrl-pxa3xx.c | 7 | ||||
-rw-r--r-- | drivers/pinctrl/pinctrl-samsung.c | 8 | ||||
-rw-r--r-- | drivers/pinctrl/pinctrl-u300.c | 6 | ||||
-rw-r--r-- | drivers/pinctrl/pinctrl-xway.c | 9 | ||||
-rw-r--r-- | drivers/pinctrl/spear/pinctrl-plgpio.c | 8 |
12 files changed, 40 insertions, 52 deletions
diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c index 471c71f7f8b6..75933a6aa828 100644 --- a/drivers/pinctrl/pinctrl-at91.c +++ b/drivers/pinctrl/pinctrl-at91.c | |||
@@ -1503,10 +1503,9 @@ static int at91_gpio_probe(struct platform_device *pdev) | |||
1503 | goto err; | 1503 | goto err; |
1504 | } | 1504 | } |
1505 | 1505 | ||
1506 | at91_chip->regbase = devm_request_and_ioremap(&pdev->dev, res); | 1506 | at91_chip->regbase = devm_ioremap_resource(&pdev->dev, res); |
1507 | if (!at91_chip->regbase) { | 1507 | if (IS_ERR(at91_chip->regbase)) { |
1508 | dev_err(&pdev->dev, "failed to map registers, ignoring.\n"); | 1508 | ret = PTR_ERR(at91_chip->regbase); |
1509 | ret = -EBUSY; | ||
1510 | goto err; | 1509 | goto err; |
1511 | } | 1510 | } |
1512 | 1511 | ||
diff --git a/drivers/pinctrl/pinctrl-bcm2835.c b/drivers/pinctrl/pinctrl-bcm2835.c index d347b9f2eae3..4eb6d2c4e4df 100644 --- a/drivers/pinctrl/pinctrl-bcm2835.c +++ b/drivers/pinctrl/pinctrl-bcm2835.c | |||
@@ -959,9 +959,9 @@ static int bcm2835_pinctrl_probe(struct platform_device *pdev) | |||
959 | return err; | 959 | return err; |
960 | } | 960 | } |
961 | 961 | ||
962 | pc->base = devm_request_and_ioremap(dev, &iomem); | 962 | pc->base = devm_ioremap_resource(dev, &iomem); |
963 | if (!pc->base) | 963 | if (IS_ERR(pc->base)) |
964 | return -EADDRNOTAVAIL; | 964 | return PTR_ERR(pc->base); |
965 | 965 | ||
966 | pc->gpio_chip = bcm2835_gpio_chip; | 966 | pc->gpio_chip = bcm2835_gpio_chip; |
967 | pc->gpio_chip.dev = dev; | 967 | pc->gpio_chip.dev = dev; |
diff --git a/drivers/pinctrl/pinctrl-coh901.c b/drivers/pinctrl/pinctrl-coh901.c index fbb37154471c..8b7e7bc2226b 100644 --- a/drivers/pinctrl/pinctrl-coh901.c +++ b/drivers/pinctrl/pinctrl-coh901.c | |||
@@ -715,11 +715,9 @@ static int __init u300_gpio_probe(struct platform_device *pdev) | |||
715 | return -ENODEV; | 715 | return -ENODEV; |
716 | } | 716 | } |
717 | 717 | ||
718 | gpio->base = devm_request_and_ioremap(&pdev->dev, memres); | 718 | gpio->base = devm_ioremap_resource(&pdev->dev, memres); |
719 | if (!gpio->base) { | 719 | if (IS_ERR(gpio->base)) |
720 | dev_err(gpio->dev, "could not get remap memory\n"); | 720 | return PTR_ERR(gpio->base); |
721 | return -ENOMEM; | ||
722 | } | ||
723 | 721 | ||
724 | gpio->clk = devm_clk_get(gpio->dev, NULL); | 722 | gpio->clk = devm_clk_get(gpio->dev, NULL); |
725 | if (IS_ERR(gpio->clk)) { | 723 | if (IS_ERR(gpio->clk)) { |
diff --git a/drivers/pinctrl/pinctrl-exynos5440.c b/drivers/pinctrl/pinctrl-exynos5440.c index de05b64f0da6..5e77242cb0db 100644 --- a/drivers/pinctrl/pinctrl-exynos5440.c +++ b/drivers/pinctrl/pinctrl-exynos5440.c | |||
@@ -866,11 +866,9 @@ static int exynos5440_pinctrl_probe(struct platform_device *pdev) | |||
866 | return -ENOENT; | 866 | return -ENOENT; |
867 | } | 867 | } |
868 | 868 | ||
869 | priv->reg_base = devm_request_and_ioremap(&pdev->dev, res); | 869 | priv->reg_base = devm_ioremap_resource(&pdev->dev, res); |
870 | if (!priv->reg_base) { | 870 | if (IS_ERR(priv->reg_base)) |
871 | dev_err(dev, "ioremap failed\n"); | 871 | return PTR_ERR(priv->reg_base); |
872 | return -ENODEV; | ||
873 | } | ||
874 | 872 | ||
875 | ret = exynos5440_gpiolib_register(pdev, priv); | 873 | ret = exynos5440_gpiolib_register(pdev, priv); |
876 | if (ret) | 874 | if (ret) |
diff --git a/drivers/pinctrl/pinctrl-falcon.c b/drivers/pinctrl/pinctrl-falcon.c index 8ed20e84cb02..a5d9d562d966 100644 --- a/drivers/pinctrl/pinctrl-falcon.c +++ b/drivers/pinctrl/pinctrl-falcon.c | |||
@@ -411,14 +411,11 @@ static int pinctrl_falcon_probe(struct platform_device *pdev) | |||
411 | dev_err(&ppdev->dev, "failed to get clock\n"); | 411 | dev_err(&ppdev->dev, "failed to get clock\n"); |
412 | return PTR_ERR(falcon_info.clk[*bank]); | 412 | return PTR_ERR(falcon_info.clk[*bank]); |
413 | } | 413 | } |
414 | falcon_info.membase[*bank] = | 414 | falcon_info.membase[*bank] = devm_ioremap_resource(&pdev->dev, |
415 | devm_request_and_ioremap(&pdev->dev, &res); | 415 | &res); |
416 | if (!falcon_info.membase[*bank]) { | 416 | if (IS_ERR(falcon_info.membase[*bank])) |
417 | dev_err(&pdev->dev, | 417 | return PTR_ERR(falcon_info.membase[*bank]); |
418 | "Failed to remap memory for bank %d\n", | 418 | |
419 | *bank); | ||
420 | return -ENOMEM; | ||
421 | } | ||
422 | avail = pad_r32(falcon_info.membase[*bank], | 419 | avail = pad_r32(falcon_info.membase[*bank], |
423 | LTQ_PADC_AVAIL); | 420 | LTQ_PADC_AVAIL); |
424 | pins = fls(avail); | 421 | pins = fls(avail); |
diff --git a/drivers/pinctrl/pinctrl-imx.c b/drivers/pinctrl/pinctrl-imx.c index 43a6f1ffc786..4cebb9c6c5c5 100644 --- a/drivers/pinctrl/pinctrl-imx.c +++ b/drivers/pinctrl/pinctrl-imx.c | |||
@@ -584,9 +584,9 @@ int imx_pinctrl_probe(struct platform_device *pdev, | |||
584 | if (!res) | 584 | if (!res) |
585 | return -ENOENT; | 585 | return -ENOENT; |
586 | 586 | ||
587 | ipctl->base = devm_request_and_ioremap(&pdev->dev, res); | 587 | ipctl->base = devm_ioremap_resource(&pdev->dev, res); |
588 | if (!ipctl->base) | 588 | if (IS_ERR(ipctl->base)) |
589 | return -EBUSY; | 589 | return PTR_ERR(ipctl->base); |
590 | 590 | ||
591 | imx_pinctrl_desc.name = dev_name(&pdev->dev); | 591 | imx_pinctrl_desc.name = dev_name(&pdev->dev); |
592 | imx_pinctrl_desc.pins = info->pins; | 592 | imx_pinctrl_desc.pins = info->pins; |
diff --git a/drivers/pinctrl/pinctrl-nomadik.c b/drivers/pinctrl/pinctrl-nomadik.c index 1bb16ffb4e41..96e7cfbbce6d 100644 --- a/drivers/pinctrl/pinctrl-nomadik.c +++ b/drivers/pinctrl/pinctrl-nomadik.c | |||
@@ -1367,9 +1367,9 @@ static int nmk_gpio_probe(struct platform_device *dev) | |||
1367 | goto out; | 1367 | goto out; |
1368 | } | 1368 | } |
1369 | 1369 | ||
1370 | base = devm_request_and_ioremap(&dev->dev, res); | 1370 | base = devm_ioremap_resource(&dev->dev, res); |
1371 | if (!base) { | 1371 | if (IS_ERR(base)) { |
1372 | ret = -ENOMEM; | 1372 | ret = PTR_ERR(base); |
1373 | goto out; | 1373 | goto out; |
1374 | } | 1374 | } |
1375 | 1375 | ||
diff --git a/drivers/pinctrl/pinctrl-pxa3xx.c b/drivers/pinctrl/pinctrl-pxa3xx.c index 51f8a388b917..1f49bb02a6af 100644 --- a/drivers/pinctrl/pinctrl-pxa3xx.c +++ b/drivers/pinctrl/pinctrl-pxa3xx.c | |||
@@ -11,6 +11,7 @@ | |||
11 | * | 11 | * |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <linux/err.h> | ||
14 | #include <linux/module.h> | 15 | #include <linux/module.h> |
15 | #include <linux/device.h> | 16 | #include <linux/device.h> |
16 | #include <linux/io.h> | 17 | #include <linux/io.h> |
@@ -187,9 +188,9 @@ int pxa3xx_pinctrl_register(struct platform_device *pdev, | |||
187 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 188 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
188 | if (!res) | 189 | if (!res) |
189 | return -ENOENT; | 190 | return -ENOENT; |
190 | info->virt_base = devm_request_and_ioremap(&pdev->dev, res); | 191 | info->virt_base = devm_ioremap_resource(&pdev->dev, res); |
191 | if (!info->virt_base) | 192 | if (IS_ERR(info->virt_base)) |
192 | return -ENOMEM; | 193 | return PTR_ERR(info->virt_base); |
193 | info->pctrl = pinctrl_register(desc, &pdev->dev, info); | 194 | info->pctrl = pinctrl_register(desc, &pdev->dev, info); |
194 | if (!info->pctrl) { | 195 | if (!info->pctrl) { |
195 | dev_err(&pdev->dev, "failed to register PXA pinmux driver\n"); | 196 | dev_err(&pdev->dev, "failed to register PXA pinmux driver\n"); |
diff --git a/drivers/pinctrl/pinctrl-samsung.c b/drivers/pinctrl/pinctrl-samsung.c index fd7b24cd8908..7e6669cfa58f 100644 --- a/drivers/pinctrl/pinctrl-samsung.c +++ b/drivers/pinctrl/pinctrl-samsung.c | |||
@@ -917,11 +917,9 @@ static int samsung_pinctrl_probe(struct platform_device *pdev) | |||
917 | return -ENOENT; | 917 | return -ENOENT; |
918 | } | 918 | } |
919 | 919 | ||
920 | drvdata->virt_base = devm_request_and_ioremap(&pdev->dev, res); | 920 | drvdata->virt_base = devm_ioremap_resource(&pdev->dev, res); |
921 | if (!drvdata->virt_base) { | 921 | if (IS_ERR(drvdata->virt_base)) |
922 | dev_err(dev, "ioremap failed\n"); | 922 | return PTR_ERR(drvdata->virt_base); |
923 | return -ENODEV; | ||
924 | } | ||
925 | 923 | ||
926 | res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); | 924 | res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); |
927 | if (res) | 925 | if (res) |
diff --git a/drivers/pinctrl/pinctrl-u300.c b/drivers/pinctrl/pinctrl-u300.c index 718ec5762683..2b5772550836 100644 --- a/drivers/pinctrl/pinctrl-u300.c +++ b/drivers/pinctrl/pinctrl-u300.c | |||
@@ -1078,9 +1078,9 @@ static int u300_pmx_probe(struct platform_device *pdev) | |||
1078 | if (!res) | 1078 | if (!res) |
1079 | return -ENOENT; | 1079 | return -ENOENT; |
1080 | 1080 | ||
1081 | upmx->virtbase = devm_request_and_ioremap(&pdev->dev, res); | 1081 | upmx->virtbase = devm_ioremap_resource(&pdev->dev, res); |
1082 | if (!upmx->virtbase) | 1082 | if (IS_ERR(upmx->virtbase)) |
1083 | return -ENOMEM; | 1083 | return PTR_ERR(upmx->virtbase); |
1084 | 1084 | ||
1085 | upmx->pctl = pinctrl_register(&u300_pmx_desc, &pdev->dev, upmx); | 1085 | upmx->pctl = pinctrl_register(&u300_pmx_desc, &pdev->dev, upmx); |
1086 | if (!upmx->pctl) { | 1086 | if (!upmx->pctl) { |
diff --git a/drivers/pinctrl/pinctrl-xway.c b/drivers/pinctrl/pinctrl-xway.c index 5f0eb04c2336..ae8f3a02ed97 100644 --- a/drivers/pinctrl/pinctrl-xway.c +++ b/drivers/pinctrl/pinctrl-xway.c | |||
@@ -9,6 +9,7 @@ | |||
9 | * Copyright (C) 2012 John Crispin <blogic@openwrt.org> | 9 | * Copyright (C) 2012 John Crispin <blogic@openwrt.org> |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/err.h> | ||
12 | #include <linux/slab.h> | 13 | #include <linux/slab.h> |
13 | #include <linux/module.h> | 14 | #include <linux/module.h> |
14 | #include <linux/of_platform.h> | 15 | #include <linux/of_platform.h> |
@@ -687,11 +688,9 @@ static int pinmux_xway_probe(struct platform_device *pdev) | |||
687 | dev_err(&pdev->dev, "Failed to get resource\n"); | 688 | dev_err(&pdev->dev, "Failed to get resource\n"); |
688 | return -ENOENT; | 689 | return -ENOENT; |
689 | } | 690 | } |
690 | xway_info.membase[0] = devm_request_and_ioremap(&pdev->dev, res); | 691 | xway_info.membase[0] = devm_ioremap_resource(&pdev->dev, res); |
691 | if (!xway_info.membase[0]) { | 692 | if (IS_ERR(xway_info.membase[0])) |
692 | dev_err(&pdev->dev, "Failed to remap resource\n"); | 693 | return PTR_ERR(xway_info.membase[0]); |
693 | return -ENOMEM; | ||
694 | } | ||
695 | 694 | ||
696 | match = of_match_device(xway_match, &pdev->dev); | 695 | match = of_match_device(xway_match, &pdev->dev); |
697 | if (match) | 696 | if (match) |
diff --git a/drivers/pinctrl/spear/pinctrl-plgpio.c b/drivers/pinctrl/spear/pinctrl-plgpio.c index 3cf4ecd9302c..295b349a05cf 100644 --- a/drivers/pinctrl/spear/pinctrl-plgpio.c +++ b/drivers/pinctrl/spear/pinctrl-plgpio.c | |||
@@ -540,11 +540,9 @@ static int plgpio_probe(struct platform_device *pdev) | |||
540 | return -ENOMEM; | 540 | return -ENOMEM; |
541 | } | 541 | } |
542 | 542 | ||
543 | plgpio->base = devm_request_and_ioremap(&pdev->dev, res); | 543 | plgpio->base = devm_ioremap_resource(&pdev->dev, res); |
544 | if (!plgpio->base) { | 544 | if (IS_ERR(plgpio->base)) |
545 | dev_err(&pdev->dev, "request and ioremap fail\n"); | 545 | return PTR_ERR(plgpio->base); |
546 | return -ENOMEM; | ||
547 | } | ||
548 | 546 | ||
549 | ret = plgpio_probe_dt(pdev, plgpio); | 547 | ret = plgpio_probe_dt(pdev, plgpio); |
550 | if (ret) { | 548 | if (ret) { |