From: Russell King <rmk+kernel@xxxxxxxxxxxxxxxx> Rename the GPU clock functions for what they actually are, splitting the clock disable out from etnaviv_gpu_suspend(). This allows us to fix etnaviv_gpu_rpm_resume(), which needed only to disable the clocks on failure, rather than trying to stop an uninitialised GPU. Signed-off-by: Russell King <rmk+kernel@xxxxxxxxxxxxxxxx> --- drivers/staging/etnaviv/etnaviv_gpu.c | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/drivers/staging/etnaviv/etnaviv_gpu.c b/drivers/staging/etnaviv/etnaviv_gpu.c index d274fcf9f5b1..2a6560be4c51 100644 --- a/drivers/staging/etnaviv/etnaviv_gpu.c +++ b/drivers/staging/etnaviv/etnaviv_gpu.c @@ -1046,7 +1046,7 @@ static irqreturn_t irq_handler(int irq, void *data) return ret; } -static int etnaviv_gpu_resume(struct etnaviv_gpu *gpu) +static int etnaviv_gpu_clk_enable(struct etnaviv_gpu *gpu) { int ret; @@ -1063,10 +1063,23 @@ static int etnaviv_gpu_resume(struct etnaviv_gpu *gpu) return 0; } -static int etnaviv_gpu_suspend(struct etnaviv_gpu *gpu) +static int etnaviv_gpu_clk_disable(struct etnaviv_gpu *gpu) { int ret; + ret = disable_axi(gpu); + if (ret) + return ret; + + ret = disable_clk(gpu); + if (ret) + return ret; + + return 0; +} + +static int etnaviv_gpu_suspend(struct etnaviv_gpu *gpu) +{ if (gpu->buffer) { unsigned long timeout; @@ -1096,15 +1109,7 @@ static int etnaviv_gpu_suspend(struct etnaviv_gpu *gpu) } while (1); } - ret = disable_axi(gpu); - if (ret) - return ret; - - ret = disable_clk(gpu); - if (ret) - return ret; - - return 0; + return etnaviv_gpu_clk_disable(gpu); } static int etnaviv_gpu_bind(struct device *dev, struct device *master, @@ -1118,7 +1123,7 @@ static int etnaviv_gpu_bind(struct device *dev, struct device *master, #ifdef CONFIG_PM ret = pm_runtime_get_sync(gpu->dev); #else - ret = etnaviv_gpu_resume(gpu); + ret = etnaviv_gpu_clk_enable(gpu); #endif if (ret < 0) return ret; @@ -1300,7 +1305,7 @@ static int etnaviv_gpu_rpm_resume(struct device *dev) if (drm && WARN_ON_ONCE(mutex_is_locked(&drm->struct_mutex))) return -EDEADLK; - ret = etnaviv_gpu_resume(gpu); + ret = etnaviv_gpu_clk_enable(gpu); if (ret) return ret; @@ -1308,7 +1313,7 @@ static int etnaviv_gpu_rpm_resume(struct device *dev) if (drm && gpu->buffer) { ret = mutex_lock_killable(&drm->struct_mutex); if (ret) { - etnaviv_gpu_suspend(gpu); + etnaviv_gpu_clk_disable(gpu); return ret; } etnaviv_gpu_hw_init(gpu); -- 2.5.1 _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/dri-devel