Message ID | 1350472311-9748-5-git-send-email-sachin.kamat@linaro.org (mailing list archive) |
---|---|
State | RFC, archived |
Headers |
Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from <linux-media-owner@vger.kernel.org>) id 1TORcH-0007XK-Sr for patchwork@linuxtv.org; Wed, 17 Oct 2012 13:16:49 +0200 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.75/mailfrontend-3) with esmtp for <patchwork@linuxtv.org> id 1TORcH-0000BE-Dz; Wed, 17 Oct 2012 13:16:49 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756616Ab2JQLQq (ORCPT <rfc822;patchwork@linuxtv.org>); Wed, 17 Oct 2012 07:16:46 -0400 Received: from mail-pa0-f46.google.com ([209.85.220.46]:42343 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756530Ab2JQLQn (ORCPT <rfc822;linux-media@vger.kernel.org>); Wed, 17 Oct 2012 07:16:43 -0400 Received: by mail-pa0-f46.google.com with SMTP id hz1so6997024pad.19 for <linux-media@vger.kernel.org>; Wed, 17 Oct 2012 04:16:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=Yzobj+eLlWKlh0sCQszrNy+Y2PXijGfXOMthUFTrBjs=; b=b23ZQV+5OrnCzM0abCa7Z6KC8PEe4tIidW5RBurLKkGjmBezePvwldk+BudYztwcC1 rwXVC2hZ6Fya2knjitPokCa1k6EvdJ62Ej2wlIHSd3ZuFMa6c+9y0zn+xPjtvtE97j9Q /gkuPUzH7zhXQL7Zync5YpeBnMquROnIYf6WWlVS8EIlGppSOf0wdhGLE54y6V/TlFWD QnVVBGO75K7bzIArTg415Ft3tcBfz0ILh+wynd6GdF7gA8KaCGy9V+Z9Tn2oWUa0z+C9 GaPpICx7t62cLB2iLAPYN5TO/F3dPJ3JbE3xfm0n7G/fnrQ8fU4xQca1s7HzluPt2CSv glmg== Received: by 10.68.125.229 with SMTP id mt5mr30037923pbb.51.1350472603560; Wed, 17 Oct 2012 04:16:43 -0700 (PDT) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPS id vu7sm12365003pbc.9.2012.10.17.04.16.41 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 17 Oct 2012 04:16:43 -0700 (PDT) From: Sachin Kamat <sachin.kamat@linaro.org> To: linux-media@vger.kernel.org Cc: s.nawrocki@samsung.com, sachin.kamat@linaro.org, patches@linaro.org Subject: [PATCH 5/8] [media] exynos-gsc: Use clk_prepare_enable and clk_disable_unprepare Date: Wed, 17 Oct 2012 16:41:48 +0530 Message-Id: <1350472311-9748-5-git-send-email-sachin.kamat@linaro.org> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1350472311-9748-1-git-send-email-sachin.kamat@linaro.org> References: <1350472311-9748-1-git-send-email-sachin.kamat@linaro.org> X-Gm-Message-State: ALoCoQkF4LTI3ZhpD+h8srY3eouCfVvi8ArO0oLW3tiG6QVocYXVR/jvkH7sErGpCkKNfg0dKuHu Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: <linux-media.vger.kernel.org> X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2012.10.17.110917 X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' MULTIPLE_RCPTS 0.1, HTML_00_01 0.05, HTML_00_10 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_1200_1299 0, BODY_SIZE_2000_LESS 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, URI_ENDS_IN_HTML 0, __ANY_URI 0, __CP_URI_IN_BODY 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __HAS_X_MAILING_LIST 0, __MIME_TEXT_ONLY 0, __MULTIPLE_RCPTS_CC_X2 0, __SANE_MSGID 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_WWW 0, __URI_NS ' |
Commit Message
Sachin Kamat
Oct. 17, 2012, 11:11 a.m. UTC
Replace clk_enable/clk_disable with clk_prepare_enable/clk_disable_unprepare
as required by the common clock framework.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
drivers/media/platform/exynos-gsc/gsc-core.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
Comments
On 10/17/2012 01:11 PM, Sachin Kamat wrote: > Replace clk_enable/clk_disable with clk_prepare_enable/clk_disable_unprepare > as required by the common clock framework. > > Signed-off-by: Sachin Kamat<sachin.kamat@linaro.org> > --- > drivers/media/platform/exynos-gsc/gsc-core.c | 4 ++-- > 1 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/media/platform/exynos-gsc/gsc-core.c b/drivers/media/platform/exynos-gsc/gsc-core.c > index bfec9e6..d11668b 100644 > --- a/drivers/media/platform/exynos-gsc/gsc-core.c > +++ b/drivers/media/platform/exynos-gsc/gsc-core.c > @@ -1009,7 +1009,7 @@ static int gsc_clk_get(struct gsc_dev *gsc) > if (IS_ERR(gsc->clock)) > goto err_print; > > - ret = clk_prepare(gsc->clock); > + ret = clk_prepare_enable(gsc->clock); This is not right, gsc->clock is being enabled somewhere else. And as you can see this driver has already taken care of preparing/ unpreparing the clock. > if (ret< 0) { > clk_put(gsc->clock); > gsc->clock = NULL; > @@ -1186,7 +1186,7 @@ static int gsc_runtime_suspend(struct device *dev) > > ret = gsc_m2m_suspend(gsc); > if (!ret) > - clk_disable(gsc->clock); > + clk_disable_unprepare(gsc->clock); No, that will result in unbalanced clk_prepare/unprepare. Please don't do that. > > pr_debug("gsc%d: state: 0x%lx", gsc->id, gsc->state); > return ret; This driver should already inter-work fine with the common clock framework, just look how it handles the clock: # git grep -n -7 clk_ -- exynos-gsc exynos-gsc/gsc-core.c:993:static void gsc_clk_put(struct gsc_dev *gsc) exynos-gsc/gsc-core.c-994-{ exynos-gsc/gsc-core.c-995- if (IS_ERR_OR_NULL(gsc->clock)) exynos-gsc/gsc-core.c-996- return; exynos-gsc/gsc-core.c-997- exynos-gsc/gsc-core.c:998: clk_unprepare(gsc->clock); exynos-gsc/gsc-core.c:999: clk_put(gsc->clock); exynos-gsc/gsc-core.c-1000- gsc->clock = NULL; exynos-gsc/gsc-core.c-1001-} exynos-gsc/gsc-core.c-1002- exynos-gsc/gsc-core.c:1003:static int gsc_clk_get(struct gsc_dev *gsc) exynos-gsc/gsc-core.c-1004-{ exynos-gsc/gsc-core.c-1005- int ret; exynos-gsc/gsc-core.c-1006- exynos-gsc/gsc-core.c:1007: dev_dbg(&gsc->pdev->dev, "gsc_clk_get Called\n"); exynos-gsc/gsc-core.c-1008- exynos-gsc/gsc-core.c:1009: gsc->clock = clk_get(&gsc->pdev->dev, GSC_CLOCK_GATE_NAME); exynos-gsc/gsc-core.c-1010- if (IS_ERR(gsc->clock)) exynos-gsc/gsc-core.c-1011- goto err_print; exynos-gsc/gsc-core.c-1012- exynos-gsc/gsc-core.c:1013: ret = clk_prepare(gsc->clock); exynos-gsc/gsc-core.c-1014- if (ret < 0) { exynos-gsc/gsc-core.c:1015: clk_put(gsc->clock); exynos-gsc/gsc-core.c-1016- gsc->clock = NULL; exynos-gsc/gsc-core.c-1017- goto err; exynos-gsc/gsc-core.c-1018- } exynos-gsc/gsc-core.c-1019- exynos-gsc/gsc-core.c-1020- return 0; exynos-gsc/gsc-core.c-1021- exynos-gsc/gsc-core.c-1022-err: exynos-gsc/gsc-core.c-1023- dev_err(&gsc->pdev->dev, "clock prepare failed for clock: %s\n", exynos-gsc/gsc-core.c-1024- GSC_CLOCK_GATE_NAME); exynos-gsc/gsc-core.c:1025: gsc_clk_put(gsc); exynos-gsc/gsc-core.c-1026-err_print: exynos-gsc/gsc-core.c-1027- dev_err(&gsc->pdev->dev, "failed to get clock~~~: %s\n", exynos-gsc/gsc-core.c-1028- GSC_CLOCK_GATE_NAME); exynos-gsc/gsc-core.c-1029- return -ENXIO; exynos-gsc/gsc-core.c-1030-} -- exynos-gsc/gsc-core.c-1105- exynos-gsc/gsc-core.c-1106- res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); exynos-gsc/gsc-core.c-1107- if (!res) { exynos-gsc/gsc-core.c-1108- dev_err(dev, "failed to get IRQ resource\n"); exynos-gsc/gsc-core.c-1109- return -ENXIO; exynos-gsc/gsc-core.c-1110- } exynos-gsc/gsc-core.c-1111- exynos-gsc/gsc-core.c:1112: ret = gsc_clk_get(gsc); exynos-gsc/gsc-core.c-1113- if (ret) exynos-gsc/gsc-core.c-1114- return ret; -- exynos-gsc/gsc-core.c-1142- pm_runtime_put(dev); exynos-gsc/gsc-core.c-1143- return 0; exynos-gsc/gsc-core.c-1144-err_pm: exynos-gsc/gsc-core.c-1145- pm_runtime_put(dev); exynos-gsc/gsc-core.c-1146-err_m2m: exynos-gsc/gsc-core.c-1147- gsc_unregister_m2m_device(gsc); exynos-gsc/gsc-core.c-1148-err_clk: exynos-gsc/gsc-core.c:1149: gsc_clk_put(gsc); exynos-gsc/gsc-core.c-1150- return ret; exynos-gsc/gsc-core.c-1151-} -- exynos-gsc/gsc-core.c-1166-static int gsc_runtime_resume(struct device *dev) exynos-gsc/gsc-core.c-1167-{ exynos-gsc/gsc-core.c-1168- struct gsc_dev *gsc = dev_get_drvdata(dev); exynos-gsc/gsc-core.c-1169- int ret = 0; exynos-gsc/gsc-core.c-1170- exynos-gsc/gsc-core.c-1171- pr_debug("gsc%d: state: 0x%lx", gsc->id, gsc->state); exynos-gsc/gsc-core.c-1172- exynos-gsc/gsc-core.c:1173: ret = clk_enable(gsc->clock); exynos-gsc/gsc-core.c-1174- if (ret) exynos-gsc/gsc-core.c-1175- return ret; exynos-gsc/gsc-core.c-1176- exynos-gsc/gsc-core.c-1177- gsc_hw_set_sw_reset(gsc); exynos-gsc/gsc-core.c-1178- gsc_wait_reset(gsc); exynos-gsc/gsc-core.c-1179- exynos-gsc/gsc-core.c-1180- return gsc_m2m_resume(gsc); -- exynos-gsc/gsc-core.c-1183-static int gsc_runtime_suspend(struct device *dev) exynos-gsc/gsc-core.c-1184-{ exynos-gsc/gsc-core.c-1185- struct gsc_dev *gsc = dev_get_drvdata(dev); exynos-gsc/gsc-core.c-1186- int ret = 0; exynos-gsc/gsc-core.c-1187- exynos-gsc/gsc-core.c-1188- ret = gsc_m2m_suspend(gsc); exynos-gsc/gsc-core.c-1189- if (!ret) exynos-gsc/gsc-core.c:1190: clk_disable(gsc->clock); exynos-gsc/gsc-core.c-1191- exynos-gsc/gsc-core.c-1192- pr_debug("gsc%d: state: 0x%lx", gsc->id, gsc->state); exynos-gsc/gsc-core.c-1193- return ret; exynos-gsc/gsc-core.c-1194-} -- Regards, Sylwester -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/media/platform/exynos-gsc/gsc-core.c b/drivers/media/platform/exynos-gsc/gsc-core.c index bfec9e6..d11668b 100644 --- a/drivers/media/platform/exynos-gsc/gsc-core.c +++ b/drivers/media/platform/exynos-gsc/gsc-core.c @@ -1009,7 +1009,7 @@ static int gsc_clk_get(struct gsc_dev *gsc) if (IS_ERR(gsc->clock)) goto err_print; - ret = clk_prepare(gsc->clock); + ret = clk_prepare_enable(gsc->clock); if (ret < 0) { clk_put(gsc->clock); gsc->clock = NULL; @@ -1186,7 +1186,7 @@ static int gsc_runtime_suspend(struct device *dev) ret = gsc_m2m_suspend(gsc); if (!ret) - clk_disable(gsc->clock); + clk_disable_unprepare(gsc->clock); pr_debug("gsc%d: state: 0x%lx", gsc->id, gsc->state); return ret;