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 <asriv...@redhat.com>
---
 drivers/gpu/drm/panel/panel-jdi-lpm102a188a.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-jdi-lpm102a188a.c 
b/drivers/gpu/drm/panel/panel-jdi-lpm102a188a.c
index 
5b5082efb282bcf705cf2d38dea24901e9803648..5f897e143758c2be51c39a20eeda2ecd09e1fbee
 100644
--- a/drivers/gpu/drm/panel/panel-jdi-lpm102a188a.c
+++ b/drivers/gpu/drm/panel/panel-jdi-lpm102a188a.c
@@ -435,9 +435,6 @@ static int jdi_panel_add(struct jdi_panel *jdi)
                return dev_err_probe(dev, PTR_ERR(jdi->backlight),
                                     "failed to create backlight\n");
 
-       drm_panel_init(&jdi->base, &jdi->link1->dev, &jdi_panel_funcs,
-                      DRM_MODE_CONNECTOR_DSI);
-
        drm_panel_add(&jdi->base);
 
        return 0;
@@ -475,10 +472,13 @@ static int jdi_panel_dsi_probe(struct mipi_dsi_device 
*dsi)
 
        /* register a panel for only the DSI-LINK1 interface */
        if (secondary) {
-               jdi = devm_kzalloc(&dsi->dev, sizeof(*jdi), GFP_KERNEL);
-               if (!jdi) {
+               jdi = devm_drm_panel_alloc(&dsi->dev, __typeof(*jdi),
+                                          base, &jdi_panel_funcs,
+                                          DRM_MODE_CONNECTOR_DSI);
+
+               if (IS_ERR(jdi)) {
                        put_device(&secondary->dev);
-                       return -ENOMEM;
+                       return PTR_ERR(jdi);
                }
 
                mipi_dsi_set_drvdata(dsi, jdi);

-- 
2.48.1

Reply via email to