From 148e11349b0c9c7199fd3096254bd3ea16d59a05 Mon Sep 17 00:00:00 2001 From: Thierry Reding Date: Mon, 21 Jan 2013 11:09:22 +0100 Subject: usb: 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 Acked-by: Alan Stern Acked-by: Felipe Balbi Signed-off-by: Greg Kroah-Hartman --- drivers/usb/host/ehci-atmel.c | 7 +++---- drivers/usb/host/ehci-grlib.c | 9 ++++----- drivers/usb/host/ehci-mxc.c | 7 +++---- drivers/usb/host/ehci-platform.c | 7 ++++--- drivers/usb/host/ehci-ppc-of.c | 8 ++++---- drivers/usb/host/ehci-sead3.c | 8 ++++---- drivers/usb/host/ehci-sh.c | 7 +++---- drivers/usb/host/ehci-vt8500.c | 8 ++++---- drivers/usb/host/ehci-xilinx-of.c | 8 ++++---- drivers/usb/host/ohci-nxp.c | 7 +++---- drivers/usb/host/ohci-platform.c | 7 ++++--- drivers/usb/host/ohci-s3c2410.c | 7 +++---- 12 files changed, 43 insertions(+), 47 deletions(-) (limited to 'drivers/usb/host') diff --git a/drivers/usb/host/ehci-atmel.c b/drivers/usb/host/ehci-atmel.c index 27639487f7a..f3beac4d06b 100644 --- a/drivers/usb/host/ehci-atmel.c +++ b/drivers/usb/host/ehci-atmel.c @@ -143,10 +143,9 @@ static int ehci_atmel_drv_probe(struct platform_device *pdev) hcd->rsrc_start = res->start; hcd->rsrc_len = resource_size(res); - hcd->regs = devm_request_and_ioremap(&pdev->dev, res); - if (hcd->regs == NULL) { - dev_dbg(&pdev->dev, "error mapping memory\n"); - retval = -EFAULT; + hcd->regs = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(hcd->regs)) { + retval = PTR_ERR(hcd->regs); goto fail_request_resource; } diff --git a/drivers/usb/host/ehci-grlib.c b/drivers/usb/host/ehci-grlib.c index 1fc89292f5d..5d75de9729b 100644 --- a/drivers/usb/host/ehci-grlib.c +++ b/drivers/usb/host/ehci-grlib.c @@ -25,7 +25,7 @@ * Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - +#include #include #include @@ -118,10 +118,9 @@ static int ehci_hcd_grlib_probe(struct platform_device *op) goto err_irq; } - hcd->regs = devm_request_and_ioremap(&op->dev, &res); - if (!hcd->regs) { - pr_err("%s: devm_request_and_ioremap failed\n", __FILE__); - rv = -ENOMEM; + hcd->regs = devm_ioremap_resource(&op->dev, &res); + if (IS_ERR(hcd->regs)) { + rv = PTR_ERR(hcd->regs); goto err_ioremap; } diff --git a/drivers/usb/host/ehci-mxc.c b/drivers/usb/host/ehci-mxc.c index ec7f5d2c90d..4f506af4c30 100644 --- a/drivers/usb/host/ehci-mxc.c +++ b/drivers/usb/host/ehci-mxc.c @@ -128,10 +128,9 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev) hcd->rsrc_start = res->start; hcd->rsrc_len = resource_size(res); - hcd->regs = devm_request_and_ioremap(&pdev->dev, res); - if (!hcd->regs) { - dev_err(dev, "error mapping memory\n"); - ret = -EFAULT; + hcd->regs = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(hcd->regs)) { + ret = PTR_ERR(hcd->regs); goto err_alloc; } diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c index 58fa0c90c7c..ca750639054 100644 --- a/drivers/usb/host/ehci-platform.c +++ b/drivers/usb/host/ehci-platform.c @@ -18,6 +18,7 @@ * * Licensed under the GNU/GPL. See COPYING for details. */ +#include #include #include #include @@ -104,9 +105,9 @@ static int ehci_platform_probe(struct platform_device *dev) hcd->rsrc_start = res_mem->start; hcd->rsrc_len = resource_size(res_mem); - hcd->regs = devm_request_and_ioremap(&dev->dev, res_mem); - if (!hcd->regs) { - err = -ENOMEM; + hcd->regs = devm_ioremap_resource(&dev->dev, res_mem); + if (IS_ERR(hcd->regs)) { + err = PTR_ERR(hcd->regs); goto err_put_hcd; } err = usb_add_hcd(hcd, irq, IRQF_SHARED); diff --git a/drivers/usb/host/ehci-ppc-of.c b/drivers/usb/host/ehci-ppc-of.c index 45aceefd0c2..56dc732bf45 100644 --- a/drivers/usb/host/ehci-ppc-of.c +++ b/drivers/usb/host/ehci-ppc-of.c @@ -12,6 +12,7 @@ * This file is licenced under the GPL. */ +#include #include #include @@ -121,10 +122,9 @@ static int ehci_hcd_ppc_of_probe(struct platform_device *op) goto err_irq; } - hcd->regs = devm_request_and_ioremap(&op->dev, &res); - if (!hcd->regs) { - pr_err("%s: devm_request_and_ioremap failed\n", __FILE__); - rv = -ENOMEM; + hcd->regs = devm_ioremap_resource(&op->dev, &res); + if (IS_ERR(hcd->regs)) { + rv = PTR_ERR(hcd->regs); goto err_ioremap; } diff --git a/drivers/usb/host/ehci-sead3.c b/drivers/usb/host/ehci-sead3.c index efad02d947f..f55477c5a1b 100644 --- a/drivers/usb/host/ehci-sead3.c +++ b/drivers/usb/host/ehci-sead3.c @@ -19,6 +19,7 @@ * Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include #include static int ehci_sead3_setup(struct usb_hcd *hcd) @@ -112,10 +113,9 @@ static int ehci_hcd_sead3_drv_probe(struct platform_device *pdev) hcd->rsrc_start = res->start; hcd->rsrc_len = resource_size(res); - hcd->regs = devm_request_and_ioremap(&pdev->dev, res); - if (!hcd->regs) { - pr_debug("ioremap failed"); - ret = -ENOMEM; + hcd->regs = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(hcd->regs)) { + ret = PTR_ERR(hcd->regs); goto err1; } diff --git a/drivers/usb/host/ehci-sh.c b/drivers/usb/host/ehci-sh.c index 0c90a24fa98..3565a300f40 100644 --- a/drivers/usb/host/ehci-sh.c +++ b/drivers/usb/host/ehci-sh.c @@ -118,10 +118,9 @@ static int ehci_hcd_sh_probe(struct platform_device *pdev) hcd->rsrc_start = res->start; hcd->rsrc_len = resource_size(res); - hcd->regs = devm_request_and_ioremap(&pdev->dev, res); - if (hcd->regs == NULL) { - dev_dbg(&pdev->dev, "error mapping memory\n"); - ret = -ENXIO; + hcd->regs = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(hcd->regs)) { + ret = PTR_ERR(hcd->regs); goto fail_request_resource; } diff --git a/drivers/usb/host/ehci-vt8500.c b/drivers/usb/host/ehci-vt8500.c index 11695d5b9d8..7ecf709610b 100644 --- a/drivers/usb/host/ehci-vt8500.c +++ b/drivers/usb/host/ehci-vt8500.c @@ -16,6 +16,7 @@ * */ +#include #include #include @@ -96,10 +97,9 @@ static int vt8500_ehci_drv_probe(struct platform_device *pdev) hcd->rsrc_start = res->start; hcd->rsrc_len = resource_size(res); - hcd->regs = devm_request_and_ioremap(&pdev->dev, res); - if (!hcd->regs) { - pr_debug("ioremap failed"); - ret = -ENOMEM; + hcd->regs = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(hcd->regs)) { + ret = PTR_ERR(hcd->regs); goto err1; } diff --git a/drivers/usb/host/ehci-xilinx-of.c b/drivers/usb/host/ehci-xilinx-of.c index 4f285e8e404..d845e3bcfaf 100644 --- a/drivers/usb/host/ehci-xilinx-of.c +++ b/drivers/usb/host/ehci-xilinx-of.c @@ -25,6 +25,7 @@ * */ +#include #include #include @@ -159,10 +160,9 @@ static int ehci_hcd_xilinx_of_probe(struct platform_device *op) goto err_irq; } - hcd->regs = devm_request_and_ioremap(&op->dev, &res); - if (!hcd->regs) { - pr_err("%s: devm_request_and_ioremap failed\n", __FILE__); - rv = -ENOMEM; + hcd->regs = devm_ioremap_resource(&op->dev, &res); + if (IS_ERR(hcd->regs)) { + rv = PTR_ERR(hcd->regs); goto err_irq; } diff --git a/drivers/usb/host/ohci-nxp.c b/drivers/usb/host/ohci-nxp.c index 2344040c16d..f4988fbe78e 100644 --- a/drivers/usb/host/ohci-nxp.c +++ b/drivers/usb/host/ohci-nxp.c @@ -306,10 +306,9 @@ static int usb_hcd_nxp_probe(struct platform_device *pdev) goto out8; } - hcd->regs = devm_request_and_ioremap(&pdev->dev, res); - if (!hcd->regs) { - dev_err(&pdev->dev, "Failed to devm_request_and_ioremap\n"); - ret = -ENOMEM; + hcd->regs = devm_ioremap_resource(&pdev->dev, res); + if (IS_ERR(hcd->regs)) { + ret = PTR_ERR(hcd->regs); goto out8; } hcd->rsrc_start = res->start; diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c index 084503b03fc..c3e7287f792 100644 --- a/drivers/usb/host/ohci-platform.c +++ b/drivers/usb/host/ohci-platform.c @@ -13,6 +13,7 @@ * * Licensed under the GNU/GPL. See COPYING for details. */ +#include #include #include @@ -127,9 +128,9 @@ static int ohci_platform_probe(struct platform_device *dev) hcd->rsrc_start = res_mem->start; hcd->rsrc_len = resource_size(res_mem); - hcd->regs = devm_request_and_ioremap(&dev->dev, res_mem); - if (!hcd->regs) { - err = -ENOMEM; + hcd->regs = devm_ioremap_resource(&dev->dev, res_mem); + if (IS_ERR(hcd->regs)) { + err = PTR_ERR(hcd->regs); goto err_put_hcd; } err = usb_add_hcd(hcd, irq, IRQF_SHARED); diff --git a/drivers/usb/host/ohci-s3c2410.c b/drivers/usb/host/ohci-s3c2410.c index ad0f5526960..e125770b893 100644 --- a/drivers/usb/host/ohci-s3c2410.c +++ b/drivers/usb/host/ohci-s3c2410.c @@ -351,10 +351,9 @@ static int usb_hcd_s3c2410_probe(const struct hc_driver *driver, hcd->rsrc_start = dev->resource[0].start; hcd->rsrc_len = resource_size(&dev->resource[0]); - hcd->regs = devm_request_and_ioremap(&dev->dev, &dev->resource[0]); - if (!hcd->regs) { - dev_err(&dev->dev, "devm_request_and_ioremap failed\n"); - retval = -ENOMEM; + hcd->regs = devm_ioremap_resource(&dev->dev, &dev->resource[0]); + if (IS_ERR(hcd->regs)) { + retval = PTR_ERR(hcd->regs); goto err_put; } -- cgit v1.2.3-70-g09d2