aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChen-Yu Tsai <wens@csie.org>2017-10-14 00:02:46 -0400
committerMaxime Ripard <maxime.ripard@free-electrons.com>2017-10-16 03:53:44 -0400
commite8afb7b67fbadfbb2b4fd74bf34566e64cbcbe6f (patch)
tree7c6b119f9147c3246cbf4dfdc482e0863f2fc508
parent652badb9458b41a24b156146a73a5bfbc4356f29 (diff)
drm/sun4i: don't add components that are already in the queue
Even though the components framework can handle duplicate entries, the extra entries cause a lot more debug messages to be generated, which would be confusing to developers not familiar with our driver and the framework in general. Instead, we can scan the relatively small queue and check if the component to be added is already queued up. Since the display pipelines are symmetrical (not considering the third display pipeline on the A80), and we add components level by level, when we get to the second instance at the same level, any shared downstream components would already be in the queue. Signed-off-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Link: https://patchwork.freedesktop.org/patch/msgid/20171014040252.9621-2-wens@csie.org
-rw-r--r--drivers/gpu/drm/sun4i/sun4i_drv.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c
index a2012638d5f7..b5879d4620d8 100644
--- a/drivers/gpu/drm/sun4i/sun4i_drv.c
+++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
@@ -226,6 +226,18 @@ struct endpoint_list {
226 struct list_head list; 226 struct list_head list;
227}; 227};
228 228
229static bool node_is_in_list(struct list_head *endpoints,
230 struct device_node *node)
231{
232 struct endpoint_list *endpoint;
233
234 list_for_each_entry(endpoint, endpoints, list)
235 if (endpoint->node == node)
236 return true;
237
238 return false;
239}
240
229static int sun4i_drv_add_endpoints(struct device *dev, 241static int sun4i_drv_add_endpoints(struct device *dev,
230 struct list_head *endpoints, 242 struct list_head *endpoints,
231 struct component_match **match, 243 struct component_match **match,
@@ -292,6 +304,10 @@ static int sun4i_drv_add_endpoints(struct device *dev,
292 } 304 }
293 } 305 }
294 306
307 /* skip downstream node if it is already in the queue */
308 if (node_is_in_list(endpoints, remote))
309 continue;
310
295 /* Add downstream nodes to the queue */ 311 /* Add downstream nodes to the queue */
296 endpoint = kzalloc(sizeof(*endpoint), GFP_KERNEL); 312 endpoint = kzalloc(sizeof(*endpoint), GFP_KERNEL);
297 if (!endpoint) { 313 if (!endpoint) {