usb: chipidea: ci_hdrc_imx: Use of_device_get_match_data()
authorFabio Estevam <festevam@gmail.com>
Tue, 24 Nov 2020 16:39:12 +0000 (13:39 -0300)
committerPeter Chen <peter.chen@nxp.com>
Thu, 10 Dec 2020 09:35:33 +0000 (17:35 +0800)
The retrieval of driver data via of_device_get_match_data() can make
the code simpler.

Use of_device_get_match_data() to simplify the code.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
drivers/usb/chipidea/ci_hdrc_imx.c

index 25c65accf089c169b6a9cfbabedabf1a7ad3a8b6..8fa712148e5d59ffcd95a46c7ff300a2cfd3ad25 100644 (file)
@@ -319,16 +319,11 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
                .notify_event   = ci_hdrc_imx_notify_event,
        };
        int ret;
-       const struct of_device_id *of_id;
        const struct ci_hdrc_imx_platform_flag *imx_platform_flag;
        struct device_node *np = pdev->dev.of_node;
        struct device *dev = &pdev->dev;
 
-       of_id = of_match_device(ci_hdrc_imx_dt_ids, dev);
-       if (!of_id)
-               return -ENODEV;
-
-       imx_platform_flag = of_id->data;
+       imx_platform_flag = of_device_get_match_data(&pdev->dev);
 
        data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
        if (!data)