diff options
author | Thierry Reding <thierry.reding@avionic-design.de> | 2013-01-21 05:09:12 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-01-25 15:21:47 -0500 |
commit | b0de774c6334dccdcd43a7ef46155a1f3a52a954 (patch) | |
tree | d845a8ea2c8f5d556591829ec1829f216ad0cbb1 /drivers/mtd/nand | |
parent | a3e2cd7f24ba7521169943ace3d14b567487ea29 (diff) |
mtd: 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: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/mtd/nand')
-rw-r--r-- | drivers/mtd/nand/fsmc_nand.c | 33 | ||||
-rw-r--r-- | drivers/mtd/nand/lpc32xx_mlc.c | 9 | ||||
-rw-r--r-- | drivers/mtd/nand/lpc32xx_slc.c | 8 | ||||
-rw-r--r-- | drivers/mtd/nand/mxc_nand.c | 12 | ||||
-rw-r--r-- | drivers/mtd/nand/s3c2410.c | 7 | ||||
-rw-r--r-- | drivers/mtd/nand/txx9ndfmc.c | 7 |
6 files changed, 33 insertions, 43 deletions
diff --git a/drivers/mtd/nand/fsmc_nand.c b/drivers/mtd/nand/fsmc_nand.c index 67e62d3d495c..c543cc09f193 100644 --- a/drivers/mtd/nand/fsmc_nand.c +++ b/drivers/mtd/nand/fsmc_nand.c | |||
@@ -937,42 +937,35 @@ static int __init fsmc_nand_probe(struct platform_device *pdev) | |||
937 | if (!res) | 937 | if (!res) |
938 | return -EINVAL; | 938 | return -EINVAL; |
939 | 939 | ||
940 | host->data_va = devm_request_and_ioremap(&pdev->dev, res); | 940 | host->data_va = devm_ioremap_resource(&pdev->dev, res); |
941 | if (!host->data_va) { | 941 | if (IS_ERR(host->data_va)) |
942 | dev_err(&pdev->dev, "data ioremap failed\n"); | 942 | return PTR_ERR(host->data_va); |
943 | return -ENOMEM; | 943 | |
944 | } | ||
945 | host->data_pa = (dma_addr_t)res->start; | 944 | host->data_pa = (dma_addr_t)res->start; |
946 | 945 | ||
947 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "nand_addr"); | 946 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "nand_addr"); |
948 | if (!res) | 947 | if (!res) |
949 | return -EINVAL; | 948 | return -EINVAL; |
950 | 949 | ||
951 | host->addr_va = devm_request_and_ioremap(&pdev->dev, res); | 950 | host->addr_va = devm_ioremap_resource(&pdev->dev, res); |
952 | if (!host->addr_va) { | 951 | if (IS_ERR(host->addr_va)) |
953 | dev_err(&pdev->dev, "ale ioremap failed\n"); | 952 | return PTR_ERR(host->addr_va); |
954 | return -ENOMEM; | ||
955 | } | ||
956 | 953 | ||
957 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "nand_cmd"); | 954 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "nand_cmd"); |
958 | if (!res) | 955 | if (!res) |
959 | return -EINVAL; | 956 | return -EINVAL; |
960 | 957 | ||
961 | host->cmd_va = devm_request_and_ioremap(&pdev->dev, res); | 958 | host->cmd_va = devm_ioremap_resource(&pdev->dev, res); |
962 | if (!host->cmd_va) { | 959 | if (IS_ERR(host->cmd_va)) |
963 | dev_err(&pdev->dev, "ale ioremap failed\n"); | 960 | return PTR_ERR(host->cmd_va); |
964 | return -ENOMEM; | ||
965 | } | ||
966 | 961 | ||
967 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "fsmc_regs"); | 962 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "fsmc_regs"); |
968 | if (!res) | 963 | if (!res) |
969 | return -EINVAL; | 964 | return -EINVAL; |
970 | 965 | ||
971 | host->regs_va = devm_request_and_ioremap(&pdev->dev, res); | 966 | host->regs_va = devm_ioremap_resource(&pdev->dev, res); |
972 | if (!host->regs_va) { | 967 | if (IS_ERR(host->regs_va)) |
973 | dev_err(&pdev->dev, "regs ioremap failed\n"); | 968 | return PTR_ERR(host->regs_va); |
974 | return -ENOMEM; | ||
975 | } | ||
976 | 969 | ||
977 | host->clk = clk_get(&pdev->dev, NULL); | 970 | host->clk = clk_get(&pdev->dev, NULL); |
978 | if (IS_ERR(host->clk)) { | 971 | if (IS_ERR(host->clk)) { |
diff --git a/drivers/mtd/nand/lpc32xx_mlc.c b/drivers/mtd/nand/lpc32xx_mlc.c index f182befa7360..0ca22ae9135c 100644 --- a/drivers/mtd/nand/lpc32xx_mlc.c +++ b/drivers/mtd/nand/lpc32xx_mlc.c | |||
@@ -677,11 +677,10 @@ static int lpc32xx_nand_probe(struct platform_device *pdev) | |||
677 | return -ENXIO; | 677 | return -ENXIO; |
678 | } | 678 | } |
679 | 679 | ||
680 | host->io_base = devm_request_and_ioremap(&pdev->dev, rc); | 680 | host->io_base = devm_ioremap_resource(&pdev->dev, rc); |
681 | if (host->io_base == NULL) { | 681 | if (IS_ERR(host->io_base)) |
682 | dev_err(&pdev->dev, "ioremap failed\n"); | 682 | return PTR_ERR(host->io_base); |
683 | return -EIO; | 683 | |
684 | } | ||
685 | host->io_base_phy = rc->start; | 684 | host->io_base_phy = rc->start; |
686 | 685 | ||
687 | mtd = &host->mtd; | 686 | mtd = &host->mtd; |
diff --git a/drivers/mtd/nand/lpc32xx_slc.c b/drivers/mtd/nand/lpc32xx_slc.c index 030b78c62895..be94ed5abefb 100644 --- a/drivers/mtd/nand/lpc32xx_slc.c +++ b/drivers/mtd/nand/lpc32xx_slc.c | |||
@@ -778,11 +778,9 @@ static int lpc32xx_nand_probe(struct platform_device *pdev) | |||
778 | } | 778 | } |
779 | host->io_base_dma = rc->start; | 779 | host->io_base_dma = rc->start; |
780 | 780 | ||
781 | host->io_base = devm_request_and_ioremap(&pdev->dev, rc); | 781 | host->io_base = devm_ioremap_resource(&pdev->dev, rc); |
782 | if (host->io_base == NULL) { | 782 | if (IS_ERR(host->io_base)) |
783 | dev_err(&pdev->dev, "ioremap failed\n"); | 783 | return PTR_ERR(host->io_base); |
784 | return -ENOMEM; | ||
785 | } | ||
786 | 784 | ||
787 | if (pdev->dev.of_node) | 785 | if (pdev->dev.of_node) |
788 | host->ncfg = lpc32xx_parse_dt(&pdev->dev); | 786 | host->ncfg = lpc32xx_parse_dt(&pdev->dev); |
diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c index 45204e41a028..60ac5b98b718 100644 --- a/drivers/mtd/nand/mxc_nand.c +++ b/drivers/mtd/nand/mxc_nand.c | |||
@@ -1437,9 +1437,9 @@ static int mxcnd_probe(struct platform_device *pdev) | |||
1437 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 1437 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
1438 | if (!res) | 1438 | if (!res) |
1439 | return -ENODEV; | 1439 | return -ENODEV; |
1440 | host->regs_ip = devm_request_and_ioremap(&pdev->dev, res); | 1440 | host->regs_ip = devm_ioremap_resource(&pdev->dev, res); |
1441 | if (!host->regs_ip) | 1441 | if (IS_ERR(host->regs_ip)) |
1442 | return -ENOMEM; | 1442 | return PTR_ERR(host->regs_ip); |
1443 | 1443 | ||
1444 | res = platform_get_resource(pdev, IORESOURCE_MEM, 1); | 1444 | res = platform_get_resource(pdev, IORESOURCE_MEM, 1); |
1445 | } else { | 1445 | } else { |
@@ -1449,9 +1449,9 @@ static int mxcnd_probe(struct platform_device *pdev) | |||
1449 | if (!res) | 1449 | if (!res) |
1450 | return -ENODEV; | 1450 | return -ENODEV; |
1451 | 1451 | ||
1452 | host->base = devm_request_and_ioremap(&pdev->dev, res); | 1452 | host->base = devm_ioremap_resource(&pdev->dev, res); |
1453 | if (!host->base) | 1453 | if (IS_ERR(host->base)) |
1454 | return -ENOMEM; | 1454 | return PTR_ERR(host->base); |
1455 | 1455 | ||
1456 | host->main_area0 = host->base; | 1456 | host->main_area0 = host->base; |
1457 | 1457 | ||
diff --git a/drivers/mtd/nand/s3c2410.c b/drivers/mtd/nand/s3c2410.c index df954b4dcba2..d65afd23e171 100644 --- a/drivers/mtd/nand/s3c2410.c +++ b/drivers/mtd/nand/s3c2410.c | |||
@@ -952,10 +952,9 @@ static int s3c24xx_nand_probe(struct platform_device *pdev) | |||
952 | info->platform = plat; | 952 | info->platform = plat; |
953 | info->cpu_type = cpu_type; | 953 | info->cpu_type = cpu_type; |
954 | 954 | ||
955 | info->regs = devm_request_and_ioremap(&pdev->dev, res); | 955 | info->regs = devm_ioremap_resource(&pdev->dev, res); |
956 | if (info->regs == NULL) { | 956 | if (IS_ERR(info->regs)) { |
957 | dev_err(&pdev->dev, "cannot reserve register region\n"); | 957 | err = PTR_ERR(info->regs); |
958 | err = -EIO; | ||
959 | goto exit_error; | 958 | goto exit_error; |
960 | } | 959 | } |
961 | 960 | ||
diff --git a/drivers/mtd/nand/txx9ndfmc.c b/drivers/mtd/nand/txx9ndfmc.c index e3d7266e256f..e1e8748aa47b 100644 --- a/drivers/mtd/nand/txx9ndfmc.c +++ b/drivers/mtd/nand/txx9ndfmc.c | |||
@@ -9,6 +9,7 @@ | |||
9 | * (C) Copyright TOSHIBA CORPORATION 2004-2007 | 9 | * (C) Copyright TOSHIBA CORPORATION 2004-2007 |
10 | * All Rights Reserved. | 10 | * All Rights Reserved. |
11 | */ | 11 | */ |
12 | #include <linux/err.h> | ||
12 | #include <linux/init.h> | 13 | #include <linux/init.h> |
13 | #include <linux/slab.h> | 14 | #include <linux/slab.h> |
14 | #include <linux/module.h> | 15 | #include <linux/module.h> |
@@ -286,9 +287,9 @@ static int __init txx9ndfmc_probe(struct platform_device *dev) | |||
286 | drvdata = devm_kzalloc(&dev->dev, sizeof(*drvdata), GFP_KERNEL); | 287 | drvdata = devm_kzalloc(&dev->dev, sizeof(*drvdata), GFP_KERNEL); |
287 | if (!drvdata) | 288 | if (!drvdata) |
288 | return -ENOMEM; | 289 | return -ENOMEM; |
289 | drvdata->base = devm_request_and_ioremap(&dev->dev, res); | 290 | drvdata->base = devm_ioremap_resource(&dev->dev, res); |
290 | if (!drvdata->base) | 291 | if (IS_ERR(drvdata->base)) |
291 | return -EBUSY; | 292 | return PTR_ERR(drvdata->base); |
292 | 293 | ||
293 | hold = plat->hold ?: 20; /* tDH */ | 294 | hold = plat->hold ?: 20; /* tDH */ |
294 | spw = plat->spw ?: 90; /* max(tREADID, tWP, tRP) */ | 295 | spw = plat->spw ?: 90; /* max(tREADID, tWP, tRP) */ |