Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 325809
b: refs/heads/master
c: af09c06
h: refs/heads/master
i:
  325807: fab473a
v: v3
  • Loading branch information
Julia Lawall authored and Greg Kroah-Hartman committed Aug 10, 2012
1 parent 965760a commit 139fc9f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 36 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 35b55563dffd4a68988077e402ddd330e8cfa580
refs/heads/master: af09c060895b9c9137c02943c71302ac0fc9555a
45 changes: 10 additions & 35 deletions trunk/drivers/usb/host/ehci-mxc.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev)
if (!hcd)
return -ENOMEM;

priv = kzalloc(sizeof(*priv), GFP_KERNEL);
priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
if (!priv) {
ret = -ENOMEM;
goto err_alloc;
Expand All @@ -131,42 +131,36 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev)
if (!res) {
dev_err(dev, "Found HC with no register addr. Check setup!\n");
ret = -ENODEV;
goto err_get_resource;
goto err_alloc;
}

hcd->rsrc_start = res->start;
hcd->rsrc_len = resource_size(res);

if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {
dev_dbg(dev, "controller already in use\n");
ret = -EBUSY;
goto err_request_mem;
}

hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len);
hcd->regs = devm_request_and_ioremap(&pdev->dev, res);
if (!hcd->regs) {
dev_err(dev, "error mapping memory\n");
ret = -EFAULT;
goto err_ioremap;
goto err_alloc;
}

/* enable clocks */
priv->usbclk = clk_get(dev, "ipg");
priv->usbclk = devm_clk_get(&pdev->dev, "ipg");
if (IS_ERR(priv->usbclk)) {
ret = PTR_ERR(priv->usbclk);
goto err_clk;
goto err_alloc;
}
clk_prepare_enable(priv->usbclk);

priv->ahbclk = clk_get(dev, "ahb");
priv->ahbclk = devm_clk_get(&pdev->dev, "ahb");
if (IS_ERR(priv->ahbclk)) {
ret = PTR_ERR(priv->ahbclk);
goto err_clk_ahb;
}
clk_prepare_enable(priv->ahbclk);

/* "dr" device has its own clock on i.MX51 */
priv->phyclk = clk_get(dev, "phy");
priv->phyclk = devm_clk_get(&pdev->dev, "phy");
if (IS_ERR(priv->phyclk))
priv->phyclk = NULL;
if (priv->phyclk)
Expand Down Expand Up @@ -245,23 +239,12 @@ static int ehci_mxc_drv_probe(struct platform_device *pdev)
if (pdata && pdata->exit)
pdata->exit(pdev);
err_init:
if (priv->phyclk) {
if (priv->phyclk)
clk_disable_unprepare(priv->phyclk);
clk_put(priv->phyclk);
}

clk_disable_unprepare(priv->ahbclk);
clk_put(priv->ahbclk);
err_clk_ahb:
clk_disable_unprepare(priv->usbclk);
clk_put(priv->usbclk);
err_clk:
iounmap(hcd->regs);
err_ioremap:
release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
err_request_mem:
err_get_resource:
kfree(priv);
err_alloc:
usb_put_hcd(hcd);
return ret;
Expand All @@ -280,22 +263,14 @@ static int __exit ehci_mxc_drv_remove(struct platform_device *pdev)
usb_phy_shutdown(pdata->otg);

usb_remove_hcd(hcd);
iounmap(hcd->regs);
release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
usb_put_hcd(hcd);
platform_set_drvdata(pdev, NULL);

clk_disable_unprepare(priv->usbclk);
clk_put(priv->usbclk);
clk_disable_unprepare(priv->ahbclk);
clk_put(priv->ahbclk);

if (priv->phyclk) {
if (priv->phyclk)
clk_disable_unprepare(priv->phyclk);
clk_put(priv->phyclk);
}

kfree(priv);

return 0;
}
Expand Down

0 comments on commit 139fc9f

Please sign in to comment.