Commit fd666348 authored by Himangi Saraogi's avatar Himangi Saraogi Committed by Greg Kroah-Hartman

usb: host: xhci-plat: use devm_functions

This patch introduces the use of managed interface devm_ioremap_resource
for ioremap_nocache and request_mem_region and removes the corresponding
free functions in the probe and remove functions.
Signed-off-by: default avatarHimangi Saraogi <himangi774@gmail.com>
Acked-by: default avatarJulia Lawall <julia.lawall@lip6.fr>
Reviewed-by: default avatarFelipe Balbi <balbi@ti.com>
Acked-by: default avatarFelipe Balbi <balbi@ti.com>
Cc: Mathias Nyman <mathias.nyman@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 288c0f44
...@@ -146,20 +146,12 @@ static int xhci_plat_probe(struct platform_device *pdev) ...@@ -146,20 +146,12 @@ static int xhci_plat_probe(struct platform_device *pdev)
hcd->rsrc_start = res->start; hcd->rsrc_start = res->start;
hcd->rsrc_len = resource_size(res); hcd->rsrc_len = resource_size(res);
if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd->regs = devm_ioremap_resource(&pdev->dev, res);
driver->description)) { if (IS_ERR(hcd->regs)) {
dev_dbg(&pdev->dev, "controller already in use\n"); ret = PTR_ERR(hcd->regs);
ret = -EBUSY;
goto put_hcd; goto put_hcd;
} }
hcd->regs = ioremap_nocache(hcd->rsrc_start, hcd->rsrc_len);
if (!hcd->regs) {
dev_dbg(&pdev->dev, "error mapping memory\n");
ret = -EFAULT;
goto release_mem_region;
}
/* /*
* Not all platforms have a clk so it is not an error if the * Not all platforms have a clk so it is not an error if the
* clock does not exists. * clock does not exists.
...@@ -168,7 +160,7 @@ static int xhci_plat_probe(struct platform_device *pdev) ...@@ -168,7 +160,7 @@ static int xhci_plat_probe(struct platform_device *pdev)
if (!IS_ERR(clk)) { if (!IS_ERR(clk)) {
ret = clk_prepare_enable(clk); ret = clk_prepare_enable(clk);
if (ret) if (ret)
goto unmap_registers; goto put_hcd;
} }
ret = usb_add_hcd(hcd, irq, IRQF_SHARED); ret = usb_add_hcd(hcd, irq, IRQF_SHARED);
...@@ -216,12 +208,6 @@ static int xhci_plat_probe(struct platform_device *pdev) ...@@ -216,12 +208,6 @@ static int xhci_plat_probe(struct platform_device *pdev)
if (!IS_ERR(clk)) if (!IS_ERR(clk))
clk_disable_unprepare(clk); clk_disable_unprepare(clk);
unmap_registers:
iounmap(hcd->regs);
release_mem_region:
release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
put_hcd: put_hcd:
usb_put_hcd(hcd); usb_put_hcd(hcd);
...@@ -240,8 +226,6 @@ static int xhci_plat_remove(struct platform_device *dev) ...@@ -240,8 +226,6 @@ static int xhci_plat_remove(struct platform_device *dev)
usb_remove_hcd(hcd); usb_remove_hcd(hcd);
if (!IS_ERR(clk)) if (!IS_ERR(clk))
clk_disable_unprepare(clk); clk_disable_unprepare(clk);
iounmap(hcd->regs);
release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
usb_put_hcd(hcd); usb_put_hcd(hcd);
kfree(xhci); kfree(xhci);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment