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.

Reviewed-by: Neil Armstrong <[email protected]>
Reviewed-by: Maxime Ripard <[email protected]>
Signed-off-by: Albert Esteve <[email protected]>
---
 drivers/gpu/drm/panel/panel-ilitek-ili9806e-core.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9806e-core.c 
b/drivers/gpu/drm/panel/panel-ilitek-ili9806e-core.c
index be2cf14401553..53e25d1086db8 100644
--- a/drivers/gpu/drm/panel/panel-ilitek-ili9806e-core.c
+++ b/drivers/gpu/drm/panel/panel-ilitek-ili9806e-core.c
@@ -78,9 +78,11 @@ int ili9806e_probe(struct device *dev, void *transport,
        bool set_prepare_prev_first = false;
        int ret;
 
-       ctx = devm_kzalloc(dev, sizeof(struct ili9806e), GFP_KERNEL);
-       if (!ctx)
-               return -ENOMEM;
+       ctx = devm_drm_panel_alloc(dev, __typeof(*ctx), panel,
+                                 funcs, connector_type);
+
+       if (IS_ERR(ctx))
+               return PTR_ERR(ctx);
 
        dev_set_drvdata(dev, ctx);
        ctx->transport = transport;
@@ -103,8 +105,6 @@ int ili9806e_probe(struct device *dev, void *transport,
                return dev_err_probe(dev, PTR_ERR(ctx->reset_gpio),
                                     "Failed to get reset-gpios\n");
 
-       drm_panel_init(&ctx->panel, dev, funcs, connector_type);
-
        ret = drm_panel_of_backlight(&ctx->panel);
        if (ret)
                return dev_err_probe(dev, ret, "Failed to get backlight\n");

-- 
2.53.0

Reply via email to