Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 354599
b: refs/heads/master
c: 20b97dc
h: refs/heads/master
i:
  354597: 706d06e
  354595: bfdb3cb
  354591: 4e118d1
v: v3
  • Loading branch information
Jingoo Han authored and Felipe Balbi committed Jan 18, 2013
1 parent 6988cc8 commit a1c3fc8
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 29 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: 5da93478251cf0dd6b34874c7c1c24a4a52eabc1
refs/heads/master: 20b97dc18323938a92319abf031936b7d2686eaf
51 changes: 23 additions & 28 deletions trunk/drivers/usb/dwc3/dwc3-exynos.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,14 @@ static int dwc3_exynos_probe(struct platform_device *pdev)
struct platform_device *dwc3;
struct dwc3_exynos *exynos;
struct clk *clk;
struct device *dev = &pdev->dev;

int ret = -ENOMEM;

exynos = kzalloc(sizeof(*exynos), GFP_KERNEL);
exynos = devm_kzalloc(dev, sizeof(*exynos), GFP_KERNEL);
if (!exynos) {
dev_err(&pdev->dev, "not enough memory\n");
goto err0;
dev_err(dev, "not enough memory\n");
return -ENOMEM;
}

/*
Expand All @@ -116,57 +117,54 @@ static int dwc3_exynos_probe(struct platform_device *pdev)

ret = dwc3_exynos_register_phys(exynos);
if (ret) {
dev_err(&pdev->dev, "couldn't register PHYs\n");
goto err1;
dev_err(dev, "couldn't register PHYs\n");
return ret;
}

dwc3 = platform_device_alloc("dwc3", PLATFORM_DEVID_AUTO);
if (!dwc3) {
dev_err(&pdev->dev, "couldn't allocate dwc3 device\n");
goto err1;
dev_err(dev, "couldn't allocate dwc3 device\n");
return -ENOMEM;
}

clk = clk_get(&pdev->dev, "usbdrd30");
clk = devm_clk_get(dev, "usbdrd30");
if (IS_ERR(clk)) {
dev_err(&pdev->dev, "couldn't get clock\n");
dev_err(dev, "couldn't get clock\n");
ret = -EINVAL;
goto err3;
goto err1;
}

dma_set_coherent_mask(&dwc3->dev, pdev->dev.coherent_dma_mask);
dma_set_coherent_mask(&dwc3->dev, dev->coherent_dma_mask);

dwc3->dev.parent = &pdev->dev;
dwc3->dev.dma_mask = pdev->dev.dma_mask;
dwc3->dev.dma_parms = pdev->dev.dma_parms;
dwc3->dev.parent = dev;
dwc3->dev.dma_mask = dev->dma_mask;
dwc3->dev.dma_parms = dev->dma_parms;
exynos->dwc3 = dwc3;
exynos->dev = &pdev->dev;
exynos->dev = dev;
exynos->clk = clk;

clk_enable(exynos->clk);

ret = platform_device_add_resources(dwc3, pdev->resource,
pdev->num_resources);
if (ret) {
dev_err(&pdev->dev, "couldn't add resources to dwc3 device\n");
goto err4;
dev_err(dev, "couldn't add resources to dwc3 device\n");
goto err2;
}

ret = platform_device_add(dwc3);
if (ret) {
dev_err(&pdev->dev, "failed to register dwc3 device\n");
goto err4;
dev_err(dev, "failed to register dwc3 device\n");
goto err2;
}

return 0;

err4:
err2:
clk_disable(clk);
clk_put(clk);
err3:
platform_device_put(dwc3);
err1:
kfree(exynos);
err0:
platform_device_put(dwc3);

return ret;
}

Expand All @@ -179,9 +177,6 @@ static int dwc3_exynos_remove(struct platform_device *pdev)
platform_device_unregister(exynos->usb3_phy);

clk_disable(exynos->clk);
clk_put(exynos->clk);

kfree(exynos);

return 0;
}
Expand Down

0 comments on commit a1c3fc8

Please sign in to comment.