aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_bridge.c
diff options
context:
space:
mode:
authorAndrea Merello <andrea.merello@gmail.com>2016-08-25 05:04:32 -0400
committerArchit Taneja <architt@codeaurora.org>2016-08-28 23:43:00 -0400
commitcf3bef95e1014233cb1ce89da8cfa5cd22e7412c (patch)
treeaa79bd6123a9669499178ee470ec3bd333b486bd /drivers/gpu/drm/drm_bridge.c
parent6dcf0de7ef10244b17442f47956a1d9fabe2abe1 (diff)
drm/bridge: introduce bridge detaching mechanism
Up to now, once a bridge has been attached to a DRM device, it cannot be undone. In particular you couldn't rmmod/insmod a DRM driver that uses a bridge, because the bridge would remain bound to the first (dead) driver instance. This patch fixes this by introducing drm_encoder_detach() and a ->detach callback in drm_bridge_funcs for the bridge to be notified about detaches. It's DRM/KMS driver responsibility to call drm_encoder_detach(). While adding the bridge detach callback, with its kerneldoc, I also added kerneldoc for attach callback. Few other kerneldocs fixes around there are included. Suggested-by: Daniel Vetter <daniel@ffwll.ch> Suggested-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Andrea Merello <andrea.merello@gmail.com> Cc: Archit Taneja <architt@codeaurora.org> Cc: David Airlie <airlied@linux.ie> Cc: Daniel Vetter <daniel@ffwll.ch> Cc: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Archit Taneja <architt@codeaurora.org> Link: http://patchwork.freedesktop.org/patch/msgid/1472115874-6219-1-git-send-email-andrea.merello@gmail.com
Diffstat (limited to 'drivers/gpu/drm/drm_bridge.c')
-rw-r--r--drivers/gpu/drm/drm_bridge.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c
index 255543086590..484046664d6c 100644
--- a/drivers/gpu/drm/drm_bridge.c
+++ b/drivers/gpu/drm/drm_bridge.c
@@ -98,11 +98,11 @@ EXPORT_SYMBOL(drm_bridge_remove);
98 * @dev: DRM device 98 * @dev: DRM device
99 * @bridge: bridge control structure 99 * @bridge: bridge control structure
100 * 100 *
101 * called by a kms driver to link one of our encoder/bridge to the given 101 * Called by a kms driver to link one of our encoder/bridge to the given
102 * bridge. 102 * bridge.
103 * 103 *
104 * Note that setting up links between the bridge and our encoder/bridge 104 * Note that setting up links between the bridge and our encoder/bridge
105 * objects needs to be handled by the kms driver itself 105 * objects needs to be handled by the kms driver itself.
106 * 106 *
107 * RETURNS: 107 * RETURNS:
108 * Zero on success, error code on failure 108 * Zero on success, error code on failure
@@ -125,6 +125,31 @@ int drm_bridge_attach(struct drm_device *dev, struct drm_bridge *bridge)
125EXPORT_SYMBOL(drm_bridge_attach); 125EXPORT_SYMBOL(drm_bridge_attach);
126 126
127/** 127/**
128 * drm_bridge_detach - deassociate given bridge from its DRM device
129 *
130 * @bridge: bridge control structure
131 *
132 * Called by a kms driver to unlink the given bridge from its DRM device.
133 *
134 * Note that tearing down links between the bridge and our encoder/bridge
135 * objects needs to be handled by the kms driver itself.
136 */
137void drm_bridge_detach(struct drm_bridge *bridge)
138{
139 if (WARN_ON(!bridge))
140 return;
141
142 if (WARN_ON(!bridge->dev))
143 return;
144
145 if (bridge->funcs->detach)
146 bridge->funcs->detach(bridge);
147
148 bridge->dev = NULL;
149}
150EXPORT_SYMBOL(drm_bridge_detach);
151
152/**
128 * DOC: bridge callbacks 153 * DOC: bridge callbacks
129 * 154 *
130 * The &drm_bridge_funcs ops are populated by the bridge driver. The DRM 155 * The &drm_bridge_funcs ops are populated by the bridge driver. The DRM