ARM: omap2: use clkdev_add_alias()
When creating aliases of existing clkdev clocks, use clkdev_add_alias() isntead of open coding the lookup and clk_lookup creation. Acked-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
This commit is contained in:
parent
b2e0112946
commit
1ca90bd408
|
@ -47,7 +47,7 @@ static void _add_clkdev(struct omap_device *od, const char *clk_alias,
|
|||
const char *clk_name)
|
||||
{
|
||||
struct clk *r;
|
||||
struct clk_lookup *l;
|
||||
int rc;
|
||||
|
||||
if (!clk_alias || !clk_name)
|
||||
return;
|
||||
|
@ -62,21 +62,15 @@ static void _add_clkdev(struct omap_device *od, const char *clk_alias,
|
|||
return;
|
||||
}
|
||||
|
||||
r = clk_get(NULL, clk_name);
|
||||
if (IS_ERR(r)) {
|
||||
dev_err(&od->pdev->dev,
|
||||
"clk_get for %s failed\n", clk_name);
|
||||
return;
|
||||
rc = clk_add_alias(clk_alias, dev_name(&od->pdev->dev), clk_name, NULL);
|
||||
if (rc) {
|
||||
if (rc == -ENODEV || rc == -ENOMEM)
|
||||
dev_err(&od->pdev->dev,
|
||||
"clkdev_alloc for %s failed\n", clk_alias);
|
||||
else
|
||||
dev_err(&od->pdev->dev,
|
||||
"clk_get for %s failed\n", clk_name);
|
||||
}
|
||||
|
||||
l = clkdev_alloc(r, clk_alias, dev_name(&od->pdev->dev));
|
||||
if (!l) {
|
||||
dev_err(&od->pdev->dev,
|
||||
"clkdev_alloc for %s failed\n", clk_alias);
|
||||
return;
|
||||
}
|
||||
|
||||
clkdev_add(l);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue