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 8B3DCE83062 for ; Tue, 3 Feb 2026 09:09:24 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F0E0910E593; Tue, 3 Feb 2026 09:09:23 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=collabora.com header.i=@collabora.com header.b="ZFatVTox"; dkim-atps=neutral Received: from bali.collaboradmins.com (bali.collaboradmins.com [148.251.105.195]) by gabe.freedesktop.org (Postfix) with ESMTPS id EB17F10E593 for ; Tue, 3 Feb 2026 09:09:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1770109760; bh=X7jzLZ1GgbMnGkSzg2P6TINP/UEVUi+UuFD6WvVbSxI=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=ZFatVToxDXh4OwgdhbjFjXaOgCJU6JZAujnQlkaozaIVHjVFryZrSDyEFFhWw7Dde DLTH3PD5JoMagk7qYK3kH1V8AjraHnhM5T2a1qj8snpWNY9xQ7YaweaWpLBE2jgoKY KgjsOWUMIKOmJJlU8yOwmpsR4ghuvUXWvya6/uyjkxfjMfejARwbzAsddQKibn/6ji M7XapaCo7JLZYZNkHmsmCb/TtbEKMcItKPGOpOGuBzceyoN0Kk8TK+clcecM1qCrCy 6OmvvOrV3XVaiX8JrMdndc+czEOTHamjC851t5mx78kTiEMUlHh/xLat/r3OIIKGSx hsgcwAJUHjUUQ== Received: from fedora (unknown [IPv6:2a01:e0a:2c:6930:d919:a6e:5ea1:8a9f]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: bbrezillon) by bali.collaboradmins.com (Postfix) with ESMTPSA id 603B717E00A3; Tue, 3 Feb 2026 10:09:19 +0100 (CET) Date: Tue, 3 Feb 2026 10:09:13 +0100 From: Boris Brezillon To: "Gary Guo" Cc: "Daniel Almeida" , "Rafael J. Wysocki" , "Viresh Kumar" , "Danilo Krummrich" , "Alice Ryhl" , "Maarten Lankhorst" , "Maxime Ripard" , "Thomas Zimmermann" , "David Airlie" , "Simona Vetter" , "Drew Fustini" , "Guo Ren" , "Fu Wei" , Uwe =?UTF-8?B?S2xlaW5lLUvDtm5pZw==?= , "Michael Turquette" , "Stephen Boyd" , "Miguel Ojeda" , "Boqun Feng" , =?UTF-8?B?QmrDtnJu?= Roy Baron , "Benno Lossin" , "Andreas Hindborg" , "Trevor Gross" , , , , , , , Subject: Re: [PATCH v3 1/3] rust: clk: use the type-state pattern Message-ID: <20260203100913.6d224657@fedora> In-Reply-To: <20260202171038.10e51e18@fedora> References: <20260107-clk-type-state-v3-0-77d3e3ee59c2@collabora.com> <20260107-clk-type-state-v3-1-77d3e3ee59c2@collabora.com> <20260202171038.10e51e18@fedora> Organization: Collabora X-Mailer: Claws Mail 4.3.1 (GTK 3.24.51; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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" Hello Daniel, On Mon, 2 Feb 2026 17:10:38 +0100 Boris Brezillon wrote: > > > -#[pin_data(PinnedDrop)] > > > +#[pin_data] > > > pub(crate) struct TyrData { > > > pub(crate) pdev: ARef, > > > > > > @@ -92,13 +92,9 @@ fn probe( > > > pdev: &platform::Device, > > > _info: Option<&Self::IdInfo>, > > > ) -> impl PinInit { > > > - let core_clk = Clk::get(pdev.as_ref(), Some(c_str!("core")))?; > > > - let stacks_clk = OptionalClk::get(pdev.as_ref(), Some(c_str!("stacks")))?; > > > - let coregroup_clk = OptionalClk::get(pdev.as_ref(), Some(c_str!("coregroup")))?; > > > - > > > - core_clk.prepare_enable()?; > > > - stacks_clk.prepare_enable()?; > > > - coregroup_clk.prepare_enable()?; > > > + let core_clk = Clk::::get(pdev.as_ref(), Some(c_str!("core")))?; > > > > Ah, more turbofish.. I'd really want to avoid them if possible. > > > > Any disadvantage on just ask the user to chain `.get().prepare_enable()?`? This > > way it is also clear that some action is performed. > > I've just disc Sorry, I've hit the reply button before I had finished writing my answer. So I was about to say that I had started writing something similar without knowing this series existed, and I feel like we'd don't really need those prepare_enable() shortcuts that exist in C. We might has well just go: Clk::get(dev, Some(c_str!("core"))).prepare()?.enable()?; and have the following variant-specofoc functions - Clk::get[_optional]() (no get on Prepared and Enabled variants) - Clk::prepare() - Clk::{enable,unprepare}() - Clk::{disable}() Regards, Boris