From patchwork Fri Dec 28 10:26:18 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Kamat X-Patchwork-Id: 13735 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 0BA8F23E1F for ; Fri, 28 Dec 2012 10:34:09 +0000 (UTC) Received: from mail-vb0-f51.google.com (mail-vb0-f51.google.com [209.85.212.51]) by fiordland.canonical.com (Postfix) with ESMTP id 9E3EAA193E8 for ; Fri, 28 Dec 2012 10:34:08 +0000 (UTC) Received: by mail-vb0-f51.google.com with SMTP id fq11so10774283vbb.10 for ; Fri, 28 Dec 2012 02:34:08 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :x-gm-message-state; bh=fBJ6GPr+ni73b8pUzopjfIJqMquohBquz7tL+RHvocw=; b=H2z2S6eLLvyY+Kks8AbYkhGr/5Fr7L7nRurMYihQMOq0roQZh3oaHJm1QgneTr9IQ1 rYCFLAlIhoDe6hut8T1P8sUkEOcDRzvhxeai02qPhUSpy+45G0rHkUmV9P9EMcsCQ0sJ thdtokze8xHEOITgPyksMYbn3EsOIqMkvR10H+dl8gkkCC8nM+tQqqfRTEiVxLfDTzXV tiWy4kSJSgckyPf7+0ZDYVwjKvRe7UO/OVFMAodP5deEw2KH1TzMUBoKu16y/OKqeDuN JaQp+QiRdP/FWhhEWvvp/ONCxLinM/2e8rdAEPbv4gpgB9eOTjsC9PsvS//1jIU3OPbt aOug== X-Received: by 10.220.218.197 with SMTP id hr5mr49744679vcb.8.1356690848133; Fri, 28 Dec 2012 02:34:08 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.58.214.195 with SMTP id oc3csp53757vec; Fri, 28 Dec 2012 02:34:07 -0800 (PST) X-Received: by 10.68.233.201 with SMTP id ty9mr105096602pbc.14.1356690846810; Fri, 28 Dec 2012 02:34:06 -0800 (PST) Received: from mail-pb0-f42.google.com (mail-pb0-f42.google.com [209.85.160.42]) by mx.google.com with ESMTPS id wk7si31690253pbc.199.2012.12.28.02.34.06 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 28 Dec 2012 02:34:06 -0800 (PST) Received-SPF: neutral (google.com: 209.85.160.42 is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) client-ip=209.85.160.42; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.160.42 is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) smtp.mail=sachin.kamat@linaro.org Received: by mail-pb0-f42.google.com with SMTP id rp2so5894412pbb.1 for ; Fri, 28 Dec 2012 02:34:06 -0800 (PST) X-Received: by 10.66.87.202 with SMTP id ba10mr97575994pab.72.1356690846164; Fri, 28 Dec 2012 02:34:06 -0800 (PST) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPS id t5sm20169766paw.20.2012.12.28.02.34.00 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 28 Dec 2012 02:34:05 -0800 (PST) From: Sachin Kamat To: dri-devel@lists.freedesktop.org Cc: inki.dae@samsung.com, sachin.kamat@linaro.org, patches@linaro.org, Eunchul Kim Subject: [PATCH 04/10 Resend] drm/exynos: Use devm_clk_get in exynos_drm_fimc.c Date: Fri, 28 Dec 2012 15:56:18 +0530 Message-Id: <1356690378-12802-1-git-send-email-sachin.kamat@linaro.org> X-Mailer: git-send-email 1.7.4.1 X-Gm-Message-State: ALoCoQkG7QLfDDewN9sEURi+Q3gUralqBWrHNNHd+RqulVqLm46Uyh/rq3XUXS7veHZAPaVNCpA9 This eliminates the need for explicit clk_put and makes the cleanup and exit path code simpler. Cc: Eunchul Kim Signed-off-by: Sachin Kamat --- drivers/gpu/drm/exynos/exynos_drm_fimc.c | 45 ++++++------------------------ 1 files changed, 9 insertions(+), 36 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimc.c b/drivers/gpu/drm/exynos/exynos_drm_fimc.c index ef3a838..c52197b 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimc.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimc.c @@ -1739,64 +1739,49 @@ static int fimc_probe(struct platform_device *pdev) platform_get_device_id(pdev)->driver_data; /* clock control */ - ctx->sclk_fimc_clk = clk_get(dev, "sclk_fimc"); + ctx->sclk_fimc_clk = devm_clk_get(dev, "sclk_fimc"); if (IS_ERR(ctx->sclk_fimc_clk)) { dev_err(dev, "failed to get src fimc clock.\n"); return PTR_ERR(ctx->sclk_fimc_clk); } clk_enable(ctx->sclk_fimc_clk); - ctx->fimc_clk = clk_get(dev, "fimc"); + ctx->fimc_clk = devm_clk_get(dev, "fimc"); if (IS_ERR(ctx->fimc_clk)) { dev_err(dev, "failed to get fimc clock.\n"); clk_disable(ctx->sclk_fimc_clk); - clk_put(ctx->sclk_fimc_clk); return PTR_ERR(ctx->fimc_clk); } - ctx->wb_clk = clk_get(dev, "pxl_async0"); + ctx->wb_clk = devm_clk_get(dev, "pxl_async0"); if (IS_ERR(ctx->wb_clk)) { dev_err(dev, "failed to get writeback a clock.\n"); clk_disable(ctx->sclk_fimc_clk); - clk_put(ctx->sclk_fimc_clk); - clk_put(ctx->fimc_clk); return PTR_ERR(ctx->wb_clk); } - ctx->wb_b_clk = clk_get(dev, "pxl_async1"); + ctx->wb_b_clk = devm_clk_get(dev, "pxl_async1"); if (IS_ERR(ctx->wb_b_clk)) { dev_err(dev, "failed to get writeback b clock.\n"); clk_disable(ctx->sclk_fimc_clk); - clk_put(ctx->sclk_fimc_clk); - clk_put(ctx->fimc_clk); - clk_put(ctx->wb_clk); return PTR_ERR(ctx->wb_b_clk); } - parent_clk = clk_get(dev, ddata->parent_clk); + parent_clk = devm_clk_get(dev, ddata->parent_clk); if (IS_ERR(parent_clk)) { dev_err(dev, "failed to get parent clock.\n"); clk_disable(ctx->sclk_fimc_clk); - clk_put(ctx->sclk_fimc_clk); - clk_put(ctx->fimc_clk); - clk_put(ctx->wb_clk); - clk_put(ctx->wb_b_clk); return PTR_ERR(parent_clk); } if (clk_set_parent(ctx->sclk_fimc_clk, parent_clk)) { dev_err(dev, "failed to set parent.\n"); - clk_put(parent_clk); clk_disable(ctx->sclk_fimc_clk); - clk_put(ctx->sclk_fimc_clk); - clk_put(ctx->fimc_clk); - clk_put(ctx->wb_clk); - clk_put(ctx->wb_b_clk); return -EINVAL; } - clk_put(parent_clk); + devm_clk_put(dev, parent_clk); clk_set_rate(ctx->sclk_fimc_clk, pdata->clk_rate); /* resource memory */ @@ -1804,16 +1789,14 @@ static int fimc_probe(struct platform_device *pdev) ctx->regs = devm_request_and_ioremap(dev, ctx->regs_res); if (!ctx->regs) { dev_err(dev, "failed to map registers.\n"); - ret = -ENXIO; - goto err_clk; + return -ENXIO; } /* resource irq */ res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); if (!res) { dev_err(dev, "failed to request irq resource.\n"); - ret = -ENOENT; - goto err_clk; + return -ENOENT; } ctx->irq = res->start; @@ -1821,7 +1804,7 @@ static int fimc_probe(struct platform_device *pdev) IRQF_ONESHOT, "drm_fimc", ctx); if (ret < 0) { dev_err(dev, "failed to request irq.\n"); - goto err_clk; + return ret; } /* context initailization */ @@ -1867,11 +1850,6 @@ err_ippdrv_register: pm_runtime_disable(dev); err_get_irq: free_irq(ctx->irq, ctx); -err_clk: - clk_put(ctx->sclk_fimc_clk); - clk_put(ctx->fimc_clk); - clk_put(ctx->wb_clk); - clk_put(ctx->wb_b_clk); return ret; } @@ -1891,11 +1869,6 @@ static int fimc_remove(struct platform_device *pdev) free_irq(ctx->irq, ctx); - clk_put(ctx->sclk_fimc_clk); - clk_put(ctx->fimc_clk); - clk_put(ctx->wb_clk); - clk_put(ctx->wb_b_clk); - return 0; }