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: 13197 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 35C0823FCD for ; Mon, 26 Nov 2012 06:27:05 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id D6767A19925 for ; Mon, 26 Nov 2012 06:27:04 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id c10so4098190ieb.11 for ; Sun, 25 Nov 2012 22:27:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=tj/6Cbe3I/15Fdc5+cHJGaiAyBUtUo+UgzObibd2KIo=; b=n2Up2mYOvXgWG4TPLZ+pYZSFcJRxSTzsPD1APXpEVYENq+mRYJAd7YJbotjjdqj3tA syOoOm3hIxDnhsEVQL0RBlI1Udo9f6JfaapVzCcwbz92+jX5W8tXNU+Q2R1j5DTQb67c 82cTkeAyFCSDHEHpZbKSC9cQYjdRNdObO8GT35h0tjjevoAUirmj1KA6p5lmlF+CF2jS fc7DZIXKY1OqVU0Iwoky57sAdY8Xtmps1ltt2HX2Z1r3VUYHn6nWUHjLh12AI6sgAabY 3e3HmHrAJjlA8/6OMbBaDRcrjLlRW833vMYzPtX83c4ykTKOqcYO0lRwlvwfOoCYfbx+ Wbbw== Received: by 10.50.91.195 with SMTP id cg3mr12637171igb.57.1353911224533; Sun, 25 Nov 2012 22:27:04 -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.50.67.148 with SMTP id n20csp209072igt; Sun, 25 Nov 2012 22:27:04 -0800 (PST) Received: by 10.68.132.202 with SMTP id ow10mr34157688pbb.139.1353911223962; Sun, 25 Nov 2012 22:27:03 -0800 (PST) Received: from mail-pb0-f43.google.com (mail-pb0-f43.google.com [209.85.160.43]) by mx.google.com with ESMTPS id gk10si18223689pbc.146.2012.11.25.22.27.03 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 25 Nov 2012 22:27:03 -0800 (PST) Received-SPF: neutral (google.com: 209.85.160.43 is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) client-ip=209.85.160.43; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.160.43 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-f43.google.com with SMTP id wz17so7193186pbc.2 for ; Sun, 25 Nov 2012 22:27:03 -0800 (PST) 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: ALoCoQk/bx1H4rGf6XfMZsh5X34Nbz1umSEtMAk60nhKvmoKi4PjsmRKkzFBcr80odLUJZvKx5dz 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)