From patchwork Wed Jan 17 16:28:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 124852 Delivered-To: patch@linaro.org Received: by 10.46.62.1 with SMTP id l1csp107511lja; Wed, 17 Jan 2018 08:41:27 -0800 (PST) X-Google-Smtp-Source: ACJfBotnWXfqQNypEv4OKvMg7xqpSQiU8VlFylDGp2QE82UF9YzGmsADle02jJbTHisZd+1zqG95 X-Received: by 10.159.253.68 with SMTP id b4mr44046446plx.220.1516207287426; Wed, 17 Jan 2018 08:41:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516207287; cv=none; d=google.com; s=arc-20160816; b=d14ltNpi3LfoyxwmgSnz6i3W3M1tCmHZGNfztIqSJmLn+2IlMAmPy1DyPVb3/eoHHZ +OUZecmsKuvYuP20yrb9fUkaMyF7ZJn5YXZThO0NV3neGzXp/4pjNtl/A9ROPJijvdK/ u/oWyOGreve6f1orTZIOM0JHUQ0RXims4c+i3uESgleWTlBb4Ub3CUv8nBnm3BRObqPF kBKpItXN6KDdrZZr6QmqLdTqjN12aUnurvvV1A8fgMYgA0YarQDCUU0iKJPGoiw2CQVe zndCN+ewdLJv4rt7Z+q9G9bA6+iKElDgPuKRoZz0+MPWlTp4svY9Q1mYFBQijZWN2EbJ dkjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=8nzk6tRvMUc2im6t6Zshc7yaBP831kVjkiZyzNYtBjQ=; b=PFkj43ZDLXBrmP0IHlrFBFFn5peOUOj8MZFw4+pWrmtD8FoQF29Y/VT8c4ela41H1K xiFv/gOQEWLtO+b+iDgeJUlFExhM8kJ4C5YzqtXqrRi/qNtscxiOB5w0YhEginf43xXV IwjpfI1LIVbhvj8DwbOu7/T5k7o7BCCk7gpRK9UxwnumlcvoJzMZBTUUO8dDkcnAW/dh Jh4u67PitaOCyk8l4PtseVqqUFZvTdsyDxrwp2qwjXX4b3IHMv1R3EuDcGRW+UMo4iG3 kdO2vd4/IG8m2byLTxrZbFk6WHilObtnKB5/yKzXDgXzMxd3p292dYNYBB3DhCeDzHyD DWyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=tk/pJ0No; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l22si4686060pfb.353.2018.01.17.08.41.27; Wed, 17 Jan 2018 08:41:27 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=tk/pJ0No; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754447AbeAQQlZ (ORCPT + 28 others); Wed, 17 Jan 2018 11:41:25 -0500 Received: from conuserg-08.nifty.com ([210.131.2.75]:36690 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753834AbeAQQ3d (ORCPT ); Wed, 17 Jan 2018 11:29:33 -0500 Received: from grover.sesame (FL1-125-199-20-195.osk.mesh.ad.jp [125.199.20.195]) (authenticated) by conuserg-08.nifty.com with ESMTP id w0HGSIKn014790; Thu, 18 Jan 2018 01:28:22 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com w0HGSIKn014790 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1516206502; bh=8nzk6tRvMUc2im6t6Zshc7yaBP831kVjkiZyzNYtBjQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tk/pJ0NoX1WlAmtZDYwi4y9bvqsM1GHip5geR/74P4rxwspQ0CFQnfYEdcUaRlplf lQd7XxhCF0Gf1F7DiSEWHuoIxoKqh/+Ri/G+WXbbIxfGwd2ic1MCsY4F6Kfxr0k/6L rF2Lbv4V63IcVDTLmg9Kq+kRpOw6EI4Acg1WeUEHsmKOLh+apbDtuuwy9Y/I2nEQL8 NA8v1X5VKsn8S4DLdIblTRhCktG3CxxpTB7YAxS1oPYcwQnClztMs5ZAeHJ7M7LlJa dJXnExZCFcySOeLlwjAuXk+/HSYYUP5V2fAU11VShxS6rDTdE2T8inQrYMfEwmpOgX ClNSSPLd82ZKg== X-Nifty-SrcIP: [125.199.20.195] From: Masahiro Yamada To: linux-mmc@vger.kernel.org, Wolfram Sang Cc: Ulf Magnusson , Geert Uytterhoeven , Simon Horman , Yoshihiro Shimoda , linux-renesas-soc@vger.kernel.org, Masahiro Yamada , linux-kernel@vger.kernel.org, Ulf Hansson Subject: [PATCH v3 03/16] mmc: tmio: move {tmio_}mmc_of_parse() to tmio_mmc_host_alloc() Date: Thu, 18 Jan 2018 01:28:03 +0900 Message-Id: <1516206496-16612-4-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516206496-16612-1-git-send-email-yamada.masahiro@socionext.com> References: <1516206496-16612-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org mmc_of_parse() parses various DT properties and sets capability flags accordingly. However, drivers have no chance to run platform init code depending on such flags because mmc_of_parse() is called from tmio_mmc_host_probe(). Move mmc_of_parse() to tmio_mmc_host_alloc() so that drivers can handle capabilities before mmc_add_host(). Move tmio_mmc_of_parse() likewise. Signed-off-by: Masahiro Yamada Reviewed-by: Wolfram Sang --- Changes in v3: None Changes in v2: - Newly added drivers/mmc/host/tmio_mmc_core.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) -- 2.7.4 diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c index 55442ed..fc9b28d 100644 --- a/drivers/mmc/host/tmio_mmc_core.c +++ b/drivers/mmc/host/tmio_mmc_core.c @@ -1152,6 +1152,7 @@ struct tmio_mmc_host *tmio_mmc_host_alloc(struct platform_device *pdev, struct mmc_host *mmc; struct resource *res; void __iomem *ctl; + int ret; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ctl = devm_ioremap_resource(&pdev->dev, res); @@ -1170,9 +1171,21 @@ struct tmio_mmc_host *tmio_mmc_host_alloc(struct platform_device *pdev, host->ops = tmio_mmc_ops; mmc->ops = &host->ops; + ret = mmc_of_parse(host->mmc); + if (ret) { + host = ERR_PTR(ret); + goto free; + } + + tmio_mmc_of_parse(pdev, pdata); + platform_set_drvdata(pdev, host); return host; +free: + mmc_free_host(mmc); + + return host; } EXPORT_SYMBOL_GPL(tmio_mmc_host_alloc); @@ -1198,15 +1211,9 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host, if (mmc->f_min == 0) return -EINVAL; - tmio_mmc_of_parse(pdev, pdata); - if (!(pdata->flags & TMIO_MMC_HAS_IDLE_WAIT)) _host->write16_hook = NULL; - ret = mmc_of_parse(mmc); - if (ret < 0) - return ret; - _host->set_pwr = pdata->set_pwr; _host->set_clk_div = pdata->set_clk_div;