From patchwork Wed Jan 9 02:11:43 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jingoo Han X-Patchwork-Id: 1950321 Return-Path: X-Original-To: patchwork-linux-mmc@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 8FDB43FC5A for ; Wed, 9 Jan 2013 02:11:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756506Ab3AICLr (ORCPT ); Tue, 8 Jan 2013 21:11:47 -0500 Received: from mailout1.samsung.com ([203.254.224.24]:21607 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756144Ab3AICLq (ORCPT ); Tue, 8 Jan 2013 21:11:46 -0500 Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MGC005GS6370ZA0@mailout1.samsung.com> for linux-mmc@vger.kernel.org; Wed, 09 Jan 2013 11:11:44 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [203.254.230.50]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 8F.65.01231.0E1DCE05; Wed, 09 Jan 2013 11:11:44 +0900 (KST) X-AuditID: cbfee61a-b7fa66d0000004cf-06-50ecd1e07dd7 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 2F.65.01231.0E1DCE05; Wed, 09 Jan 2013 11:11:44 +0900 (KST) Received: from DOJG1HAN02 ([12.23.120.99]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MGC007AV63JN440@mmp2.samsung.com> for linux-mmc@vger.kernel.org; Wed, 09 Jan 2013 11:11:44 +0900 (KST) From: Jingoo Han To: 'Chris Ball' Cc: linux-mmc@vger.kernel.org, 'Ben Dooks' , 'Jingoo Han' Subject: [PATCH] mmc: sdhci-s3c: Use devm_clk_get() Date: Wed, 09 Jan 2013 11:11:43 +0900 Message-id: <004101cdee0e$ab8dc440$02a94cc0$%han@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit X-Mailer: Microsoft Office Outlook 12.0 Thread-index: Ac3uDqjViXxUOesDQyCXL6lDlpZX9A== Content-language: ko x-cr-hashedpuzzle: AJxN AhK9 B70D E+jQ Gthe GvlE Gwwt Gzrj HJ9u RNbD Tp4S UTsB WoR2 XZNv YPFR czLX; 4; YgBlAG4ALQBsAGkAbgB1AHgAQABmAGwAdQBmAGYALgBvAHIAZwA7AGMAagBiAEAAbABhAHAAdABvAHAALgBvAHIAZwA7AGoAZwAxAC4AaABhAG4AQABzAGEAbQBzAHUAbgBnAC4AYwBvAG0AOwBsAGkAbgB1AHgALQBtAG0AYwBAAHYAZwBlAHIALgBrAGUAcgBuAGUAbAAuAG8AcgBnAA==; Sosha1_v1; 7; {2AC0CED2-8BBD-4440-9F2D-9B911F2BA16D}; agBnADEALgBoAGEAbgBAAHMAYQBtAHMAdQBuAGcALgBjAG8AbQA=; Wed, 09 Jan 2013 02:11:39 GMT; WwBQAEEAVABDAEgAXQAgAG0AbQBjADoAIABzAGQAaABjAGkALQBzADMAYwA6ACAAVQBzAGUAIABkAGUAdgBtAF8AYwBsAGsAXwBnAGUAdAAoACkA x-cr-puzzleid: {2AC0CED2-8BBD-4440-9F2D-9B911F2BA16D} DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrGIsWRmVeSWpSXmKPExsVy+t8zI90HF98EGFz7JWZx5H8/owOjx+dN cgGMUVw2Kak5mWWpRfp2CVwZq/ZOYi34J1ixY902xgbGz3xdjJwcEgImEnt2fmeDsMU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aNWSWL/zOBOELS+xec1bZpAxEgLqEo/+6kJs0pNYMv0MK0SJiMS+F+8YQU6TENjD IvHs/Vo2iAdMJVZN+sI+gVFoFpIVs5CsmIVkxSwksxYwsqxiFE0tSC4oTkrPNdQrTswtLs1L 10vOz93ECI7cZ1I7GFc2WBxiFOBgVOLhtZz5JkCINbGsuDL3EKMEB7OSCO9db6AQb0piZVVq UX58UWlOavEhRh9gCExklhJNzgcmlbySeENjEzMjSyMzCyMTc3McwkrivIynngQICaQnlqRm p6YWpBbBjGPi4JRqYDzfMGHPjV+67q46FknLDnwo7ZugMWdeyQlj25035qlMyvyw8K/1lgks qw8rnDyq8kF6m3Jaom6GokIHy8aGauVCY7+Oml3Hpvvycwkv2PD99estMeenGOh87dwmGpTI 1K0vuunbLgefxa3xB3Vit10McZynF/r6mJ1rUcPXHYXPtjy3vHnfa6MSS3FGoqEWc1FxIgCb JeVMCQMAAA== X-CFilter-Loop: Reflected Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org The devm_ functions allocate memory that is released when a driver detaches. This patch uses devm_clk_get() for these functions. These make the code smaller and a bit simpler. Signed-off-by: Jingoo Han --- drivers/mmc/host/sdhci-s3c.c | 17 ++--------------- 1 files changed, 2 insertions(+), 15 deletions(-) diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c index 82a8de1..5aaef5b 100644 --- a/drivers/mmc/host/sdhci-s3c.c +++ b/drivers/mmc/host/sdhci-s3c.c @@ -608,7 +608,7 @@ static int sdhci_s3c_probe(struct platform_device *pdev) platform_set_drvdata(pdev, host); - sc->clk_io = clk_get(dev, "hsmmc"); + sc->clk_io = devm_clk_get(dev, "hsmmc"); if (IS_ERR(sc->clk_io)) { dev_err(dev, "failed to get io clock\n"); ret = PTR_ERR(sc->clk_io); @@ -623,7 +623,7 @@ static int sdhci_s3c_probe(struct platform_device *pdev) char name[14]; snprintf(name, 14, "mmc_busclk.%d", ptr); - clk = clk_get(dev, name); + clk = devm_clk_get(dev, name); if (IS_ERR(clk)) continue; @@ -765,15 +765,9 @@ static int sdhci_s3c_probe(struct platform_device *pdev) #ifndef CONFIG_PM_RUNTIME clk_disable_unprepare(sc->clk_bus[sc->cur_clk]); #endif - for (ptr = 0; ptr < MAX_BUS_CLK; ptr++) { - if (sc->clk_bus[ptr]) { - clk_put(sc->clk_bus[ptr]); - } - } err_no_busclks: clk_disable_unprepare(sc->clk_io); - clk_put(sc->clk_io); err_pdata_io_clk: sdhci_free_host(host); @@ -786,7 +780,6 @@ static int sdhci_s3c_remove(struct platform_device *pdev) struct sdhci_host *host = platform_get_drvdata(pdev); struct sdhci_s3c *sc = sdhci_priv(host); struct s3c_sdhci_platdata *pdata = sc->pdata; - int ptr; if (pdata->cd_type == S3C_SDHCI_CD_EXTERNAL && pdata->ext_cd_cleanup) pdata->ext_cd_cleanup(&sdhci_s3c_notify_change); @@ -806,13 +799,7 @@ static int sdhci_s3c_remove(struct platform_device *pdev) #ifndef CONFIG_PM_RUNTIME clk_disable_unprepare(sc->clk_bus[sc->cur_clk]); #endif - for (ptr = 0; ptr < MAX_BUS_CLK; ptr++) { - if (sc->clk_bus[ptr]) { - clk_put(sc->clk_bus[ptr]); - } - } clk_disable_unprepare(sc->clk_io); - clk_put(sc->clk_io); sdhci_free_host(host); platform_set_drvdata(pdev, NULL);