From patchwork Fri Nov 24 16:24:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 119609 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp2443662qgn; Fri, 24 Nov 2017 08:27:27 -0800 (PST) X-Google-Smtp-Source: AGs4zMYGYqG/Mcl+H5RA3/q1AAeCYfQPthvXGlJUKu8pXQTsjBzFGJ3CJ5P2GM2Y8Y4YR2lRGRUP X-Received: by 10.84.132.46 with SMTP id 43mr30146471ple.126.1511540847442; Fri, 24 Nov 2017 08:27:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511540847; cv=none; d=google.com; s=arc-20160816; b=y5WQDRsZaebOiVETGIfcQuYbZSwSvBDlM4/0lj39VM5AZwZxWWtulAnuYEMn2gXI/X 80zmRC0CqjxkB3g8KvZ+RyohDm7sPoh+0/I7+hvzwegDBc9JTCOVGgIyzMiwj3wWwQfF N7gVjEiyjc5e17NoeMN1sdG6hOjCQZ7UPIKzRSUlzZbvqwdvydxvRscO4gF1/lvFeFjd Alk/EUUJZMzAvNn2TtwirwxAuJ7xHUz32xbdCPeXEglC2v6dTfFdCX7FG0fZtHwGG6Ee J4M9GEBXpUvI/Y+nU7VPo6SWowr1w73bcft4TDa67VM2oTlDop+0dpGf/A+6R7gMukEL RdAQ== 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=1cIUv9KdMSPzrljWce2XbD8cpoUY8AkwpXJ4QKnkkpI=; b=oDA4AMRemYjIY6puJVGIrNdsu1RR/u7HXs2R2XNRRRGNSQM0b/56x3k7q23lCVBXHk XJDdEaf1hzOeFSGxnm3SGpGWQBiyQKDEvo25/CxGU7lL/xt062CFS4cEIcOsT7vnlXzJ YvIGaVePN/+IcV70vv8GlLkhp7NNty8ZeqeI7D+RmITrDcLZiOoj8EjfLCW2ZejQ3zDk kuagU5/l8izSgAz2K/TkBH/jmUJOt5UWrUnIGl+XT3ES/Qlx8d2LOzf9wbZg1zUsyXUc EmALsoVGDJcBXs9/g41WKst0iGeAh5GAC3/3mg+j+kicmGEpMBknusslcZWxpFQ6e/OL LX8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=Y1RRwF0V; 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 bg3si15390634plb.167.2017.11.24.08.27.27; Fri, 24 Nov 2017 08:27: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=Y1RRwF0V; 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 S1753982AbdKXQ10 (ORCPT + 28 others); Fri, 24 Nov 2017 11:27:26 -0500 Received: from conuserg-11.nifty.com ([210.131.2.78]:61634 "EHLO conuserg-11.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753600AbdKXQ0I (ORCPT ); Fri, 24 Nov 2017 11:26:08 -0500 Received: from grover.sesame (FL1-125-199-20-195.osk.mesh.ad.jp [125.199.20.195]) (authenticated) by conuserg-11.nifty.com with ESMTP id vAOGP9W7007100; Sat, 25 Nov 2017 01:25:27 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com vAOGP9W7007100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1511540727; bh=1cIUv9KdMSPzrljWce2XbD8cpoUY8AkwpXJ4QKnkkpI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y1RRwF0Vks4MY1188t9V/cw7hlO1iuudi3CPN9b0hbC3n5Y8Otx9PC0eTmxZz8/JY PsOhz/WTIEwfNP/ZTuFSVlTV9XlpSdmGQPli1le665pWBlXuQ519/m68IqpirOaWNB uyCDMkaKFeLDw1yfDXIs/3ybYOFyRb9xJI3jh1CpC5z3LHI4HpEZ4EN80CJrkZ13SG S1pKdUQ5E/JZ8LQjlaCP5qhlxCP0cLpmhvjZD4Wjsv/A0OanAZ90VxC9Is4viHmhXZ vn/SHO/nqU4w+EoXPQsiXgfhZOeHXgjEq+6H2wWrruObHTtm9bdkkS7Uoe48OvPgZh K514U9dqg/xog== X-Nifty-SrcIP: [125.199.20.195] From: Masahiro Yamada To: linux-mmc@vger.kernel.org, Wolfram Sang Cc: Simon Horman , Yoshihiro Shimoda , linux-renesas-soc@vger.kernel.org, Masahiro Yamada , linux-kernel@vger.kernel.org, Ulf Hansson Subject: [PATCH v2 21/22] mmc: tmio: move {tmio_}mmc_of_parse() to tmio_mmc_host_alloc() Date: Sat, 25 Nov 2017 01:24:56 +0900 Message-Id: <1511540697-27387-22-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1511540697-27387-1-git-send-email-yamada.masahiro@socionext.com> References: <1511540697-27387-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 --- Changes in v2: - Newly added drivers/mmc/host/tmio_mmc_core.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) -- 2.7.4 Reviewed-by: Wolfram Sang diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c index b51486d..02e1438 100644 --- a/drivers/mmc/host/tmio_mmc_core.c +++ b/drivers/mmc/host/tmio_mmc_core.c @@ -1167,6 +1167,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); @@ -1185,9 +1186,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); @@ -1212,15 +1225,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;