From patchwork Sat Nov 8 14:33:15 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Fenkart X-Patchwork-Id: 5257081 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 297709F2F1 for ; Sat, 8 Nov 2014 14:40:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 65D1F2012E for ; Sat, 8 Nov 2014 14:40:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 54FA920145 for ; Sat, 8 Nov 2014 14:39:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753853AbaKHOj5 (ORCPT ); Sat, 8 Nov 2014 09:39:57 -0500 Received: from mail-wi0-f172.google.com ([209.85.212.172]:40900 "EHLO mail-wi0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753783AbaKHOj4 (ORCPT ); Sat, 8 Nov 2014 09:39:56 -0500 Received: by mail-wi0-f172.google.com with SMTP id bs8so6813645wib.11 for ; Sat, 08 Nov 2014 06:39:54 -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=tko3ioaoqtWU8W9d/DufROcl/YALH2ioZH2UhYnKjzs=; b=tAarZ53cGbvuuaAiOcHomJLNrTqCNLlN0xv7bcThTN2nqg0JUGJEMlgvt1mYoKpB30 0g5pSUeV3Qaj36k0wyp0SfxXjUhIRom8LPeWMtIyPRpR57wkbG1DDMy0lZfih6eJkrlq z21CpDjZWzC7psWbWb7l4DSKlBM7DjA19d6+qpXb+CTw0tHYszj/OrXXxFR6syWiFmeH 7N9xuk/fl97wal5Cda5DN9H2q4dNFDIQDPda0FWAY/X2bApYLGvYRkGT3o6j+VOz7iPk BkagCsEinAVrRmCLYayBN5NPCZG86Ol0cdmR6u9kiQzPqrF9DeHTajDQR0znkz5HFJjS tlZA== X-Received: by 10.180.83.37 with SMTP id n5mr14693982wiy.7.1415457226999; Sat, 08 Nov 2014 06:33:46 -0800 (PST) Received: from localhost (ip-89-176-142-212.net.upcbroadband.cz. [89.176.142.212]) by mx.google.com with ESMTPSA id f1sm5882333wiy.17.2014.11.08.06.33.45 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 08 Nov 2014 06:33:46 -0800 (PST) From: Andreas Fenkart To: linux-mmc@vger.kernel.org Cc: linux-omap@vger.kernel.org, Tony Lindgren , =?UTF-8?q?Beno=C3=AEt=20Cousson?= , Ulf Hansson , pascal.huerst@gmail.com, Andreas Fenkart Subject: [PATCH v4 08/10] omap_hsmmc: pass mmc_priv struct to gpio init / free Date: Sat, 8 Nov 2014 15:33:15 +0100 Message-Id: <1415457197-14294-9-git-send-email-afenkart@gmail.com> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1415457197-14294-1-git-send-email-afenkart@gmail.com> References: <1415457197-14294-1-git-send-email-afenkart@gmail.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP this is needed when installing callbacks in the host struct and not in the platform data, e.g. cover detect irq should be stored in omap_hsmmc_host and not platform data Acked-by: Tony Lindgren Signed-off-by: Andreas Fenkart --- drivers/mmc/host/omap_hsmmc.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index 291b9e1..8a216c9 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c @@ -449,7 +449,8 @@ static inline int omap_hsmmc_have_reg(void) #endif -static int omap_hsmmc_gpio_init(struct omap_hsmmc_platform_data *pdata) +static int omap_hsmmc_gpio_init(struct omap_hsmmc_host *host, + struct omap_hsmmc_platform_data *pdata) { int ret; @@ -494,7 +495,8 @@ err_free_sp: return ret; } -static void omap_hsmmc_gpio_free(struct omap_hsmmc_platform_data *pdata) +static void omap_hsmmc_gpio_free(struct omap_hsmmc_host *host, + struct omap_hsmmc_platform_data *pdata) { if (gpio_is_valid(pdata->gpio_wp)) gpio_free(pdata->gpio_wp); @@ -2064,14 +2066,10 @@ static int omap_hsmmc_probe(struct platform_device *pdev) if (IS_ERR(base)) return PTR_ERR(base); - ret = omap_hsmmc_gpio_init(pdata); - if (ret) - goto err; - mmc = mmc_alloc_host(sizeof(struct omap_hsmmc_host), &pdev->dev); if (!mmc) { ret = -ENOMEM; - goto err_alloc; + goto err; } host = mmc_priv(mmc); @@ -2088,6 +2086,10 @@ static int omap_hsmmc_probe(struct platform_device *pdev) host->next_data.cookie = 1; host->pbias_enabled = 0; + ret = omap_hsmmc_gpio_init(host, pdata); + if (ret) + goto err_gpio; + platform_set_drvdata(pdev, host); if (pdev->dev.of_node) @@ -2283,9 +2285,9 @@ err_irq: if (host->dbclk) clk_disable_unprepare(host->dbclk); err1: + omap_hsmmc_gpio_free(host, pdata); +err_gpio: mmc_free_host(mmc); -err_alloc: - omap_hsmmc_gpio_free(pdata); err: return ret; } @@ -2309,7 +2311,7 @@ static int omap_hsmmc_remove(struct platform_device *pdev) if (host->dbclk) clk_disable_unprepare(host->dbclk); - omap_hsmmc_gpio_free(host->pdata); + omap_hsmmc_gpio_free(host, host->pdata); mmc_free_host(host->mmc); return 0;