diff options
author | Ryder Lee <ryder.lee@mediatek.com> | 2018-04-16 10:33:54 +0800 |
---|---|---|
committer | Boris Brezillon <boris.brezillon@bootlin.com> | 2018-04-29 08:56:41 +0200 |
commit | 36bf2eb90de03d37e05169be29efd2e959ae27a9 (patch) | |
tree | 0563a460a201529660ddd6d923a0138e4820197f /drivers/mtd/nand/raw/mtk_nand.c | |
parent | 7b4b199459f31541141c4510e542bd4533a60585 (diff) | |
download | linux-36bf2eb90de03d37e05169be29efd2e959ae27a9.tar.gz |
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_nand.c')
-rw-r--r-- | drivers/mtd/nand/raw/mtk_nand.c | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/drivers/mtd/nand/raw/mtk_nand.c b/drivers/mtd/nand/raw/mtk_nand.c index 6977da3a26aa..75c845adb050 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); |