All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Heiko Stübner" <heiko@sntech.de>
To: dri-devel@lists.freedesktop.org, Dave Airlie <airlied@gmail.com>
Cc: Andy Yan <andy.yan@rock-chips.com>,
	Ajay Kumar <ajaykumar.rs@samsung.com>
Subject: [PATCH] drm/bridge: dw_hdmi: adapt to updated bridge API
Date: Mon, 26 Jan 2015 14:12:02 +0100	[thread overview]
Message-ID: <2147669.MYb46qfbGd@diego> (raw)

Commits 8eb17f05bc18 ("drm/bridge: do not pass drm_bridge_funcs to
drm_bridge_init") and fbc4572e9c48 ("drm/bridge: make bridge registration
independent of drm flow") changed the bridge API without taking into account
the also newly introduced dw_hdmi bridge.

Therefore adapt the dw_hdmi bridge to the new bridge API.

The bridge struct is already allocated using devm_kzalloc, so the destroy
function can go away completely.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
---
Tested on a rk3288-firefly board

 drivers/gpu/drm/bridge/dw_hdmi.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/bridge/dw_hdmi.c b/drivers/gpu/drm/bridge/dw_hdmi.c
index 4cc4569..37e8711 100644
--- a/drivers/gpu/drm/bridge/dw_hdmi.c
+++ b/drivers/gpu/drm/bridge/dw_hdmi.c
@@ -1373,12 +1373,6 @@ static void dw_hdmi_bridge_enable(struct drm_bridge *bridge)
 	dw_hdmi_poweron(hdmi);
 }
 
-static void dw_hdmi_bridge_destroy(struct drm_bridge *bridge)
-{
-	drm_bridge_cleanup(bridge);
-	kfree(bridge);
-}
-
 static void dw_hdmi_bridge_nop(struct drm_bridge *bridge)
 {
 	/* do nothing */
@@ -1468,7 +1462,6 @@ struct drm_bridge_funcs dw_hdmi_bridge_funcs = {
 	.post_disable = dw_hdmi_bridge_nop,
 	.mode_set = dw_hdmi_bridge_mode_set,
 	.mode_fixup = dw_hdmi_bridge_mode_fixup,
-	.destroy = dw_hdmi_bridge_destroy,
 };
 
 static irqreturn_t dw_hdmi_hardirq(int irq, void *dev_id)
@@ -1532,7 +1525,15 @@ static int dw_hdmi_register(struct drm_device *drm, struct dw_hdmi *hdmi)
 	hdmi->bridge = bridge;
 	bridge->driver_private = hdmi;
 
-	ret = drm_bridge_init(drm, bridge, &dw_hdmi_bridge_funcs);
+	bridge->funcs = &dw_hdmi_bridge_funcs;
+	bridge->of_node = hdmi->dev->of_node;
+	ret = drm_bridge_add(bridge);
+	if (ret) {
+		DRM_ERROR("Failed to add bridge\n");
+		return ret;
+	}
+
+	ret = drm_bridge_attach(drm, bridge);
 	if (ret) {
 		DRM_ERROR("Failed to initialize bridge with drm\n");
 		return -EINVAL;
@@ -1700,6 +1701,8 @@ void dw_hdmi_unbind(struct device *dev, struct device *master, void *data)
 	hdmi->connector.funcs->destroy(&hdmi->connector);
 	hdmi->encoder->funcs->destroy(hdmi->encoder);
 
+	drm_bridge_remove(hdmi->encoder->bridge);
+
 	clk_disable_unprepare(hdmi->iahb_clk);
 	clk_disable_unprepare(hdmi->isfr_clk);
 	i2c_put_adapter(hdmi->ddc);
-- 
2.1.1


_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

             reply	other threads:[~2015-01-26 13:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-26 13:12 Heiko Stübner [this message]
2015-01-26 23:19 ` [PATCH] drm/bridge: dw_hdmi: adapt to updated bridge API Dave Airlie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2147669.MYb46qfbGd@diego \
    --to=heiko@sntech.de \
    --cc=airlied@gmail.com \
    --cc=ajaykumar.rs@samsung.com \
    --cc=andy.yan@rock-chips.com \
    --cc=dri-devel@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.