Received: by 2002:a05:7412:f584:b0:e2:908c:2ebd with SMTP id eh4csp1062494rdb; Mon, 4 Sep 2023 01:31:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHaOpSL9to+DxUCOLc/VeUfYPYBLPj9QIXblLjUn5/OktX7vqz6PgBoD//MD7ZvVMYr9LDP X-Received: by 2002:a05:6a20:428b:b0:14d:7511:1c1 with SMTP id o11-20020a056a20428b00b0014d751101c1mr10051196pzj.49.1693816263565; Mon, 04 Sep 2023 01:31:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693816263; cv=none; d=google.com; s=arc-20160816; b=0hkZVoi3dsrTbhJUSl8lcKVilyFRdD4a5KeKxHfIF0U9UDXXsrxHct/wZ9MtkaS132 Dza1iLtfpT0PFJyEV0Ms9lSgf8Yve6/6Lgjixafsauq57ntwGU1ajJPji35a6xSYsd0s EPQznHLbxGPhrClBhnI99zSfar0llN1eljXqSh0x+VgrQ8q/4Lb9IyXjHEvWPX/a6dO2 HWlSS0EHcQgAN32i3FyTr4ojC1F5/elBG7+v9ByA4sjk25f8V1Fb6/dbEymgF8fJRcaE 1XWipo2YMyHcfBRnX1v5wWYfpysu/Win7wP4dMBhOBcgEhgsNKPtqchWwiZTFTtAwqKo TiwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=HFFWGiw/0uizFQtG50aI919dArfwrxeqsAuMKggc+5A=; fh=w3ggimFwzt8OT7v7CU9nuCwg9ZR6qcihTfzWzRtiJAw=; b=DyI9qg5CQH5J/f22LJaKNcc4IQPh6xTssgwH2Sen/yyNKJaesLU+U2tuEiIajZXTbC aasT2UVGUmWZObnGMU6ZZS4sKuekBvVU/v4gkfOESgFzWDEqCan/QK4ELyf0WaOBd8Pc Orgs6dBYk3xnuWUFpJmc11Zhp5pd3GRCKfPHhMbMEeCt+FW8tvZittxyju73Dz2rhts5 3px08bfPODZYgyx5LeTRJacuj6xw9wct+cuFJwWBa9c+1WkfOLewSLGS65k/w6IrpByu majUopeKMkbkLvDWCpx+H3SJQWztGJo7ZPHr60wHaK7hfRfLAPxQEOx2Pu+Sn5DCb8NR hSNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=i4LlWGto; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h24-20020a635758000000b0055391572218si7320472pgm.26.2023.09.04.01.30.50; Mon, 04 Sep 2023 01:31:03 -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 header.i=@kernel.org header.s=k20201202 header.b=i4LlWGto; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236981AbjIDHgS (ORCPT + 99 others); Mon, 4 Sep 2023 03:36:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229612AbjIDHgS (ORCPT ); Mon, 4 Sep 2023 03:36:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 37180FA for ; Mon, 4 Sep 2023 00:36:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BD7E360E07 for ; Mon, 4 Sep 2023 07:36:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CC303C433C7; Mon, 4 Sep 2023 07:36:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1693812973; bh=HFFWGiw/0uizFQtG50aI919dArfwrxeqsAuMKggc+5A=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=i4LlWGtoTssrh19alu6FCpRQEpibxXHAQar0iip3haPXS8+6V/gX5G9cnGzsK4+Eh 3G0ATi5leP6ncrLHJS3g3p0UHpZp/1/ytMmibUUKHLr5RHqogPEmcD5/yrCrTtNOon b5hocdZASzjnhqe8c2yFVTr7j6aQTz0WUysn2Ru3JCluyXKyn33w99E6ANdL4AOPpE No2N5vfV7EKV/M/fKcjm7ulAdpJOKK+A7KITOTze6tTuSf0O3mibzZ2ruBGSaFCv6m WYVtFpH9yLcNt+u4FPI1ZvaAOAymhgSinFNLmapu7QV4QR8JlNaUSjxewJ9Tuf4E7p UD98lsz+2IRLw== Date: Mon, 4 Sep 2023 09:36:10 +0200 From: Maxime Ripard To: "Russell King (Oracle)" Cc: Douglas Anderson , dri-devel@lists.freedesktop.org, airlied@gmail.com, daniel@ffwll.ch, linux-kernel@vger.kernel.org Subject: Re: [RFT PATCH 01/15] drm/armada: Call drm_atomic_helper_shutdown() at shutdown time Message-ID: References: <20230901234202.566951-1-dianders@chromium.org> <20230901164111.RFT.1.I3d5598bd73a59b5ded71430736c93f67dc5dea61@changeid> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS 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 On Sun, Sep 03, 2023 at 04:53:42PM +0100, Russell King (Oracle) wrote: > On Fri, Sep 01, 2023 at 04:41:12PM -0700, Douglas Anderson wrote: > > Based on grepping through the source code this driver appears to be > > missing a call to drm_atomic_helper_shutdown() at system shutdown > > time. Among other things, this means that if a panel is in use that it > > won't be cleanly powered off at system shutdown time. > >=20 > > The fact that we should call drm_atomic_helper_shutdown() in the case > > of OS shutdown/restart comes straight out of the kernel doc "driver > > instance overview" in drm_drv.c. > >=20 > > This driver was fairly easy to update. The drm_device is stored in the > > drvdata so we just have to make sure the drvdata is NULL whenever the > > device is not bound. >=20 > ... and there I think you have a misunderstanding of the driver model. > Please have a look at device_unbind_cleanup() which will be called if > probe fails, or when the device is removed (in other words, when it is > not bound to a driver.) >=20 > Also, devices which aren't bound to a driver won't have their shutdown > method called (because there is no driver currently bound to that > device.) So, ->probe must have completed successfully, and ->remove > must not have been called for that device. >=20 > So, I think that all these dev_set_drvdata(dev, NULL) that you're > adding are just asking for a kernel janitor to come along later and > remove them because they serve no purpose... so best not introduce > them in the first place. What would that hypothetical janitor clean up exactly? Code making sure that there's no dangling pointer? Doesn't look very wise to me. Maxime