Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp864408rdb; Tue, 19 Sep 2023 12:24:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEAEDeOp3V2NdUrf+Rw6J3vY3oKbmvIQ1SvINw6CjSb0d3rN/dlFYXIndIBF1e04HDgb02C X-Received: by 2002:a17:90b:3c4:b0:274:98ae:d72f with SMTP id go4-20020a17090b03c400b0027498aed72fmr671535pjb.38.1695151499372; Tue, 19 Sep 2023 12:24:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695151499; cv=none; d=google.com; s=arc-20160816; b=Ifwiba3c22bAyIN7dVnOgaOcTsJOySMGMgwIFujLa+AFXvhNkO1mDzFmG6gu7PU1Kh HW9cVEiKFP7AE/OwXEQg9pvc8GJwvj4NVJCeFnp+p6yoPBPbgk90Uf6Dv2S7SwCIL7q3 1lp3mSq+G/FPzWhpC9QaW/QXoYb1NqyP0H650XhLY2tY2xRVKKgyrYWkVbYPCCj4v8OB Hhk+wHXxNd9MUP/zKaC7k+Lq7r8C2ShWuM51sKzY7I/owwyBniOpv0aZdX7M28MyDYOQ g41wsmIGxHqMUEoc1F14jhuI7fb/z1PXCfwUVhEB4sdX4e6ze745uqizvbCDrW5ht7rW +6OA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=kWHMiyXKBqMxt2bEjOl2zybAe3AijywLuFJKLsv69As=; fh=nZlCt8U8JpY96k+WFqOGis+f4PIsEBhjFDozDoL65Ks=; b=BreBM5wA3YplispPWtE/MXuaDGuO5kkvVpO3k1gG+0d0DGQgiCXTU9WC6kWsgi/g/c 9PkTBsCDZ6AQpJaNkRTNuw/4qqEk1tCY4LiuCW0yunpr68fRLSogKp/0DBuhpEBCeW27 MWMO9eyhhBJOnguZ9upHhz0iUuxhy+4XHly6SfNZelQhlc1AI3DNupwALFX6tTT1acDR q3Wh7stfVSayEvN4wxngH76R0SFm+rzecdDEqtYhp+4F8iI2VQTaWc30aw15EEwMSzNr UfiZUryzC0KdXJGh4BlIKIX+YBmMPaaxbfRweiJdFnWQsciHwDzCtV4u5CJ0KiqNFAMt USAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=BOesDxxo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id x6-20020a17090ab00600b002634977e6e5si12307992pjq.142.2023.09.19.12.24.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Sep 2023 12:24:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=BOesDxxo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 5C98A802784B; Tue, 19 Sep 2023 00:31:27 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231704AbjISHbU (ORCPT + 99 others); Tue, 19 Sep 2023 03:31:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231561AbjISHbT (ORCPT ); Tue, 19 Sep 2023 03:31:19 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09462FC; Tue, 19 Sep 2023 00:31:13 -0700 (PDT) Received: from [192.168.88.20] (91-154-35-171.elisa-laajakaista.fi [91.154.35.171]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 57854FA2; Tue, 19 Sep 2023 09:29:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1695108574; bh=DQnS4aIKIh13ovdc7BzfWH9E6TxBe1gPiyTE4ZjyNYY=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=BOesDxxoV/01VlAhluf7YLPC/1LY5v6DUSAmbryylQA/UVNncmcoPm89AX/9XYQ6d nW4D4fbSVh5QAPCRVAPFeL6NrYodQDHDg4hKu5ZyPB9+abblvv6BOZXW80KLAK5An8 zKVe1L0FDrNX/uErlZKXCnkz1zj3Og7O87huezYg= Message-ID: <06ac6d3b-e82e-dd25-ab21-90db76f3a5fd@ideasonboard.com> Date: Tue, 19 Sep 2023 10:31:05 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [RFT PATCH 2/6] drm: Call drm_atomic_helper_shutdown() at shutdown time for misc drivers Content-Language: en-US To: Douglas Anderson , dri-devel@lists.freedesktop.org, Maxime Ripard Cc: airlied@gmail.com, airlied@redhat.com, alain.volmat@foss.st.com, alexander.deucher@amd.com, alexandre.belloni@bootlin.com, alison.wang@nxp.com, bbrezillon@kernel.org, christian.koenig@amd.com, claudiu.beznea@microchip.com, daniel@ffwll.ch, drawat.floss@gmail.com, javierm@redhat.com, jernej.skrabec@gmail.com, jfalempe@redhat.com, jstultz@google.com, kong.kongxinwei@hisilicon.com, kraxel@redhat.com, linus.walleij@linaro.org, linux-arm-kernel@lists.infradead.org, linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@lists.linux.dev, liviu.dudau@arm.com, nicolas.ferre@microchip.com, paul.kocialkowski@bootlin.com, sam@ravnborg.org, samuel@sholland.org, spice-devel@lists.freedesktop.org, stefan@agner.ch, suijingfeng@loongson.cn, sumit.semwal@linaro.org, tiantao6@hisilicon.com, tzimmermann@suse.de, virtualization@lists.linux-foundation.org, wens@csie.org, xinliang.liu@linaro.org, yongqin.liu@linaro.org, zackr@vmware.com References: <20230901234015.566018-1-dianders@chromium.org> <20230901163944.RFT.2.I9115e5d094a43e687978b0699cc1fe9f2a3452ea@changeid> From: Tomi Valkeinen In-Reply-To: <20230901163944.RFT.2.I9115e5d094a43e687978b0699cc1fe9f2a3452ea@changeid> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.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 (groat.vger.email [0.0.0.0]); Tue, 19 Sep 2023 00:31:27 -0700 (PDT) On 02/09/2023 02:39, Douglas Anderson wrote: > Based on grepping through the source code these drivers appear 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. > > 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. > > All of the drivers in this patch were fairly straightforward to fix > since they already had a call to drm_atomic_helper_shutdown() at > remove/unbind time but were just lacking one at system shutdown. The > only hitch is that some of these drivers use the component model to > register/unregister their DRM devices. The shutdown callback is part > of the original device. The typical solution here, based on how other > DRM drivers do this, is to keep track of whether the device is bound > based on drvdata. In most cases the drvdata is the drm_device, so we > can just make sure it is NULL when the device is not bound. In some > drivers, this required minor code changes. To make things simpler, > drm_atomic_helper_shutdown() has been modified to consider a NULL > drm_device as a noop in the patch ("drm/atomic-helper: > drm_atomic_helper_shutdown(NULL) should be a noop"). > > Suggested-by: Maxime Ripard > Signed-off-by: Douglas Anderson For omapdrm: Reviewed-by: Tomi Valkeinen Tested-by: Tomi Valkeinen Tomi