diff options
author | Boris Brezillon <boris.brezillon@collabora.com> | 2019-12-03 15:15:08 +0100 |
---|---|---|
committer | Boris Brezillon <boris.brezillon@collabora.com> | 2019-12-09 10:03:01 +0100 |
commit | 05193dc38197021894b17239fafbd2eb1afe5a45 (patch) | |
tree | ae8656cacf3a21e180c0a9a920c3d661550032a3 /drivers/gpu/drm/drm_encoder.c | |
parent | 35a61fe9218a9d32a93447bdcca1d0f167cd0433 (diff) | |
download | linux-05193dc38197021894b17239fafbd2eb1afe5a45.tar.gz linux-05193dc38197021894b17239fafbd2eb1afe5a45.tar.bz2 linux-05193dc38197021894b17239fafbd2eb1afe5a45.zip |
drm/bridge: Make the bridge chain a double-linked list
So that each element in the chain can easily access its predecessor.
This will be needed to support bus format negotiation between elements
of the bridge chain.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191203141515.3597631-5-boris.brezillon@collabora.com
Diffstat (limited to 'drivers/gpu/drm/drm_encoder.c')
-rw-r--r-- | drivers/gpu/drm/drm_encoder.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/drivers/gpu/drm/drm_encoder.c b/drivers/gpu/drm/drm_encoder.c index a2cc7e7241a9..e555281f43d4 100644 --- a/drivers/gpu/drm/drm_encoder.c +++ b/drivers/gpu/drm/drm_encoder.c @@ -140,6 +140,7 @@ int drm_encoder_init(struct drm_device *dev, goto out_put; } + INIT_LIST_HEAD(&encoder->bridge_chain); list_add_tail(&encoder->head, &dev->mode_config.encoder_list); encoder->index = dev->mode_config.num_encoder++; @@ -160,23 +161,16 @@ EXPORT_SYMBOL(drm_encoder_init); void drm_encoder_cleanup(struct drm_encoder *encoder) { struct drm_device *dev = encoder->dev; + struct drm_bridge *bridge, *next; /* Note that the encoder_list is considered to be static; should we * remove the drm_encoder at runtime we would have to decrement all * the indices on the drm_encoder after us in the encoder_list. */ - if (encoder->bridge) { - struct drm_bridge *bridge; - struct drm_bridge *next; - - bridge = drm_bridge_chain_get_first_bridge(encoder); - while (bridge) { - next = drm_bridge_get_next_bridge(bridge); - drm_bridge_detach(bridge); - bridge = next; - } - } + list_for_each_entry_safe(bridge, next, &encoder->bridge_chain, + chain_node) + drm_bridge_detach(bridge); drm_mode_object_unregister(dev, &encoder->base); kfree(encoder->name); |