diff mbox series

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

Message ID 20250408122008.1676235-1-mripard@kernel.org (mailing list archive)
State New, archived
Headers show
Series [1/3] drm/panel: auo-a030jtn01: Fix compilation build | expand

Commit Message

Maxime Ripard April 8, 2025, 12:20 p.m. UTC
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()")
Signed-off-by: Maxime Ripard <mripard@kernel.org>
---
 drivers/gpu/drm/panel/panel-auo-a030jtn01.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Thomas Zimmermann April 8, 2025, 1:20 p.m. UTC | #1
Hi Maxime

thanks for the fixes

Am 08.04.25 um 14:20 schrieb 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()")
> Signed-off-by: Maxime Ripard <mripard@kernel.org>

On this series

Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>

And as far as the build error is concerned:

Tested-by: Thomas Zimmermann <tzimmermann@suse.de>

Best regards
Thomas



> ---
>   drivers/gpu/drm/panel/panel-auo-a030jtn01.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/panel/panel-auo-a030jtn01.c b/drivers/gpu/drm/panel/panel-auo-a030jtn01.c
> index 83529b1c2bac..6e52bf6830e1 100644
> --- a/drivers/gpu/drm/panel/panel-auo-a030jtn01.c
> +++ b/drivers/gpu/drm/panel/panel-auo-a030jtn01.c
> @@ -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);
Lucas De Marchi April 8, 2025, 2:34 p.m. UTC | #2
On Tue, Apr 08, 2025 at 02:20:06PM +0200, Maxime Ripard wrote:
>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()")
>Signed-off-by: Maxime Ripard <mripard@kernel.org>

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")
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
  drivers/gpu/drm/drm_panel.c | 76 ++++++++++++++++++-------------------
  1 file changed, 38 insertions(+), 38 deletions(-)

diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
index 870bf8d471ee9..99b348782ce31 100644
--- a/drivers/gpu/drm/drm_panel.c
+++ b/drivers/gpu/drm/drm_panel.c
@@ -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
Maxime Ripard April 8, 2025, 2:57 p.m. UTC | #3
Hi Lucas,

On Tue, Apr 08, 2025 at 09:34:22AM -0500, Lucas De Marchi wrote:
> On Tue, Apr 08, 2025 at 02:20:06PM +0200, Maxime Ripard wrote:
> > 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()")
> > Signed-off-by: Maxime Ripard <mripard@kernel.org>
> 
> 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")
> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
> ---
>  drivers/gpu/drm/drm_panel.c | 76 ++++++++++++++++++-------------------
>  1 file changed, 38 insertions(+), 38 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
> index 870bf8d471ee9..99b348782ce31 100644
> --- a/drivers/gpu/drm/drm_panel.c
> +++ b/drivers/gpu/drm/drm_panel.c
> @@ -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

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

Reviewed-by: Maxime Ripard <mripard@kernel.org>

Maxime
Lucas De Marchi April 8, 2025, 3:21 p.m. UTC | #4
On Tue, Apr 08, 2025 at 04:57:44PM +0200, Maxime Ripard wrote:
>Hi Lucas,
>
>On Tue, Apr 08, 2025 at 09:34:22AM -0500, Lucas De Marchi wrote:
>> On Tue, Apr 08, 2025 at 02:20:06PM +0200, Maxime Ripard wrote:
>> > 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()")
>> > Signed-off-by: Maxime Ripard <mripard@kernel.org>
>>
>> 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")
>> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
>> ---
>>  drivers/gpu/drm/drm_panel.c | 76 ++++++++++++++++++-------------------
>>  1 file changed, 38 insertions(+), 38 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
>> index 870bf8d471ee9..99b348782ce31 100644
>> --- a/drivers/gpu/drm/drm_panel.c
>> +++ b/drivers/gpu/drm/drm_panel.c
>> @@ -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
>
>It's a bit hard to read with that change log, but assuming this doesn't
>change of_drm_find_panel,
>
>Reviewed-by: Maxime Ripard <mripard@kernel.org>

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

>
>Maxime
diff mbox series

Patch

diff --git a/drivers/gpu/drm/panel/panel-auo-a030jtn01.c b/drivers/gpu/drm/panel/panel-auo-a030jtn01.c
index 83529b1c2bac..6e52bf6830e1 100644
--- a/drivers/gpu/drm/panel/panel-auo-a030jtn01.c
+++ b/drivers/gpu/drm/panel/panel-auo-a030jtn01.c
@@ -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);