From patchwork Mon Jun 3 22:02:13 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 2655351 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork1.kernel.org (Postfix) with ESMTP id 8D75E3FC23 for ; Mon, 3 Jun 2013 22:03:12 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Ujcpq-00076p-R4; Mon, 03 Jun 2013 22:02:39 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Ujcpo-0004YP-6K; Mon, 03 Jun 2013 22:02:36 +0000 Received: from moutng.kundenserver.de ([212.227.17.9]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Ujcpl-0004Y5-OD for linux-arm-kernel@lists.infradead.org; Mon, 03 Jun 2013 22:02:34 +0000 Received: from wuerfel.localnet (HSI-KBW-095-208-002-043.hsi5.kabel-badenwuerttemberg.de [95.208.2.43]) by mrelayeu.kundenserver.de (node=mreu3) with ESMTP (Nemesis) id 0LywZI-1UNqmf2oLY-014FD8; Tue, 04 Jun 2013 00:01:53 +0200 From: Arnd Bergmann To: linux-mmc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Christian Daudt , Barry Song , Chris Ball Subject: [PATCH] mmc: sirf: fix sdhci_pltfm_init sequence Date: Tue, 04 Jun 2013 00:02:13 +0200 Message-ID: <24753444.e6CjWoyOih@wuerfel> User-Agent: KMail/4.10.2 (Linux/3.10.0-rc3-next-20130527+; KDE/4.10.3; x86_64; ; ) MIME-Version: 1.0 X-Provags-ID: V02:K0:mXMfmw/kgutfMv2ALuWtk2If50qR50FOgOOFg3ykA69 rtChK6GCblBWII+EvaHLaDcJJeFAngd8cyixujWlnGNBBW5CA6 18YFy3C92UOCiunwF4kpNJbAFl5QUnzPbsn/rW1noCw1eg7kif lD8fB+euJNUQ2BpYvLzo0IrzBpNv2gqfmxa8PaIyoHGObpc52f 1VuKtnYqWos7IwN3JWKyOxlQeF3DVmxCax4tDAjQPaNNFD2zhy t0jze6ZwZCCedjm44kASd61kWMA7hEES+YMU4yVy681gwC3k+m JeHWauhf7o0UljY49x5Xfgfc7GL69i4wteK4UxDs5tC5/EOTFd SE6oU/YCn3K42Dbj3fWU= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130603_180233_997754_AC966E40 X-CRM114-Status: GOOD ( 13.70 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [212.227.17.9 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Patch "mmc: sdhci: Add size for caller in init+register" changed the interface for sdhci_pltfm_init, while patch "mmc: sdhci-sirf: add mmc host sdhci-pltfm based driver for SiRF SoCs" added a new driver with the old interface. This changes the sirf driver to use the new interface, avoiding one warning, and simplifying the init sequence. Since we're here already, this also adds an error path for failed clk_prepare_enable. Signed-off-by: Arnd Bergmann Cc: Christian Daudt Cc: Barry Song Cc: Chris Ball ---- This needs an Ack from Barry before it can get applied. Acked-by: Christian Daudt diff --git a/drivers/mmc/host/sdhci-sirf.c b/drivers/mmc/host/sdhci-sirf.c index 09805af..cc80f26 100644 --- a/drivers/mmc/host/sdhci-sirf.c +++ b/drivers/mmc/host/sdhci-sirf.c @@ -24,7 +24,7 @@ struct sdhci_sirf_priv { static unsigned int sdhci_sirf_get_max_clk(struct sdhci_host *host) { struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); - struct sdhci_sirf_priv *priv = pltfm_host->priv; + struct sdhci_sirf_priv *priv = sdhci_pltfm_priv(pltfm_host); return clk_get_rate(priv->clk); } @@ -47,6 +47,8 @@ static int sdhci_sirf_probe(struct platform_device *pdev) struct sdhci_pltfm_host *pltfm_host; struct sdhci_sirf_priv *priv; struct pinctrl *pinctrl; + struct clk *clk; + int gpio_cd; int ret; pinctrl = devm_pinctrl_get_select_default(&pdev->dev); @@ -55,38 +57,31 @@ static int sdhci_sirf_probe(struct platform_device *pdev) return PTR_ERR(pinctrl); } - priv = devm_kzalloc(&pdev->dev, sizeof(struct sdhci_sirf_priv), - GFP_KERNEL); - if (!priv) { - dev_err(&pdev->dev, "unable to allocate private data"); - return -ENOMEM; - } - - priv->clk = devm_clk_get(&pdev->dev, NULL); - if (IS_ERR(priv->clk)) { + clk = devm_clk_get(&pdev->dev, NULL); + if (IS_ERR(clk)) { dev_err(&pdev->dev, "unable to get clock"); - return PTR_ERR(priv->clk); + return PTR_ERR(clk); } - if (pdev->dev.of_node) { - priv->gpio_cd = of_get_named_gpio(pdev->dev.of_node, - "cd-gpios", 0); - } else { - priv->gpio_cd = -EINVAL; - } + if (pdev->dev.of_node) + gpio_cd = of_get_named_gpio(pdev->dev.of_node, "cd-gpios", 0); + else + gpio_cd = -EINVAL; - host = sdhci_pltfm_init(pdev, &sdhci_sirf_pdata); - if (IS_ERR(host)) { - ret = PTR_ERR(host); - goto err_sdhci_pltfm_init; - } + host = sdhci_pltfm_init(pdev, &sdhci_sirf_pdata, sizeof(struct sdhci_sirf_priv)); + if (IS_ERR(host)) + return PTR_ERR(host); pltfm_host = sdhci_priv(host); - pltfm_host->priv = priv; + priv = sdhci_pltfm_priv(pltfm_host); + priv->clk = clk; + priv->gpio_cd = gpio_cd; sdhci_get_of_property(pdev); - clk_prepare_enable(priv->clk); + ret = clk_prepare_enable(priv->clk); + if (ret) + goto err_clk_prepare; ret = sdhci_add_host(host); if (ret) @@ -111,8 +106,8 @@ err_request_cd: sdhci_remove_host(host, 0); err_sdhci_add: clk_disable_unprepare(priv->clk); +err_clk_prepare: sdhci_pltfm_free(pdev); -err_sdhci_pltfm_init: return ret; } @@ -120,7 +115,7 @@ static int sdhci_sirf_remove(struct platform_device *pdev) { struct sdhci_host *host = platform_get_drvdata(pdev); struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); - struct sdhci_sirf_priv *priv = pltfm_host->priv; + struct sdhci_sirf_priv *priv = sdhci_pltfm_priv(pltfm_host); sdhci_pltfm_unregister(pdev); @@ -136,7 +131,7 @@ static int sdhci_sirf_suspend(struct device *dev) { struct sdhci_host *host = dev_get_drvdata(dev); struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); - struct sdhci_sirf_priv *priv = pltfm_host->priv; + struct sdhci_sirf_priv *priv = sdhci_pltfm_priv(pltfm_host); int ret; ret = sdhci_suspend_host(host); @@ -152,7 +147,7 @@ static int sdhci_sirf_resume(struct device *dev) { struct sdhci_host *host = dev_get_drvdata(dev); struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); - struct sdhci_sirf_priv *priv = pltfm_host->priv; + struct sdhci_sirf_priv *priv = sdhci_pltfm_priv(pltfm_host); int ret; ret = clk_enable(priv->clk);