[PATCH] drm: adp: Use device_match_of_node()

shao.mingyin@zte.com.cn posted 1 patch 10 months, 2 weeks ago
drivers/gpu/drm/adp/adp_drv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] drm: adp: Use device_match_of_node()
Posted by shao.mingyin@zte.com.cn 10 months, 2 weeks ago
From: Tang Dongxing <tang.dongxing@zte.com.cn>

Replace the open-code with device_match_of_node().

Signed-off-by: Tang Dongxing <tang.dongxing@zte.com.cn>
Signed-off-by: Shao Mingyin <shao.mingyin@zte.com.cn>
---
 drivers/gpu/drm/adp/adp_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/adp/adp_drv.c b/drivers/gpu/drm/adp/adp_drv.c
index c98c647f981d..0abb56ce2c34 100644
--- a/drivers/gpu/drm/adp/adp_drv.c
+++ b/drivers/gpu/drm/adp/adp_drv.c
@@ -553,7 +553,7 @@ static const struct component_master_ops adp_master_ops = {

 static int compare_dev(struct device *dev, void *data)
 {
-	return dev->of_node == data;
+	return device_match_of_node(dev, data);
 }

 static int adp_probe(struct platform_device *pdev)
-- 
2.25.1
Re: [PATCH] drm: adp: Use device_match_of_node()
Posted by Janne Grunau 10 months, 2 weeks ago
On Fri, Mar 28, 2025 at 05:07:05PM +0800, shao.mingyin@zte.com.cn wrote:
> From: Tang Dongxing <tang.dongxing@zte.com.cn>
> 
> Replace the open-code with device_match_of_node().
> 
> Signed-off-by: Tang Dongxing <tang.dongxing@zte.com.cn>
> Signed-off-by: Shao Mingyin <shao.mingyin@zte.com.cn>
> ---
>  drivers/gpu/drm/adp/adp_drv.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/adp/adp_drv.c b/drivers/gpu/drm/adp/adp_drv.c
> index c98c647f981d..0abb56ce2c34 100644
> --- a/drivers/gpu/drm/adp/adp_drv.c
> +++ b/drivers/gpu/drm/adp/adp_drv.c
> @@ -553,7 +553,7 @@ static const struct component_master_ops adp_master_ops = {
> 
>  static int compare_dev(struct device *dev, void *data)
>  {
> -	return dev->of_node == data;
> +	return device_match_of_node(dev, data);
>  }

please remove compare_dev() completely and replace the argmunent in the
drm_of_component_match_add() call directly. Commonly
component_compare_of() is used but it is also just a wrapper around
device_match_of_node().

drivers/gpu/drm/arm/hdlcd_drv.c and drivers/gpu/drm/arm/malidp_drv.c
follow the same pattern so please fix those as well. One of them was
used as template for this driver.

Thanks,

Janne