From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 492C0EB3640 for ; Mon, 2 Mar 2026 23:25:21 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6564710E5E6; Mon, 2 Mar 2026 23:25:17 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=collabora.com header.i=deborah.brouwer@collabora.com header.b="HxFvgbOR"; dkim-atps=neutral Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) by gabe.freedesktop.org (Postfix) with ESMTPS id A0C9910E076 for ; Mon, 2 Mar 2026 23:25:15 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; t=1772493913; cv=none; d=zohomail.com; s=zohoarc; b=XHuP/ecpMVBWNRcFchhNtqW/nBJXdY6JFa+lEgVWekQUCQJQWT7XIHghA4yOb4DtIjszCJFunkmRIhlctmptcrhHT5ysj9I4uYTtaH0nxuPngAbpnzYsvdvsHyFWy3Tdf4pCd3+kgwEWPhL5f9ZLifBGmml/VQCMhjkmNFBoQ9g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1772493913; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=JeVKrmBGAZbOfL0zQIy44YasmHlurQx5d/IhOY6/xAA=; b=NKzLIa1PuLgAqJ+V3onBbuQ5w9FeW8ZSc31EsTvWwdT1JJAtWbe+loN84RSeb4zdLV4ipriYdi1p2BxWSjpRSYqaXFhXzDD2pTKjwt9yE9vjwebSPnWUL0m0YGRL0k5w808f2NxyOWkucaLH7pwWT7Wil8w1aK1MPATM1nEJyL0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=deborah.brouwer@collabora.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1772493913; s=zohomail; d=collabora.com; i=deborah.brouwer@collabora.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Message-Id:Reply-To; bh=JeVKrmBGAZbOfL0zQIy44YasmHlurQx5d/IhOY6/xAA=; b=HxFvgbOR4fEuqQmZyFoUAEG/DFus7cJTuuJYjsfCHLAG+ZP2EdukCYdjE1mzTVtq u7EhZa4r5c8lg0GK//4wr4JLUQGNaKZ1yep02C6lNeQNLMlJyP95nc31t72s1M9YDKg nmi0o/5u/J+dpY5vMlKpF94xuZbxTyi4Inu7RuuE= Received: by mx.zohomail.com with SMTPS id 1772493911012417.9461385509999; Mon, 2 Mar 2026 15:25:11 -0800 (PST) From: Deborah Brouwer To: dri-devel@lists.freedesktop.org, rust-for-linux@vger.kernel.org Cc: daniel.almeida@collabora.com, aliceryhl@google.com, boris.brezillon@collabora.com, beata.michalska@arm.com, lyude@redhat.com, work@onurozkan.dev, Deborah Brouwer Subject: [PATCH v2 02/12] drm/tyr: move clock cleanup into Clocks Drop impl Date: Mon, 2 Mar 2026 15:24:50 -0800 Message-ID: <20260302232500.244489-3-deborah.brouwer@collabora.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260302232500.244489-1-deborah.brouwer@collabora.com> References: <20260302232500.244489-1-deborah.brouwer@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Currently Tyr disables its clocks from TyrDrmDeviceData::drop(), which causes them to be shut down before any other fields in TyrDrmDeviceData are dropped. This prevents us from using the clocks when dropping the other fields in TyrDrmDeviceData. In order to better control when the clocks are dropped, move this cleanup logic into a Drop implementation on the Clocks struct itself. Since it serves no further purpose, remove the PinnedDrop implementation for TyrDrmDeviceData. Also, while here, remove the #[pin_data] annotation from both the struct Clocks and struct Regulators since neither of these structs need this macro to create structurally pinned fields. Reviewed-by: Boris Brezillon Reviewed-by: Daniel Almeida Reviewed-by: Alice Ryhl Signed-off-by: Deborah Brouwer --- Changes in v2: - Mention pinning changes in commit message. - Pick up Reviewed-by tags. drivers/gpu/drm/tyr/driver.rs | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/drm/tyr/driver.rs b/drivers/gpu/drm/tyr/driver.rs index 38e5268e881a..4fff01478391 100644 --- a/drivers/gpu/drm/tyr/driver.rs +++ b/drivers/gpu/drm/tyr/driver.rs @@ -54,7 +54,7 @@ pub(crate) struct TyrPlatformDriverData { _device: ARef, } -#[pin_data(PinnedDrop)] +#[pin_data] pub(crate) struct TyrDrmDeviceData { pub(crate) pdev: ARef, @@ -168,17 +168,6 @@ impl PinnedDrop for TyrPlatformDriverData { fn drop(self: Pin<&mut Self>) {} } -#[pinned_drop] -impl PinnedDrop for TyrDrmDeviceData { - fn drop(self: Pin<&mut Self>) { - // TODO: the type-state pattern for Clks will fix this. - let clks = self.clks.lock(); - clks.core.disable_unprepare(); - clks.stacks.disable_unprepare(); - clks.coregroup.disable_unprepare(); - } -} - // We need to retain the name "panthor" to achieve drop-in compatibility with // the C driver in the userspace stack. const INFO: drm::DriverInfo = drm::DriverInfo { @@ -202,14 +191,20 @@ impl drm::Driver for TyrDrmDriver { } } -#[pin_data] struct Clocks { core: Clk, stacks: OptionalClk, coregroup: OptionalClk, } -#[pin_data] +impl Drop for Clocks { + fn drop(&mut self) { + self.core.disable_unprepare(); + self.stacks.disable_unprepare(); + self.coregroup.disable_unprepare(); + } +} + struct Regulators { _mali: Regulator, _sram: Regulator, -- 2.52.0