From 6c0f0536214ab1934a0987625217b5e58d621b93 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Tue, 17 Jan 2017 10:28:54 +0200 Subject: [PATCH] UPSTREAM: drm: bridge: dw-hdmi: Embed drm_bridge in struct dw_hdmi The drm_bridge instance is always needed, there's no point in allocating it separately. Signed-off-by: Laurent Pinchart Reviewed-by: Jose Abreu Signed-off-by: Archit Taneja Link: http://patchwork.freedesktop.org/patch/msgid/20170117082910.27023-5-laurent.pinchart+renesas@ideasonboard.com Change-Id: Iba5ca73877c3611148af51c0993276eac982bb3e Signed-off-by: Zheng Yang (cherry pick from 70c963ec4f15a13197524611875168f23acc4a97) --- drivers/gpu/drm/bridge/dw-hdmi.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/bridge/dw-hdmi.c b/drivers/gpu/drm/bridge/dw-hdmi.c index 9f822a7ac8d7..3ec4d712c5b8 100644 --- a/drivers/gpu/drm/bridge/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/dw-hdmi.c @@ -183,7 +183,7 @@ struct dw_hdmi_i2c { struct dw_hdmi { struct drm_connector connector; struct drm_encoder *encoder; - struct drm_bridge *bridge; + struct drm_bridge bridge; struct platform_device *audio; enum dw_hdmi_devtype dev_type; @@ -291,7 +291,7 @@ static void repo_hpd_event(struct work_struct *p_work) { struct dw_hdmi *hdmi = container_of(p_work, struct dw_hdmi, work.work); - drm_helper_hpd_irq_event(hdmi->bridge->dev); + drm_helper_hpd_irq_event(hdmi->bridge.dev); #ifdef CONFIG_SWITCH if (hdmi->hpd_state) switch_set_state(&hdmi->switchdev, 1); @@ -2222,16 +2222,9 @@ static irqreturn_t dw_hdmi_irq(int irq, void *dev_id) static int dw_hdmi_register(struct drm_device *drm, struct dw_hdmi *hdmi) { struct drm_encoder *encoder = hdmi->encoder; - struct drm_bridge *bridge; + struct drm_bridge *bridge = &hdmi->bridge; int ret; - bridge = devm_kzalloc(drm->dev, sizeof(*bridge), GFP_KERNEL); - if (!bridge) { - DRM_ERROR("Failed to allocate drm bridge\n"); - return -ENOMEM; - } - - hdmi->bridge = bridge; bridge->driver_private = hdmi; bridge->funcs = &dw_hdmi_bridge_funcs; ret = drm_bridge_attach(drm, bridge); -- 2.34.1