Commit 6d6defd4 authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by Javier Martinez Canillas

drm/mxsfb: improve clk handling for axi clk

Ignoring errors from devm_clk_get() is wrong. To handle not all platforms
having an axi clk use devm_clk_get_optional() instead and do proper error
handling.

Also the clk API handles NULL as a dummy clk (which is also returned by
devm_clk_get_optional() if there is no clk) so there is no need to check
for NULL before calling clk_prepare_enable() or its counter part.
Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: default avatarJavier Martinez Canillas <javierm@redhat.com>
Signed-off-by: default avatarJavier Martinez Canillas <javierm@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200720153254.18071-1-u.kleine-koenig@pengutronix.de
parent 67d0a301
...@@ -78,14 +78,12 @@ static const struct mxsfb_devdata mxsfb_devdata[] = { ...@@ -78,14 +78,12 @@ static const struct mxsfb_devdata mxsfb_devdata[] = {
void mxsfb_enable_axi_clk(struct mxsfb_drm_private *mxsfb) void mxsfb_enable_axi_clk(struct mxsfb_drm_private *mxsfb)
{ {
if (mxsfb->clk_axi) clk_prepare_enable(mxsfb->clk_axi);
clk_prepare_enable(mxsfb->clk_axi);
} }
void mxsfb_disable_axi_clk(struct mxsfb_drm_private *mxsfb) void mxsfb_disable_axi_clk(struct mxsfb_drm_private *mxsfb)
{ {
if (mxsfb->clk_axi) clk_disable_unprepare(mxsfb->clk_axi);
clk_disable_unprepare(mxsfb->clk_axi);
} }
static struct drm_framebuffer * static struct drm_framebuffer *
...@@ -235,9 +233,9 @@ static int mxsfb_load(struct drm_device *drm, ...@@ -235,9 +233,9 @@ static int mxsfb_load(struct drm_device *drm,
if (IS_ERR(mxsfb->clk)) if (IS_ERR(mxsfb->clk))
return PTR_ERR(mxsfb->clk); return PTR_ERR(mxsfb->clk);
mxsfb->clk_axi = devm_clk_get(drm->dev, "axi"); mxsfb->clk_axi = devm_clk_get_optional(drm->dev, "axi");
if (IS_ERR(mxsfb->clk_axi)) if (IS_ERR(mxsfb->clk_axi))
mxsfb->clk_axi = NULL; return PTR_ERR(mxsfb->clk_axi);
mxsfb->clk_disp_axi = devm_clk_get(drm->dev, "disp_axi"); mxsfb->clk_disp_axi = devm_clk_get(drm->dev, "disp_axi");
if (IS_ERR(mxsfb->clk_disp_axi)) if (IS_ERR(mxsfb->clk_disp_axi))
......
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