lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1523852857.14673.30.camel@mhfsdcap03>
Date:   Mon, 16 Apr 2018 12:27:37 +0800
From:   xiaolei li <xiaolei.li@...iatek.com>
To:     Ryder Lee <ryder.lee@...iatek.com>
CC:     Boris Brezillon <boris.brezillon@...e-electrons.com>,
        <linux-mtd@...ts.infradead.org>, <linux-kernel@...r.kernel.org>,
        <linux-arm-kernel@...ts.infradead.org>,
        <linux-mediatek@...ts.infradead.org>
Subject: Re: [PATCH] mtd: nand: mtk: use of_device_get_match_data()

On Mon, 2018-04-16 at 10:33 +0800, Ryder Lee 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@...iatek.com>
> ---
>  drivers/mtd/nand/raw/mtk_ecc.c  |  7 +------
>  drivers/mtd/nand/raw/mtk_nand.c | 10 +---------
>  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);
>  
Thanks.

Reviewed-by: Xiaolei Li <xiaolei.li@...iatek.com>

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


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ