Commit b2c9c8ee authored by Archit Taneja's avatar Archit Taneja Committed by Tomi Valkeinen

omapdss: use devm_clk_get()

Use devm_clk_get() instead of clk_get() for dss, and for outputs hdmi
and venc. This reduces code and simplifies error handling.
Signed-off-by: default avatarArchit Taneja <archit@ti.com>
Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
parent 3aff5b12
...@@ -767,13 +767,11 @@ int dss_dpi_select_source(enum omap_channel channel) ...@@ -767,13 +767,11 @@ int dss_dpi_select_source(enum omap_channel channel)
static int dss_get_clocks(void) static int dss_get_clocks(void)
{ {
struct clk *clk; struct clk *clk;
int r;
clk = clk_get(&dss.pdev->dev, "fck"); clk = devm_clk_get(&dss.pdev->dev, "fck");
if (IS_ERR(clk)) { if (IS_ERR(clk)) {
DSSERR("can't get clock fck\n"); DSSERR("can't get clock fck\n");
r = PTR_ERR(clk); return PTR_ERR(clk);
goto err;
} }
dss.dss_clk = clk; dss.dss_clk = clk;
...@@ -782,8 +780,7 @@ static int dss_get_clocks(void) ...@@ -782,8 +780,7 @@ static int dss_get_clocks(void)
clk = clk_get(NULL, dss.feat->clk_name); clk = clk_get(NULL, dss.feat->clk_name);
if (IS_ERR(clk)) { if (IS_ERR(clk)) {
DSSERR("Failed to get %s\n", dss.feat->clk_name); DSSERR("Failed to get %s\n", dss.feat->clk_name);
r = PTR_ERR(clk); return PTR_ERR(clk);
goto err;
} }
} else { } else {
clk = NULL; clk = NULL;
...@@ -792,21 +789,12 @@ static int dss_get_clocks(void) ...@@ -792,21 +789,12 @@ static int dss_get_clocks(void)
dss.dpll4_m4_ck = clk; dss.dpll4_m4_ck = clk;
return 0; return 0;
err:
if (dss.dss_clk)
clk_put(dss.dss_clk);
if (dss.dpll4_m4_ck)
clk_put(dss.dpll4_m4_ck);
return r;
} }
static void dss_put_clocks(void) static void dss_put_clocks(void)
{ {
if (dss.dpll4_m4_ck) if (dss.dpll4_m4_ck)
clk_put(dss.dpll4_m4_ck); clk_put(dss.dpll4_m4_ck);
clk_put(dss.dss_clk);
} }
static int dss_runtime_get(void) static int dss_runtime_get(void)
......
...@@ -804,7 +804,7 @@ static int hdmi_get_clocks(struct platform_device *pdev) ...@@ -804,7 +804,7 @@ static int hdmi_get_clocks(struct platform_device *pdev)
{ {
struct clk *clk; struct clk *clk;
clk = clk_get(&pdev->dev, "sys_clk"); clk = devm_clk_get(&pdev->dev, "sys_clk");
if (IS_ERR(clk)) { if (IS_ERR(clk)) {
DSSERR("can't get sys_clk\n"); DSSERR("can't get sys_clk\n");
return PTR_ERR(clk); return PTR_ERR(clk);
...@@ -815,12 +815,6 @@ static int hdmi_get_clocks(struct platform_device *pdev) ...@@ -815,12 +815,6 @@ static int hdmi_get_clocks(struct platform_device *pdev)
return 0; return 0;
} }
static void hdmi_put_clocks(void)
{
if (hdmi.sys_clk)
clk_put(hdmi.sys_clk);
}
#if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO) #if defined(CONFIG_OMAP4_DSS_HDMI_AUDIO)
int hdmi_compute_acr(u32 sample_freq, u32 *n, u32 *cts) int hdmi_compute_acr(u32 sample_freq, u32 *n, u32 *cts)
{ {
...@@ -1100,7 +1094,7 @@ static int __init omapdss_hdmihw_probe(struct platform_device *pdev) ...@@ -1100,7 +1094,7 @@ static int __init omapdss_hdmihw_probe(struct platform_device *pdev)
r = hdmi_panel_init(); r = hdmi_panel_init();
if (r) { if (r) {
DSSERR("can't init panel\n"); DSSERR("can't init panel\n");
goto err_panel_init; return r;
} }
dss_debugfs_create_file("hdmi", hdmi_dump_regs); dss_debugfs_create_file("hdmi", hdmi_dump_regs);
...@@ -1110,10 +1104,6 @@ static int __init omapdss_hdmihw_probe(struct platform_device *pdev) ...@@ -1110,10 +1104,6 @@ static int __init omapdss_hdmihw_probe(struct platform_device *pdev)
hdmi_probe_pdata(pdev); hdmi_probe_pdata(pdev);
return 0; return 0;
err_panel_init:
hdmi_put_clocks();
return r;
} }
static int __exit hdmi_remove_child(struct device *dev, void *data) static int __exit hdmi_remove_child(struct device *dev, void *data)
...@@ -1135,8 +1125,6 @@ static int __exit omapdss_hdmihw_remove(struct platform_device *pdev) ...@@ -1135,8 +1125,6 @@ static int __exit omapdss_hdmihw_remove(struct platform_device *pdev)
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
hdmi_put_clocks();
return 0; return 0;
} }
......
...@@ -721,7 +721,7 @@ static int venc_get_clocks(struct platform_device *pdev) ...@@ -721,7 +721,7 @@ static int venc_get_clocks(struct platform_device *pdev)
struct clk *clk; struct clk *clk;
if (dss_has_feature(FEAT_VENC_REQUIRES_TV_DAC_CLK)) { if (dss_has_feature(FEAT_VENC_REQUIRES_TV_DAC_CLK)) {
clk = clk_get(&pdev->dev, "tv_dac_clk"); clk = devm_clk_get(&pdev->dev, "tv_dac_clk");
if (IS_ERR(clk)) { if (IS_ERR(clk)) {
DSSERR("can't get tv_dac_clk\n"); DSSERR("can't get tv_dac_clk\n");
return PTR_ERR(clk); return PTR_ERR(clk);
...@@ -735,12 +735,6 @@ static int venc_get_clocks(struct platform_device *pdev) ...@@ -735,12 +735,6 @@ static int venc_get_clocks(struct platform_device *pdev)
return 0; return 0;
} }
static void venc_put_clocks(void)
{
if (venc.tv_dac_clk)
clk_put(venc.tv_dac_clk);
}
static struct omap_dss_device * __init venc_find_dssdev(struct platform_device *pdev) static struct omap_dss_device * __init venc_find_dssdev(struct platform_device *pdev)
{ {
struct omap_dss_board_info *pdata = pdev->dev.platform_data; struct omap_dss_board_info *pdata = pdev->dev.platform_data;
...@@ -886,7 +880,6 @@ static int __init omap_venchw_probe(struct platform_device *pdev) ...@@ -886,7 +880,6 @@ static int __init omap_venchw_probe(struct platform_device *pdev)
err_panel_init: err_panel_init:
err_runtime_get: err_runtime_get:
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
venc_put_clocks();
return r; return r;
} }
...@@ -904,7 +897,6 @@ static int __exit omap_venchw_remove(struct platform_device *pdev) ...@@ -904,7 +897,6 @@ static int __exit omap_venchw_remove(struct platform_device *pdev)
venc_uninit_output(pdev); venc_uninit_output(pdev);
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
venc_put_clocks();
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment