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 <[email protected]>
---
 drivers/gpu/drm/panel/panel-boe-himax8279d.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-boe-himax8279d.c 
b/drivers/gpu/drm/panel/panel-boe-himax8279d.c
index 
df746baae301cf70d9fa940b36aae2712e73b3e3..4a8560b4b899a4da3b307dcb43682303d0543813
 100644
--- a/drivers/gpu/drm/panel/panel-boe-himax8279d.c
+++ b/drivers/gpu/drm/panel/panel-boe-himax8279d.c
@@ -847,9 +847,6 @@ static int panel_add(struct panel_info *pinfo)
                                                 "failed to get enable gpio\n");
        }
 
-       drm_panel_init(&pinfo->base, dev, &panel_funcs,
-                      DRM_MODE_CONNECTOR_DSI);
-
        ret = drm_panel_of_backlight(&pinfo->base);
        if (ret)
                return ret;
@@ -865,9 +862,11 @@ static int panel_probe(struct mipi_dsi_device *dsi)
        const struct panel_desc *desc;
        int err;
 
-       pinfo = devm_kzalloc(&dsi->dev, sizeof(*pinfo), GFP_KERNEL);
-       if (!pinfo)
-               return -ENOMEM;
+       pinfo = devm_drm_panel_alloc(&dsi->dev, __typeof(*pinfo), base,
+                                    &panel_funcs, DRM_MODE_CONNECTOR_DSI);
+
+       if (IS_ERR(pinfo))
+               return PTR_ERR(pinfo);
 
        desc = of_device_get_match_data(&dsi->dev);
        dsi->mode_flags = desc->mode_flags;

-- 
2.48.1

Reply via email to