From 384764c3611645d96889742a079168c86a6fc4c4 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 27 Jan 2015 09:37:03 +1000 Subject: [PATCH] drm/sti: fixup for bridge interface So sti doesn't build because the bridge interfaces changes didn't catch up to its new DVO driver. Now I might just carry this patch, but I might just push the bridge pull into a side-pull until someone resolves it. So this might not be the right solution to the problem, so please figure it out and let me know ASAP. Signed-off-by: Dave Airlie Signed-off-by: Thierry Reding --- drivers/gpu/drm/sti/sti_dvo.c | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/sti/sti_dvo.c b/drivers/gpu/drm/sti/sti_dvo.c index 651afad..aeb5070 100644 --- a/drivers/gpu/drm/sti/sti_dvo.c +++ b/drivers/gpu/drm/sti/sti_dvo.c @@ -91,6 +91,7 @@ struct sti_dvo { struct dvo_config *config; bool enabled; struct drm_encoder *encoder; + struct drm_bridge *bridge; }; struct sti_dvo_connector { @@ -272,19 +273,12 @@ static void sti_dvo_bridge_nope(struct drm_bridge *bridge) /* do nothing */ } -static void sti_dvo_brigde_destroy(struct drm_bridge *bridge) -{ - drm_bridge_cleanup(bridge); - kfree(bridge); -} - static const struct drm_bridge_funcs sti_dvo_bridge_funcs = { .pre_enable = sti_dvo_pre_enable, .enable = sti_dvo_bridge_nope, .disable = sti_dvo_disable, .post_disable = sti_dvo_bridge_nope, .mode_set = sti_dvo_set_mode, - .destroy = sti_dvo_brigde_destroy, }; static int sti_dvo_connector_get_modes(struct drm_connector *connector) @@ -416,8 +410,21 @@ static int sti_dvo_bind(struct device *dev, struct device *master, void *data) return -ENOMEM; bridge->driver_private = dvo; - drm_bridge_init(drm_dev, bridge, &sti_dvo_bridge_funcs); + bridge->funcs = &sti_dvo_bridge_funcs; + bridge->of_node = dvo->dev.of_node; + err = drm_bridge_add(bridge); + if (err) { + DRM_ERROR("Failed to add bridge\n"); + return err; + } + err = drm_bridge_attach(drm_dev, bridge); + if (err) { + DRM_ERROR("Failed to attach bridge\n"); + return err; + } + + dvo->bridge = bridge; encoder->bridge = bridge; connector->encoder = encoder; dvo->encoder = encoder; @@ -446,7 +453,7 @@ static int sti_dvo_bind(struct device *dev, struct device *master, void *data) err_sysfs: drm_connector_unregister(drm_connector); err_connector: - drm_bridge_cleanup(bridge); + drm_bridge_remove(bridge); drm_connector_cleanup(drm_connector); return -EINVAL; } @@ -454,7 +461,9 @@ err_connector: static void sti_dvo_unbind(struct device *dev, struct device *master, void *data) { - /* do nothing */ + struct sti_dvo *dvo = dev_get_drvdata(dev); + + drm_bridge_remove(dvo->bridge); } static const struct component_ops sti_dvo_ops = { -- 2.7.4