Skip to contentSkip to conversation

drm/panel: auo-a030jtn01: Fix compilation build

PATCH In review Maxime Ripard 3 participants 7 messages Apr 8, 2025

Subsystems (3)
lore
Share & tools
lore

Maxime Ripard

author maintainer
#0 lore raw

PATCH 1/3 drm/panel: auo-a030jtn01: Fix compilation build

Commit 9d7d7c3c9a19 ("panel/auo-a030jtn01: Use refcounted allocation in place of devm_kzalloc()") switched from a kmalloc + drm_panel_init call to a devm_drm_panel_alloc one.

However, the variable it was storing the allocated pointer in doesn't exist, resulting in a compilation breakage.

Fixes 9d7d7c3c9a19 ("panel/auo-a030jtn01: Use refcounted allocation in place of devm_kzalloc()")
---
 drivers/gpu/drm/panel/panel-auo-a030jtn01.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/panel/panel-auo-a030jtn01.c +4 -4
index 83529b1c2bac..6e52bf6830e1 100644
@@ -198,14 +198,14 @@ static int a030jtn01_probe(struct spi_device *spi)
 	struct a030jtn01 *priv;
 	int err;
 
 	spi->mode |= SPI_MODE_3 | SPI_3WIRE;
 
-	panel = devm_drm_panel_alloc(dev, struct a030jtn01, panel,
-				     &a030jtn01_funcs, DRM_MODE_CONNECTOR_DPI);
-	if (IS_ERR(panel))
-		return PTR_ERR(panel);
+	priv = devm_drm_panel_alloc(dev, struct a030jtn01, panel,
+				    &a030jtn01_funcs, DRM_MODE_CONNECTOR_DPI);
+	if (IS_ERR(priv))
+		return PTR_ERR(priv);
 
 	priv->spi = spi;
 	spi_set_drvdata(spi, priv);
 
 	priv->map = devm_regmap_init_spi(spi, &a030jtn01_regmap_config);
Signature · 1 line
2.49.0
author maintainer
#1 lore raw

PATCH 2/3 drm/panel: boe-th101mb31ig002-28a: Fix compilation build

Commit 77dcbce63779 ("panel/th101mb31ig002-28a: Use refcounted allocation in place of devm_kzalloc()") switched from a kmalloc + drm_panel_init call to a devm_drm_panel_alloc one.

However, the variable it was storing the allocated pointer in doesn't exist, resulting in a compilation breakage.

Fixes 77dcbce63779 ("panel/th101mb31ig002-28a: Use refcounted allocation in place of devm_kzalloc()")
---
 drivers/gpu/drm/panel/panel-boe-th101mb31ig002-28a.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/panel/panel-boe-th101mb31ig002-28a.c +5 -5
index 7ae196424b6d..f33d4f855929 100644
@@ -347,15 +347,15 @@ static int boe_th101mb31ig002_dsi_probe(struct mipi_dsi_device *dsi)
 {
 	struct boe_th101mb31ig002 *ctx;
 	const struct panel_desc *desc;
 	int ret;
 
-	panel = devm_drm_panel_alloc(dev, struct panel_desc, panel,
-				     &boe_th101mb31ig002_funcs,
-				     DRM_MODE_CONNECTOR_DSI);
-	if (IS_ERR(panel))
-		return PTR_ERR(panel);
+	ctx = devm_drm_panel_alloc(&dsi->dev, struct boe_th101mb31ig002, panel,
+				   &boe_th101mb31ig002_funcs,
+				   DRM_MODE_CONNECTOR_DSI);
+	if (IS_ERR(ctx))
+		return PTR_ERR(ctx);
 
 	mipi_dsi_set_drvdata(dsi, ctx);
 	ctx->dsi = dsi;
 
 	desc = of_device_get_match_data(&dsi->dev);
Signature · 1 line
2.49.0
author maintainer
#2 lore raw

PATCH 3/3 drm/panel: boe-tv101wum-ll2: Fix compilation build

In reply to Maxime Ripard

Commit 5d2b55e55e61 ("panel/boe-tv101wum-ll2: Use refcounted allocation in place of devm_kzalloc()") switched from a kmalloc + drm_panel_init call to a devm_drm_panel_alloc one.

However, the variable it was storing the allocated pointer in doesn't exist, resulting in a compilation breakage.

Fixes 5d2b55e55e61 ("panel/boe-tv101wum-ll2: Use refcounted allocation in place of devm_kzalloc()")
---
 drivers/gpu/drm/panel/panel-boe-tv101wum-ll2.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/panel/panel-boe-tv101wum-ll2.c +3 -3
index 04c7890cc51d..20b6e11a7d84 100644
@@ -166,13 +166,13 @@ static int boe_tv101wum_ll2_probe(struct mipi_dsi_device *dsi)
 	struct boe_tv101wum_ll2 *ctx;
 	int ret;
 
 	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);
+				   DRM_MODE_CONNECTOR_DSI);
+	if (IS_ERR(ctx))
+		return PTR_ERR(ctx);
 
 	ret = devm_regulator_bulk_get_const(&dsi->dev,
 					ARRAY_SIZE(boe_tv101wum_ll2_supplies),
 					boe_tv101wum_ll2_supplies,
 					&ctx->supplies);
Signature · 1 line
2.49.0
maintainer Reviewed-by Tested-by on v1 1/3
#3 lore raw
In reply to Maxime Ripard

Hi Maxime

thanks for the fixes

Am 08.04.25 um 14:20 schrieb Maxime Ripard:

Quoted 9 lines

Commit 9d7d7c3c9a19 ("panel/auo-a030jtn01: Use refcounted allocation in place of devm_kzalloc()") switched from a kmalloc + drm_panel_init call to a devm_drm_panel_alloc one.

However, the variable it was storing the allocated pointer in doesn't exist, resulting in a compilation breakage.

Fixes 9d7d7c3c9a19 ("panel/auo-a030jtn01: Use refcounted allocation in place of devm_kzalloc()")

On this series

And as far as the build error is concerned:

Best regards
Thomas

Quoted 27 lines
---
  drivers/gpu/drm/panel/panel-auo-a030jtn01.c | 8 ++++----
  1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/panel/panel-auo-a030jtn01.c +4 -4
index 83529b1c2bac..6e52bf6830e1 100644
@@ -198,14 +198,14 @@ static int a030jtn01_probe(struct spi_device *spi)
  	struct a030jtn01 *priv;
  	int err;
 
  	spi->mode |= SPI_MODE_3 | SPI_3WIRE;
 
-	panel = devm_drm_panel_alloc(dev, struct a030jtn01, panel,
-				     &a030jtn01_funcs, DRM_MODE_CONNECTOR_DPI);
-	if (IS_ERR(panel))
-		return PTR_ERR(panel);
+	priv = devm_drm_panel_alloc(dev, struct a030jtn01, panel,
+				    &a030jtn01_funcs, DRM_MODE_CONNECTOR_DPI);
+	if (IS_ERR(priv))
+		return PTR_ERR(priv);
 
  	priv->spi = spi;
  	spi_set_drvdata(spi, priv);
 
  	priv->map = devm_regmap_init_spi(spi, &a030jtn01_regmap_config);
Signature · 7 lines
--
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)
#4 lore raw
In reply to Maxime Ripard
Quoted 9 lines · Maxime Ripard

Commit 9d7d7c3c9a19 ("panel/auo-a030jtn01: Use refcounted allocation in place of devm_kzalloc()") switched from a kmalloc + drm_panel_init call to a devm_drm_panel_alloc one.

However, the variable it was storing the allocated pointer in doesn't exist, resulting in a compilation breakage.

Fixes 9d7d7c3c9a19 ("panel/auo-a030jtn01: Use refcounted allocation in place of devm_kzalloc()")

I still get a failure in modpost:

ERROR: modpost: "__devm_drm_panel_alloc" [drivers/gpu/drm/panel/panel-auo-a030jtn01.ko] undefined!

because that entire block is:

	#ifdef CONFIG_OF

Based on the header, I think the intention wasn't to add those functions there, right? Moving it outside the ifdef at least fixes the build for me.

Lucas De Marchi

-------8<------------
Subject: [PATCH] drm/panel: Fix build error on !CONFIG_OF

Move helpers outside of CONFIG_OF, so basic allocation also works without it.

Fixes ed9c594d495d ("drm/panel: Add new helpers for refcounted panel allocatons")
Fixes dcba396f6907 ("drm/panel: Add refcount support")
---
 drivers/gpu/drm/drm_panel.c | 76 ++++++++++++++++++-------------------
 1 file changed, 38 insertions(+), 38 deletions(-)
drivers/gpu/drm/drm_panel.c +38 -38
index 870bf8d471ee9..99b348782ce31 100644
@@ -318,44 +318,6 @@ int drm_panel_get_modes(struct drm_panel *panel,
 }
 EXPORT_SYMBOL(drm_panel_get_modes);
 
-#ifdef CONFIG_OF
-/**
- * of_drm_find_panel - look up a panel using a device tree node
- * @np: device tree node of the panel
- *
- * Searches the set of registered panels for one that matches the given device
- * tree node. If a matching panel is found, return a pointer to it.
- *
- * Return: A pointer to the panel registered for the specified device tree
- * node or an ERR_PTR() if no panel matching the device tree node can be found.
- *
- * Possible error codes returned by this function:
- *
- * - EPROBE_DEFER: the panel device has not been probed yet, and the caller
- *   should retry later
- * - ENODEV: the device is not available (status != "okay" or "ok")
- */
-struct drm_panel *of_drm_find_panel(const struct device_node *np)
-{
-	struct drm_panel *panel;
-
-	if (!of_device_is_available(np))
-		return ERR_PTR(-ENODEV);
-
-	mutex_lock(&panel_lock);
-
-	list_for_each_entry(panel, &panel_list, list) {
-		if (panel->dev->of_node == np) {
-			mutex_unlock(&panel_lock);
-			return panel;
-		}
-	}
-
-	mutex_unlock(&panel_lock);
-	return ERR_PTR(-EPROBE_DEFER);
-}
-EXPORT_SYMBOL(of_drm_find_panel);
-
 static void __drm_panel_free(struct kref *kref)
 {
 	struct drm_panel *panel = container_of(kref, struct drm_panel, refcount);
@@ -443,6 +405,44 @@ void *__devm_drm_panel_alloc(struct device *dev, size_t size, size_t offset,
 }
 EXPORT_SYMBOL(__devm_drm_panel_alloc);
 
+#ifdef CONFIG_OF
+/**
+ * of_drm_find_panel - look up a panel using a device tree node
+ * @np: device tree node of the panel
+ *
+ * Searches the set of registered panels for one that matches the given device
+ * tree node. If a matching panel is found, return a pointer to it.
+ *
+ * Return: A pointer to the panel registered for the specified device tree
+ * node or an ERR_PTR() if no panel matching the device tree node can be found.
+ *
+ * Possible error codes returned by this function:
+ *
+ * - EPROBE_DEFER: the panel device has not been probed yet, and the caller
+ *   should retry later
+ * - ENODEV: the device is not available (status != "okay" or "ok")
+ */
+struct drm_panel *of_drm_find_panel(const struct device_node *np)
+{
+	struct drm_panel *panel;
+
+	if (!of_device_is_available(np))
+		return ERR_PTR(-ENODEV);
+
+	mutex_lock(&panel_lock);
+
+	list_for_each_entry(panel, &panel_list, list) {
+		if (panel->dev->of_node == np) {
+			mutex_unlock(&panel_lock);
+			return panel;
+		}
+	}
+
+	mutex_unlock(&panel_lock);
+	return ERR_PTR(-EPROBE_DEFER);
+}
+EXPORT_SYMBOL(of_drm_find_panel);
+
 /**
  * of_drm_get_panel_orientation - look up the orientation of the panel through
  * the "rotation" binding from a device tree node
Signature · 1 line
2.49.0
author maintainer Reviewed-by
#5 lore raw

Hi Lucas,

Quoted 120 lines · Lucas De Marchi
Quoted 9 lines · Maxime Ripard

Commit 9d7d7c3c9a19 ("panel/auo-a030jtn01: Use refcounted allocation in place of devm_kzalloc()") switched from a kmalloc + drm_panel_init call to a devm_drm_panel_alloc one.

However, the variable it was storing the allocated pointer in doesn't exist, resulting in a compilation breakage.

Fixes 9d7d7c3c9a19 ("panel/auo-a030jtn01: Use refcounted allocation in place of devm_kzalloc()")

I still get a failure in modpost:

ERROR: modpost: "__devm_drm_panel_alloc" [drivers/gpu/drm/panel/panel-auo-a030jtn01.ko] undefined!

because that entire block is:

	#ifdef CONFIG_OF

Based on the header, I think the intention wasn't to add those functions there, right? Moving it outside the ifdef at least fixes the build for me.

Lucas De Marchi

-------8<------------
Subject: [PATCH] drm/panel: Fix build error on !CONFIG_OF

Move helpers outside of CONFIG_OF, so basic allocation also works without it.

Fixes ed9c594d495d ("drm/panel: Add new helpers for refcounted panel allocatons")
Fixes dcba396f6907 ("drm/panel: Add refcount support")
---
 drivers/gpu/drm/drm_panel.c | 76 ++++++++++++++++++-------------------
 1 file changed, 38 insertions(+), 38 deletions(-)
drivers/gpu/drm/drm_panel.c +31 -38
index 870bf8d471ee9..99b348782ce31 100644
@@ -318,44 +318,6 @@ int drm_panel_get_modes(struct drm_panel *panel,
 }
 EXPORT_SYMBOL(drm_panel_get_modes);
-#ifdef CONFIG_OF
-/**
- * of_drm_find_panel - look up a panel using a device tree node
- * @np: device tree node of the panel
- *
- * Searches the set of registered panels for one that matches the given device
- * tree node. If a matching panel is found, return a pointer to it.
- *
- * Return: A pointer to the panel registered for the specified device tree
- * node or an ERR_PTR() if no panel matching the device tree node can be found.
- *
- * Possible error codes returned by this function:
- *
- * - EPROBE_DEFER: the panel device has not been probed yet, and the caller
- *   should retry later
- * - ENODEV: the device is not available (status != "okay" or "ok")
- */
-struct drm_panel *of_drm_find_panel(const struct device_node *np)
-{
-	struct drm_panel *panel;
-
-	if (!of_device_is_available(np))
-		return ERR_PTR(-ENODEV);
-
-	mutex_lock(&panel_lock);
-
-	list_for_each_entry(panel, &panel_list, list) {
-		if (panel->dev->of_node == np) {
-			mutex_unlock(&panel_lock);
-			return panel;
-		}
-	}
-
-	mutex_unlock(&panel_lock);
-	return ERR_PTR(-EPROBE_DEFER);
-}
-EXPORT_SYMBOL(of_drm_find_panel);
-
 static void __drm_panel_free(struct kref *kref)
 {
 	struct drm_panel *panel = container_of(kref, struct drm_panel, refcount);
@@ -443,6 +405,44 @@ void *__devm_drm_panel_alloc(struct device *dev, size_t size, size_t offset,
 }
 EXPORT_SYMBOL(__devm_drm_panel_alloc);
+#ifdef CONFIG_OF
+/**
+ * of_drm_find_panel - look up a panel using a device tree node
+ * @np: device tree node of the panel
+ *
+ * Searches the set of registered panels for one that matches the given device
+ * tree node. If a matching panel is found, return a pointer to it.
+ *
+ * Return: A pointer to the panel registered for the specified device tree
+ * node or an ERR_PTR() if no panel matching the device tree node can be found.
+ *
+ * Possible error codes returned by this function:
+ *
+ * - EPROBE_DEFER: the panel device has not been probed yet, and the caller
+ *   should retry later
+ * - ENODEV: the device is not available (status != "okay" or "ok")
+ */
+struct drm_panel *of_drm_find_panel(const struct device_node *np)
+{
+	struct drm_panel *panel;
+
+	if (!of_device_is_available(np))
+		return ERR_PTR(-ENODEV);
+
+	mutex_lock(&panel_lock);
+
+	list_for_each_entry(panel, &panel_list, list) {
+		if (panel->dev->of_node == np) {
+			mutex_unlock(&panel_lock);
+			return panel;
+		}

drivers/gpu/drm/drm_panel.c void *__devm_drm_panel_alloc(struct device *dev, size_t size, size_t offset, · line 447

Quoted 10 lines
drivers/gpu/drm/drm_panel.c +7 -0
+	}
+
+	mutex_unlock(&panel_lock);
+	return ERR_PTR(-EPROBE_DEFER);
+}
+EXPORT_SYMBOL(of_drm_find_panel);
+
 /**
  * of_drm_get_panel_orientation - look up the orientation of the panel through
  * the "rotation" binding from a device tree node

It's a bit hard to read with that change log, but assuming this doesn't change of_drm_find_panel,

Maxime

#6 lore raw
Quoted 137 lines · Maxime Ripard

Hi Lucas,

Quoted 120 lines · Lucas De Marchi
Quoted 9 lines · Maxime Ripard

Commit 9d7d7c3c9a19 ("panel/auo-a030jtn01: Use refcounted allocation in place of devm_kzalloc()") switched from a kmalloc + drm_panel_init call to a devm_drm_panel_alloc one.

However, the variable it was storing the allocated pointer in doesn't exist, resulting in a compilation breakage.

Fixes 9d7d7c3c9a19 ("panel/auo-a030jtn01: Use refcounted allocation in place of devm_kzalloc()")

I still get a failure in modpost:

ERROR: modpost: "__devm_drm_panel_alloc" [drivers/gpu/drm/panel/panel-auo-a030jtn01.ko] undefined!

because that entire block is:

	#ifdef CONFIG_OF

Based on the header, I think the intention wasn't to add those functions there, right? Moving it outside the ifdef at least fixes the build for me.

Lucas De Marchi

-------8<------------
Subject: [PATCH] drm/panel: Fix build error on !CONFIG_OF

Move helpers outside of CONFIG_OF, so basic allocation also works without it.

Fixes ed9c594d495d ("drm/panel: Add new helpers for refcounted panel allocatons")
Fixes dcba396f6907 ("drm/panel: Add refcount support")
---
 drivers/gpu/drm/drm_panel.c | 76 ++++++++++++++++++-------------------
 1 file changed, 38 insertions(+), 38 deletions(-)
drivers/gpu/drm/drm_panel.c +31 -38
index 870bf8d471ee9..99b348782ce31 100644
@@ -318,44 +318,6 @@ int drm_panel_get_modes(struct drm_panel *panel,
 }
 EXPORT_SYMBOL(drm_panel_get_modes);
-#ifdef CONFIG_OF
-/**
- * of_drm_find_panel - look up a panel using a device tree node
- * @np: device tree node of the panel
- *
- * Searches the set of registered panels for one that matches the given device
- * tree node. If a matching panel is found, return a pointer to it.
- *
- * Return: A pointer to the panel registered for the specified device tree
- * node or an ERR_PTR() if no panel matching the device tree node can be found.
- *
- * Possible error codes returned by this function:
- *
- * - EPROBE_DEFER: the panel device has not been probed yet, and the caller
- *   should retry later
- * - ENODEV: the device is not available (status != "okay" or "ok")
- */
-struct drm_panel *of_drm_find_panel(const struct device_node *np)
-{
-	struct drm_panel *panel;
-
-	if (!of_device_is_available(np))
-		return ERR_PTR(-ENODEV);
-
-	mutex_lock(&panel_lock);
-
-	list_for_each_entry(panel, &panel_list, list) {
-		if (panel->dev->of_node == np) {
-			mutex_unlock(&panel_lock);
-			return panel;
-		}
-	}
-
-	mutex_unlock(&panel_lock);
-	return ERR_PTR(-EPROBE_DEFER);
-}
-EXPORT_SYMBOL(of_drm_find_panel);
-
 static void __drm_panel_free(struct kref *kref)
 {
 	struct drm_panel *panel = container_of(kref, struct drm_panel, refcount);
@@ -443,6 +405,44 @@ void *__devm_drm_panel_alloc(struct device *dev, size_t size, size_t offset,
 }
 EXPORT_SYMBOL(__devm_drm_panel_alloc);
+#ifdef CONFIG_OF
+/**
+ * of_drm_find_panel - look up a panel using a device tree node
+ * @np: device tree node of the panel
+ *
+ * Searches the set of registered panels for one that matches the given device
+ * tree node. If a matching panel is found, return a pointer to it.
+ *
+ * Return: A pointer to the panel registered for the specified device tree
+ * node or an ERR_PTR() if no panel matching the device tree node can be found.
+ *
+ * Possible error codes returned by this function:
+ *
+ * - EPROBE_DEFER: the panel device has not been probed yet, and the caller
+ *   should retry later
+ * - ENODEV: the device is not available (status != "okay" or "ok")
+ */
+struct drm_panel *of_drm_find_panel(const struct device_node *np)
+{
+	struct drm_panel *panel;
+
+	if (!of_device_is_available(np))
+		return ERR_PTR(-ENODEV);
+
+	mutex_lock(&panel_lock);
+
+	list_for_each_entry(panel, &panel_list, list) {
+		if (panel->dev->of_node == np) {
+			mutex_unlock(&panel_lock);
+			return panel;
+		}

drivers/gpu/drm/drm_panel.c void *__devm_drm_panel_alloc(struct device *dev, size_t size, size_t offset, · line 447

Quoted 10 lines
drivers/gpu/drm/drm_panel.c +7 -0
+	}
+
+	mutex_unlock(&panel_lock);
+	return ERR_PTR(-EPROBE_DEFER);
+}
+EXPORT_SYMBOL(of_drm_find_panel);
+
 /**
  * of_drm_get_panel_orientation - look up the orientation of the panel through
  * the "rotation" binding from a device tree node

It's a bit hard to read with that change log, but assuming this doesn't change of_drm_find_panel,

Quoted 1 line

unfortunately in plain text we don't have the equivalent of git show --color-moved. I confirmed here it's only moving code outside the ifdef so the only functions inside it are the of_* ones. I will push them to drm-misc-next soon

thanks
Lucas De Marchi

Quoted 2 lines

Maxime