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: 1795141 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 5F6663FC64 for ; Fri, 23 Nov 2012 11:57:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754793Ab2KWL5N (ORCPT ); Fri, 23 Nov 2012 06:57:13 -0500 Received: from mail-pa0-f46.google.com ([209.85.220.46]:64565 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754105Ab2KWL5L (ORCPT ); Fri, 23 Nov 2012 06:57:11 -0500 Received: by mail-pa0-f46.google.com with SMTP id bh2so3502852pad.19 for ; Fri, 23 Nov 2012 03:57:11 -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=qp469+Vc7nUbVX87G9BnLv3WPJFrZdhFQYasaxRMMsE=; b=UCXfEQ4ruNkyfEI54PQj6oI7oq6pnJM9rweM7hN00Ozi5juSgalmGNzqHZW67+5rQq UgUooZ7EaqlESnciS5hyEe0wdUWfFTRMhC3qf4hucSVXcIEiAioxMTQs/TA1RmJD4m8x LVrgbDD5/uCUrJZZX8/v2AgOG+G6I/hnyY2qbZeq+TSPyeanLa1offYhKt8TdDKcgCIl jZIbL0pNoZjzWzmzjhahP1wbg/WfnDrfQjoe/30ZglwIxJACi07xdRm8jNwlAqv49yb/ Qvt4sfotHKwPQwBSOV9GmTHErDo5SnaBh320Y7bjIs/iKR1bBL13jTGGh9Vltlq/mIlw CQ9A== 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: ALoCoQnO/0ZZO6O6ZT4xWmf3HAyyynFTR120UZI1miZw1ou6/iz8++o0kS6LTAk+YSqH19xp5qjb Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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; }