Received: by 10.192.165.156 with SMTP id m28csp130965imm; Tue, 17 Apr 2018 07:39:28 -0700 (PDT) X-Google-Smtp-Source: AIpwx49+peofBecr4zRJ0jtz/jhG3FP0Y40BHH+Bo7ldGJTgF90Pw8+0fzcQe8bnanudj1D2+pGy X-Received: by 10.99.114.80 with SMTP id c16mr1966451pgn.385.1523975968796; Tue, 17 Apr 2018 07:39:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523975968; cv=none; d=google.com; s=arc-20160816; b=cDTT//ewgMKd0XcMCZgpLjSxpuW0bGBsIU0hQe3nSZi4YC6x+iyJ2LYQIXXJudUGFv wxtqHT12lOg4x00wrk/zjUlhgPXxtex+TuNdlzbt+mvpwUshkkJdC/aP91kxQEYYTJS0 FqbtUwM4p+cKQK+8Dma/TXmqEDepit+glEitjataJ5n288tqg0V78t6dFsE/eqSj1ovE dp5nHheBliowHAqX8H4mWYKMe9l+QbhXs2ZEHOubDhTfdayN9WWgRDdMtOhjbI5OlBl2 7yhlYFjYL8VHqO8MQtkuhGzQnvRF100hSsZQUVOdjg1ftsJnMIHPcJQN2ak9Rh6PxRov h33A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:openpgp:from:references:cc:to:subject :dkim-signature:arc-authentication-results; bh=6X/OZpKG+dfaw925EdxN92vnDfM72XVeq6aBPMf/AbY=; b=HXqutLF20tEVJHerVxd3BsDX6rpIZKWCErPmmuhjph1QTyIobKna9PYnl9n10TsL8B mSwD7Jg1MCneXmDaJ5R+vryWZRLTcVjzolMlFGDNy9317nXoRewvYKIBM4fjZnCY7LU3 BkV3pPPY40IHmk8+3eykPI41arBVs/nb5F88OEPpDsfPp9VDOYXMZI7YLgWE+bc8BiBa sqew1B+VJgaVL1VBF20PMlbe6iQZ686VwQoXExqEZUgxtAguFVfUFCbDRImKWWia8QZg l+PWpde5tJh+krntbK3SbCsvkbTvC+bH2eG0hmG6Uv/QcuEYMPjzIko5f3gzwU3khAXD Q+Gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=irdJKAVY; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y96-v6si296821plh.370.2018.04.17.07.39.14; Tue, 17 Apr 2018 07:39:28 -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=@gmail.com header.s=20161025 header.b=irdJKAVY; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753949AbeDQOhf (ORCPT + 99 others); Tue, 17 Apr 2018 10:37:35 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:39232 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752976AbeDQOhc (ORCPT ); Tue, 17 Apr 2018 10:37:32 -0400 Received: by mail-wr0-f193.google.com with SMTP id q6so24121615wrd.6 for ; Tue, 17 Apr 2018 07:37:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:openpgp:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=6X/OZpKG+dfaw925EdxN92vnDfM72XVeq6aBPMf/AbY=; b=irdJKAVYJ2VGtAfzUs2NfWlPKuAWPgR6mN7tILy7YwxJds/U8Y51tq1DKmXtiVCtP0 3CkJQK0IkDvwyxXEomrdmp9HOQRi7hpCY7EmBhDgbn2XuzwT3rkRx2p+IkiJG1EKHT6P ArSjOKaAUFrK+MhIfoZZUXLSYmwPjlVcljfI9VaMhgZmU+WWSnz3QakjG6qIsYJAxidX aDdAJsDKKFb/zUDEXPvXX9MDEuDFoC2A78bho4GE3w8PIivWIKXuw669ECslArds1PDe etWJneeLOfn51KslKd1M0FCn+onGxZbnX2Nd/MrjrbJUbqUNM4Ct9+ZZPBW6sPiuB4nG +9OA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:openpgp:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=6X/OZpKG+dfaw925EdxN92vnDfM72XVeq6aBPMf/AbY=; b=ebswc9yzWo58IXwxBcQrd+XTck+nVu5JLZbUGv9Bb42kvOcenRWuZS31NOP5Jceh2f +/G5HSBGSFlmhCxxvzdQFlfkAYJ6hR7ahTFEEwFNI7sQR8Rj4RnGbgbhVunstXCcbLE9 Qewg0HU2D2zq0bJYqXVA/G51wVpH7Z0oemivN1JC+cfkkFbJ67+d6bECUp/fCeVx4NaK eJWQ7BBj8r512XLNFX0ICNlra0pMXCqv1n4lmjTrCr2CK3730LBA7mLl9p/7MUn/RqW7 mZBQbo3+zkbay8+imu0bee55rc1q/pAQpMoXhg9hty7KU1y3qFASgr3qLT7uds0s7nLO B68A== X-Gm-Message-State: ALQs6tB36yhDtnKJ2IkX0349AvJ8fqp9+bdScAuiNNSzY1HLD0AoOWCq 0cYap6DLiJToDOnToFtPn34= X-Received: by 10.80.207.136 with SMTP id h8mr3541228edk.40.1523975851594; Tue, 17 Apr 2018 07:37:31 -0700 (PDT) Received: from ziggy.stardust ([37.223.140.222]) by smtp.gmail.com with ESMTPSA id i8sm8548499edj.3.2018.04.17.07.37.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 17 Apr 2018 07:37:30 -0700 (PDT) Subject: Re: [PATCH] soc: mediatek: use of_device_get_match_data() To: Ryder Lee Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org References: <31f944ab8dfcc1d7b6f03b35657a2a34825b5246.1523347340.git.ryder.lee@mediatek.com> From: Matthias Brugger Openpgp: preference=signencrypt Autocrypt: addr=matthias.bgg@gmail.com; prefer-encrypt=mutual; keydata= xsFNBFP1zgUBEAC21D6hk7//0kOmsUrE3eZ55kjc9DmFPKIz6l4NggqwQjBNRHIMh04BbCMY fL3eT7ZsYV5nur7zctmJ+vbszoOASXUpfq8M+S5hU2w7sBaVk5rpH9yW8CUWz2+ZpQXPJcFa OhLZuSKB1F5JcvLbETRjNzNU7B3TdS2+zkgQQdEyt7Ij2HXGLJ2w+yG2GuR9/iyCJRf10Okq gTh//XESJZ8S6KlOWbLXRE+yfkKDXQx2Jr1XuVvM3zPqH5FMg8reRVFsQ+vI0b+OlyekT/Xe 0Hwvqkev95GG6x7yseJwI+2ydDH6M5O7fPKFW5mzAdDE2g/K9B4e2tYK6/rA7Fq4cqiAw1+u EgO44+eFgv082xtBez5WNkGn18vtw0LW3ESmKh19u6kEGoi0WZwslCNaGFrS4M7OH+aOJeqK fx5dIv2CEbxc6xnHY7dwkcHikTA4QdbdFeUSuj4YhIZ+0QlDVtS1QEXyvZbZky7ur9rHkZvP ZqlUsLJ2nOqsmahMTIQ8Mgx9SLEShWqD4kOF4zNfPJsgEMB49KbS2o9jxbGB+JKupjNddfxZ HlH1KF8QwCMZEYaTNogrVazuEJzx6JdRpR3sFda/0x5qjTadwIW6Cl9tkqe2h391dOGX1eOA 1ntn9O/39KqSrWNGvm+1raHK+Ev1yPtn0Wxn+0oy1tl67TxUjQARAQABzSRNYXR0aGlhcyBC cnVnZ2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sVmM9Y8VPE61 4zSiZQBL5CinBTTI8ssYlV/aIKYi0dxRcj6vYnAfUImOsdZ5AQja5xIqw1rwWWUOYb99 Message-ID: Date: Tue, 17 Apr 2018 16:37:29 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/16/2018 04:33 AM, Ryder Lee wrote: > The usage of of_device_get_match_data() reduce the code size a bit. > > Also, the only way to call pwrap_probe() is to match an entry in > of_pwrap_match_tbl[], so of_id cannot be NULL. > > Signed-off-by: Ryder Lee > --- Applied to v4.17-next/soc Thanks. > drivers/soc/mediatek/mtk-pmic-wrap.c | 13 +++---------- > drivers/soc/mediatek/mtk-scpsys.c | 4 +--- > 2 files changed, 4 insertions(+), 13 deletions(-) > > diff --git a/drivers/soc/mediatek/mtk-pmic-wrap.c b/drivers/soc/mediatek/mtk-pmic-wrap.c > index e9e054a..2afae64 100644 > --- a/drivers/soc/mediatek/mtk-pmic-wrap.c > +++ b/drivers/soc/mediatek/mtk-pmic-wrap.c > @@ -1458,19 +1458,12 @@ static int pwrap_probe(struct platform_device *pdev) > int ret, irq; > struct pmic_wrapper *wrp; > struct device_node *np = pdev->dev.of_node; > - const struct of_device_id *of_id = > - of_match_device(of_pwrap_match_tbl, &pdev->dev); > const struct of_device_id *of_slave_id = NULL; > struct resource *res; > > - if (!of_id) { > - dev_err(&pdev->dev, "Error: No device match found\n"); > - return -ENODEV; > - } > + if (np->child) > + of_slave_id = of_match_node(of_slave_match_tbl, np->child); > > - if (pdev->dev.of_node->child) > - of_slave_id = of_match_node(of_slave_match_tbl, > - pdev->dev.of_node->child); > if (!of_slave_id) { > dev_dbg(&pdev->dev, "slave pmic should be defined in dts\n"); > return -EINVAL; > @@ -1482,7 +1475,7 @@ static int pwrap_probe(struct platform_device *pdev) > > platform_set_drvdata(pdev, wrp); > > - wrp->master = of_id->data; > + wrp->master = of_device_get_match_data(&pdev->dev); > wrp->slave = of_slave_id->data; > wrp->dev = &pdev->dev; > > diff --git a/drivers/soc/mediatek/mtk-scpsys.c b/drivers/soc/mediatek/mtk-scpsys.c > index 435ce5e..a02a18e 100644 > --- a/drivers/soc/mediatek/mtk-scpsys.c > +++ b/drivers/soc/mediatek/mtk-scpsys.c > @@ -973,15 +973,13 @@ static void mtk_register_power_domains(struct platform_device *pdev, > > static int scpsys_probe(struct platform_device *pdev) > { > - const struct of_device_id *match; > const struct scp_subdomain *sd; > const struct scp_soc_data *soc; > struct scp *scp; > struct genpd_onecell_data *pd_data; > int i, ret; > > - match = of_match_device(of_scpsys_match_tbl, &pdev->dev); > - soc = (const struct scp_soc_data *)match->data; > + soc = of_device_get_match_data(&pdev->dev); > > scp = init_scp(pdev, soc->domains, soc->num_domains, &soc->regs, > soc->bus_prot_reg_update); >