From patchwork Mon Nov 26 06:20:21 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Kamat X-Patchwork-Id: 1800621 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id CD66BDF2F9 for ; Mon, 26 Nov 2012 06:27:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753976Ab2KZG1F (ORCPT ); Mon, 26 Nov 2012 01:27:05 -0500 Received: from mail-pb0-f46.google.com ([209.85.160.46]:56097 "EHLO mail-pb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751814Ab2KZG1D (ORCPT ); Mon, 26 Nov 2012 01:27:03 -0500 Received: by mail-pb0-f46.google.com with SMTP id wy7so7770073pbc.19 for ; Sun, 25 Nov 2012 22:27:03 -0800 (PST) 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=tj/6Cbe3I/15Fdc5+cHJGaiAyBUtUo+UgzObibd2KIo=; b=TP3+Q2S6bJ0vQevXv77usnjg+F9q9/BNMPm1homM9cMujoa1ZviHqmgo/T3ZGWu+8I uqDUpT2JKzkbcukvm8QYnyCmvRB2U8+R1bQhYUcaesBz8nWPhNSLjfjIX7RzXjAmar9E XXDby4nv5qVr6WrXrKMv9/BlalL+KU8qkBx8AqThJ7prbjr91sPIXwS9GHdjWLga2Zg3 9jGSRPLDnN/TCv35kD+zMCi8GeHCOUJ+n2cDEkdspp6NExwNXmlTdt03rr0tlKSWPD2w 8YeLf8wn5mqdImGkTFv1fxxvT1czsOrg3ZZlDz6UUvfQDL7iZ2lf9V7OJpKbn3t5b0yv AO0w== Received: by 10.66.80.68 with SMTP id p4mr30130601pax.35.1353911223722; Sun, 25 Nov 2012 22:27:03 -0800 (PST) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPS id o1sm8215060paz.34.2012.11.25.22.27.00 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 25 Nov 2012 22:27:03 -0800 (PST) From: Sachin Kamat To: linux-media@vger.kernel.org Cc: shaik.ameer@samsung.com, sylvester.nawrocki@gmail.com, s.nawrocki@samsung.com, sachin.kamat@linaro.org, patches@linaro.org Subject: [PATCH v2 3/3] [media] exynos-gsc: Use devm_clk_get() Date: Mon, 26 Nov 2012 11:50:21 +0530 Message-Id: <1353910821-21408-4-git-send-email-sachin.kamat@linaro.org> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1353910821-21408-1-git-send-email-sachin.kamat@linaro.org> References: <1353910821-21408-1-git-send-email-sachin.kamat@linaro.org> X-Gm-Message-State: ALoCoQnNatYKF1QT+sNyFOrckLirj6ICRCGYVZLMghSRlJDjZsvV/qfhYb7I4KLfR4YuI4gXH/JP Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org devm_clk_get() is a device managed function and makes error handling a bit simpler. Cc: Shaik Ameer Basha Signed-off-by: Sachin Kamat --- drivers/media/platform/exynos-gsc/gsc-core.c | 17 ++++------------- 1 files changed, 4 insertions(+), 13 deletions(-) diff --git a/drivers/media/platform/exynos-gsc/gsc-core.c b/drivers/media/platform/exynos-gsc/gsc-core.c index c8b82c0..0c22ad5 100644 --- a/drivers/media/platform/exynos-gsc/gsc-core.c +++ b/drivers/media/platform/exynos-gsc/gsc-core.c @@ -1002,11 +1002,8 @@ static void *gsc_get_drv_data(struct platform_device *pdev) static void gsc_clk_put(struct gsc_dev *gsc) { - if (!IS_ERR(gsc->clock)) { + if (!IS_ERR(gsc->clock)) clk_unprepare(gsc->clock); - clk_put(gsc->clock); - gsc->clock = NULL; - } } static int gsc_clk_get(struct gsc_dev *gsc) @@ -1015,28 +1012,22 @@ static int gsc_clk_get(struct gsc_dev *gsc) dev_dbg(&gsc->pdev->dev, "gsc_clk_get Called\n"); - gsc->clock = clk_get(&gsc->pdev->dev, GSC_CLOCK_GATE_NAME); + gsc->clock = devm_clk_get(&gsc->pdev->dev, GSC_CLOCK_GATE_NAME); if (IS_ERR(gsc->clock)) { dev_err(&gsc->pdev->dev, "failed to get clock~~~: %s\n", GSC_CLOCK_GATE_NAME); - goto err_clk_get; + return PTR_ERR(gsc->clock); } ret = clk_prepare(gsc->clock); if (ret < 0) { dev_err(&gsc->pdev->dev, "clock prepare failed for clock: %s\n", GSC_CLOCK_GATE_NAME); - clk_put(gsc->clock); gsc->clock = ERR_PTR(-EINVAL); - goto err_clk_prepare; + return ret; } return 0; - -err_clk_prepare: - gsc_clk_put(gsc); -err_clk_get: - return -ENXIO; } static int gsc_m2m_suspend(struct gsc_dev *gsc)