drm/panel: simple: Simplify matching using of_device_get_match_data()
authorGeert Uytterhoeven <geert+renesas@glider.be>
Fri, 28 Jul 2023 09:17:09 +0000 (11:17 +0200)
committerJavier Martinez Canillas <javierm@redhat.com>
Fri, 28 Jul 2023 09:55:26 +0000 (11:55 +0200)
Both the patform_driver and mipi_dsi_driver structures contain pointers
to the match table used, so the custom code to obtain match and match
data can be replaced by calls to of_device_get_match_data().

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/64ded5b7e809e4c6e915b2c4d8b82e02319cd206.1690535800.git.geert+renesas@glider.be
drivers/gpu/drm/panel/panel-simple.c

index 4badda6..f27d5d8 100644 (file)
@@ -4455,13 +4455,13 @@ MODULE_DEVICE_TABLE(of, platform_of_match);
 
 static int panel_simple_platform_probe(struct platform_device *pdev)
 {
-       const struct of_device_id *id;
+       const struct panel_desc *desc;
 
-       id = of_match_node(platform_of_match, pdev->dev.of_node);
-       if (!id)
+       desc = of_device_get_match_data(&pdev->dev);
+       if (!desc)
                return -ENODEV;
 
-       return panel_simple_probe(&pdev->dev, id->data);
+       return panel_simple_probe(&pdev->dev, desc);
 }
 
 static void panel_simple_platform_remove(struct platform_device *pdev)
@@ -4732,15 +4732,12 @@ MODULE_DEVICE_TABLE(of, dsi_of_match);
 static int panel_simple_dsi_probe(struct mipi_dsi_device *dsi)
 {
        const struct panel_desc_dsi *desc;
-       const struct of_device_id *id;
        int err;
 
-       id = of_match_node(dsi_of_match, dsi->dev.of_node);
-       if (!id)
+       desc = of_device_get_match_data(&dsi->dev);
+       if (!desc)
                return -ENODEV;
 
-       desc = id->data;
-
        err = panel_simple_probe(&dsi->dev, &desc->desc);
        if (err < 0)
                return err;