]> git.baikalelectronics.ru Git - kernel.git/commit
drm/sun4i: Implement endpoint parsing using kfifo
authorMaxime Ripard <maxime.ripard@free-electrons.com>
Tue, 17 Oct 2017 09:06:08 +0000 (11:06 +0200)
committerMaxime Ripard <maxime.ripard@free-electrons.com>
Tue, 17 Oct 2017 14:31:31 +0000 (16:31 +0200)
commit674148f1f64891366e23b8fdac29ef946588e150
tree9e364b2eb13df8da4c15b5f246715317e66211e6
parent195df1b0c6f04d78babb38d4ccea8732973c92ef
drm/sun4i: Implement endpoint parsing using kfifo

The commit 381bf3feedbe ("drm/sun4i: add components in breadth first
traversal order") implemented a breadth first traversal of our device tree
nodes graph. However, it was relying on the kernel linked lists, and those
are not really safe for addition.

Indeed, in a single pipeline stage, your first stage (ie, the mixer or
fronted) will be queued, and it will be the final iteration of that list as
far as list_for_each_entry_safe is concerned. Then, during that final
iteration, we'll queue another element (the TCON or the backend) that
list_for_each_entry_safe will not account for, and we will leave the loop
without having iterated over all the elements. And since we won't have
built our components list properly, the DRM driver will be left
non-functional.

We can instead use a kfifo to queue and enqueue components in-order, as was
the original intention. This also has the benefit of removing any dynamic
allocation, making the error handling path simpler too. The only thing
we're losing is the ability to tell whether an element has already been
queued, but that was only needed to remove spurious logs, and therefore
purely cosmetic.

This means that this commit effectively reverses 1d60aa0c34e5 ("drm/sun4i:
don't add components that are already in the queue").

Fixes: 381bf3feedbe ("drm/sun4i: add components in breadth first traversal order")
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/4ecb323e787918208f6a5d9f0ebba12c62583c98.1508231063.git-series.maxime.ripard@free-electrons.com
drivers/gpu/drm/sun4i/sun4i_drv.c