From: Matthias Brugger <matthias.bgg@gmail.com>
To: Ryder Lee <ryder.lee@mediatek.com>
Cc: linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org
Subject: Re: [PATCH] soc: mediatek: use of_device_get_match_data()
Date: Tue, 17 Apr 2018 16:37:29 +0200 [thread overview]
Message-ID: <ca67f622-d624-81c1-b8f4-eb5dfe4d5dab@gmail.com> (raw)
In-Reply-To: <b7fffebff04c6b717c568194ac7503144a3302a8.1523347340.git.ryder.lee@mediatek.com>
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 <ryder.lee@mediatek.com>
> ---
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);
>
next prev parent reply other threads:[~2018-04-17 14:37 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-16 2:32 [PATCH] i2c: mediatek: use of_device_get_match_data() Ryder Lee
2018-04-16 2:33 ` [PATCH] spi: mediatek: Use of_device_get_match_data() Ryder Lee
2018-04-30 7:26 ` Ryder Lee
2018-05-01 20:35 ` Mark Brown
2018-04-16 2:33 ` [PATCH] soc: mediatek: use of_device_get_match_data() Ryder Lee
2018-04-17 14:37 ` Matthias Brugger [this message]
2018-04-16 2:33 ` [PATCH] net: " Ryder Lee
2018-04-16 17:43 ` David Miller
2018-04-16 2:33 ` [PATCH] mmc: " Ryder Lee
2018-04-19 13:18 ` Ulf Hansson
2018-04-16 2:33 ` [PATCH] mtd: nand: mtk: " Ryder Lee
2018-04-16 4:27 ` xiaolei li
2018-04-22 17:27 ` Boris Brezillon
2018-04-16 2:34 ` [PATCH] thermal: mediatek: " Ryder Lee
2018-04-16 2:34 ` [PATCH] media: rc: mtk-cir: " Ryder Lee
2018-04-17 3:58 ` Sean Wang
2018-04-28 13:12 ` [PATCH] i2c: mediatek: " Wolfram Sang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ca67f622-d624-81c1-b8f4-eb5dfe4d5dab@gmail.com \
--to=matthias.bgg@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=ryder.lee@mediatek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).