]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/panel/lq101r1sx01: Use refcounted allocation in place of devm_kzalloc()
authorAnusha Srivatsa <asrivats@redhat.com>
Fri, 11 Jul 2025 04:31:12 +0000 (23:31 -0500)
committerMaxime Ripard <mripard@kernel.org>
Wed, 16 Jul 2025 14:58:08 +0000 (16:58 +0200)
Move to using the new API devm_drm_panel_alloc() to allocate the
panel. In the call to the new API, avoid using explicit type and use
__typeof() for more type safety.

Signed-off-by: Anusha Srivatsa <asrivats@redhat.com>
Link: https://lore.kernel.org/r/20250710-b4-driver-convert-last-part-july-v1-1-de73ba81b2f5@redhat.com
Signed-off-by: Maxime Ripard <mripard@kernel.org>
drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c

index a0d76d588da1a276c5875ad291195d01a0c0495c..d159b0e4fdb6bfb00beb60de660db59ed2c9c566 100644 (file)
@@ -279,9 +279,6 @@ static int sharp_panel_add(struct sharp_panel *sharp)
        if (IS_ERR(sharp->supply))
                return PTR_ERR(sharp->supply);
 
-       drm_panel_init(&sharp->base, &sharp->link1->dev, &sharp_panel_funcs,
-                      DRM_MODE_CONNECTOR_DSI);
-
        ret = drm_panel_of_backlight(&sharp->base);
        if (ret)
                return ret;
@@ -323,10 +320,12 @@ static int sharp_panel_probe(struct mipi_dsi_device *dsi)
 
        /* register a panel for only the DSI-LINK1 interface */
        if (secondary) {
-               sharp = devm_kzalloc(&dsi->dev, sizeof(*sharp), GFP_KERNEL);
-               if (!sharp) {
+               sharp = devm_drm_panel_alloc(&dsi->dev, __typeof(*sharp), base,
+                                            &sharp_panel_funcs,
+                                            DRM_MODE_CONNECTOR_DSI);
+               if (IS_ERR(sharp)) {
                        put_device(&secondary->dev);
-                       return -ENOMEM;
+                       return PTR_ERR(sharp);
                }
 
                mipi_dsi_set_drvdata(dsi, sharp);