Message ID | 1353642119-10253-4-git-send-email-sachin.kamat@linaro.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
> -----Original Message----- > From: Sachin Kamat [mailto:sachin.kamat@linaro.org] > Sent: Friday, November 23, 2012 12:42 PM > To: dri-devel@lists.freedesktop.org > Cc: inki.dae@samsung.com; jy0922.shim@samsung.com; airlied@linux.ie; > sachin.kamat@linaro.org; patches@linaro.org > Subject: [PATCH 3/5] drm/exynos: Use devm_clk_get in exynos_mixer.c > > devm_clk_get is device managed and makes error handling and exit code > simpler. > > Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> > --- > drivers/gpu/drm/exynos/exynos_mixer.c | 20 +++++--------------- > 1 files changed, 5 insertions(+), 15 deletions(-) > > diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c > b/drivers/gpu/drm/exynos/exynos_mixer.c > index 0d3ed28..88fcb40 100644 > --- a/drivers/gpu/drm/exynos/exynos_mixer.c > +++ b/drivers/gpu/drm/exynos/exynos_mixer.c > @@ -962,14 +962,14 @@ static int __devinit mixer_resources_init(struct > exynos_drm_hdmi_context *ctx, > > spin_lock_init(&mixer_res->reg_slock); > > - mixer_res->mixer = clk_get(dev, "mixer"); > + mixer_res->mixer = devm_clk_get(dev, "mixer"); > if (IS_ERR_OR_NULL(mixer_res->mixer)) { > dev_err(dev, "failed to get clock 'mixer'\n"); > ret = -ENODEV; Just return ret; > goto fail; > } > > - mixer_res->sclk_hdmi = clk_get(dev, "sclk_hdmi"); > + mixer_res->sclk_hdmi = devm_clk_get(dev, "sclk_hdmi"); > if (IS_ERR_OR_NULL(mixer_res->sclk_hdmi)) { > dev_err(dev, "failed to get clock 'sclk_hdmi'\n"); > ret = -ENODEV; Ditto. > @@ -1008,10 +1008,6 @@ static int __devinit mixer_resources_init(struct > exynos_drm_hdmi_context *ctx, > return 0; > > fail: > - if (!IS_ERR_OR_NULL(mixer_res->sclk_hdmi)) > - clk_put(mixer_res->sclk_hdmi); > - if (!IS_ERR_OR_NULL(mixer_res->mixer)) > - clk_put(mixer_res->mixer); > return ret; > } > > @@ -1024,19 +1020,19 @@ static int __devinit vp_resources_init(struct > exynos_drm_hdmi_context *ctx, > struct resource *res; > int ret; > > - mixer_res->vp = clk_get(dev, "vp"); > + mixer_res->vp = devm_clk_get(dev, "vp"); > if (IS_ERR_OR_NULL(mixer_res->vp)) { > dev_err(dev, "failed to get clock 'vp'\n"); > ret = -ENODEV; > goto fail; Just return ret; > } > - mixer_res->sclk_mixer = clk_get(dev, "sclk_mixer"); > + mixer_res->sclk_mixer = devm_clk_get(dev, "sclk_mixer"); > if (IS_ERR_OR_NULL(mixer_res->sclk_mixer)) { > dev_err(dev, "failed to get clock 'sclk_mixer'\n"); > ret = -ENODEV; > goto fail; Ditto. > } > - mixer_res->sclk_dac = clk_get(dev, "sclk_dac"); > + mixer_res->sclk_dac = devm_clk_get(dev, "sclk_dac"); > if (IS_ERR_OR_NULL(mixer_res->sclk_dac)) { > dev_err(dev, "failed to get clock 'sclk_dac'\n"); > ret = -ENODEV; > @@ -1064,12 +1060,6 @@ static int __devinit vp_resources_init(struct > exynos_drm_hdmi_context *ctx, > return 0; > > fail: > - if (!IS_ERR_OR_NULL(mixer_res->sclk_dac)) > - clk_put(mixer_res->sclk_dac); > - if (!IS_ERR_OR_NULL(mixer_res->sclk_mixer)) > - clk_put(mixer_res->sclk_mixer); > - if (!IS_ERR_OR_NULL(mixer_res->vp)) > - clk_put(mixer_res->vp); > return ret; And remove this. > } > > -- > 1.7.4.1
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index 0d3ed28..88fcb40 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c @@ -962,14 +962,14 @@ static int __devinit mixer_resources_init(struct exynos_drm_hdmi_context *ctx, spin_lock_init(&mixer_res->reg_slock); - mixer_res->mixer = clk_get(dev, "mixer"); + mixer_res->mixer = devm_clk_get(dev, "mixer"); if (IS_ERR_OR_NULL(mixer_res->mixer)) { dev_err(dev, "failed to get clock 'mixer'\n"); ret = -ENODEV; goto fail; } - mixer_res->sclk_hdmi = clk_get(dev, "sclk_hdmi"); + mixer_res->sclk_hdmi = devm_clk_get(dev, "sclk_hdmi"); if (IS_ERR_OR_NULL(mixer_res->sclk_hdmi)) { dev_err(dev, "failed to get clock 'sclk_hdmi'\n"); ret = -ENODEV; @@ -1008,10 +1008,6 @@ static int __devinit mixer_resources_init(struct exynos_drm_hdmi_context *ctx, return 0; fail: - if (!IS_ERR_OR_NULL(mixer_res->sclk_hdmi)) - clk_put(mixer_res->sclk_hdmi); - if (!IS_ERR_OR_NULL(mixer_res->mixer)) - clk_put(mixer_res->mixer); return ret; } @@ -1024,19 +1020,19 @@ static int __devinit vp_resources_init(struct exynos_drm_hdmi_context *ctx, struct resource *res; int ret; - mixer_res->vp = clk_get(dev, "vp"); + mixer_res->vp = devm_clk_get(dev, "vp"); if (IS_ERR_OR_NULL(mixer_res->vp)) { dev_err(dev, "failed to get clock 'vp'\n"); ret = -ENODEV; goto fail; } - mixer_res->sclk_mixer = clk_get(dev, "sclk_mixer"); + mixer_res->sclk_mixer = devm_clk_get(dev, "sclk_mixer"); if (IS_ERR_OR_NULL(mixer_res->sclk_mixer)) { dev_err(dev, "failed to get clock 'sclk_mixer'\n"); ret = -ENODEV; goto fail; } - mixer_res->sclk_dac = clk_get(dev, "sclk_dac"); + mixer_res->sclk_dac = devm_clk_get(dev, "sclk_dac"); if (IS_ERR_OR_NULL(mixer_res->sclk_dac)) { dev_err(dev, "failed to get clock 'sclk_dac'\n"); ret = -ENODEV; @@ -1064,12 +1060,6 @@ static int __devinit vp_resources_init(struct exynos_drm_hdmi_context *ctx, return 0; fail: - if (!IS_ERR_OR_NULL(mixer_res->sclk_dac)) - clk_put(mixer_res->sclk_dac); - if (!IS_ERR_OR_NULL(mixer_res->sclk_mixer)) - clk_put(mixer_res->sclk_mixer); - if (!IS_ERR_OR_NULL(mixer_res->vp)) - clk_put(mixer_res->vp); return ret; }
devm_clk_get is device managed and makes error handling and exit code simpler. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> --- drivers/gpu/drm/exynos/exynos_mixer.c | 20 +++++--------------- 1 files changed, 5 insertions(+), 15 deletions(-)