From patchwork Thu Dec 1 15:52:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jyri Sarha X-Patchwork-Id: 9456487 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CAE1160756 for ; Thu, 1 Dec 2016 15:52:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BF3A3284FB for ; Thu, 1 Dec 2016 15:52:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B452F284F9; Thu, 1 Dec 2016 15:52:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4C2B7284FB for ; Thu, 1 Dec 2016 15:52:31 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D42576E7A4; Thu, 1 Dec 2016 15:52:20 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from lelnx194.ext.ti.com (lelnx194.ext.ti.com [198.47.27.80]) by gabe.freedesktop.org (Postfix) with ESMTPS id 56E7C6E7A4 for ; Thu, 1 Dec 2016 15:52:17 +0000 (UTC) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by lelnx194.ext.ti.com (8.15.1/8.15.1) with ESMTP id uB1FqEuQ016205; Thu, 1 Dec 2016 09:52:14 -0600 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id uB1FqEGh026436; Thu, 1 Dec 2016 09:52:14 -0600 Received: from dlep32.itg.ti.com (157.170.170.100) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.3.294.0; Thu, 1 Dec 2016 09:52:13 -0600 Received: from jadmar.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id uB1Fq8Bg020069; Thu, 1 Dec 2016 09:52:12 -0600 From: Jyri Sarha To: Subject: [PATCH RFC 2/3] drm/bridge: ti-tfp410: Adapt to bridge object and module refcounting Date: Thu, 1 Dec 2016 17:52:05 +0200 Message-ID: <04ef63804ffce4c51a17cf8d3e8dbe1bdcd6c3ce.1480603126.git.jsarha@ti.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: References: MIME-Version: 1.0 Cc: Jyri Sarha , tomi.valkeinen@ti.com, laurent.pinchart@ideasonboard.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Jyri Sarha --- drivers/gpu/drm/bridge/ti-tfp410.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/bridge/ti-tfp410.c b/drivers/gpu/drm/bridge/ti-tfp410.c index b054ea3..f0c81dd 100644 --- a/drivers/gpu/drm/bridge/ti-tfp410.c +++ b/drivers/gpu/drm/bridge/ti-tfp410.c @@ -19,7 +19,7 @@ #include struct tfp410 { - struct drm_bridge bridge; + struct drm_bridge *bridge; struct drm_connector connector; struct i2c_adapter *ddc; @@ -30,7 +30,7 @@ struct tfp410 { static inline struct tfp410 * drm_bridge_to_tfp410(struct drm_bridge *bridge) { - return container_of(bridge, struct tfp410, bridge); + return bridge->driver_private; } static inline struct tfp410 * @@ -171,16 +171,18 @@ static int tfp410_init(struct device *dev) if (!dvi) return -ENOMEM; dev_set_drvdata(dev, dvi); + dvi->bridge = drm_bridge_alloc(THIS_MODULE); + dvi->bridge->driver_private = dvi; - dvi->bridge.funcs = &tfp410_bridge_funcs; - dvi->bridge.of_node = dev->of_node; + dvi->bridge->funcs = &tfp410_bridge_funcs; + dvi->bridge->of_node = dev->of_node; dvi->dev = dev; ret = tfp410_get_connector_ddc(dvi); if (ret) goto fail; - ret = drm_bridge_add(&dvi->bridge); + ret = drm_bridge_add(dvi->bridge); if (ret) { dev_err(dev, "drm_bridge_add() failed: %d\n", ret); goto fail; @@ -196,11 +198,13 @@ static int tfp410_fini(struct device *dev) { struct tfp410 *dvi = dev_get_drvdata(dev); - drm_bridge_remove(&dvi->bridge); + drm_bridge_remove(dvi->bridge); if (dvi->ddc) i2c_put_adapter(dvi->ddc); + drm_bridge_put(dvi->bridge); + return 0; }