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: 1795161 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 C50CCDF254 for ; Fri, 23 Nov 2012 11:57:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755010Ab2KWL5T (ORCPT ); Fri, 23 Nov 2012 06:57:19 -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 S1754105Ab2KWL5R (ORCPT ); Fri, 23 Nov 2012 06:57:17 -0500 Received: by mail-pa0-f46.google.com with SMTP id bh2so3502852pad.19 for ; Fri, 23 Nov 2012 03:57:17 -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=JpWkqG3wZ58HbpDviZg7cwyF06U4w47+Eg9mxWzkmLg=; b=fy+OwsoQv4UWXbP+79UgTozHGvGZ0o06T5ifKe9tWniywALW5CXVv0e9eN1sZSz97k 0tFxtIWPuHjsXiv9YYGjw73IYpVtY+rnA3EtJFg3QdiNQP12IW2VGiJeGgA6utgXPySk LILnKGyoqLQFcySbeGo0uaHPnPXumIDP9FknV8ZXtwd0flnltuKuJNg8+a1KUKf3rgvj vHEMnt8j3kQcMoq4ccNQEMD9OIdCkGziRwla+1kuev3C0XH8bje3HhzBx5fknsmJIBPo 9sjF8a2DPCzfd/UmKank9inL6gGmZ1Wlvo82cdA512d8csH4o1qXrfeDJQEi2q3honVY afvA== 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: ALoCoQmnes4R8R4BSiXZwJlJbTpCXK6WoFEsoVrs/Zet34PWDTuPOVf2rmiEa/9C9NoItF/zlCBe 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-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