summaryrefslogtreecommitdiff
path: root/drivers/mtd/nand/raw/mtk_ecc.c
diff options
context:
space:
mode:
authorRyder Lee <ryder.lee@mediatek.com>2018-04-16 05:33:54 +0300
committerBoris Brezillon <boris.brezillon@bootlin.com>2018-04-29 09:56:41 +0300
commit36bf2eb90de03d37e05169be29efd2e959ae27a9 (patch)
tree0563a460a201529660ddd6d923a0138e4820197f /drivers/mtd/nand/raw/mtk_ecc.c
parent7b4b199459f31541141c4510e542bd4533a60585 (diff)
downloadlinux-36bf2eb90de03d37e05169be29efd2e959ae27a9.tar.xz
mtd: rawnand: mtk: use of_device_get_match_data()
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> Reviewed-by: Xiaolei Li <xiaolei.li@mediatek.com> Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Diffstat (limited to 'drivers/mtd/nand/raw/mtk_ecc.c')
-rw-r--r--drivers/mtd/nand/raw/mtk_ecc.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/drivers/mtd/nand/raw/mtk_ecc.c b/drivers/mtd/nand/raw/mtk_ecc.c
index 40d86a861a70..6432bd70c3b3 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];