From patchwork Fri Nov 23 11:50:43 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Kamat X-Patchwork-Id: 13148 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 0F3BC23DFE for ; Fri, 23 Nov 2012 11:57:19 +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 B21C6A194B2 for ; Fri, 23 Nov 2012 11:57:18 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id c10so1705179ieb.11 for ; Fri, 23 Nov 2012 03:57:18 -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=JpWkqG3wZ58HbpDviZg7cwyF06U4w47+Eg9mxWzkmLg=; b=azJygO7IJNbvay88xwF2px5/dko41aincbtA9lLBHQoYpEfqVU4ZGiiD0k4HIUOJ8t VaZ+i30GgQHh8+HpE7yyQkyjTtIKSAEhke1WIeh0tkOxhNsG6QtJM1rEOIdEVGVQ3+xE kcsd5mRe6gPePv8aAfpHUzJTrlCNUhH2+IhogXdaHFdrfRxOYDOoY4guMgwdrLuhJFDi Nk8A0XFwy8i35Kq8DraDVuFenez8fFs0bHTZv3Wr6GPcmm/JizJeMAbUTj0bf6pmKit7 5styBrFB3UF6BAAFdk6zTyfnUwdHnkbpoUj62ReTHZq83kVrY160VU3Ibw9+FM5if9Js 9BOg== Received: by 10.50.42.168 with SMTP id p8mr3243753igl.57.1353671838485; Fri, 23 Nov 2012 03:57:18 -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 n20csp341281igt; Fri, 23 Nov 2012 03:57:17 -0800 (PST) Received: by 10.66.78.169 with SMTP id c9mr9911286pax.30.1353671837657; Fri, 23 Nov 2012 03:57:17 -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 ka8si8267479pbc.185.2012.11.23.03.57.17 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 23 Nov 2012 03:57:17 -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 bg2so3852962pad.4 for ; Fri, 23 Nov 2012 03:57:17 -0800 (PST) Received: by 10.66.72.136 with SMTP id d8mr10012251pav.4.1353671837423; Fri, 23 Nov 2012 03:57:17 -0800 (PST) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPS id zv10sm3718784pbc.76.2012.11.23.03.57.14 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 23 Nov 2012 03:57:16 -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 6/6] [media] s5p-mfc: Use devm_clk_get APIs Date: Fri, 23 Nov 2012 17:20:43 +0530 Message-Id: <1353671443-2978-7-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: ALoCoQlk5xkQyDLxful7zxaTjfYs4T84aS1TuiBkcafDJvPylKWVy7GrhvteD6a2x16VkTgWDavJ 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-mfc/s5p_mfc_pm.c | 14 ++++---------- 1 files changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/media/platform/s5p-mfc/s5p_mfc_pm.c b/drivers/media/platform/s5p-mfc/s5p_mfc_pm.c index 2895333..4864d93 100644 --- a/drivers/media/platform/s5p-mfc/s5p_mfc_pm.c +++ b/drivers/media/platform/s5p-mfc/s5p_mfc_pm.c @@ -37,7 +37,7 @@ int s5p_mfc_init_pm(struct s5p_mfc_dev *dev) pm = &dev->pm; p_dev = dev; - pm->clock_gate = clk_get(&dev->plat_dev->dev, MFC_GATE_CLK_NAME); + pm->clock_gate = devm_clk_get(&dev->plat_dev->dev, MFC_GATE_CLK_NAME); if (IS_ERR(pm->clock_gate)) { mfc_err("Failed to get clock-gating control\n"); ret = PTR_ERR(pm->clock_gate); @@ -47,10 +47,10 @@ int s5p_mfc_init_pm(struct s5p_mfc_dev *dev) ret = clk_prepare(pm->clock_gate); if (ret) { mfc_err("Failed to preapre clock-gating control\n"); - goto err_p_ip_clk; + goto err_g_ip_clk; } - pm->clock = clk_get(&dev->plat_dev->dev, dev->variant->mclk_name); + pm->clock = devm_clk_get(&dev->plat_dev->dev, dev->variant->mclk_name); if (IS_ERR(pm->clock)) { mfc_err("Failed to get MFC clock\n"); ret = PTR_ERR(pm->clock); @@ -60,7 +60,7 @@ int s5p_mfc_init_pm(struct s5p_mfc_dev *dev) ret = clk_prepare(pm->clock); if (ret) { mfc_err("Failed to prepare MFC clock\n"); - goto err_p_ip_clk_2; + goto err_g_ip_clk_2; } atomic_set(&pm->power, 0); @@ -72,12 +72,8 @@ int s5p_mfc_init_pm(struct s5p_mfc_dev *dev) atomic_set(&clk_ref, 0); #endif return 0; -err_p_ip_clk_2: - clk_put(pm->clock); err_g_ip_clk_2: clk_unprepare(pm->clock_gate); -err_p_ip_clk: - clk_put(pm->clock_gate); err_g_ip_clk: return ret; } @@ -85,9 +81,7 @@ err_g_ip_clk: void s5p_mfc_final_pm(struct s5p_mfc_dev *dev) { clk_unprepare(pm->clock_gate); - clk_put(pm->clock_gate); clk_unprepare(pm->clock); - clk_put(pm->clock); #ifdef CONFIG_PM_RUNTIME pm_runtime_disable(pm->device); #endif