From patchwork Fri Aug 4 10:48:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 131143 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:44a:b0:3f2:4152:657d with SMTP id ez10csp233243vqb; Fri, 4 Aug 2023 05:41:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFeftkPfXTlp+mN79Sz0Dyu1BBbb62hB0eIjyWPcVGe3wwkhtIYzhvSJYijf6m/LhGyO9mm X-Received: by 2002:a05:6a21:9992:b0:138:198f:6edf with SMTP id ve18-20020a056a21999200b00138198f6edfmr2305448pzb.46.1691152903335; Fri, 04 Aug 2023 05:41:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691152903; cv=none; d=google.com; s=arc-20160816; b=x1dSYSm18l01cUvuqUaYx6FzRz1lj+nY1i9X08VdJ1Av3YJknl2upT9Te88uOMMGzF psMw81P3JfrGhGNFP8gyFmbXc3AhQ05RtYYq1sq8aLfsi/j/O4Z72/vVTDg8uYg9NSKA ZjKFHYt1d3HfGqjhnb/ytbTHzCdZoG00LDvJd3avEvs+EMFlwIliOOVxapm0ZtlPY0Nq q+9P8bhU99x/oN2fULcX/3Bf1mm+kq9dhYANMZRgLWm9I7LJdI3IPiS3Ux85u0ynQaqH qARN0rSOPQH6XFh52XzHrKBDlNyvtBxfavqlyJsy3paC8IASTz+37w1iT66tvVEH9wXO HYsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=Rwd5cFC56uPpCrYVdbY9ff+V/SIK3O+6evrnpQhFU7Q=; fh=ZOGtXHfkWMH/uI/XcDfhJQNKxcvOVtHiIbcBRd7ipUs=; b=c1GImQUDOJhM5gJomTlRbsfOuhU5uKweWZqwosEbIH4xJrMVI0G0JIxffGytFuV/Xz vHhcxEVHRwPCu9p+h/2Bt0WtfAzTCHdYzeBlsAmv/nqPigxL4YsQKefKnFQIb4XPbxUG 1xSHeKWYrlPJU412rkFMrzXwz0Zmwx3R1aUspwejdsGy4dOXjdt3xBNXXzxiByzkFGYc 11b79qedLDOvLpDXL9pErhUk1TWF33UHp99wBdUzcYMtGjgRK0mBeOtb3aBm5MGVEw0C VnrOVVjYBHBEUqyNDpkIAjmob2T0Qk6BVhteuMaROjQXljRlaLm554fmJ+ASVZTGI4ed Nqtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=eZPgyRl4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u6-20020a056a00158600b006874c4a7b6asi1767077pfk.29.2023.08.04.05.41.24; Fri, 04 Aug 2023 05:41:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=eZPgyRl4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229923AbjHDKuz (ORCPT + 99 others); Fri, 4 Aug 2023 06:50:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229598AbjHDKuZ (ORCPT ); Fri, 4 Aug 2023 06:50:25 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B3B7558B for ; Fri, 4 Aug 2023 03:48:32 -0700 (PDT) Received: from [127.0.1.1] (91-154-35-171.elisa-laajakaista.fi [91.154.35.171]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 419C112E4; Fri, 4 Aug 2023 12:47:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1691146045; bh=WPn1AxdTbVK2rBt8KyZ5pLuKTboKnk0kbLICj2/CxXg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=eZPgyRl4fhOR+GjfERv8LQ4n8rOr3iNptbLXIhIQn8p9LFWyICnMy95ykPXVxiygY HOPTHnB0hKxAmsNHrLl5HkvnmMwUnVsKZ+ZCqLfP1uOC0Bxhr6IXt1FWhqQUWfn2fO +Ivmo+m828wLDo5bb1YGVb7xhfTuj73DF+R0g9N4= From: Tomi Valkeinen Date: Fri, 04 Aug 2023 13:48:10 +0300 Subject: [PATCH 1/4] drm/bridge: lt8912b: Fix bridge_detach MIME-Version: 1.0 Message-Id: <20230804-lt8912b-v1-1-c542692c6a2f@ideasonboard.com> References: <20230804-lt8912b-v1-0-c542692c6a2f@ideasonboard.com> In-Reply-To: <20230804-lt8912b-v1-0-c542692c6a2f@ideasonboard.com> To: Adrien Grassein , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , David Airlie , Daniel Vetter , Francesco Dolcini , Stefan Eichenberger Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Tomi Valkeinen X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=2251; i=tomi.valkeinen@ideasonboard.com; h=from:subject:message-id; bh=WPn1AxdTbVK2rBt8KyZ5pLuKTboKnk0kbLICj2/CxXg=; b=owEBbQKS/ZANAwAIAfo9qoy8lh71AcsmYgBkzNd6CzQGoXs4vpPoOgcUqTbWmS76ZzxcS1XCy my0BlS41TaJAjMEAAEIAB0WIQTEOAw+ll79gQef86f6PaqMvJYe9QUCZMzXegAKCRD6PaqMvJYe 9To5D/96c/eG+8WqJSaQP/PFgeAK5pwqit3+cPaRGEwlYyyG66X1ZsQsfn8Dv0hTEyvTFi4bajt kylDxWgIMMg83AsbK15AgglIlbs4C6EQPQEDBdnawhQTG6VIr3RQ052k4nJi37NRs6enTbPOFfp 6lhf9RsXD5BXEjMk0hHUyV7wxbKvHMMcyoGU3/iRjsTmMPGlhfY9eJEBrFX1I96g+jqwYEjgHb0 4mmlfHL2V5O/Fss0b2K8DbND/7rJmUiICpfpUX/+FlTNjTx/UkUwW7ppA/y69U4kbe9GNSa5Nny vQ33WcfItsgYwSgTAeRs5FCCvYWe1TrM3dTPxjV7g31q3fvGF9t0+IG1mTPc98o3wRknlogBQ+D T0Az2AGczXGERLuHrfOk7k6PTk+OsJui5ES0ve/mk3nkQz3sbNgatiXAi3PxX/ItbJJN4UVuIFn Uk386nTJv2ZVyUqCVw6sbm47dCbTi9o7j55i/YoqoVVLY2RW8ey7w5tCnkoSZr+Fwgr2dZV6H+5 OV60X0aJeR7ze7zSh5GtfIEqQ9FKMKV4EfpaAM1gHXzOqWHnRfRA4fMgvuR84UZ9pJKPXV6lYbc cuOk3nZZh1hiotPRwqBkN1taHArTlGl2wjetqh3du9cxUkcDOZAP2beOI7gAoXkQO/CtEZtGk8a o2chkjn15jPTDDQ== X-Developer-Key: i=tomi.valkeinen@ideasonboard.com; a=openpgp; fpr=C4380C3E965EFD81079FF3A7FA3DAA8CBC961EF5 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_PASS,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773302347039843119 X-GMAIL-MSGID: 1773302347039843119 The driver calls lt8912_bridge_detach() from its lt8912_remove() function. As the DRM core detaches bridges automatically, this leads to calling lt8912_bridge_detach() twice. The code probably has tried to manage the double-call with the 'is_attached' variable, but the driver never sets the variable to false, so its of no help. Fix the issue by dropping the call to lt8912_bridge_detach() from lt8912_remove(), as the DRM core will handle the detach call for us, and also drop the useless is_attached field. Fixes: 88abfc2b9e61 ("drm/bridge: Introduce LT8912B DSI to HDMI bridge") Signed-off-by: Tomi Valkeinen Reviewed-by: Robert Foss --- drivers/gpu/drm/bridge/lontium-lt8912b.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/bridge/lontium-lt8912b.c b/drivers/gpu/drm/bridge/lontium-lt8912b.c index 4eaea67fb71c..0e581f6e3c88 100644 --- a/drivers/gpu/drm/bridge/lontium-lt8912b.c +++ b/drivers/gpu/drm/bridge/lontium-lt8912b.c @@ -45,7 +45,6 @@ struct lt8912 { u8 data_lanes; bool is_power_on; - bool is_attached; }; static int lt8912_write_init_config(struct lt8912 *lt) @@ -575,8 +574,6 @@ static int lt8912_bridge_attach(struct drm_bridge *bridge, if (ret) goto error; - lt->is_attached = true; - return 0; error: @@ -588,15 +585,13 @@ static void lt8912_bridge_detach(struct drm_bridge *bridge) { struct lt8912 *lt = bridge_to_lt8912(bridge); - if (lt->is_attached) { - lt8912_hard_power_off(lt); + lt8912_hard_power_off(lt); - if (lt->hdmi_port->ops & DRM_BRIDGE_OP_HPD) - drm_bridge_hpd_disable(lt->hdmi_port); + if (lt->hdmi_port->ops & DRM_BRIDGE_OP_HPD) + drm_bridge_hpd_disable(lt->hdmi_port); - drm_connector_unregister(<->connector); - drm_connector_cleanup(<->connector); - } + drm_connector_unregister(<->connector); + drm_connector_cleanup(<->connector); } static enum drm_connector_status @@ -750,7 +745,6 @@ static void lt8912_remove(struct i2c_client *client) { struct lt8912 *lt = i2c_get_clientdata(client); - lt8912_bridge_detach(<->bridge); drm_bridge_remove(<->bridge); lt8912_free_i2c(lt); lt8912_put_dt(lt);