From patchwork Fri Feb 27 07:47:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Hao X-Patchwork-Id: 444168 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 43A701400B6 for ; Fri, 27 Feb 2015 18:48:07 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="verification failed; unprotected key" header.d=gmail.com header.i=@gmail.com header.b=M/TG70Zh; dkim-adsp=none (unprotected policy); dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751007AbbB0HsF (ORCPT ); Fri, 27 Feb 2015 02:48:05 -0500 Received: from mail-yk0-f179.google.com ([209.85.160.179]:36877 "EHLO mail-yk0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753201AbbB0HsF (ORCPT ); Fri, 27 Feb 2015 02:48:05 -0500 Received: by ykq19 with SMTP id 19so6503385ykq.4; Thu, 26 Feb 2015 23:48:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=womFwyTrDdu2UYwQBO8Iuagh2Q5FbJasRG/iWeuAbfA=; b=M/TG70ZhCBDJeEAJ2MtxoD2OtvgxeYIjRhVE0GXV5cMJ8xjJuuPcj1u5bDa024DDDn Gc26WrMrO8pQX1xQce2wVZDDs1Zxu8Ye/tKJ85+Vu05JVDAzLgOxtzMRLrSjn5bpx0pB g5VUx0Itft4Cp6c/tb1YR/Ewi9oiVoNytFLM0MSLykKlfW1lJ2CCM/pgjDeQCDTxy/Nh tHxpTs9+gl1ejuvyz2zhMvNKeC5M9XptcShoGbAdlRIUSzOpetVazOWnAWCxvZM431h7 ts5vGPEGlgQCIsgd1kveT5bWC3b/4O5mH2oQmiQta9rfRr0G+4xTXnGUJjCrxPPVt8OA wfNw== X-Received: by 10.236.105.226 with SMTP id k62mr12009699yhg.175.1425023284114; Thu, 26 Feb 2015 23:48:04 -0800 (PST) Received: from pek-khao-d1.corp.ad.wrs.com ([106.120.101.38]) by mx.google.com with ESMTPSA id l66sm2593230yha.2.2015.02.26.23.48.00 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Feb 2015 23:48:03 -0800 (PST) From: Kevin Hao To: linux-mmc@vger.kernel.org Cc: Chris Ball , Ulf Hansson , linux-tegra@vger.kernel.org Subject: [PATCH v2 3/7] mmc: tegra: use devm help functions to get the clk and gpio Date: Fri, 27 Feb 2015 15:47:27 +0800 Message-Id: <1425023251-4544-4-git-send-email-haokexin@gmail.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1425023251-4544-1-git-send-email-haokexin@gmail.com> References: <1425023251-4544-1-git-send-email-haokexin@gmail.com> Sender: linux-tegra-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-tegra@vger.kernel.org Simplify the error and remove path. Signed-off-by: Kevin Hao Acked-by: Alexandre Courbot --- v2: No change. drivers/mmc/host/sdhci-tegra.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c index f3778d58d1cd..0643f66b4e14 100644 --- a/drivers/mmc/host/sdhci-tegra.c +++ b/drivers/mmc/host/sdhci-tegra.c @@ -286,7 +286,8 @@ static int sdhci_tegra_probe(struct platform_device *pdev) goto err_parse_dt; if (gpio_is_valid(tegra_host->power_gpio)) { - rc = gpio_request(tegra_host->power_gpio, "sdhci_power"); + rc = devm_gpio_request(&pdev->dev, tegra_host->power_gpio, + "sdhci_power"); if (rc) { dev_err(mmc_dev(host->mmc), "failed to allocate power gpio\n"); @@ -295,7 +296,7 @@ static int sdhci_tegra_probe(struct platform_device *pdev) gpio_direction_output(tegra_host->power_gpio, 1); } - clk = clk_get(mmc_dev(host->mmc), NULL); + clk = devm_clk_get(mmc_dev(host->mmc), NULL); if (IS_ERR(clk)) { dev_err(mmc_dev(host->mmc), "clk err\n"); rc = PTR_ERR(clk); @@ -312,10 +313,7 @@ static int sdhci_tegra_probe(struct platform_device *pdev) err_add_host: clk_disable_unprepare(pltfm_host->clk); - clk_put(pltfm_host->clk); err_clk_get: - if (gpio_is_valid(tegra_host->power_gpio)) - gpio_free(tegra_host->power_gpio); err_power_req: err_parse_dt: err_alloc_tegra_host: @@ -327,16 +325,11 @@ static int sdhci_tegra_remove(struct platform_device *pdev) { struct sdhci_host *host = platform_get_drvdata(pdev); struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); - struct sdhci_tegra *tegra_host = pltfm_host->priv; int dead = (readl(host->ioaddr + SDHCI_INT_STATUS) == 0xffffffff); sdhci_remove_host(host, dead); - if (gpio_is_valid(tegra_host->power_gpio)) - gpio_free(tegra_host->power_gpio); - clk_disable_unprepare(pltfm_host->clk); - clk_put(pltfm_host->clk); sdhci_pltfm_free(pdev);