Skip to contentSkip to conversation

drm/panel: abstract of_panel_find()

PATCH In review Jani Nikula 2 participants 3 messages May 22, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/panel: abstract of_panel_find()

Add a helper to wrap OF-specific calls in drm_panel_add_follower() in preparation for adding an ACPI equivalent in the future. No functional changes.

---
 drivers/gpu/drm/drm_panel.c | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)
drivers/gpu/drm/drm_panel.c +16 -7
index 650de4da0853..fee65dc65979 100644
@@ -473,6 +473,21 @@ int of_drm_get_panel_orientation(const struct device_node *np,
 EXPORT_SYMBOL(of_drm_get_panel_orientation);
 #endif
 
+static struct drm_panel *of_find_panel(struct device *follower_dev)
+{
+	struct device_node *panel_np;
+	struct drm_panel *panel;
+
+	panel_np = of_parse_phandle(follower_dev->of_node, "panel", 0);
+	if (!panel_np)
+		return ERR_PTR(-ENODEV);
+
+	panel = of_drm_find_panel(panel_np);
+	of_node_put(panel_np);
+
+	return panel;
+}
+
 /**
  * drm_is_panel_follower() - Check if the device is a panel follower
  * @dev: The 'struct device' to check
@@ -518,16 +533,10 @@ EXPORT_SYMBOL(drm_is_panel_follower);
 int drm_panel_add_follower(struct device *follower_dev,
 			   struct drm_panel_follower *follower)
 {
-	struct device_node *panel_np;
 	struct drm_panel *panel;
 	int ret;
 
-	panel_np = of_parse_phandle(follower_dev->of_node, "panel", 0);
-	if (!panel_np)
-		return -ENODEV;
-
-	panel = of_drm_find_panel(panel_np);
-	of_node_put(panel_np);
+	panel = of_find_panel(follower_dev);
 	if (IS_ERR(panel))
 		return PTR_ERR(panel);
 
Signature · 1 line
2.39.5
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Jani Nikula

Add a helper to wrap OF-specific calls in drm_panel_add_follower() in preparation for adding an ACPI equivalent in the future. No functional changes.

---
 drivers/gpu/drm/drm_panel.c | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)
Signature · 2 lines
With best wishes
Dmitry
#2 lore raw
Quoted 5 lines · Dmitry Baryshkov
Quoted 4 lines · Jani Nikula

Add a helper to wrap OF-specific calls in drm_panel_add_follower() in preparation for adding an ACPI equivalent in the future. No functional changes.

Quoted 7 lines
Quoted 5 lines
---
 drivers/gpu/drm/drm_panel.c | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

Thanks, pushed to drm-misc-next.

BR,
Jani.

Signature · 1 line
Jani Nikula, Intel