Received: by 10.192.165.156 with SMTP id m28csp708163imm; Thu, 19 Apr 2018 06:20:24 -0700 (PDT) X-Google-Smtp-Source: AIpwx49yrBbBbc2YDRm+HcU5OlY6/J1WMpY2NXiqAzxq5grkyNphNp+xpHpwwCVFIF5/BWX+Bvyp X-Received: by 2002:a17:902:5c6:: with SMTP id f64-v6mr6118356plf.77.1524144024843; Thu, 19 Apr 2018 06:20:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524144024; cv=none; d=google.com; s=arc-20160816; b=IfMynj4xUTmngw5Y87e4uES6i9Efa0ofqw5mb13yWrpomHJIub9WZLMg74DoVcxt2T qwXuvUJdMjXjliBVmRTaBUm309i+cSB3PuQOyBGYnxKgPDM1218sGzTnPlJDyo3454AP 3NNRIkkiHksCT2y/UZp/sqeOC10CRIZO4ek1HQPgeeSEACwAGr2/Xnp0sbDLGqbdGxu1 nYbQnYlKKMmgVY2hCV2mkRAPgEfVrKAQR4Ik/pPOMy6L2sSWG5tyZPX59OgfA1HulLab oSR4vvY+/ohc/tujKCvNAHMdK6MOcdXOBO4esGbigiZBOomgGiN2qT234XS6HOjzTaAk gZgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=0VBpWOIwV5/w5IrhPE+qsJIyocxAuHfn3O+3BfsV7S4=; b=yGlplQ4ch6O9D9qJ0C/72gsx2vGefkhOU5N6byuz/OZf6Habn89w0eS4njOLNjPUaU zpZUVuJUsOQudC9lXuSYeWUdnvAcgP7ilD8h7NozeA0wqg3pOBxOq0U1kMxv1Q+NPlfA YZOEfB767gGZLhLRq0aPJ03uSK9TEs11qHB5NXLXjuAQ2XpBRlnbcx06TBrjWTLekwkw Ht6h1QlpbohwqmN0a7mDp2PUgIaoVr22PymNujOyI7NTF9STzLRhGFoD+qHfaD9N8rHq 12zRNKvEv/JOMgD6sEWbi2GcsjzT7WhdeXEFqn9x6ZtxKgOpVLrAMOpW2cmTlpdOmYZc HCBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=bJBEKrd7; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e8-v6si3171605pli.219.2018.04.19.06.20.10; Thu, 19 Apr 2018 06:20:24 -0700 (PDT) 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=@linaro.org header.s=google header.b=bJBEKrd7; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751830AbeDSNS7 (ORCPT + 99 others); Thu, 19 Apr 2018 09:18:59 -0400 Received: from mail-it0-f65.google.com ([209.85.214.65]:34094 "EHLO mail-it0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750735AbeDSNS6 (ORCPT ); Thu, 19 Apr 2018 09:18:58 -0400 Received: by mail-it0-f65.google.com with SMTP id t192-v6so155143itc.1 for ; Thu, 19 Apr 2018 06:18:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=0VBpWOIwV5/w5IrhPE+qsJIyocxAuHfn3O+3BfsV7S4=; b=bJBEKrd7VXSez+gbouSlqU89nVk6wyirn6cB6fkaKwczYgD4cRZe0JRdacTuP+tQBv PidkmGY37L1v/zTr72P8+xNJplqB1iKUVoY1ylOB3sQpyuPhVOdhHGf5WhFQegoMwT/A E3v7Crcq+dwaWCiOBgKTo1Q7LJAbfdso2u5bE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=0VBpWOIwV5/w5IrhPE+qsJIyocxAuHfn3O+3BfsV7S4=; b=BGIOJ33357wDZIbturyf7CCeT6hPR2IkjmGSVEBNWDU+hh1ocuNhPgFVO0tZDRG37D IAfdIh4DJcGFGwS4thLzVbxvqkeep+v37hc1juoI6hZhRE9iVvAc3WJqRJFY2aiDtgLp 1+JtHXGHCA8st7tUtbuqM3ha+Yiklui2+IyCh5waBY3aU0wip/Vo3BaMQXhe08OuBOYQ VrLLaxutSsJHVLg0t4/TtyZrfx1FGqOeE5zpQLjMdXzkkE6/en1uoPl7u0m95xTHeJH7 Xx+IjLR5dPPZH7jU8hKxUTI/dK2FvRL4cWgtRCPmCgXF1UpNBq33Dy2VTOjGl7x5mMPs SaDw== X-Gm-Message-State: ALQs6tAHLl1zxADhcYKzSwjsvIzc29fxOeYzmoWSjvoWkx7RseX5eCED U0Q+Vt5QyNeUJX6FADQJGFDXnHkB83V/K2IxeuGIz+Ha X-Received: by 2002:a24:3941:: with SMTP id l62-v6mr6274769ita.55.1524143937641; Thu, 19 Apr 2018 06:18:57 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a02:734a:0:0:0:0:0 with HTTP; Thu, 19 Apr 2018 06:18:57 -0700 (PDT) In-Reply-To: References: <31f944ab8dfcc1d7b6f03b35657a2a34825b5246.1523347340.git.ryder.lee@mediatek.com> From: Ulf Hansson Date: Thu, 19 Apr 2018 15:18:57 +0200 Message-ID: Subject: Re: [PATCH] mmc: mediatek: use of_device_get_match_data() To: Ryder Lee Cc: Chaotian Jing , "linux-mmc@vger.kernel.org" , Linux Kernel Mailing List , Linux ARM , linux-mediatek@lists.infradead.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 16 April 2018 at 04:33, Ryder Lee wrote: > The usage of of_device_get_match_data() reduce the code size a bit. > > Also, the only way to call msdc_drv_probe() is to match an entry in > msdc_of_ids[], so of_id cannot be NULL. > > Signed-off-by: Ryder Lee Thanks, applied for next! Kind regards Uffe > --- > drivers/mmc/host/mtk-sd.c | 7 ++----- > 1 file changed, 2 insertions(+), 5 deletions(-) > > diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c > index 6457a7d..67e9b57 100644 > --- a/drivers/mmc/host/mtk-sd.c > +++ b/drivers/mmc/host/mtk-sd.c > @@ -19,6 +19,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -1808,7 +1809,6 @@ static int msdc_drv_probe(struct platform_device *pdev) > struct mmc_host *mmc; > struct msdc_host *host; > struct resource *res; > - const struct of_device_id *of_id; > int ret; > > if (!pdev->dev.of_node) { > @@ -1816,9 +1816,6 @@ static int msdc_drv_probe(struct platform_device *pdev) > return -EINVAL; > } > > - of_id = of_match_node(msdc_of_ids, pdev->dev.of_node); > - if (!of_id) > - return -EINVAL; > /* Allocate MMC host for this device */ > mmc = mmc_alloc_host(sizeof(struct msdc_host), &pdev->dev); > if (!mmc) > @@ -1887,7 +1884,7 @@ static int msdc_drv_probe(struct platform_device *pdev) > msdc_of_property_parse(pdev, host); > > host->dev = &pdev->dev; > - host->dev_comp = of_id->data; > + host->dev_comp = of_device_get_match_data(&pdev->dev); > host->mmc = mmc; > host->src_clk_freq = clk_get_rate(host->src_clk); > /* Set host parameters to mmc */ > -- > 1.9.1 >