mtd: nand: sh_flctl: Use of_device_get_match_data() helper
authorGeert Uytterhoeven <geert+renesas@glider.be>
Wed, 4 Oct 2017 12:19:03 +0000 (14:19 +0200)
committerBoris Brezillon <boris.brezillon@free-electrons.com>
Sat, 7 Oct 2017 09:28:07 +0000 (11:28 +0200)
Use the of_device_get_match_data() helper instead of open coding.
While at it, make config const so the cast can be dropped.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
drivers/mtd/nand/sh_flctl.c

index e7f3c98..3c5008a 100644 (file)
@@ -1094,14 +1094,11 @@ MODULE_DEVICE_TABLE(of, of_flctl_match);
 
 static struct sh_flctl_platform_data *flctl_parse_dt(struct device *dev)
 {
-       const struct of_device_id *match;
-       struct flctl_soc_config *config;
+       const struct flctl_soc_config *config;
        struct sh_flctl_platform_data *pdata;
 
-       match = of_match_device(of_flctl_match, dev);
-       if (match)
-               config = (struct flctl_soc_config *)match->data;
-       else {
+       config = of_device_get_match_data(dev);
+       if (!config) {
                dev_err(dev, "%s: no OF configuration attached\n", __func__);
                return NULL;
        }