[PATCH 07/10] panel/boe-tv101wum-ll2: Use refcounted allocation in place of devm_kzalloc()

Anusha Srivatsa posted 10 patches 1 week, 2 days ago
[PATCH 07/10] panel/boe-tv101wum-ll2: Use refcounted allocation in place of devm_kzalloc()
Posted by Anusha Srivatsa 1 week, 2 days ago
Move to using the new API devm_drm_panel_alloc() to allocate the
panel.

Signed-off-by: Anusha Srivatsa <asrivats@redhat.com>
---
 drivers/gpu/drm/panel/panel-boe-tv101wum-ll2.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-boe-tv101wum-ll2.c b/drivers/gpu/drm/panel/panel-boe-tv101wum-ll2.c
index 50e4a5341bc65727b5ed6ba43a11f5ab9ac9f5b9..04c7890cc51db43bdc6e38cdae8f7f21fd48009f 100644
--- a/drivers/gpu/drm/panel/panel-boe-tv101wum-ll2.c
+++ b/drivers/gpu/drm/panel/panel-boe-tv101wum-ll2.c
@@ -166,9 +166,11 @@ static int boe_tv101wum_ll2_probe(struct mipi_dsi_device *dsi)
 	struct boe_tv101wum_ll2 *ctx;
 	int ret;
 
-	ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL);
-	if (!ctx)
-		return -ENOMEM;
+	ctx = devm_drm_panel_alloc(dev, struct boe_tv101wum_ll2, panel,
+				   &boe_tv101wum_ll2_panel_funcs,
+				   DRM_MODE_CONNECTOR_DSI
+	if (IS_ERR(panel))
+		return PTR_ERR(panel);
 
 	ret = devm_regulator_bulk_get_const(&dsi->dev,
 					ARRAY_SIZE(boe_tv101wum_ll2_supplies),
@@ -190,8 +192,6 @@ static int boe_tv101wum_ll2_probe(struct mipi_dsi_device *dsi)
 	dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST |
 			  MIPI_DSI_MODE_VIDEO_HSE;
 
-	drm_panel_init(&ctx->panel, dev, &boe_tv101wum_ll2_panel_funcs,
-		       DRM_MODE_CONNECTOR_DSI);
 	ctx->panel.prepare_prev_first = true;
 
 	ret = drm_panel_of_backlight(&ctx->panel);

-- 
2.48.1
Re: [PATCH 07/10] panel/boe-tv101wum-ll2: Use refcounted allocation in place of devm_kzalloc()
Posted by Thomas Zimmermann 2 days, 10 hours ago
Hi,

this patch doesn't build.

linux/drivers/gpu/drm/panel/panel-boe-tv101wum-ll2.c: In function 
‘boe_tv101wum_ll2_probe’:
linux/drivers/gpu/drm/panel/panel-boe-tv101wum-ll2.c:241:23: error: 
unterminated argument list invoking macro "devm_drm_panel_alloc"
   241 | MODULE_LICENSE("GPL");
       |                       ^
linux/drivers/gpu/drm/panel/panel-boe-tv101wum-ll2.c:169:15: error: 
‘devm_drm_panel_alloc’ undeclared (first use in this function); did you 
mean ‘devm_drm_panel_add_follower’?
   169 |         ctx = devm_drm_panel_alloc(dev, struct 
boe_tv101wum_ll2, panel,
       |               ^~~~~~~~~~~~~~~~~~~~
       |               devm_drm_panel_add_follower
linux/drivers/gpu/drm/panel/panel-boe-tv101wum-ll2.c:169:15: note: each 
undeclared identifier is reported only once for each function it appears in
linux/drivers/gpu/drm/panel/panel-boe-tv101wum-ll2.c:169:35: error: 
expected ‘;’ at end of input
   169 |         ctx = devm_drm_panel_alloc(dev, struct 
boe_tv101wum_ll2, panel,
       |                                   ^
       |                                   ;
......
linux/drivers/gpu/drm/panel/panel-boe-tv101wum-ll2.c:169:9: error: 
expected declaration or statement at end of input
   169 |         ctx = devm_drm_panel_alloc(dev, struct 
boe_tv101wum_ll2, panel,
       |         ^~~
linux/drivers/gpu/drm/panel/panel-boe-tv101wum-ll2.c:167:13: warning: 
unused variable ‘ret’ [-Wunused-variable]
   167 |         int ret;
       |             ^~~
linux/drivers/gpu/drm/panel/panel-boe-tv101wum-ll2.c:166:34: warning: 
variable ‘ctx’ set but not used [-Wunused-but-set-variable]
   166 |         struct boe_tv101wum_ll2 *ctx;
       |                                  ^~~
linux/drivers/gpu/drm/panel/panel-boe-tv101wum-ll2.c:165:24: warning: 
unused variable ‘dev’ [-Wunused-variable]
   165 |         struct device *dev = &dsi->dev;
       |                        ^~~
linux/drivers/gpu/drm/panel/panel-boe-tv101wum-ll2.c:169:9: error: no 
return statement in function returning non-void [-Werror=return-type]
   169 |         ctx = devm_drm_panel_alloc(dev, struct 
boe_tv101wum_ll2, panel,
       |         ^~~
linux/drivers/gpu/drm/panel/panel-boe-tv101wum-ll2.c: At top level:
linux/drivers/gpu/drm/panel/panel-boe-tv101wum-ll2.c:163:12: warning: 
‘boe_tv101wum_ll2_probe’ defined but not used [-Wunused-function]
   163 | static int boe_tv101wum_ll2_probe(struct mipi_dsi_device *dsi)
       |            ^~~~~~~~~~~~~~~~~~~~~~
linux/drivers/gpu/drm/panel/panel-boe-tv101wum-ll2.c:157:37: warning: 
‘boe_tv101wum_ll2_panel_funcs’ defined but not used 
[-Wunused-const-variable=]
   157 | static const struct drm_panel_funcs 
boe_tv101wum_ll2_panel_funcs = {
       | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors

Please fix.

Best regard
Thomas

Am 01.04.25 um 18:03 schrieb Anusha Srivatsa:
> Move to using the new API devm_drm_panel_alloc() to allocate the
> panel.
>
> Signed-off-by: Anusha Srivatsa <asrivats@redhat.com>
> ---
>   drivers/gpu/drm/panel/panel-boe-tv101wum-ll2.c | 10 +++++-----
>   1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/panel/panel-boe-tv101wum-ll2.c b/drivers/gpu/drm/panel/panel-boe-tv101wum-ll2.c
> index 50e4a5341bc65727b5ed6ba43a11f5ab9ac9f5b9..04c7890cc51db43bdc6e38cdae8f7f21fd48009f 100644
> --- a/drivers/gpu/drm/panel/panel-boe-tv101wum-ll2.c
> +++ b/drivers/gpu/drm/panel/panel-boe-tv101wum-ll2.c
> @@ -166,9 +166,11 @@ static int boe_tv101wum_ll2_probe(struct mipi_dsi_device *dsi)
>   	struct boe_tv101wum_ll2 *ctx;
>   	int ret;
>   
> -	ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL);
> -	if (!ctx)
> -		return -ENOMEM;
> +	ctx = devm_drm_panel_alloc(dev, struct boe_tv101wum_ll2, panel,
> +				   &boe_tv101wum_ll2_panel_funcs,
> +				   DRM_MODE_CONNECTOR_DSI
> +	if (IS_ERR(panel))
> +		return PTR_ERR(panel);
>   
>   	ret = devm_regulator_bulk_get_const(&dsi->dev,
>   					ARRAY_SIZE(boe_tv101wum_ll2_supplies),
> @@ -190,8 +192,6 @@ static int boe_tv101wum_ll2_probe(struct mipi_dsi_device *dsi)
>   	dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST |
>   			  MIPI_DSI_MODE_VIDEO_HSE;
>   
> -	drm_panel_init(&ctx->panel, dev, &boe_tv101wum_ll2_panel_funcs,
> -		       DRM_MODE_CONNECTOR_DSI);
>   	ctx->panel.prepare_prev_first = true;
>   
>   	ret = drm_panel_of_backlight(&ctx->panel);
>

-- 
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)