Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 324563
b: refs/heads/master
c: 390d75c
h: refs/heads/master
i:
  324561: f19c64c
  324559: c32e8eb
v: v3
  • Loading branch information
Julia Lawall authored and Jonathan Cameron committed Aug 16, 2012
1 parent 85493a2 commit 1068548
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 35 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: d16f6dbddbd7a2ac40e090da1e6bb7dd9b5a1dcb
refs/heads/master: 390d75c1287bf68c2e29226bf8eb10ae6a08c380
42 changes: 8 additions & 34 deletions trunk/drivers/iio/adc/at91_adc.c
Original file line number Diff line number Diff line change
Expand Up @@ -545,13 +545,6 @@ static int __devinit at91_adc_probe(struct platform_device *pdev)
goto error_free_device;
}

res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) {
dev_err(&pdev->dev, "No resource defined\n");
ret = -ENXIO;
goto error_ret;
}

platform_set_drvdata(pdev, idev);

idev->dev.parent = &pdev->dev;
Expand All @@ -566,18 +559,12 @@ static int __devinit at91_adc_probe(struct platform_device *pdev)
goto error_free_device;
}

if (!request_mem_region(res->start, resource_size(res),
"AT91 adc registers")) {
dev_err(&pdev->dev, "Resources are unavailable.\n");
ret = -EBUSY;
goto error_free_device;
}
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);

st->reg_base = ioremap(res->start, resource_size(res));
st->reg_base = devm_request_and_ioremap(&pdev->dev, res);
if (!st->reg_base) {
dev_err(&pdev->dev, "Failed to map registers.\n");
ret = -ENOMEM;
goto error_release_mem;
goto error_free_device;
}

/*
Expand All @@ -592,10 +579,10 @@ static int __devinit at91_adc_probe(struct platform_device *pdev)
idev);
if (ret) {
dev_err(&pdev->dev, "Failed to allocate IRQ.\n");
goto error_unmap_reg;
goto error_free_device;
}

st->clk = clk_get(&pdev->dev, "adc_clk");
st->clk = devm_clk_get(&pdev->dev, "adc_clk");
if (IS_ERR(st->clk)) {
dev_err(&pdev->dev, "Failed to get the clock.\n");
ret = PTR_ERR(st->clk);
Expand All @@ -605,7 +592,7 @@ static int __devinit at91_adc_probe(struct platform_device *pdev)
ret = clk_prepare(st->clk);
if (ret) {
dev_err(&pdev->dev, "Could not prepare the clock.\n");
goto error_free_clk;
goto error_free_irq;
}

ret = clk_enable(st->clk);
Expand All @@ -614,7 +601,7 @@ static int __devinit at91_adc_probe(struct platform_device *pdev)
goto error_unprepare_clk;
}

st->adc_clk = clk_get(&pdev->dev, "adc_op_clk");
st->adc_clk = devm_clk_get(&pdev->dev, "adc_op_clk");
if (IS_ERR(st->adc_clk)) {
dev_err(&pdev->dev, "Failed to get the ADC clock.\n");
ret = PTR_ERR(st->clk);
Expand All @@ -624,7 +611,7 @@ static int __devinit at91_adc_probe(struct platform_device *pdev)
ret = clk_prepare(st->adc_clk);
if (ret) {
dev_err(&pdev->dev, "Could not prepare the ADC clock.\n");
goto error_free_adc_clk;
goto error_disable_clk;
}

ret = clk_enable(st->adc_clk);
Expand Down Expand Up @@ -697,20 +684,12 @@ static int __devinit at91_adc_probe(struct platform_device *pdev)
clk_disable(st->adc_clk);
error_unprepare_adc_clk:
clk_unprepare(st->adc_clk);
error_free_adc_clk:
clk_put(st->adc_clk);
error_disable_clk:
clk_disable(st->clk);
error_unprepare_clk:
clk_unprepare(st->clk);
error_free_clk:
clk_put(st->clk);
error_free_irq:
free_irq(st->irq, idev);
error_unmap_reg:
iounmap(st->reg_base);
error_release_mem:
release_mem_region(res->start, resource_size(res));
error_free_device:
iio_device_free(idev);
error_ret:
Expand All @@ -720,20 +699,15 @@ static int __devinit at91_adc_probe(struct platform_device *pdev)
static int __devexit at91_adc_remove(struct platform_device *pdev)
{
struct iio_dev *idev = platform_get_drvdata(pdev);
struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
struct at91_adc_state *st = iio_priv(idev);

iio_device_unregister(idev);
at91_adc_trigger_remove(idev);
at91_adc_buffer_remove(idev);
clk_disable_unprepare(st->adc_clk);
clk_put(st->adc_clk);
clk_disable(st->clk);
clk_unprepare(st->clk);
clk_put(st->clk);
free_irq(st->irq, idev);
iounmap(st->reg_base);
release_mem_region(res->start, resource_size(res));
iio_device_free(idev);

return 0;
Expand Down

0 comments on commit 1068548

Please sign in to comment.