All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/2] drm/ingenic: Fix leak of device_node pointer
@ 2020-08-27 11:44 ` Paul Cercueil
  0 siblings, 0 replies; 14+ messages in thread
From: Paul Cercueil @ 2020-08-27 11:44 UTC (permalink / raw)
  To: David Airlie, Daniel Vetter
  Cc: Sam Ravnborg, dri-devel, linux-kernel, od, Paul Cercueil

of_graph_get_remote_node() requires of_node_put() to be called on the
device_node pointer when it's no more in use.

Fixes: fc1acf317b01 ("drm/ingenic: Add support for the IPU")
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
index ada990a7f911..c1bcb93aed2d 100644
--- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
+++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
@@ -978,6 +978,7 @@ static int ingenic_drm_probe(struct platform_device *pdev)
 	}
 
 	drm_of_component_match_add(dev, &match, compare_of, np);
+	of_node_put(np);
 
 	return component_master_add_with_match(dev, &ingenic_master_ops, match);
 }
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v2 1/2] drm/ingenic: Fix leak of device_node pointer
@ 2020-08-27 11:44 ` Paul Cercueil
  0 siblings, 0 replies; 14+ messages in thread
From: Paul Cercueil @ 2020-08-27 11:44 UTC (permalink / raw)
  To: David Airlie, Daniel Vetter
  Cc: Paul Cercueil, od, Sam Ravnborg, linux-kernel, dri-devel

of_graph_get_remote_node() requires of_node_put() to be called on the
device_node pointer when it's no more in use.

Fixes: fc1acf317b01 ("drm/ingenic: Add support for the IPU")
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
index ada990a7f911..c1bcb93aed2d 100644
--- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
+++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
@@ -978,6 +978,7 @@ static int ingenic_drm_probe(struct platform_device *pdev)
 	}
 
 	drm_of_component_match_add(dev, &match, compare_of, np);
+	of_node_put(np);
 
 	return component_master_add_with_match(dev, &ingenic_master_ops, match);
 }
-- 
2.28.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v2 2/2] drm/ingenic: Fix driver not probing when IPU port is missing
  2020-08-27 11:44 ` Paul Cercueil
@ 2020-08-27 11:44   ` Paul Cercueil
  -1 siblings, 0 replies; 14+ messages in thread
From: Paul Cercueil @ 2020-08-27 11:44 UTC (permalink / raw)
  To: David Airlie, Daniel Vetter
  Cc: Sam Ravnborg, dri-devel, linux-kernel, od, Paul Cercueil

Even if support for the IPU was compiled in, we may run on a device
(e.g. the Qi LB60) where the IPU is not available, or simply with an old
devicetree without the IPU node. In that case the ingenic-drm refused to
probe.

Fix the driver so that it will probe even if the IPU node is not present
in devicetree (but then IPU support is disabled of course).

v2: Take a different approach

Fixes: fc1acf317b01 ("drm/ingenic: Add support for the IPU")
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
index c1bcb93aed2d..b7074161ccf0 100644
--- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
+++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
@@ -673,7 +673,7 @@ static void ingenic_drm_unbind_all(void *d)
 	component_unbind_all(priv->dev, &priv->drm);
 }
 
-static int ingenic_drm_bind(struct device *dev)
+static int ingenic_drm_bind(struct device *dev, bool has_components)
 {
 	struct platform_device *pdev = to_platform_device(dev);
 	const struct jz_soc_info *soc_info;
@@ -808,7 +808,7 @@ static int ingenic_drm_bind(struct device *dev)
 			return ret;
 		}
 
-		if (IS_ENABLED(CONFIG_DRM_INGENIC_IPU)) {
+		if (IS_ENABLED(CONFIG_DRM_INGENIC_IPU) && has_components) {
 			ret = component_bind_all(dev, drm);
 			if (ret) {
 				if (ret != -EPROBE_DEFER)
@@ -939,6 +939,11 @@ static int ingenic_drm_bind(struct device *dev)
 	return ret;
 }
 
+static int ingenic_drm_bind_with_components(struct device *dev)
+{
+	return ingenic_drm_bind(dev, true);
+}
+
 static int compare_of(struct device *dev, void *data)
 {
 	return dev->of_node == data;
@@ -957,7 +962,7 @@ static void ingenic_drm_unbind(struct device *dev)
 }
 
 static const struct component_master_ops ingenic_master_ops = {
-	.bind = ingenic_drm_bind,
+	.bind = ingenic_drm_bind_with_components,
 	.unbind = ingenic_drm_unbind,
 };
 
@@ -968,14 +973,12 @@ static int ingenic_drm_probe(struct platform_device *pdev)
 	struct device_node *np;
 
 	if (!IS_ENABLED(CONFIG_DRM_INGENIC_IPU))
-		return ingenic_drm_bind(dev);
+		return ingenic_drm_bind(dev, false);
 
 	/* IPU is at port address 8 */
 	np = of_graph_get_remote_node(dev->of_node, 8, 0);
-	if (!np) {
-		dev_err(dev, "Unable to get IPU node\n");
-		return -EINVAL;
-	}
+	if (!np)
+		return ingenic_drm_bind(dev, false);
 
 	drm_of_component_match_add(dev, &match, compare_of, np);
 	of_node_put(np);
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v2 2/2] drm/ingenic: Fix driver not probing when IPU port is missing
@ 2020-08-27 11:44   ` Paul Cercueil
  0 siblings, 0 replies; 14+ messages in thread
From: Paul Cercueil @ 2020-08-27 11:44 UTC (permalink / raw)
  To: David Airlie, Daniel Vetter
  Cc: Paul Cercueil, od, Sam Ravnborg, linux-kernel, dri-devel

Even if support for the IPU was compiled in, we may run on a device
(e.g. the Qi LB60) where the IPU is not available, or simply with an old
devicetree without the IPU node. In that case the ingenic-drm refused to
probe.

Fix the driver so that it will probe even if the IPU node is not present
in devicetree (but then IPU support is disabled of course).

v2: Take a different approach

Fixes: fc1acf317b01 ("drm/ingenic: Add support for the IPU")
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
index c1bcb93aed2d..b7074161ccf0 100644
--- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
+++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
@@ -673,7 +673,7 @@ static void ingenic_drm_unbind_all(void *d)
 	component_unbind_all(priv->dev, &priv->drm);
 }
 
-static int ingenic_drm_bind(struct device *dev)
+static int ingenic_drm_bind(struct device *dev, bool has_components)
 {
 	struct platform_device *pdev = to_platform_device(dev);
 	const struct jz_soc_info *soc_info;
@@ -808,7 +808,7 @@ static int ingenic_drm_bind(struct device *dev)
 			return ret;
 		}
 
-		if (IS_ENABLED(CONFIG_DRM_INGENIC_IPU)) {
+		if (IS_ENABLED(CONFIG_DRM_INGENIC_IPU) && has_components) {
 			ret = component_bind_all(dev, drm);
 			if (ret) {
 				if (ret != -EPROBE_DEFER)
@@ -939,6 +939,11 @@ static int ingenic_drm_bind(struct device *dev)
 	return ret;
 }
 
+static int ingenic_drm_bind_with_components(struct device *dev)
+{
+	return ingenic_drm_bind(dev, true);
+}
+
 static int compare_of(struct device *dev, void *data)
 {
 	return dev->of_node == data;
@@ -957,7 +962,7 @@ static void ingenic_drm_unbind(struct device *dev)
 }
 
 static const struct component_master_ops ingenic_master_ops = {
-	.bind = ingenic_drm_bind,
+	.bind = ingenic_drm_bind_with_components,
 	.unbind = ingenic_drm_unbind,
 };
 
@@ -968,14 +973,12 @@ static int ingenic_drm_probe(struct platform_device *pdev)
 	struct device_node *np;
 
 	if (!IS_ENABLED(CONFIG_DRM_INGENIC_IPU))
-		return ingenic_drm_bind(dev);
+		return ingenic_drm_bind(dev, false);
 
 	/* IPU is at port address 8 */
 	np = of_graph_get_remote_node(dev->of_node, 8, 0);
-	if (!np) {
-		dev_err(dev, "Unable to get IPU node\n");
-		return -EINVAL;
-	}
+	if (!np)
+		return ingenic_drm_bind(dev, false);
 
 	drm_of_component_match_add(dev, &match, compare_of, np);
 	of_node_put(np);
-- 
2.28.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH v2 1/2] drm/ingenic: Fix leak of device_node pointer
  2020-08-27 11:44 ` Paul Cercueil
@ 2020-08-29 21:07   ` Sam Ravnborg
  -1 siblings, 0 replies; 14+ messages in thread
From: Sam Ravnborg @ 2020-08-29 21:07 UTC (permalink / raw)
  To: Paul Cercueil; +Cc: David Airlie, Daniel Vetter, dri-devel, linux-kernel, od

On Thu, Aug 27, 2020 at 01:44:03PM +0200, Paul Cercueil wrote:
> of_graph_get_remote_node() requires of_node_put() to be called on the
> device_node pointer when it's no more in use.
> 
> Fixes: fc1acf317b01 ("drm/ingenic: Add support for the IPU")
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
> ---
>  drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> index ada990a7f911..c1bcb93aed2d 100644
> --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> @@ -978,6 +978,7 @@ static int ingenic_drm_probe(struct platform_device *pdev)
>  	}
>  
>  	drm_of_component_match_add(dev, &match, compare_of, np);
> +	of_node_put(np);
>  
>  	return component_master_add_with_match(dev, &ingenic_master_ops, match);
>  }
> -- 
> 2.28.0

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2 1/2] drm/ingenic: Fix leak of device_node pointer
@ 2020-08-29 21:07   ` Sam Ravnborg
  0 siblings, 0 replies; 14+ messages in thread
From: Sam Ravnborg @ 2020-08-29 21:07 UTC (permalink / raw)
  To: Paul Cercueil; +Cc: David Airlie, od, dri-devel, linux-kernel

On Thu, Aug 27, 2020 at 01:44:03PM +0200, Paul Cercueil wrote:
> of_graph_get_remote_node() requires of_node_put() to be called on the
> device_node pointer when it's no more in use.
> 
> Fixes: fc1acf317b01 ("drm/ingenic: Add support for the IPU")
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
> ---
>  drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> index ada990a7f911..c1bcb93aed2d 100644
> --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> @@ -978,6 +978,7 @@ static int ingenic_drm_probe(struct platform_device *pdev)
>  	}
>  
>  	drm_of_component_match_add(dev, &match, compare_of, np);
> +	of_node_put(np);
>  
>  	return component_master_add_with_match(dev, &ingenic_master_ops, match);
>  }
> -- 
> 2.28.0
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2 2/2] drm/ingenic: Fix driver not probing when IPU port is missing
  2020-08-27 11:44   ` Paul Cercueil
@ 2020-08-29 21:08     ` Sam Ravnborg
  -1 siblings, 0 replies; 14+ messages in thread
From: Sam Ravnborg @ 2020-08-29 21:08 UTC (permalink / raw)
  To: Paul Cercueil; +Cc: David Airlie, Daniel Vetter, dri-devel, linux-kernel, od

On Thu, Aug 27, 2020 at 01:44:04PM +0200, Paul Cercueil wrote:
> Even if support for the IPU was compiled in, we may run on a device
> (e.g. the Qi LB60) where the IPU is not available, or simply with an old
> devicetree without the IPU node. In that case the ingenic-drm refused to
> probe.
> 
> Fix the driver so that it will probe even if the IPU node is not present
> in devicetree (but then IPU support is disabled of course).
> 
> v2: Take a different approach
> 
> Fixes: fc1acf317b01 ("drm/ingenic: Add support for the IPU")
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
> ---
>  drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 19 +++++++++++--------
>  1 file changed, 11 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> index c1bcb93aed2d..b7074161ccf0 100644
> --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> @@ -673,7 +673,7 @@ static void ingenic_drm_unbind_all(void *d)
>  	component_unbind_all(priv->dev, &priv->drm);
>  }
>  
> -static int ingenic_drm_bind(struct device *dev)
> +static int ingenic_drm_bind(struct device *dev, bool has_components)
>  {
>  	struct platform_device *pdev = to_platform_device(dev);
>  	const struct jz_soc_info *soc_info;
> @@ -808,7 +808,7 @@ static int ingenic_drm_bind(struct device *dev)
>  			return ret;
>  		}
>  
> -		if (IS_ENABLED(CONFIG_DRM_INGENIC_IPU)) {
> +		if (IS_ENABLED(CONFIG_DRM_INGENIC_IPU) && has_components) {
>  			ret = component_bind_all(dev, drm);
>  			if (ret) {
>  				if (ret != -EPROBE_DEFER)
> @@ -939,6 +939,11 @@ static int ingenic_drm_bind(struct device *dev)
>  	return ret;
>  }
>  
> +static int ingenic_drm_bind_with_components(struct device *dev)
> +{
> +	return ingenic_drm_bind(dev, true);
> +}
> +
>  static int compare_of(struct device *dev, void *data)
>  {
>  	return dev->of_node == data;
> @@ -957,7 +962,7 @@ static void ingenic_drm_unbind(struct device *dev)
>  }
>  
>  static const struct component_master_ops ingenic_master_ops = {
> -	.bind = ingenic_drm_bind,
> +	.bind = ingenic_drm_bind_with_components,
>  	.unbind = ingenic_drm_unbind,
>  };
>  
> @@ -968,14 +973,12 @@ static int ingenic_drm_probe(struct platform_device *pdev)
>  	struct device_node *np;
>  
>  	if (!IS_ENABLED(CONFIG_DRM_INGENIC_IPU))
> -		return ingenic_drm_bind(dev);
> +		return ingenic_drm_bind(dev, false);
>  
>  	/* IPU is at port address 8 */
>  	np = of_graph_get_remote_node(dev->of_node, 8, 0);
> -	if (!np) {
> -		dev_err(dev, "Unable to get IPU node\n");
> -		return -EINVAL;
> -	}
> +	if (!np)
> +		return ingenic_drm_bind(dev, false);
>  
>  	drm_of_component_match_add(dev, &match, compare_of, np);
>  	of_node_put(np);
> -- 
> 2.28.0

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2 2/2] drm/ingenic: Fix driver not probing when IPU port is missing
@ 2020-08-29 21:08     ` Sam Ravnborg
  0 siblings, 0 replies; 14+ messages in thread
From: Sam Ravnborg @ 2020-08-29 21:08 UTC (permalink / raw)
  To: Paul Cercueil; +Cc: David Airlie, od, dri-devel, linux-kernel

On Thu, Aug 27, 2020 at 01:44:04PM +0200, Paul Cercueil wrote:
> Even if support for the IPU was compiled in, we may run on a device
> (e.g. the Qi LB60) where the IPU is not available, or simply with an old
> devicetree without the IPU node. In that case the ingenic-drm refused to
> probe.
> 
> Fix the driver so that it will probe even if the IPU node is not present
> in devicetree (but then IPU support is disabled of course).
> 
> v2: Take a different approach
> 
> Fixes: fc1acf317b01 ("drm/ingenic: Add support for the IPU")
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
> ---
>  drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 19 +++++++++++--------
>  1 file changed, 11 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> index c1bcb93aed2d..b7074161ccf0 100644
> --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> @@ -673,7 +673,7 @@ static void ingenic_drm_unbind_all(void *d)
>  	component_unbind_all(priv->dev, &priv->drm);
>  }
>  
> -static int ingenic_drm_bind(struct device *dev)
> +static int ingenic_drm_bind(struct device *dev, bool has_components)
>  {
>  	struct platform_device *pdev = to_platform_device(dev);
>  	const struct jz_soc_info *soc_info;
> @@ -808,7 +808,7 @@ static int ingenic_drm_bind(struct device *dev)
>  			return ret;
>  		}
>  
> -		if (IS_ENABLED(CONFIG_DRM_INGENIC_IPU)) {
> +		if (IS_ENABLED(CONFIG_DRM_INGENIC_IPU) && has_components) {
>  			ret = component_bind_all(dev, drm);
>  			if (ret) {
>  				if (ret != -EPROBE_DEFER)
> @@ -939,6 +939,11 @@ static int ingenic_drm_bind(struct device *dev)
>  	return ret;
>  }
>  
> +static int ingenic_drm_bind_with_components(struct device *dev)
> +{
> +	return ingenic_drm_bind(dev, true);
> +}
> +
>  static int compare_of(struct device *dev, void *data)
>  {
>  	return dev->of_node == data;
> @@ -957,7 +962,7 @@ static void ingenic_drm_unbind(struct device *dev)
>  }
>  
>  static const struct component_master_ops ingenic_master_ops = {
> -	.bind = ingenic_drm_bind,
> +	.bind = ingenic_drm_bind_with_components,
>  	.unbind = ingenic_drm_unbind,
>  };
>  
> @@ -968,14 +973,12 @@ static int ingenic_drm_probe(struct platform_device *pdev)
>  	struct device_node *np;
>  
>  	if (!IS_ENABLED(CONFIG_DRM_INGENIC_IPU))
> -		return ingenic_drm_bind(dev);
> +		return ingenic_drm_bind(dev, false);
>  
>  	/* IPU is at port address 8 */
>  	np = of_graph_get_remote_node(dev->of_node, 8, 0);
> -	if (!np) {
> -		dev_err(dev, "Unable to get IPU node\n");
> -		return -EINVAL;
> -	}
> +	if (!np)
> +		return ingenic_drm_bind(dev, false);
>  
>  	drm_of_component_match_add(dev, &match, compare_of, np);
>  	of_node_put(np);
> -- 
> 2.28.0
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2 1/2] drm/ingenic: Fix leak of device_node pointer
  2020-08-29 21:07   ` Sam Ravnborg
@ 2020-08-30 22:55     ` Paul Cercueil
  -1 siblings, 0 replies; 14+ messages in thread
From: Paul Cercueil @ 2020-08-30 22:55 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: David Airlie, Daniel Vetter, dri-devel, linux-kernel, od

Hi Sam,

Le sam. 29 août 2020 à 23:07, Sam Ravnborg <sam@ravnborg.org> a 
écrit :
> On Thu, Aug 27, 2020 at 01:44:03PM +0200, Paul Cercueil wrote:
>>  of_graph_get_remote_node() requires of_node_put() to be called on 
>> the
>>  device_node pointer when it's no more in use.
>> 
>>  Fixes: fc1acf317b01 ("drm/ingenic: Add support for the IPU")
>>  Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> Reviewed-by: Sam Ravnborg <sam@ravnborg.org>

Thanks. Both patches pushed to drm-misc-fixes.

Cheers,
-Paul

>>  ---
>>   drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 1 +
>>   1 file changed, 1 insertion(+)
>> 
>>  diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c 
>> b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
>>  index ada990a7f911..c1bcb93aed2d 100644
>>  --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
>>  +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
>>  @@ -978,6 +978,7 @@ static int ingenic_drm_probe(struct 
>> platform_device *pdev)
>>   	}
>> 
>>   	drm_of_component_match_add(dev, &match, compare_of, np);
>>  +	of_node_put(np);
>> 
>>   	return component_master_add_with_match(dev, &ingenic_master_ops, 
>> match);
>>   }
>>  --
>>  2.28.0



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2 1/2] drm/ingenic: Fix leak of device_node pointer
@ 2020-08-30 22:55     ` Paul Cercueil
  0 siblings, 0 replies; 14+ messages in thread
From: Paul Cercueil @ 2020-08-30 22:55 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: David Airlie, od, dri-devel, linux-kernel

Hi Sam,

Le sam. 29 août 2020 à 23:07, Sam Ravnborg <sam@ravnborg.org> a 
écrit :
> On Thu, Aug 27, 2020 at 01:44:03PM +0200, Paul Cercueil wrote:
>>  of_graph_get_remote_node() requires of_node_put() to be called on 
>> the
>>  device_node pointer when it's no more in use.
>> 
>>  Fixes: fc1acf317b01 ("drm/ingenic: Add support for the IPU")
>>  Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> Reviewed-by: Sam Ravnborg <sam@ravnborg.org>

Thanks. Both patches pushed to drm-misc-fixes.

Cheers,
-Paul

>>  ---
>>   drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 1 +
>>   1 file changed, 1 insertion(+)
>> 
>>  diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c 
>> b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
>>  index ada990a7f911..c1bcb93aed2d 100644
>>  --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
>>  +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
>>  @@ -978,6 +978,7 @@ static int ingenic_drm_probe(struct 
>> platform_device *pdev)
>>   	}
>> 
>>   	drm_of_component_match_add(dev, &match, compare_of, np);
>>  +	of_node_put(np);
>> 
>>   	return component_master_add_with_match(dev, &ingenic_master_ops, 
>> match);
>>   }
>>  --
>>  2.28.0


_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2 2/2] drm/ingenic: Fix driver not probing when IPU port is missing
  2020-08-27 11:44   ` Paul Cercueil
@ 2020-08-31  0:21     ` Ezequiel Garcia
  -1 siblings, 0 replies; 14+ messages in thread
From: Ezequiel Garcia @ 2020-08-31  0:21 UTC (permalink / raw)
  To: Paul Cercueil
  Cc: David Airlie, Daniel Vetter, Sam Ravnborg, dri-devel,
	Linux Kernel Mailing List, od

Hi Paul,

On Thu, 27 Aug 2020 at 09:04, Paul Cercueil <paul@crapouillou.net> wrote:
>
> Even if support for the IPU was compiled in, we may run on a device
> (e.g. the Qi LB60) where the IPU is not available, or simply with an old
> devicetree without the IPU node. In that case the ingenic-drm refused to
> probe.
>
> Fix the driver so that it will probe even if the IPU node is not present
> in devicetree (but then IPU support is disabled of course).
>
> v2: Take a different approach
>
> Fixes: fc1acf317b01 ("drm/ingenic: Add support for the IPU")
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> ---
>  drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 19 +++++++++++--------
>  1 file changed, 11 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> index c1bcb93aed2d..b7074161ccf0 100644
> --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> @@ -673,7 +673,7 @@ static void ingenic_drm_unbind_all(void *d)
>         component_unbind_all(priv->dev, &priv->drm);
>  }
>
> -static int ingenic_drm_bind(struct device *dev)
> +static int ingenic_drm_bind(struct device *dev, bool has_components)
>  {
>         struct platform_device *pdev = to_platform_device(dev);
>         const struct jz_soc_info *soc_info;
> @@ -808,7 +808,7 @@ static int ingenic_drm_bind(struct device *dev)
>                         return ret;
>                 }
>
> -               if (IS_ENABLED(CONFIG_DRM_INGENIC_IPU)) {
> +               if (IS_ENABLED(CONFIG_DRM_INGENIC_IPU) && has_components) {
>                         ret = component_bind_all(dev, drm);
>                         if (ret) {
>                                 if (ret != -EPROBE_DEFER)
> @@ -939,6 +939,11 @@ static int ingenic_drm_bind(struct device *dev)
>         return ret;
>  }
>
> +static int ingenic_drm_bind_with_components(struct device *dev)
> +{
> +       return ingenic_drm_bind(dev, true);
> +}
> +
>  static int compare_of(struct device *dev, void *data)
>  {
>         return dev->of_node == data;
> @@ -957,7 +962,7 @@ static void ingenic_drm_unbind(struct device *dev)
>  }
>
>  static const struct component_master_ops ingenic_master_ops = {
> -       .bind = ingenic_drm_bind,
> +       .bind = ingenic_drm_bind_with_components,
>         .unbind = ingenic_drm_unbind,
>  };
>
> @@ -968,14 +973,12 @@ static int ingenic_drm_probe(struct platform_device *pdev)
>         struct device_node *np;
>
>         if (!IS_ENABLED(CONFIG_DRM_INGENIC_IPU))
> -               return ingenic_drm_bind(dev);
> +               return ingenic_drm_bind(dev, false);
>
>         /* IPU is at port address 8 */
>         np = of_graph_get_remote_node(dev->of_node, 8, 0);

How about we get rid of this (seems a bit odd to rely on port address) ?
Rockchip-drm driver has a nice approach, and I think we might need
something like that going forward, to support dw-hdmi.

Thanks,
Ezequiel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2 2/2] drm/ingenic: Fix driver not probing when IPU port is missing
@ 2020-08-31  0:21     ` Ezequiel Garcia
  0 siblings, 0 replies; 14+ messages in thread
From: Ezequiel Garcia @ 2020-08-31  0:21 UTC (permalink / raw)
  To: Paul Cercueil
  Cc: David Airlie, Linux Kernel Mailing List, dri-devel, od, Sam Ravnborg

Hi Paul,

On Thu, 27 Aug 2020 at 09:04, Paul Cercueil <paul@crapouillou.net> wrote:
>
> Even if support for the IPU was compiled in, we may run on a device
> (e.g. the Qi LB60) where the IPU is not available, or simply with an old
> devicetree without the IPU node. In that case the ingenic-drm refused to
> probe.
>
> Fix the driver so that it will probe even if the IPU node is not present
> in devicetree (but then IPU support is disabled of course).
>
> v2: Take a different approach
>
> Fixes: fc1acf317b01 ("drm/ingenic: Add support for the IPU")
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> ---
>  drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 19 +++++++++++--------
>  1 file changed, 11 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> index c1bcb93aed2d..b7074161ccf0 100644
> --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> @@ -673,7 +673,7 @@ static void ingenic_drm_unbind_all(void *d)
>         component_unbind_all(priv->dev, &priv->drm);
>  }
>
> -static int ingenic_drm_bind(struct device *dev)
> +static int ingenic_drm_bind(struct device *dev, bool has_components)
>  {
>         struct platform_device *pdev = to_platform_device(dev);
>         const struct jz_soc_info *soc_info;
> @@ -808,7 +808,7 @@ static int ingenic_drm_bind(struct device *dev)
>                         return ret;
>                 }
>
> -               if (IS_ENABLED(CONFIG_DRM_INGENIC_IPU)) {
> +               if (IS_ENABLED(CONFIG_DRM_INGENIC_IPU) && has_components) {
>                         ret = component_bind_all(dev, drm);
>                         if (ret) {
>                                 if (ret != -EPROBE_DEFER)
> @@ -939,6 +939,11 @@ static int ingenic_drm_bind(struct device *dev)
>         return ret;
>  }
>
> +static int ingenic_drm_bind_with_components(struct device *dev)
> +{
> +       return ingenic_drm_bind(dev, true);
> +}
> +
>  static int compare_of(struct device *dev, void *data)
>  {
>         return dev->of_node == data;
> @@ -957,7 +962,7 @@ static void ingenic_drm_unbind(struct device *dev)
>  }
>
>  static const struct component_master_ops ingenic_master_ops = {
> -       .bind = ingenic_drm_bind,
> +       .bind = ingenic_drm_bind_with_components,
>         .unbind = ingenic_drm_unbind,
>  };
>
> @@ -968,14 +973,12 @@ static int ingenic_drm_probe(struct platform_device *pdev)
>         struct device_node *np;
>
>         if (!IS_ENABLED(CONFIG_DRM_INGENIC_IPU))
> -               return ingenic_drm_bind(dev);
> +               return ingenic_drm_bind(dev, false);
>
>         /* IPU is at port address 8 */
>         np = of_graph_get_remote_node(dev->of_node, 8, 0);

How about we get rid of this (seems a bit odd to rely on port address) ?
Rockchip-drm driver has a nice approach, and I think we might need
something like that going forward, to support dw-hdmi.

Thanks,
Ezequiel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2 2/2] drm/ingenic: Fix driver not probing when IPU port is missing
  2020-08-31  0:21     ` Ezequiel Garcia
@ 2020-08-31  0:47       ` Paul Cercueil
  -1 siblings, 0 replies; 14+ messages in thread
From: Paul Cercueil @ 2020-08-31  0:47 UTC (permalink / raw)
  To: Ezequiel Garcia
  Cc: David Airlie, Daniel Vetter, Sam Ravnborg, dri-devel,
	Linux Kernel Mailing List, od



Le dim. 30 août 2020 à 21:21, Ezequiel Garcia 
<ezequiel@vanguardiasur.com.ar> a écrit :
> Hi Paul,
> 
> On Thu, 27 Aug 2020 at 09:04, Paul Cercueil <paul@crapouillou.net> 
> wrote:
>> 
>>  Even if support for the IPU was compiled in, we may run on a device
>>  (e.g. the Qi LB60) where the IPU is not available, or simply with 
>> an old
>>  devicetree without the IPU node. In that case the ingenic-drm 
>> refused to
>>  probe.
>> 
>>  Fix the driver so that it will probe even if the IPU node is not 
>> present
>>  in devicetree (but then IPU support is disabled of course).
>> 
>>  v2: Take a different approach
>> 
>>  Fixes: fc1acf317b01 ("drm/ingenic: Add support for the IPU")
>>  Signed-off-by: Paul Cercueil <paul@crapouillou.net>
>>  ---
>>   drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 19 +++++++++++--------
>>   1 file changed, 11 insertions(+), 8 deletions(-)
>> 
>>  diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c 
>> b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
>>  index c1bcb93aed2d..b7074161ccf0 100644
>>  --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
>>  +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
>>  @@ -673,7 +673,7 @@ static void ingenic_drm_unbind_all(void *d)
>>          component_unbind_all(priv->dev, &priv->drm);
>>   }
>> 
>>  -static int ingenic_drm_bind(struct device *dev)
>>  +static int ingenic_drm_bind(struct device *dev, bool 
>> has_components)
>>   {
>>          struct platform_device *pdev = to_platform_device(dev);
>>          const struct jz_soc_info *soc_info;
>>  @@ -808,7 +808,7 @@ static int ingenic_drm_bind(struct device *dev)
>>                          return ret;
>>                  }
>> 
>>  -               if (IS_ENABLED(CONFIG_DRM_INGENIC_IPU)) {
>>  +               if (IS_ENABLED(CONFIG_DRM_INGENIC_IPU) && 
>> has_components) {
>>                          ret = component_bind_all(dev, drm);
>>                          if (ret) {
>>                                  if (ret != -EPROBE_DEFER)
>>  @@ -939,6 +939,11 @@ static int ingenic_drm_bind(struct device *dev)
>>          return ret;
>>   }
>> 
>>  +static int ingenic_drm_bind_with_components(struct device *dev)
>>  +{
>>  +       return ingenic_drm_bind(dev, true);
>>  +}
>>  +
>>   static int compare_of(struct device *dev, void *data)
>>   {
>>          return dev->of_node == data;
>>  @@ -957,7 +962,7 @@ static void ingenic_drm_unbind(struct device 
>> *dev)
>>   }
>> 
>>   static const struct component_master_ops ingenic_master_ops = {
>>  -       .bind = ingenic_drm_bind,
>>  +       .bind = ingenic_drm_bind_with_components,
>>          .unbind = ingenic_drm_unbind,
>>   };
>> 
>>  @@ -968,14 +973,12 @@ static int ingenic_drm_probe(struct 
>> platform_device *pdev)
>>          struct device_node *np;
>> 
>>          if (!IS_ENABLED(CONFIG_DRM_INGENIC_IPU))
>>  -               return ingenic_drm_bind(dev);
>>  +               return ingenic_drm_bind(dev, false);
>> 
>>          /* IPU is at port address 8 */
>>          np = of_graph_get_remote_node(dev->of_node, 8, 0);
> 
> How about we get rid of this (seems a bit odd to rely on port 
> address) ?
> Rockchip-drm driver has a nice approach, and I think we might need
> something like that going forward, to support dw-hdmi.

The rockchip-drm approach works because all the sub-drivers must probe. 
In the case of ingenic-drm, even if the ingenic-drm driver was compiled 
with the ipu and dw-hdmi sub-drivers, you can't rely on these probing, 
as they are not present on e.g. the JZ4740.

Cheers,
-Paul



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2 2/2] drm/ingenic: Fix driver not probing when IPU port is missing
@ 2020-08-31  0:47       ` Paul Cercueil
  0 siblings, 0 replies; 14+ messages in thread
From: Paul Cercueil @ 2020-08-31  0:47 UTC (permalink / raw)
  To: Ezequiel Garcia
  Cc: David Airlie, Linux Kernel Mailing List, dri-devel, od, Sam Ravnborg



Le dim. 30 août 2020 à 21:21, Ezequiel Garcia 
<ezequiel@vanguardiasur.com.ar> a écrit :
> Hi Paul,
> 
> On Thu, 27 Aug 2020 at 09:04, Paul Cercueil <paul@crapouillou.net> 
> wrote:
>> 
>>  Even if support for the IPU was compiled in, we may run on a device
>>  (e.g. the Qi LB60) where the IPU is not available, or simply with 
>> an old
>>  devicetree without the IPU node. In that case the ingenic-drm 
>> refused to
>>  probe.
>> 
>>  Fix the driver so that it will probe even if the IPU node is not 
>> present
>>  in devicetree (but then IPU support is disabled of course).
>> 
>>  v2: Take a different approach
>> 
>>  Fixes: fc1acf317b01 ("drm/ingenic: Add support for the IPU")
>>  Signed-off-by: Paul Cercueil <paul@crapouillou.net>
>>  ---
>>   drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 19 +++++++++++--------
>>   1 file changed, 11 insertions(+), 8 deletions(-)
>> 
>>  diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c 
>> b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
>>  index c1bcb93aed2d..b7074161ccf0 100644
>>  --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
>>  +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
>>  @@ -673,7 +673,7 @@ static void ingenic_drm_unbind_all(void *d)
>>          component_unbind_all(priv->dev, &priv->drm);
>>   }
>> 
>>  -static int ingenic_drm_bind(struct device *dev)
>>  +static int ingenic_drm_bind(struct device *dev, bool 
>> has_components)
>>   {
>>          struct platform_device *pdev = to_platform_device(dev);
>>          const struct jz_soc_info *soc_info;
>>  @@ -808,7 +808,7 @@ static int ingenic_drm_bind(struct device *dev)
>>                          return ret;
>>                  }
>> 
>>  -               if (IS_ENABLED(CONFIG_DRM_INGENIC_IPU)) {
>>  +               if (IS_ENABLED(CONFIG_DRM_INGENIC_IPU) && 
>> has_components) {
>>                          ret = component_bind_all(dev, drm);
>>                          if (ret) {
>>                                  if (ret != -EPROBE_DEFER)
>>  @@ -939,6 +939,11 @@ static int ingenic_drm_bind(struct device *dev)
>>          return ret;
>>   }
>> 
>>  +static int ingenic_drm_bind_with_components(struct device *dev)
>>  +{
>>  +       return ingenic_drm_bind(dev, true);
>>  +}
>>  +
>>   static int compare_of(struct device *dev, void *data)
>>   {
>>          return dev->of_node == data;
>>  @@ -957,7 +962,7 @@ static void ingenic_drm_unbind(struct device 
>> *dev)
>>   }
>> 
>>   static const struct component_master_ops ingenic_master_ops = {
>>  -       .bind = ingenic_drm_bind,
>>  +       .bind = ingenic_drm_bind_with_components,
>>          .unbind = ingenic_drm_unbind,
>>   };
>> 
>>  @@ -968,14 +973,12 @@ static int ingenic_drm_probe(struct 
>> platform_device *pdev)
>>          struct device_node *np;
>> 
>>          if (!IS_ENABLED(CONFIG_DRM_INGENIC_IPU))
>>  -               return ingenic_drm_bind(dev);
>>  +               return ingenic_drm_bind(dev, false);
>> 
>>          /* IPU is at port address 8 */
>>          np = of_graph_get_remote_node(dev->of_node, 8, 0);
> 
> How about we get rid of this (seems a bit odd to rely on port 
> address) ?
> Rockchip-drm driver has a nice approach, and I think we might need
> something like that going forward, to support dw-hdmi.

The rockchip-drm approach works because all the sub-drivers must probe. 
In the case of ingenic-drm, even if the ingenic-drm driver was compiled 
with the ipu and dw-hdmi sub-drivers, you can't rely on these probing, 
as they are not present on e.g. the JZ4740.

Cheers,
-Paul


_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2020-08-31  9:12 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-27 11:44 [PATCH v2 1/2] drm/ingenic: Fix leak of device_node pointer Paul Cercueil
2020-08-27 11:44 ` Paul Cercueil
2020-08-27 11:44 ` [PATCH v2 2/2] drm/ingenic: Fix driver not probing when IPU port is missing Paul Cercueil
2020-08-27 11:44   ` Paul Cercueil
2020-08-29 21:08   ` Sam Ravnborg
2020-08-29 21:08     ` Sam Ravnborg
2020-08-31  0:21   ` Ezequiel Garcia
2020-08-31  0:21     ` Ezequiel Garcia
2020-08-31  0:47     ` Paul Cercueil
2020-08-31  0:47       ` Paul Cercueil
2020-08-29 21:07 ` [PATCH v2 1/2] drm/ingenic: Fix leak of device_node pointer Sam Ravnborg
2020-08-29 21:07   ` Sam Ravnborg
2020-08-30 22:55   ` Paul Cercueil
2020-08-30 22:55     ` Paul Cercueil

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.