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.

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Link: https://lore.kernel.org/r/20250522100036.2529624-1-jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
This commit is contained in:
Jani Nikula 2025-05-22 13:00:36 +03:00
parent 370f86bc07
commit 9528e54198

View File

@ -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);