Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 315478
b: refs/heads/master
c: 8e476d9
h: refs/heads/master
v: v3
  • Loading branch information
Mugunthan V N authored and David S. Miller committed Jul 18, 2012
1 parent 54d0c33 commit d6f18a4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 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: ed36d7b2578e4235d7c281304c14e4085f286236
refs/heads/master: 8e476d9da7e28199b1316fca69a01920694e1876
25 changes: 12 additions & 13 deletions trunk/drivers/net/ethernet/ti/davinci_mdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include <linux/clk.h>
#include <linux/err.h>
#include <linux/io.h>
#include <linux/pm_runtime.h>
#include <linux/davinci_emac.h>

/*
Expand Down Expand Up @@ -321,16 +322,16 @@ static int __devinit davinci_mdio_probe(struct platform_device *pdev)
snprintf(data->bus->id, MII_BUS_ID_SIZE, "%s-%x",
pdev->name, pdev->id);

data->clk = clk_get(dev, NULL);
pm_runtime_enable(&pdev->dev);
pm_runtime_get_sync(&pdev->dev);
data->clk = clk_get(&pdev->dev, "fck");
if (IS_ERR(data->clk)) {
dev_err(dev, "failed to get device clock\n");
ret = PTR_ERR(data->clk);
data->clk = NULL;
goto bail_out;
}

clk_enable(data->clk);

dev_set_drvdata(dev, data);
data->dev = dev;
spin_lock_init(&data->lock);
Expand Down Expand Up @@ -378,10 +379,10 @@ static int __devinit davinci_mdio_probe(struct platform_device *pdev)
if (data->bus)
mdiobus_free(data->bus);

if (data->clk) {
clk_disable(data->clk);
if (data->clk)
clk_put(data->clk);
}
pm_runtime_put_sync(&pdev->dev);
pm_runtime_disable(&pdev->dev);

kfree(data);

Expand All @@ -396,10 +397,10 @@ static int __devexit davinci_mdio_remove(struct platform_device *pdev)
if (data->bus)
mdiobus_free(data->bus);

if (data->clk) {
clk_disable(data->clk);
if (data->clk)
clk_put(data->clk);
}
pm_runtime_put_sync(&pdev->dev);
pm_runtime_disable(&pdev->dev);

dev_set_drvdata(dev, NULL);

Expand All @@ -421,8 +422,7 @@ static int davinci_mdio_suspend(struct device *dev)
__raw_writel(ctrl, &data->regs->control);
wait_for_idle(data);

if (data->clk)
clk_disable(data->clk);
pm_runtime_put_sync(data->dev);

data->suspended = true;
spin_unlock(&data->lock);
Expand All @@ -436,8 +436,7 @@ static int davinci_mdio_resume(struct device *dev)
u32 ctrl;

spin_lock(&data->lock);
if (data->clk)
clk_enable(data->clk);
pm_runtime_put_sync(data->dev);

/* restart the scan state machine */
ctrl = __raw_readl(&data->regs->control);
Expand Down

0 comments on commit d6f18a4

Please sign in to comment.