Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 358787
b: refs/heads/master
c: d16933b
h: refs/heads/master
i:
  358785: a3120de
  358783: 1f60830
v: v3
  • Loading branch information
Tushar Behera authored and Wolfram Sang committed Jan 28, 2013
1 parent b570bce commit 34be7e1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 18 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: 2b255b947f39d9360662abf6667957add6064646
refs/heads/master: d16933b33914a6dff38a4ecbe8edce44a17898e8
29 changes: 12 additions & 17 deletions trunk/drivers/i2c/busses/i2c-s3c2410.c
Original file line number Diff line number Diff line change
Expand Up @@ -1030,23 +1030,20 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)

dev_dbg(&pdev->dev, "clock source %p\n", i2c->clk);

clk_prepare_enable(i2c->clk);

/* map the registers */

res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (res == NULL) {
dev_err(&pdev->dev, "cannot find IO resource\n");
ret = -ENOENT;
goto err_clk;
return -ENOENT;
}

i2c->regs = devm_request_and_ioremap(&pdev->dev, res);

if (i2c->regs == NULL) {
dev_err(&pdev->dev, "cannot request and map IO\n");
ret = -ENXIO;
goto err_clk;
return -ENXIO;
}

dev_dbg(&pdev->dev, "registers %p (%p)\n",
Expand All @@ -1064,38 +1061,40 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
if (i2c->pdata->cfg_gpio) {
i2c->pdata->cfg_gpio(to_platform_device(i2c->dev));
} else if (IS_ERR(i2c->pctrl) && s3c24xx_i2c_parse_dt_gpio(i2c)) {
ret = -EINVAL;
goto err_clk;
return -EINVAL;
}

/* initialise the i2c controller */

clk_prepare_enable(i2c->clk);
ret = s3c24xx_i2c_init(i2c);
if (ret != 0)
goto err_clk;

clk_disable_unprepare(i2c->clk);
if (ret != 0) {
dev_err(&pdev->dev, "I2C controller init failed\n");
return ret;
}
/* find the IRQ for this unit (note, this relies on the init call to
* ensure no current IRQs pending
*/

i2c->irq = ret = platform_get_irq(pdev, 0);
if (ret <= 0) {
dev_err(&pdev->dev, "cannot find IRQ\n");
goto err_clk;
return ret;
}

ret = devm_request_irq(&pdev->dev, i2c->irq, s3c24xx_i2c_irq, 0,
dev_name(&pdev->dev), i2c);

if (ret != 0) {
dev_err(&pdev->dev, "cannot claim IRQ %d\n", i2c->irq);
goto err_clk;
return ret;
}

ret = s3c24xx_i2c_register_cpufreq(i2c);
if (ret < 0) {
dev_err(&pdev->dev, "failed to register cpufreq notifier\n");
goto err_clk;
return ret;
}

/* Note, previous versions of the driver used i2c_add_adapter()
Expand All @@ -1120,14 +1119,10 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
pm_runtime_enable(&i2c->adap.dev);

dev_info(&pdev->dev, "%s: S3C I2C adapter\n", dev_name(&i2c->adap.dev));
clk_disable_unprepare(i2c->clk);
return 0;

err_cpufreq:
s3c24xx_i2c_deregister_cpufreq(i2c);

err_clk:
clk_disable_unprepare(i2c->clk);
return ret;
}

Expand Down

0 comments on commit 34be7e1

Please sign in to comment.