LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@bootlin.com>
To: Ryder Lee <ryder.lee@mediatek.com>
Cc: Boris Brezillon <boris.brezillon@free-electrons.com>,
	linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org,
	linux-mtd@lists.infradead.org,
	Xiaolei Li <xiaolei.li@mediatek.com>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] mtd: nand: mtk: use of_device_get_match_data()
Date: Sun, 22 Apr 2018 19:27:48 +0200	[thread overview]
Message-ID: <20180422192748.42fc6b6f@bbrezillon> (raw)
In-Reply-To: <c3af6d5035e43b53b5cc7ee68f9f1a853ce2a8f9.1523347340.git.ryder.lee@mediatek.com>

On Mon, 16 Apr 2018 10:33:54 +0800
Ryder Lee <ryder.lee@mediatek.com> wrote:

> The usage of of_device_get_match_data() reduce the code size a bit.
> 
> Also, the only way to call .probe() is to match an entry in
> .of_match_table[], so of_device_id cannot be NULL.
> 
> Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
> ---
>  drivers/mtd/nand/raw/mtk_ecc.c  |  7 +------
>  drivers/mtd/nand/raw/mtk_nand.c | 10 +---------

Applied to nand/next after fixing the subject prefix.

Thanks,

Boris

>  2 files changed, 2 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/mtd/nand/mtk_ecc.c b/drivers/mtd/nand/mtk_ecc.c
> index 40d86a8..6432bd7 100644
> --- a/drivers/mtd/nand/raw/mtk_ecc.c
> +++ b/drivers/mtd/nand/raw/mtk_ecc.c
> @@ -500,7 +500,6 @@ static int mtk_ecc_probe(struct platform_device *pdev)
>  	struct device *dev = &pdev->dev;
>  	struct mtk_ecc *ecc;
>  	struct resource *res;
> -	const struct of_device_id *of_ecc_id = NULL;
>  	u32 max_eccdata_size;
>  	int irq, ret;
>  
> @@ -508,11 +507,7 @@ static int mtk_ecc_probe(struct platform_device *pdev)
>  	if (!ecc)
>  		return -ENOMEM;
>  
> -	of_ecc_id = of_match_device(mtk_ecc_dt_match, &pdev->dev);
> -	if (!of_ecc_id)
> -		return -ENODEV;
> -
> -	ecc->caps = of_ecc_id->data;
> +	ecc->caps = of_device_get_match_data(dev);
>  
>  	max_eccdata_size = ecc->caps->num_ecc_strength - 1;
>  	max_eccdata_size = ecc->caps->ecc_strength[max_eccdata_size];
> diff --git a/drivers/mtd/nand/mtk_nand.c b/drivers/mtd/nand/mtk_nand.c
> index 6977da3..75c845a 100644
> --- a/drivers/mtd/nand/raw/mtk_nand.c
> +++ b/drivers/mtd/nand/raw/mtk_nand.c
> @@ -1434,7 +1434,6 @@ static int mtk_nfc_probe(struct platform_device *pdev)
>  	struct device_node *np = dev->of_node;
>  	struct mtk_nfc *nfc;
>  	struct resource *res;
> -	const struct of_device_id *of_nfc_id = NULL;
>  	int ret, irq;
>  
>  	nfc = devm_kzalloc(dev, sizeof(*nfc), GFP_KERNEL);
> @@ -1452,6 +1451,7 @@ static int mtk_nfc_probe(struct platform_device *pdev)
>  	else if (!nfc->ecc)
>  		return -ENODEV;
>  
> +	nfc->caps = of_device_get_match_data(dev);
>  	nfc->dev = dev;
>  
>  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> @@ -1498,14 +1498,6 @@ static int mtk_nfc_probe(struct platform_device *pdev)
>  		goto clk_disable;
>  	}
>  
> -	of_nfc_id = of_match_device(mtk_nfc_id_table, &pdev->dev);
> -	if (!of_nfc_id) {
> -		ret = -ENODEV;
> -		goto clk_disable;
> -	}
> -
> -	nfc->caps = of_nfc_id->data;
> -
>  	platform_set_drvdata(pdev, nfc);
>  
>  	ret = mtk_nfc_nand_chips_init(dev, nfc);

  parent reply	other threads:[~2018-04-22 17:28 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-16  2:32 [PATCH] i2c: mediatek: " 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
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 [this message]
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=20180422192748.42fc6b6f@bbrezillon \
    --to=boris.brezillon@bootlin.com \
    --cc=boris.brezillon@free-electrons.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=ryder.lee@mediatek.com \
    --cc=xiaolei.li@mediatek.com \
    --subject='Re: [PATCH] mtd: nand: mtk: use of_device_get_match_data()' \
    /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

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).