LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] drm/rockchip: handle non-platform devices in rockchip_drm_endpoint_is_subdriver
@ 2021-09-14 15:07 Alex Bee
  2021-09-21 10:03 ` Heiko Stuebner
  0 siblings, 1 reply; 2+ messages in thread
From: Alex Bee @ 2021-09-14 15:07 UTC (permalink / raw)
  To: Sandy Huang, Heiko Stübner, Andy Yan
  Cc: Jonathan McDowell, David Airlie, Daniel Vetter, dri-devel,
	linux-arm-kernel, linux-rockchip, linux-kernel, Alex Bee

As discussed at [1] rockchip_drm_endpoint_is_subdriver will currently always
return -ENODEV for non-platform-devices (e.g. external i2c bridges), what
makes them never being considered in rockchip_rgb_init.

As suggested at [1] this additionally adds a of_device_is_available for
the node found, which will work for both platform and non-platform devices.
Also we can return early for non-platform-devices if they are enabled,
as rockchip_sub_drivers contains exclusively platform-devices.

[1] https://lore.kernel.org/all/20210316182753.GA25685@earth.li/

Suggested-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Alex Bee <knaerzche@gmail.com>
---
 drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
index bfba9793d238..81a5ec30ef4f 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
@@ -275,10 +275,17 @@ int rockchip_drm_endpoint_is_subdriver(struct device_node *ep)
 		return -ENODEV;
 
 	/* status disabled will prevent creation of platform-devices */
+	if (!of_device_is_available(node)) {
+		of_node_put(node);
+		return -ENODEV;
+	}
+
 	pdev = of_find_device_by_node(node);
 	of_node_put(node);
+
+	/* enabled non-platform-devices can immediately return here */
 	if (!pdev)
-		return -ENODEV;
+		return false;
 
 	/*
 	 * All rockchip subdrivers have probed at this point, so

base-commit: 6880fa6c56601bb8ed59df6c30fd390cc5f6dd8f
-- 
2.30.2


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

* Re: [PATCH] drm/rockchip: handle non-platform devices in rockchip_drm_endpoint_is_subdriver
  2021-09-14 15:07 [PATCH] drm/rockchip: handle non-platform devices in rockchip_drm_endpoint_is_subdriver Alex Bee
@ 2021-09-21 10:03 ` Heiko Stuebner
  0 siblings, 0 replies; 2+ messages in thread
From: Heiko Stuebner @ 2021-09-21 10:03 UTC (permalink / raw)
  To: Andy Yan, Alex Bee, Sandy Huang
  Cc: Heiko Stuebner, Daniel Vetter, linux-rockchip, linux-arm-kernel,
	Jonathan McDowell, dri-devel, linux-kernel, David Airlie

On Tue, 14 Sep 2021 17:07:56 +0200, Alex Bee wrote:
> As discussed at [1] rockchip_drm_endpoint_is_subdriver will currently always
> return -ENODEV for non-platform-devices (e.g. external i2c bridges), what
> makes them never being considered in rockchip_rgb_init.
> 
> As suggested at [1] this additionally adds a of_device_is_available for
> the node found, which will work for both platform and non-platform devices.
> Also we can return early for non-platform-devices if they are enabled,
> as rockchip_sub_drivers contains exclusively platform-devices.
> 
> [...]

Applied, thanks!

[1/1] drm/rockchip: handle non-platform devices in rockchip_drm_endpoint_is_subdriver
      commit: 37825e07ab413187e1ea078bc33dcdb835008be2

Best regards,
-- 
Heiko Stuebner <heiko@sntech.de>

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

end of thread, other threads:[~2021-09-21 10:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-14 15:07 [PATCH] drm/rockchip: handle non-platform devices in rockchip_drm_endpoint_is_subdriver Alex Bee
2021-09-21 10:03 ` Heiko Stuebner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).