From patchwork Fri Nov 23 11:50:41 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Kamat X-Patchwork-Id: 13146 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 CA57A23DFE for ; Fri, 23 Nov 2012 11:57:12 +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 81844A18815 for ; Fri, 23 Nov 2012 11:57:12 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id c10so1705179ieb.11 for ; Fri, 23 Nov 2012 03:57:12 -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=qp469+Vc7nUbVX87G9BnLv3WPJFrZdhFQYasaxRMMsE=; b=Hl8oGiwqLGAKDL9ny9NWf4EIxMUFLKUfYa/66P5GPLIcwLg23K2VhIZ+/P6H5Md3jm WuYRDc0H0a2ykI4FMjcrvVd0trCRp5FxZ/oOMJSscvgmUWk7Li0MKcs/PFZSsqe87/0U o6HE1C4nNHaFzOOQ0xtFkGfVTqQJk2x+o/ShIEZ7mZs13AicLUlJk8AOep4a3ZCb1U6Q AiP51T14XzXOPYKvE5zkiWHpnjjzWGdZVS8SCSxi3E2JIVohP0IaarfU9d+FYTT1n9LT vZbYTXqnoTAhfwC8KD+MOI69tFrAfGkpQbOYlPus7HDoDswM2urqzF/2g72YW1LDYVLh UJKQ== Received: by 10.50.91.195 with SMTP id cg3mr5881469igb.57.1353671832286; Fri, 23 Nov 2012 03:57:12 -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 n20csp341268igt; Fri, 23 Nov 2012 03:57:12 -0800 (PST) Received: by 10.68.132.197 with SMTP id ow5mr13951832pbb.40.1353671831802; Fri, 23 Nov 2012 03:57:11 -0800 (PST) Received: from mail-pa0-f45.google.com (mail-pa0-f45.google.com [209.85.220.45]) by mx.google.com with ESMTPS id s9si7728876pav.291.2012.11.23.03.57.11 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 23 Nov 2012 03:57:11 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.45 is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) client-ip=209.85.220.45; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.45 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-pa0-f45.google.com with SMTP id bg2so4318926pad.18 for ; Fri, 23 Nov 2012 03:57:11 -0800 (PST) Received: by 10.66.86.101 with SMTP id o5mr9949636paz.15.1353671831565; Fri, 23 Nov 2012 03:57:11 -0800 (PST) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPS id zv10sm3718784pbc.76.2012.11.23.03.57.08 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 23 Nov 2012 03:57:10 -0800 (PST) From: Sachin Kamat To: linux-media@vger.kernel.org Cc: s.nawrocki@samsung.com, sachin.kamat@linaro.org, patches@linaro.org, Kamil Debski Subject: [PATCH 4/6] [media] s5p-g2d: Use devm_clk_get APIs. Date: Fri, 23 Nov 2012 17:20:41 +0530 Message-Id: <1353671443-2978-5-git-send-email-sachin.kamat@linaro.org> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1353671443-2978-1-git-send-email-sachin.kamat@linaro.org> References: <1353671443-2978-1-git-send-email-sachin.kamat@linaro.org> X-Gm-Message-State: ALoCoQlVRlWVlY9CydanbnhhZIpQIBQ9YXBoLFDbfta5g27rlA7vbouKDHfMgElBlCBX5FamfCfJ devm_clk_get() is device managed function and makes error handling and exit code a bit simpler. Cc: Kamil Debski Signed-off-by: Sachin Kamat --- drivers/media/platform/s5p-g2d/g2d.c | 14 ++++---------- 1 files changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/media/platform/s5p-g2d/g2d.c b/drivers/media/platform/s5p-g2d/g2d.c index 1bfbc32..77819d3 100644 --- a/drivers/media/platform/s5p-g2d/g2d.c +++ b/drivers/media/platform/s5p-g2d/g2d.c @@ -714,7 +714,7 @@ static int g2d_probe(struct platform_device *pdev) return -ENOENT; } - dev->clk = clk_get(&pdev->dev, "sclk_fimg2d"); + dev->clk = devm_clk_get(&pdev->dev, "sclk_fimg2d"); if (IS_ERR_OR_NULL(dev->clk)) { dev_err(&pdev->dev, "failed to get g2d clock\n"); return -ENXIO; @@ -726,7 +726,7 @@ static int g2d_probe(struct platform_device *pdev) goto put_clk; } - dev->gate = clk_get(&pdev->dev, "fimg2d"); + dev->gate = devm_clk_get(&pdev->dev, "fimg2d"); if (IS_ERR_OR_NULL(dev->gate)) { dev_err(&pdev->dev, "failed to get g2d clock gate\n"); ret = -ENXIO; @@ -736,7 +736,7 @@ static int g2d_probe(struct platform_device *pdev) ret = clk_prepare(dev->gate); if (ret) { dev_err(&pdev->dev, "failed to prepare g2d clock gate\n"); - goto put_clk_gate; + goto unprep_clk; } res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); @@ -752,7 +752,7 @@ static int g2d_probe(struct platform_device *pdev) 0, pdev->name, dev); if (ret) { dev_err(&pdev->dev, "failed to install IRQ\n"); - goto put_clk_gate; + goto unprep_clk; } dev->alloc_ctx = vb2_dma_contig_init_ctx(&pdev->dev); @@ -804,13 +804,9 @@ alloc_ctx_cleanup: vb2_dma_contig_cleanup_ctx(dev->alloc_ctx); unprep_clk_gate: clk_unprepare(dev->gate); -put_clk_gate: - clk_put(dev->gate); unprep_clk: clk_unprepare(dev->clk); put_clk: - clk_put(dev->clk); - return ret; } @@ -824,9 +820,7 @@ static int g2d_remove(struct platform_device *pdev) v4l2_device_unregister(&dev->v4l2_dev); vb2_dma_contig_cleanup_ctx(dev->alloc_ctx); clk_unprepare(dev->gate); - clk_put(dev->gate); clk_unprepare(dev->clk); - clk_put(dev->clk); return 0; }