drm/omap: dss: Create and use omapdss_device_is_registered()
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Wed, 28 Feb 2018 21:53:16 +0000 (23:53 +0200)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Mon, 3 Sep 2018 13:13:25 +0000 (16:13 +0300)
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 <laurent.pinchart@ideasonboard.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
drivers/gpu/drm/omapdrm/dss/base.c
drivers/gpu/drm/omapdrm/dss/display.c
drivers/gpu/drm/omapdrm/dss/omapdss.h
drivers/gpu/drm/omapdrm/dss/output.c

index 18b72d7c717a7b6e2f37b3e69c9d12be7228a1b6..63fe0a7178848e07f323d4fb2e82e3bbfe5e2d7c 100644 (file)
@@ -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;
index f0f9239f09d1be6294d2c01f121c948d31328115..e7872e0c8dab1a041f5705281cb4342c1a4be70d 100644 (file)
@@ -72,24 +72,6 @@ void omapdss_unregister_display(struct omap_dss_device *dssdev)
 }
 EXPORT_SYMBOL(omapdss_unregister_display);
 
-bool omapdss_component_is_display(struct device_node *node)
-{
-       struct omap_dss_device *dssdev;
-       bool found = false;
-
-       mutex_lock(&panel_list_mutex);
-       list_for_each_entry(dssdev, &panel_list, panel_list) {
-               if (dssdev->dev->of_node == node) {
-                       found = true;
-                       goto out;
-               }
-       }
-out:
-       mutex_unlock(&panel_list_mutex);
-       return found;
-}
-EXPORT_SYMBOL(omapdss_component_is_display);
-
 struct omap_dss_device *omap_dss_get_device(struct omap_dss_device *dssdev)
 {
        if (!try_module_get(dssdev->owner))
index e029613509a19218edc6460505e9db99b6d6db63..1ccf0c67d308ca4fe6246d86aa5da6ff488777d8 100644 (file)
@@ -737,9 +737,6 @@ struct dispc_ops {
 struct dispc_device *dispc_get_dispc(struct dss_device *dss);
 const struct dispc_ops *dispc_get_ops(struct dss_device *dss);
 
-bool omapdss_component_is_display(struct device_node *node);
-bool omapdss_component_is_output(struct device_node *node);
-
 bool omapdss_stack_is_ready(void);
 void omapdss_gather_components(struct device *dev);
 
index 1a2d24906edd5786281af4d7c3f8caef1cb6863e..7f18153a1bde12aac59f8cc03dce8178a1aaa75c 100644 (file)
@@ -109,19 +109,6 @@ void omapdss_unregister_output(struct omap_dss_device *out)
 }
 EXPORT_SYMBOL(omapdss_unregister_output);
 
-bool omapdss_component_is_output(struct device_node *node)
-{
-       struct omap_dss_device *out;
-
-       list_for_each_entry(out, &output_list, output_list) {
-               if (out->dev->of_node == node)
-                       return true;
-       }
-
-       return false;
-}
-EXPORT_SYMBOL(omapdss_component_is_output);
-
 struct omap_dss_device *omap_dss_get_output(enum omap_dss_output_id id)
 {
        struct omap_dss_device *out;