[PATCH 1/7] drm/msm/hdmi: Simplify with dev_of_node()

Krzysztof Kozlowski posted 7 patches 3 weeks, 5 days ago
[PATCH 1/7] drm/msm/hdmi: Simplify with dev_of_node()
Posted by Krzysztof Kozlowski 3 weeks, 5 days ago
Simplify chain of pointer dereferences with dev_of_node() which also
checks if 'dev' argument is non-NULL.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
---
 drivers/gpu/drm/msm/hdmi/hdmi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdmi.c
index 5afac09c0d33..b1db1b597901 100644
--- a/drivers/gpu/drm/msm/hdmi/hdmi.c
+++ b/drivers/gpu/drm/msm/hdmi/hdmi.c
@@ -91,7 +91,7 @@ static int msm_hdmi_get_phy(struct hdmi *hdmi)
 	struct platform_device *phy_pdev;
 	struct device_node *phy_node;
 
-	phy_node = of_parse_phandle(pdev->dev.of_node, "phys", 0);
+	phy_node = of_parse_phandle(dev_of_node(&pdev->dev), "phys", 0);
 	if (!phy_node) {
 		DRM_DEV_ERROR(&pdev->dev, "cannot find phy device\n");
 		return -ENXIO;
@@ -287,7 +287,7 @@ static int msm_hdmi_dev_probe(struct platform_device *pdev)
 	spin_lock_init(&hdmi->reg_lock);
 	mutex_init(&hdmi->state_mutex);
 
-	ret = drm_of_find_panel_or_bridge(pdev->dev.of_node, 1, 0, NULL, &hdmi->next_bridge);
+	ret = drm_of_find_panel_or_bridge(dev_of_node(dev), 1, 0, NULL, &hdmi->next_bridge);
 	if (ret && ret != -ENODEV)
 		return ret;
 

-- 
2.51.0
Re: [PATCH 1/7] drm/msm/hdmi: Simplify with dev_of_node()
Posted by Dmitry Baryshkov 3 weeks, 5 days ago
On Wed, Mar 11, 2026 at 09:17:25PM +0100, Krzysztof Kozlowski wrote:
> Simplify chain of pointer dereferences with dev_of_node() which also
> checks if 'dev' argument is non-NULL.
> 
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
> ---
>  drivers/gpu/drm/msm/hdmi/hdmi.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdmi.c
> index 5afac09c0d33..b1db1b597901 100644
> --- a/drivers/gpu/drm/msm/hdmi/hdmi.c
> +++ b/drivers/gpu/drm/msm/hdmi/hdmi.c
> @@ -91,7 +91,7 @@ static int msm_hdmi_get_phy(struct hdmi *hdmi)
>  	struct platform_device *phy_pdev;
>  	struct device_node *phy_node;
>  
> -	phy_node = of_parse_phandle(pdev->dev.of_node, "phys", 0);
> +	phy_node = of_parse_phandle(dev_of_node(&pdev->dev), "phys", 0);
>  	if (!phy_node) {
>  		DRM_DEV_ERROR(&pdev->dev, "cannot find phy device\n");
>  		return -ENXIO;
> @@ -287,7 +287,7 @@ static int msm_hdmi_dev_probe(struct platform_device *pdev)
>  	spin_lock_init(&hdmi->reg_lock);
>  	mutex_init(&hdmi->state_mutex);
>  
> -	ret = drm_of_find_panel_or_bridge(pdev->dev.of_node, 1, 0, NULL, &hdmi->next_bridge);
> +	ret = drm_of_find_panel_or_bridge(dev_of_node(dev), 1, 0, NULL, &hdmi->next_bridge);

dev_of_node(&pdev->dev)?

>  	if (ret && ret != -ENODEV)
>  		return ret;
>  
> 
> -- 
> 2.51.0
> 

-- 
With best wishes
Dmitry
Re: [PATCH 1/7] drm/msm/hdmi: Simplify with dev_of_node()
Posted by Krzysztof Kozlowski 3 weeks, 5 days ago
On 12/03/2026 03:41, Dmitry Baryshkov wrote:
> On Wed, Mar 11, 2026 at 09:17:25PM +0100, Krzysztof Kozlowski wrote:
>> Simplify chain of pointer dereferences with dev_of_node() which also
>> checks if 'dev' argument is non-NULL.
>>
>> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
>> ---
>>  drivers/gpu/drm/msm/hdmi/hdmi.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdmi.c
>> index 5afac09c0d33..b1db1b597901 100644
>> --- a/drivers/gpu/drm/msm/hdmi/hdmi.c
>> +++ b/drivers/gpu/drm/msm/hdmi/hdmi.c
>> @@ -91,7 +91,7 @@ static int msm_hdmi_get_phy(struct hdmi *hdmi)
>>  	struct platform_device *phy_pdev;
>>  	struct device_node *phy_node;
>>  
>> -	phy_node = of_parse_phandle(pdev->dev.of_node, "phys", 0);
>> +	phy_node = of_parse_phandle(dev_of_node(&pdev->dev), "phys", 0);
>>  	if (!phy_node) {
>>  		DRM_DEV_ERROR(&pdev->dev, "cannot find phy device\n");
>>  		return -ENXIO;
>> @@ -287,7 +287,7 @@ static int msm_hdmi_dev_probe(struct platform_device *pdev)
>>  	spin_lock_init(&hdmi->reg_lock);
>>  	mutex_init(&hdmi->state_mutex);
>>  
>> -	ret = drm_of_find_panel_or_bridge(pdev->dev.of_node, 1, 0, NULL, &hdmi->next_bridge);
>> +	ret = drm_of_find_panel_or_bridge(dev_of_node(dev), 1, 0, NULL, &hdmi->next_bridge);
> 
> dev_of_node(&pdev->dev)?

Why? dev is already simpler.

Best regards,
Krzysztof
Re: [PATCH 1/7] drm/msm/hdmi: Simplify with dev_of_node()
Posted by Dmitry Baryshkov 3 weeks, 4 days ago
On Thu, Mar 12, 2026 at 05:32:02PM +0100, Krzysztof Kozlowski wrote:
> On 12/03/2026 03:41, Dmitry Baryshkov wrote:
> > On Wed, Mar 11, 2026 at 09:17:25PM +0100, Krzysztof Kozlowski wrote:
> >> Simplify chain of pointer dereferences with dev_of_node() which also
> >> checks if 'dev' argument is non-NULL.
> >>
> >> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
> >> ---
> >>  drivers/gpu/drm/msm/hdmi/hdmi.c | 4 ++--
> >>  1 file changed, 2 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdmi.c
> >> index 5afac09c0d33..b1db1b597901 100644
> >> --- a/drivers/gpu/drm/msm/hdmi/hdmi.c
> >> +++ b/drivers/gpu/drm/msm/hdmi/hdmi.c
> >> @@ -91,7 +91,7 @@ static int msm_hdmi_get_phy(struct hdmi *hdmi)
> >>  	struct platform_device *phy_pdev;
> >>  	struct device_node *phy_node;
> >>  
> >> -	phy_node = of_parse_phandle(pdev->dev.of_node, "phys", 0);
> >> +	phy_node = of_parse_phandle(dev_of_node(&pdev->dev), "phys", 0);
> >>  	if (!phy_node) {
> >>  		DRM_DEV_ERROR(&pdev->dev, "cannot find phy device\n");
> >>  		return -ENXIO;
> >> @@ -287,7 +287,7 @@ static int msm_hdmi_dev_probe(struct platform_device *pdev)
> >>  	spin_lock_init(&hdmi->reg_lock);
> >>  	mutex_init(&hdmi->state_mutex);
> >>  
> >> -	ret = drm_of_find_panel_or_bridge(pdev->dev.of_node, 1, 0, NULL, &hdmi->next_bridge);
> >> +	ret = drm_of_find_panel_or_bridge(dev_of_node(dev), 1, 0, NULL, &hdmi->next_bridge);
> > 
> > dev_of_node(&pdev->dev)?
> 
> Why? dev is already simpler.

... and there is no struct device *dev in msm_hdmi_get_phy().


Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>


-- 
With best wishes
Dmitry