Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 316895
b: refs/heads/master
c: 338edab
h: refs/heads/master
i:
  316893: 5ffa210
  316891: 8627ebb
  316887: 3e5dc09
  316879: bfabbde
  316863: 69117d9
v: v3
  • Loading branch information
Sachin Kamat authored and Felipe Balbi committed Jun 4, 2012
1 parent 65027d6 commit 1133341
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 41 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: dd8e93814a357d8f032a93b6d17216436c762e9f
refs/heads/master: 338edabcd879320f0f86cc701161b95277be6b5d
51 changes: 11 additions & 40 deletions trunk/drivers/usb/gadget/s3c-hsotg.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ struct s3c_hsotg_ep {
* @driver: USB gadget driver
* @plat: The platform specific configuration data.
* @regs: The memory area mapped for accessing registers.
* @regs_res: The resource that was allocated when claiming register space.
* @irq: The IRQ number we are using
* @supplies: Definition of USB power supplies
* @dedicated_fifos: Set if the hardware has dedicated IN-EP fifos.
Expand All @@ -158,7 +157,6 @@ struct s3c_hsotg {
struct s3c_hsotg_plat *plat;

void __iomem *regs;
struct resource *regs_res;
int irq;
struct clk *clk;

Expand Down Expand Up @@ -3477,7 +3475,7 @@ static int __devinit s3c_hsotg_probe(struct platform_device *pdev)
return -EINVAL;
}

hsotg = kzalloc(sizeof(struct s3c_hsotg), GFP_KERNEL);
hsotg = devm_kzalloc(&pdev->dev, sizeof(struct s3c_hsotg), GFP_KERNEL);
if (!hsotg) {
dev_err(dev, "cannot get memory\n");
return -ENOMEM;
Expand All @@ -3489,46 +3487,33 @@ static int __devinit s3c_hsotg_probe(struct platform_device *pdev)
hsotg->clk = clk_get(&pdev->dev, "otg");
if (IS_ERR(hsotg->clk)) {
dev_err(dev, "cannot get otg clock\n");
ret = PTR_ERR(hsotg->clk);
goto err_mem;
return PTR_ERR(hsotg->clk);
}

platform_set_drvdata(pdev, hsotg);

res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) {
dev_err(dev, "cannot find register resource 0\n");
ret = -EINVAL;
goto err_clk;
}

hsotg->regs_res = request_mem_region(res->start, resource_size(res),
dev_name(dev));
if (!hsotg->regs_res) {
dev_err(dev, "cannot reserve registers\n");
ret = -ENOENT;
goto err_clk;
}

hsotg->regs = ioremap(res->start, resource_size(res));
hsotg->regs = devm_request_and_ioremap(&pdev->dev, res);
if (!hsotg->regs) {
dev_err(dev, "cannot map registers\n");
ret = -ENXIO;
goto err_regs_res;
goto err_clk;
}

ret = platform_get_irq(pdev, 0);
if (ret < 0) {
dev_err(dev, "cannot find IRQ\n");
goto err_regs;
goto err_clk;
}

hsotg->irq = ret;

ret = request_irq(ret, s3c_hsotg_irq, 0, dev_name(dev), hsotg);
ret = devm_request_irq(&pdev->dev, hsotg->irq, s3c_hsotg_irq, 0,
dev_name(dev), hsotg);
if (ret < 0) {
dev_err(dev, "cannot claim IRQ\n");
goto err_regs;
goto err_clk;
}

dev_info(dev, "regs %p, irq %d\n", hsotg->regs, hsotg->irq);
Expand Down Expand Up @@ -3558,7 +3543,7 @@ static int __devinit s3c_hsotg_probe(struct platform_device *pdev)
hsotg->supplies);
if (ret) {
dev_err(dev, "failed to request supplies: %d\n", ret);
goto err_irq;
goto err_clk;
}

ret = regulator_bulk_enable(ARRAY_SIZE(hsotg->supplies),
Expand Down Expand Up @@ -3642,19 +3627,11 @@ static int __devinit s3c_hsotg_probe(struct platform_device *pdev)
err_supplies:
s3c_hsotg_phy_disable(hsotg);
regulator_bulk_free(ARRAY_SIZE(hsotg->supplies), hsotg->supplies);
err_irq:
free_irq(hsotg->irq, hsotg);
err_regs:
iounmap(hsotg->regs);

err_regs_res:
release_resource(hsotg->regs_res);
kfree(hsotg->regs_res);

err_clk:
clk_disable_unprepare(hsotg->clk);
clk_put(hsotg->clk);
err_mem:
kfree(hsotg);

return ret;
}

Expand All @@ -3675,12 +3652,6 @@ static int __devexit s3c_hsotg_remove(struct platform_device *pdev)
usb_gadget_unregister_driver(hsotg->driver);
}

free_irq(hsotg->irq, hsotg);
iounmap(hsotg->regs);

release_resource(hsotg->regs_res);
kfree(hsotg->regs_res);

s3c_hsotg_phy_disable(hsotg);
regulator_bulk_free(ARRAY_SIZE(hsotg->supplies), hsotg->supplies);

Expand Down

0 comments on commit 1133341

Please sign in to comment.