From patchwork Mon Sep 29 09:32:57 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Fenkart X-Patchwork-Id: 4994961 Return-Path: X-Original-To: patchwork-linux-mmc@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 841D89F2BA for ; Mon, 29 Sep 2014 09:33:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B39B9202BE for ; Mon, 29 Sep 2014 09:33:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E4B69201FA for ; Mon, 29 Sep 2014 09:33:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753264AbaI2Jd2 (ORCPT ); Mon, 29 Sep 2014 05:33:28 -0400 Received: from mail-wi0-f175.google.com ([209.85.212.175]:46356 "EHLO mail-wi0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753225AbaI2JdY (ORCPT ); Mon, 29 Sep 2014 05:33:24 -0400 Received: by mail-wi0-f175.google.com with SMTP id d1so540633wiv.8 for ; Mon, 29 Sep 2014 02:33:23 -0700 (PDT) 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=zeaH4XrhdakOtjEJ6e86F/EFoPWQoLR112P1hYdqrPU=; b=wSFLcZ19uQXwKeECE8Pa7e/rr5s1DlkHNBDRWojvNHNhIjilc+pZmJgWdP5ftkfrz+ mKzqyUVVlXbj4inIwuwLnu/HpFFgjebchjpaGS2/shqpLzAcek4Y1lQfvHBLucdUQ1a4 EVnnvPvbwhNCqgOocAutiNfX/Hjnks/GgJul5YnKZ+mgkCcUVV1jvzKLPmZWG+kpHybK WxB6jx8bPBW1e0jiJiHReuGxll5yZN0lYalZ0ojfy+ndomvR1/EHNTi43t8N7/9TZkmp qTdbpWdiE3YN8JPVUo7+hslnFxB5fQ2cnMjSs0XxRtAbvZbCF0Jpw6Xi15IUbhZgnqm4 ViCw== X-Received: by 10.194.120.37 with SMTP id kz5mr2550547wjb.107.1411983203228; Mon, 29 Sep 2014 02:33:23 -0700 (PDT) Received: from localhost (ip-94-112-1-174.net.upcbroadband.cz. [94.112.1.174]) by mx.google.com with ESMTPSA id p1sm15081654wjy.22.2014.09.29.02.33.22 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 29 Sep 2014 02:33:22 -0700 (PDT) From: Andreas Fenkart To: linux-mmc@vger.kernel.org Cc: linux-omap@vger.kernel.org, Tony Lindgren , Ulf Hansson , pascal.huerst@gmail.com, Andreas Fenkart Subject: [PATCH v2 7/9] omap_hsmmc: pass mmc_priv struct to gpio init / free Date: Mon, 29 Sep 2014 11:32:57 +0200 Message-Id: <1411983179-28677-8-git-send-email-afenkart@gmail.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1411983179-28677-1-git-send-email-afenkart@gmail.com> References: <1411983179-28677-1-git-send-email-afenkart@gmail.com> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-7.5 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 Signed-off-by: Andreas Fenkart diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index d05b7f3..f8cd3b3 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); @@ -2054,14 +2056,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); @@ -2078,6 +2076,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;