Thread (31 messages) 31 messages, 4 authors, 2026-03-19

Re: [PATCH v3 phy-next 10/24] drm/rockchip: dw_hdmi: avoid direct dereference of phy->dev.of_node

From: Heiko Stuebner <heiko@sntech.de>
Date: 2026-03-10 09:08:20
Also in: dri-devel, linux-arm-kernel, linux-arm-msm, linux-can, linux-gpio, linux-ide, linux-media, linux-pci, linux-phy, linux-renesas-soc, linux-riscv, linux-rockchip, linux-samsung-soc, linux-scsi, linux-sunxi, linux-tegra, linux-usb, lkml, spacemit

Am Dienstag, 10. März 2026, 09:37:52 Mitteleuropäische Normalzeit schrieb Vladimir Oltean:
On Tue, Mar 10, 2026 at 09:24:43AM +0100, Heiko Stuebner wrote:
quoted
Am Montag, 9. März 2026, 20:08:28 Mitteleuropäische Normalzeit schrieb Vladimir Oltean:
quoted
The dw_hdmi-rockchip driver validates pixel clock rates against the
HDMI PHY's internal clock provider on certain SoCs like RK3328.
This is currently achieved by dereferencing hdmi->phy->dev.of_node
to obtain the provider node, which violates the Generic PHY API's
encapsulation (the goal is for struct phy to be an opaque pointer).

Refactor dw_hdmi_rockchip_bind() to perform a manual phandle lookup
on the "hdmi" PHY index within the controller's DT node. This provides
a parallel path to the clock provider's OF node without relying on the
internal structure of the struct phy handle.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
Cc: Sandy Huang <hjc@rock-chips.com>
Cc: "Heiko Stübner" <heiko@sntech.de>
Cc: Andy Yan <andy.yan@rock-chips.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: David Airlie <airlied@gmail.com>
Cc: Simona Vetter <simona@ffwll.ch>

v1->v3: none
---
[...]
quoted
@@ -588,13 +589,17 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master,
 		return dev_err_probe(hdmi->dev, ret, "failed to get phy\n");
 	}
 
-	if (hdmi->phy) {
nit: a comment would be nice here. I.e. hdmi->phy being an opaque pointer
so checking hdmi->phy != NULL is not possible.

With that being a "goal", I assume that information is not widely spread
so this would prevent the next developer trying to change it back to
"if (hdmi->phy)" while that handling change trickles down.
Testing the NULL quality of "struct phy *phy" is still possible and legal.
It means that you called an "optional" variant of phy_get(), and there
was no PHY.
ok, I'll keep that in mind :-)


Heiko

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help