From 9184f8d94c389c4712b4f393cca4a09c9e770514 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Wed, 28 Feb 2018 23:53:16 +0200 Subject: drm/omap: dss: Create and use omapdss_device_is_registered() The omapdss_component_is_loaded() function test whether a component is loaded by checking whether it is present in the displays list or the outputs list. Simplify the implementation by checking for the component in the global omap_dss_device list. Signed-off-by: Laurent Pinchart Reviewed-by: Sebastian Reichel Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/omapdrm/dss/base.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'drivers/gpu/drm/omapdrm/dss/base.c') diff --git a/drivers/gpu/drm/omapdrm/dss/base.c b/drivers/gpu/drm/omapdrm/dss/base.c index 18b72d7c717a..63fe0a717884 100644 --- a/drivers/gpu/drm/omapdrm/dss/base.c +++ b/drivers/gpu/drm/omapdrm/dss/base.c @@ -71,6 +71,24 @@ void omapdss_device_unregister(struct omap_dss_device *dssdev) mutex_unlock(&omapdss_devices_lock); } +static bool omapdss_device_is_registered(struct device_node *node) +{ + struct omap_dss_device *dssdev; + bool found = false; + + mutex_lock(&omapdss_devices_lock); + + list_for_each_entry(dssdev, &omapdss_devices_list, list) { + if (dssdev->dev->of_node == node) { + found = true; + break; + } + } + + mutex_unlock(&omapdss_devices_lock); + return found; +} + /* ----------------------------------------------------------------------------- * Components Handling */ @@ -157,9 +175,7 @@ static bool omapdss_component_is_loaded(struct omapdss_comp_node *comp) { if (comp->dss_core_component) return true; - if (omapdss_component_is_display(comp->node)) - return true; - if (omapdss_component_is_output(comp->node)) + if (omapdss_device_is_registered(comp->node)) return true; return false; -- cgit v1.2.3