From patchwork Tue Apr 24 15:51:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jyri Sarha X-Patchwork-Id: 134126 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp2401412lji; Tue, 24 Apr 2018 08:51:45 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+ahIldN4nl/3quRVTI66rf11x298E1fd+GILGc9D6zPnytSoDsiGzLFlxL/KnnK3nI8Ewy X-Received: by 2002:a17:902:7841:: with SMTP id e1-v6mr25743619pln.197.1524585105111; Tue, 24 Apr 2018 08:51:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524585105; cv=none; d=google.com; s=arc-20160816; b=DH0yrmJqFs6q7UnnEXcgX+5aFE/3jB8IBVsHbjNWznd2xP9USQq7tYFd96kZCCaNdX snINcKmA6FxG9GdBIE0YLBo9vSl8b4FihrSIVTCbq+xXsKzrDGx6U4CNDalS4l2EDk67 MqBdsOw8X7prsLN5LKrLmYqwx58MmUozY0eDeGIhtiLJUZyHJl2B6pdYWZ0KF1J15tT0 3TuS8dcU6epx8BZKqJAM322ds9FzYPvBAPUH2JDVGJmQ12PgXQ56VhWP7VKIYXTOCvBa 4CVNvgjYCdoc+NAm3U1QLniJgpPDHJz/7KqXH8MZR2MGLuMw95sX9cdoF/wHRNU7I5sG lf4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:delivered-to :arc-authentication-results; bh=uO7lktnL+XQBGZHOueUyDfI2vUxThmqmTVZkDqLeDNw=; b=lizAaGswoZFGrgH+w/PV+BQyIhqtMM7Q0fxjsLmlJJjM6TKAb7UMovMQFBJUSaNpB3 VrncCeHqx7kFP6JVUjripC8481PxRabSgIuis5Pj2MjMH4f13t0ZCUAsZ2EWbFcSk/Hy dngU/71xtWqRJKWFInbWAX/wPqREJYq3r/PLuZ2rcLm3xP3jF+/h1rGTj+j81Tc/AoL8 oHAJ7zmcWXU1f3MRlP+1FGoe8gaHCN0VVmB9zvrxfyceDdzi0I8LSD+3LIMBab6tMQ/V Oq7HM08uX72iYCKiUZ4zX6TbwxN3QZZofjlXsMQy9ZrILQPGgBPhuXod5Mrzwtvpz+wX pxow== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=eyUZ5rbL; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id a10si11488911pgq.272.2018.04.24.08.51.44 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 24 Apr 2018 08:51:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=eyUZ5rbL; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0874C6E419; Tue, 24 Apr 2018 15:51:44 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from fllnx210.ext.ti.com (fllnx210.ext.ti.com [198.47.19.17]) by gabe.freedesktop.org (Postfix) with ESMTPS id D93786E41A for ; Tue, 24 Apr 2018 15:51:42 +0000 (UTC) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by fllnx210.ext.ti.com (8.15.1/8.15.1) with ESMTP id w3OFpJH8003436; Tue, 24 Apr 2018 10:51:19 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1524585079; bh=ATbU6zVMeuctYXGDAIZO6SIfA/I5qUk4ra5SNHD79fU=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=eyUZ5rbLZ5EF2m0Fa9YSbtk68XfOzVWXgHdowsnP3L7okDFtK2tcxhczem/SOXz3M bk0P6U2t44ox09q1/jEj5xOyxz51SsTj3opOsHuqfQgeLV0oimRD4/IsUuB1r56U2R zThUt47e1Ves0ZDKixrC632bGkriQfF1R/MQu1yc= Received: from DFLE113.ent.ti.com (dfle113.ent.ti.com [10.64.6.34]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w3OFpJOw007375; Tue, 24 Apr 2018 10:51:19 -0500 Received: from DFLE104.ent.ti.com (10.64.6.25) by DFLE113.ent.ti.com (10.64.6.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Tue, 24 Apr 2018 10:51:18 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE104.ent.ti.com (10.64.6.25) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1466.3 via Frontend Transport; Tue, 24 Apr 2018 10:51:18 -0500 Received: from jadmar.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w3OFpDwC022588; Tue, 24 Apr 2018 10:51:16 -0500 From: Jyri Sarha To: Subject: [PATCH v3 1/2] drm/panel: Remove drm_panel_detach() calls from all panel drives Date: Tue, 24 Apr 2018 18:51:07 +0300 Message-ID: <4653f2fae86c817144204ee2f9ac704b3c823c45.1524576910.git.jsarha@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: airlied@linux.ie, linux@armlinux.org.uk, Jyri Sarha , tomi.valkeinen@ti.com, thierry.reding@gmail.com, laurent.pinchart@ideasonboard.com, peda@axentia.se Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Remove all drm_panel_detach() calls from all panel drives update the kernel doc for drm_panel_detach(). Setting the connector and drm to NULL when the drm panel device is going away hardly serves any purpose. Usually the the whole memory structure is freed right after the remove call. However, calling the detach function from the master drm device, and setting the connector pointer to NULL, has the logic of marking the panel again as available for another drm master to attach. The usual situation would be the same drm master device binding again. Signed-off-by: Jyri Sarha Reviewed-by: Daniel Vetter --- drivers/gpu/drm/drm_panel.c | 4 ++++ drivers/gpu/drm/panel/panel-innolux-p079zca.c | 1 - drivers/gpu/drm/panel/panel-jdi-lt070me05000.c | 1 - drivers/gpu/drm/panel/panel-lvds.c | 1 - drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c | 1 - drivers/gpu/drm/panel/panel-seiko-43wvf1g.c | 1 - drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c | 1 - drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c | 1 - drivers/gpu/drm/panel/panel-simple.c | 1 - drivers/gpu/drm/panel/panel-sitronix-st7789v.c | 1 - 10 files changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c index 308d442..29d2c74 100644 --- a/drivers/gpu/drm/drm_panel.c +++ b/drivers/gpu/drm/drm_panel.c @@ -115,6 +115,10 @@ EXPORT_SYMBOL(drm_panel_attach); * Detaches a panel from the connector it is attached to. If a panel is not * attached to any connector this is effectively a no-op. * + * NOTE: This function should not be called by the panel device + * itself. It is only for the drm device that called the + * drm_panel_attach(). + * * Return: 0 on success or a negative error code on failure. */ int drm_panel_detach(struct drm_panel *panel) diff --git a/drivers/gpu/drm/panel/panel-innolux-p079zca.c b/drivers/gpu/drm/panel/panel-innolux-p079zca.c index 57df39b..bb53e08 100644 --- a/drivers/gpu/drm/panel/panel-innolux-p079zca.c +++ b/drivers/gpu/drm/panel/panel-innolux-p079zca.c @@ -292,7 +292,6 @@ static int innolux_panel_remove(struct mipi_dsi_device *dsi) DRM_DEV_ERROR(&dsi->dev, "failed to detach from DSI host: %d\n", err); - drm_panel_detach(&innolux->base); innolux_panel_del(innolux); return 0; diff --git a/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c b/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c index 0a94ab7..99caa78 100644 --- a/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c +++ b/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c @@ -500,7 +500,6 @@ static int jdi_panel_remove(struct mipi_dsi_device *dsi) dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", ret); - drm_panel_detach(&jdi->base); jdi_panel_del(jdi); return 0; diff --git a/drivers/gpu/drm/panel/panel-lvds.c b/drivers/gpu/drm/panel/panel-lvds.c index 5185819..8a16878 100644 --- a/drivers/gpu/drm/panel/panel-lvds.c +++ b/drivers/gpu/drm/panel/panel-lvds.c @@ -282,7 +282,6 @@ static int panel_lvds_remove(struct platform_device *pdev) { struct panel_lvds *lvds = dev_get_drvdata(&pdev->dev); - drm_panel_detach(&lvds->panel); drm_panel_remove(&lvds->panel); panel_lvds_disable(&lvds->panel); diff --git a/drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c b/drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c index 74a8061..cb4dfb9 100644 --- a/drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c +++ b/drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c @@ -299,7 +299,6 @@ static int wuxga_nt_panel_remove(struct mipi_dsi_device *dsi) if (ret < 0) dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", ret); - drm_panel_detach(&wuxga_nt->base); wuxga_nt_panel_del(wuxga_nt); return 0; diff --git a/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c b/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c index 71c09ed..75f9253 100644 --- a/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c +++ b/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c @@ -292,7 +292,6 @@ static int seiko_panel_remove(struct platform_device *pdev) { struct seiko_panel *panel = dev_get_drvdata(&pdev->dev); - drm_panel_detach(&panel->base); drm_panel_remove(&panel->base); seiko_panel_disable(&panel->base); diff --git a/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c b/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c index 6bf8730..02fc0f5 100644 --- a/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c +++ b/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c @@ -418,7 +418,6 @@ static int sharp_panel_remove(struct mipi_dsi_device *dsi) if (err < 0) dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", err); - drm_panel_detach(&sharp->base); sharp_panel_del(sharp); return 0; diff --git a/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c b/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c index 494aa9b..e5cae00 100644 --- a/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c +++ b/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c @@ -327,7 +327,6 @@ static int sharp_nt_panel_remove(struct mipi_dsi_device *dsi) if (ret < 0) dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", ret); - drm_panel_detach(&sharp_nt->base); sharp_nt_panel_del(sharp_nt); return 0; diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c index f2d96611..9388acf 100644 --- a/drivers/gpu/drm/panel/panel-simple.c +++ b/drivers/gpu/drm/panel/panel-simple.c @@ -364,7 +364,6 @@ static int panel_simple_remove(struct device *dev) { struct panel_simple *panel = dev_get_drvdata(dev); - drm_panel_detach(&panel->base); drm_panel_remove(&panel->base); panel_simple_disable(&panel->base); diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c index 358c64e..74284e5 100644 --- a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c +++ b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c @@ -419,7 +419,6 @@ static int st7789v_remove(struct spi_device *spi) { struct st7789v *ctx = spi_get_drvdata(spi); - drm_panel_detach(&ctx->panel); drm_panel_remove(&ctx->panel); if (ctx->backlight) From patchwork Tue Apr 24 15:51:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jyri Sarha X-Patchwork-Id: 134783 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp4976023lji; Tue, 1 May 2018 06:44:37 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpIuvplt6UzAfuxHsWuGCjaUsn3NHmuychjuuZbATn5stI4CmtUGvtnpMMUXz+POqDcJWw0 X-Received: by 2002:a17:902:9a4b:: with SMTP id x11-v6mr1401893plv.176.1525182277823; Tue, 01 May 2018 06:44:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525182277; cv=none; d=google.com; s=arc-20160816; b=TlSn2d9xJnJ/Bo0V3KpwcYVdXyXZ6SMhtYPLoCxyiGBaMAz6GW6JDKqOMjWGhWr9Xn qecIVt8tlKRmuhGvQ9boFw5hYQKOG+BkWyaDjEl+weeJbyFLTdiHsKFeVjuv6BY1+5zR p+5TkvjljQRxzsad3zSHIiF/ZNk1TvhQtC7qkYWeTUdojtUrLTjCpsfBd6d7+KWnHPAT bncg+r2A6o3ahNaFvDIFZndUrcTFzhRuG/L1t7HPeul2B+VSnL9jCRbkolLEOajiE7p/ gv7N41nRNmAb8U+4b3RH7+lTzvSguCfwt7c/E6pXQkDR9mlnAe0hLO6ACxPQK73PhUPt sVbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:delivered-to :arc-authentication-results; bh=+EKWksz38MUsqc5Boi0W28pTXmZ/Y79OqdrWMoaIcu0=; b=ShSnU9K7KzcxSVnkWzbIx20oj8aZIffS6tj8/iEge9Q2B1ugplus6WCb+oGHbZkP2s V3nYz1PmlPeAHVLzyG2bXI3YJsgDjKrneEw9OqLhJzv9BK08XWg2CyW6p0a5OGSLniBt KC5JiDH3toTzWEQ9cILekB3nitThkl9yOZ4mNRz0B7zJ01xZC5ReuX0+XA6KonBzVpbG 39yKxOO3ZTMqScup9lfC6wdx/sE9+cxc/m1YoAv3gmzILDi4LaBfdmJg/Ncj7jLa7Dma MEtFI4zVEHkvfm142K6pY123YtQQMq07tNNWEkH+iKAxZGfKUrs9Bs68BfEnF6XZ+DS0 noow== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=nWCFiDg0; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id o18si9665005pfa.346.2018.05.01.06.44.37 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 01 May 2018 06:44:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=nWCFiDg0; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EA46289823; Tue, 1 May 2018 13:44:35 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from lelnx193.ext.ti.com (lelnx193.ext.ti.com [198.47.27.77]) by gabe.freedesktop.org (Postfix) with ESMTPS id F315B89811 for ; Tue, 1 May 2018 13:44:34 +0000 (UTC) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by lelnx193.ext.ti.com (8.15.1/8.15.1) with ESMTP id w3OFpLje027809; Tue, 24 Apr 2018 10:51:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1524585081; bh=w1XQeNxwavyMx+skbuHv8AY2LkEckcCEzargXPM32LY=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=nWCFiDg03KF1+N6r8F9mJ1pgC7UIjM2tL37vcV78J5DJdbfWQ0qS9ecXSDl62zzCw Zodk2wTdN5YmmS3pBqfvTaJmwqCFtXYu5CBk+vT2TfKFSUKCE2YrbYPcr9X8v6VF7D w8dg9hYwI3pgnaBhK0Sgu+ocR/dGP5iwU6TzY90c= Received: from DLEE113.ent.ti.com (dlee113.ent.ti.com [157.170.170.24]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w3OFpLau007420; Tue, 24 Apr 2018 10:51:21 -0500 Received: from DLEE100.ent.ti.com (157.170.170.30) by DLEE113.ent.ti.com (157.170.170.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Tue, 24 Apr 2018 10:51:21 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DLEE100.ent.ti.com (157.170.170.30) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1466.3 via Frontend Transport; Tue, 24 Apr 2018 10:51:21 -0500 Received: from jadmar.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w3OFpDwD022588; Tue, 24 Apr 2018 10:51:19 -0500 From: Jyri Sarha To: Subject: [PATCH v3 2/2] drm/panel: Add device_link from panel device to drm device Date: Tue, 24 Apr 2018 18:51:08 +0300 Message-ID: <0ff9cd8d5ee3156e0bcdcc0483a251ce8ccc89e4.1524576910.git.jsarha@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: airlied@linux.ie, linux@armlinux.org.uk, Jyri Sarha , tomi.valkeinen@ti.com, thierry.reding@gmail.com, laurent.pinchart@ideasonboard.com, peda@axentia.se Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Add device_link from panel device (supplier) to drm device (consumer) when drm_panel_attach() is called. This patch should protect the master drm driver if an attached panel driver unbinds while it is in use. The device_link should make sure the drm device is unbound before the panel driver becomes unavailable. The device_link is removed when drm_panel_detach() is called. The drm_panel_detach() should be called by the consumer DRM driver, not the panel driver, otherwise both drivers are racing to delete the same link. Signed-off-by: Jyri Sarha Reviewed-by: Eric Anholt --- drivers/gpu/drm/drm_panel.c | 10 ++++++++++ include/drm/drm_panel.h | 1 + 2 files changed, 11 insertions(+) diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c index 29d2c74..7474045 100644 --- a/drivers/gpu/drm/drm_panel.c +++ b/drivers/gpu/drm/drm_panel.c @@ -24,6 +24,7 @@ #include #include +#include #include #include @@ -101,6 +102,13 @@ int drm_panel_attach(struct drm_panel *panel, struct drm_connector *connector) if (panel->connector) return -EBUSY; + panel->link = device_link_add(connector->dev->dev, panel->dev, 0); + if (!panel->link) { + dev_err(panel->dev, "failed to link panel to %s\n", + dev_name(connector->dev->dev)); + return -EINVAL; + } + panel->connector = connector; panel->drm = connector->dev; @@ -123,6 +131,8 @@ EXPORT_SYMBOL(drm_panel_attach); */ int drm_panel_detach(struct drm_panel *panel) { + device_link_del(panel->link); + panel->connector = NULL; panel->drm = NULL; diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h index 14ac240..26a1b5f 100644 --- a/include/drm/drm_panel.h +++ b/include/drm/drm_panel.h @@ -89,6 +89,7 @@ struct drm_panel { struct drm_device *drm; struct drm_connector *connector; struct device *dev; + struct device_link *link; const struct drm_panel_funcs *funcs;