[PATCH v2 22/30] panel/newvision-nv3052c: Use refcounted allocation in place of devm_kzalloc()

Anusha Srivatsa posted 30 patches 10 months, 1 week ago
There is a newer version of this series
[PATCH v2 22/30] panel/newvision-nv3052c: Use refcounted allocation in place of devm_kzalloc()
Posted by Anusha Srivatsa 10 months, 1 week ago
Move to using the new API devm_drm_panel_alloc() to allocate the
panel.

Signed-off-by: Anusha Srivatsa <asrivats@redhat.com>
---
v2: none.
---
 drivers/gpu/drm/panel/panel-newvision-nv3052c.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-newvision-nv3052c.c b/drivers/gpu/drm/panel/panel-newvision-nv3052c.c
index 06e16a7c14a756b9a399347b29b410fd5f4ae273..08c99a48e06dc02677c6f0575d344f890871e0af 100644
--- a/drivers/gpu/drm/panel/panel-newvision-nv3052c.c
+++ b/drivers/gpu/drm/panel/panel-newvision-nv3052c.c
@@ -777,9 +777,10 @@ static int nv3052c_probe(struct spi_device *spi)
 	struct nv3052c *priv;
 	int err;
 
-	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
-	if (!priv)
-		return -ENOMEM;
+	priv = devm_drm_panel_alloc(dev, struct nv3052c, panel, &nv3052c_funcs,
+				DRM_MODE_CONNECTOR_DPI);
+	if (IS_ERR(priv))
+		return PTR_ERR(priv);
 
 	priv->dev = dev;
 
@@ -803,9 +804,6 @@ static int nv3052c_probe(struct spi_device *spi)
 
 	spi_set_drvdata(spi, priv);
 
-	drm_panel_init(&priv->panel, dev, &nv3052c_funcs,
-		       DRM_MODE_CONNECTOR_DPI);
-
 	err = drm_panel_of_backlight(&priv->panel);
 	if (err)
 		return dev_err_probe(dev, err, "Failed to attach backlight\n");

-- 
2.48.1
Re: [PATCH v2 22/30] panel/newvision-nv3052c: Use refcounted allocation in place of devm_kzalloc()
Posted by Neil Armstrong 10 months, 1 week ago
On 03/04/2025 16:16, Anusha Srivatsa wrote:
> Move to using the new API devm_drm_panel_alloc() to allocate the
> panel.
> 
> Signed-off-by: Anusha Srivatsa <asrivats@redhat.com>
> ---
> v2: none.
> ---
>   drivers/gpu/drm/panel/panel-newvision-nv3052c.c | 10 ++++------
>   1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panel/panel-newvision-nv3052c.c b/drivers/gpu/drm/panel/panel-newvision-nv3052c.c
> index 06e16a7c14a756b9a399347b29b410fd5f4ae273..08c99a48e06dc02677c6f0575d344f890871e0af 100644
> --- a/drivers/gpu/drm/panel/panel-newvision-nv3052c.c
> +++ b/drivers/gpu/drm/panel/panel-newvision-nv3052c.c
> @@ -777,9 +777,10 @@ static int nv3052c_probe(struct spi_device *spi)
>   	struct nv3052c *priv;
>   	int err;
>   
> -	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
> -	if (!priv)
> -		return -ENOMEM;
> +	priv = devm_drm_panel_alloc(dev, struct nv3052c, panel, &nv3052c_funcs,
> +				DRM_MODE_CONNECTOR_DPI);

Wrong alignment here

Neil

> +	if (IS_ERR(priv))
> +		return PTR_ERR(priv);
>   
>   	priv->dev = dev;
>   
> @@ -803,9 +804,6 @@ static int nv3052c_probe(struct spi_device *spi)
>   
>   	spi_set_drvdata(spi, priv);
>   
> -	drm_panel_init(&priv->panel, dev, &nv3052c_funcs,
> -		       DRM_MODE_CONNECTOR_DPI);
> -
>   	err = drm_panel_of_backlight(&priv->panel);
>   	if (err)
>   		return dev_err_probe(dev, err, "Failed to attach backlight\n");
>