From patchwork Thu Sep 21 19:26:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 142895 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp5128581vqi; Thu, 21 Sep 2023 13:46:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGJ4M0ixp65J07J9iRDWuHKVQH3d4x2ZdySdQZeI/cdjxWa2Y4VTlQ/Ig2/7xp2/7LpHXH6 X-Received: by 2002:a17:902:dac5:b0:1b6:6f12:502e with SMTP id q5-20020a170902dac500b001b66f12502emr6724121plx.49.1695329198037; Thu, 21 Sep 2023 13:46:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695329198; cv=none; d=google.com; s=arc-20160816; b=zWZ4PYOBZC0IlJmEXaD/NcEE7G7jtz7ai4kNCdSYyRpuy3BbTY0XVWj/NcSTSxf4iF 06nquvlH7maU/2jySLT+CoiDu+HerigLWY9A/T1kHTa5konkU2w4hAqJqMsY7WVKNG2q xwhQ5aVahIllEBDvMJ7kQU2xFboGSQcwfsOreqloZ8yBBAvMWq/ZHqzSnhak+uWC0vJk Xrj5GK1scSeCEs5ZeU8SF8Rwl1rumHjDjYn/L/Za74Tt4/jvNvp/wolh/cP1pqJ7FI9w IV6dQ8UZMQoYE+dszM4W/Ql9P7TWux0/ps4RlHEeZMXfHMni2APQJT0TNlpdHwZXHp1P ZCtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=pLjLrmqx+liQMxms0HfuoarLoIvQ77Y5EZxHJFXGDMo=; fh=Z4ZyLSzJJ8oXYf7fmYnIfVrK+FZ8rEdS0PAx36IDmWI=; b=qfiMdEjRIUR1SQS2cDv36W2TNF7w9HHt08DpU3FXOOLPvRTqVt9SmDlRaJGwrKp6g4 3GL3SL6GRAX3I/6H0aeXXH1jVEt+lyO4XwoTgpIh1A8F3ZUdeB0AUmM4tUd0fpVET/73 1Q0PAxgTcACCduGPNdblaO2mGqsvxoZHzsNRhbEuFp3xM+YwaaJklWOAjcuFPquPyQ5t eHdxnnmKwtGglX/z+vHyck83bm3scsKlWGEbD47dnsN9VAP1sqrsaggP4OYBow90W/53 icHqybBlYKd+E9Il7k4+OOqOCtfUnLIj3kUuq5efl76X89W6hUsXmfSwLbBPBGwuuXRg vBzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=LIF8E9mc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id x10-20020a170902a38a00b001c5db1e47c3si1486369pla.553.2023.09.21.13.46.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 13:46:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=LIF8E9mc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id CB1D48197059; Thu, 21 Sep 2023 12:49:13 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229513AbjIUTtJ (ORCPT + 28 others); Thu, 21 Sep 2023 15:49:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229988AbjIUTsn (ORCPT ); Thu, 21 Sep 2023 15:48:43 -0400 Received: from mail-pf1-x42a.google.com (mail-pf1-x42a.google.com [IPv6:2607:f8b0:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2F3F2716 for ; Thu, 21 Sep 2023 12:28:39 -0700 (PDT) Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-690f7d73a3aso1243638b3a.0 for ; Thu, 21 Sep 2023 12:28:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1695324519; x=1695929319; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=pLjLrmqx+liQMxms0HfuoarLoIvQ77Y5EZxHJFXGDMo=; b=LIF8E9mckttFvbrw4NDM1Sg64ux3FFvfxfpgs0S5Ciro8qeKUJGSsAXmN+fVtRh8vM c6c6Dustjci7+T6kT781AZZAANIJLJK5N1QLDiYayOLN/nmSSWhtwvcY+MkCz2O8IXNL V0UcSDcFiUCNQfM9PJJo7hcInXhEYma/Xeixs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695324519; x=1695929319; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pLjLrmqx+liQMxms0HfuoarLoIvQ77Y5EZxHJFXGDMo=; b=gZ0W1W5iLJRuiVm3yAKBRzU33a2fP034Z7Vgw1enCo+lekIAUYuh2V8WAGsEoSqOip mRWdbgipJ2o9zmed9fDjiS8zFiaz2F3fNdfu0DEMtSLuBUV6TksgAFQwDAZtGQu/lely IwV/6lt1iq+LlT8Ftk9ZsWML+W3lTjct1tx/93zP1XeUxARGI+xFo5ptDYTZqk/2Y64R TU5DtENp6OiKb7kjT5unwdoDD1UKG3rMn36rPcReqZmkkmt9qpk1IZ/5dPA3DdL8ZRun sF4DjKz4xTFJ/ryTe04n1bPGV5SBDEXz9ze1psvNmLHLnRGT4RzSEvVyGUd7P5mo2Atq aa4w== X-Gm-Message-State: AOJu0YweYGdA9n1dZ6dhy45xaGI5mL/CyxU+MFa4viZBe6claHxCSjkj QWmaj3TdNyNcHUb41btGQHgr1A== X-Received: by 2002:a05:6a20:324c:b0:148:6063:3273 with SMTP id hm12-20020a056a20324c00b0014860633273mr5419552pzc.29.1695324518923; Thu, 21 Sep 2023 12:28:38 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:9d:2:e6ed:6d49:f262:8041]) by smtp.gmail.com with ESMTPSA id w8-20020a1709029a8800b001b9f032bb3dsm1892875plp.3.2023.09.21.12.28.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 12:28:37 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org, Maxime Ripard Cc: Douglas Anderson , Baolin Wang , airlied@gmail.com, daniel@ffwll.ch, kieran.bingham+renesas@ideasonboard.com, linux-kernel@vger.kernel.org, orsonzhai@gmail.com, robh@kernel.org, sam@ravnborg.org, steven.price@arm.com, tzimmermann@suse.de, zhang.lyra@gmail.com Subject: [RFT PATCH v2 08/12] drm/sprd: Call drm_atomic_helper_shutdown() at remove time Date: Thu, 21 Sep 2023 12:26:51 -0700 Message-ID: <20230921122641.RFT.v2.8.I7a2dd349cb52bae53280d0a49e22cc27b923274b@changeid> X-Mailer: git-send-email 2.42.0.515.g380fc7ccd1-goog In-Reply-To: <20230921192749.1542462-1-dianders@chromium.org> References: <20230921192749.1542462-1-dianders@chromium.org> MIME-Version: 1.0 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Thu, 21 Sep 2023 12:49:13 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777681509105039452 X-GMAIL-MSGID: 1777681509105039452 Based on grepping through the source code, this driver appears to be missing a call to drm_atomic_helper_shutdown() at remove time. Let's add it. The fact that we should call drm_atomic_helper_shutdown() in the case of OS driver remove comes straight out of the kernel doc "driver instance overview" in drm_drv.c. While at it, let's also fix it so that if the driver's bind fails or if a driver gets unbound that the drvdata gets set to NULL. This will make sure we can't get confused during a later shutdown(). Suggested-by: Maxime Ripard Reviewed-by: Maxime Ripard Signed-off-by: Douglas Anderson --- This commit is only compile-time tested. (no changes since v1) drivers/gpu/drm/sprd/sprd_drm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/sprd/sprd_drm.c b/drivers/gpu/drm/sprd/sprd_drm.c index 0aa39156f2fa..86a175116140 100644 --- a/drivers/gpu/drm/sprd/sprd_drm.c +++ b/drivers/gpu/drm/sprd/sprd_drm.c @@ -114,6 +114,7 @@ static int sprd_drm_bind(struct device *dev) drm_kms_helper_poll_fini(drm); err_unbind_all: component_unbind_all(drm->dev, drm); + platform_set_drvdata(pdev, NULL); return ret; } @@ -122,10 +123,11 @@ static void sprd_drm_unbind(struct device *dev) struct drm_device *drm = dev_get_drvdata(dev); drm_dev_unregister(drm); - drm_kms_helper_poll_fini(drm); + drm_atomic_helper_shutdown(drm); component_unbind_all(drm->dev, drm); + dev_set_drvdata(dev, NULL); } static const struct component_master_ops drm_component_ops = {