From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796314561; b=AZc+JzNwfNu8sOII6UsMDowftyCFsUG6mhUPEO5+6IzGeJf1hSVMB9qGsALpyQAiGCEV 6n/wcPWUVOZzmI/8eH41mwlpxIFe1Zl3jGQKE3i42FXZL/oCjZgL1fOpLUip0TcEyISsu /YMLKCQ2sXDsUPPCjzM2skf3DrArXjjz/EiTx18lDFWZJx3/8xewgV4GKPIfVfPHaCtrw 15mgvPEV5/x/kNlyXTJxDF+mMiDKp30HZgNSHCbsl8M5la8VMWHM62QA2Ua69YhBC4BA6 0U68QiXeE+yZ6lg2FKV1tm2G5piQXkS74gR1orhnKeJEJgoIdk6Mok+TXkao74oZolQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796314561; h=Received:DKIM-Signature:Mime-Version:Content-Transfer-Encoding: Content-Type:Date:Message-Id:Subject:Cc:To:From:References: In-Reply-To; bh=BY0PjJBer+mlbbOm6fMn5QZ63T9GB5DFeOnxZrFjAss=; b=BJBFuWJI3ZbOZBYJbyWROnNIAcP51RUgOFTYQmpA9HLRbm7kuedCJt0/zd2cFnwB4vgf lvbt3JdqrdxJxRFX1LPxq6strnvZoAu4fhktmuex79DVmbtOk5AZyjLVS4a3l5z4+/f5p MJ6oAp5nRbBtjo8Wln9ndwQpBgCesz0a+MSvyRjhnhMR+zRXEv+IL9dirfFRVJa8KVYg3 QGD9UXxpzEd1KrtXPmHFRjO9TLkA63AZh81kb9Mhujkg6mZfv17xwrGChoih+m/gTMKuq lec2nsOx1Zd34YqI579Pp8ee0Pr/KOc0QQqEUFVjvTdGDIB+a8R21k5k4IT1rY8HCFg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=OykDBhRM; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EC6E0606A322; Thu, 3 Dec 2026 16:16:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=OykDBhRM Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D4DC1F00893; Thu, 3 Dec 2026 16:15:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796314560; bh=BY0PjJBer+mlbbOm6fMn5QZ63T9GB5DFeOnxZrFjAss=; h=Date:Subject:Cc:To:From:References:In-Reply-To; b=OykDBhRMcmwmBht0wNkSGjNj54MUDk51vQ7nPhPLuR8sKeYhXrCN0QIFx3lMI1SML +aYV6sktGqKBsyp+pKd8+9Ro/rlWqeS7fJW/giDj8LKze66vcJjYpuAmdBboLEI0Xz RtYCJd/MKFmfohxd09i8xshRyCGKGEq+keIflmuORO7BcwD3MEsPKt/8xBZdBg/PPG rwM9JCMv+zsFJ1hH+K3QC/cIiqfG6g4vtExUneLVb2xYH3x5VdV8vUv1p9rw6FomzX q9l/kXy+UdsU1JSiJMBmL6S+zrR9IKS3I7XWJrPVoJzMiVpLbIHfQrcnZRB1pHygKt kEa+ZaMJJEULA== X-Mailing-List: linux-clk@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Thu, 03 Dec 2026 17:15:52 +0100 Message-Id: Subject: Re: [PATCH v6 0/7] Clk improvements Cc: "Rafael J. Wysocki" , "Viresh Kumar" , "Alice Ryhl" , "David Airlie" , "Simona Vetter" , "Michal Wilczynski" , "Drew Fustini" , "Guo Ren" , "Fu Wei" , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , "Stephen Boyd" , "Brian Masney" , "Jerome Brunet" , "Miguel Ojeda" , "Boqun Feng" , "Gary Guo" , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , "Benno Lossin" , "Andreas Hindborg" , "Trevor Gross" , "Tamir Duberstein" , "Alexandre Courbot" , , , , , , , , "Boris Brezillon" , =?utf-8?q?Onur_=C3=96zkan?= , "Maurice Hieronymus" To: "Daniel Almeida" From: "Danilo Krummrich" References: <20261013-clk-type-state-v6-0-a5e9977b3509@collabora.com> In-Reply-To: <20261013-clk-type-state-v6-0-a5e9977b3509@collabora.com> On Tue Oct 13, 2026 at 7:07 PM CEST, Daniel Almeida wrote: > This series contains a few improvements that simplify clock handling for > drivers. > > Patch 1 converts clk.rs to the kernel-vertical style for imports. > > Patch 2 replaces OptionalClk with Clk::get_optional(). There is no struct > optional_clk in C, and Clk already allows a NULL pointer. > > Patch 3 implements the same typestate pattern that has been used > successfully for Regulators. This is needed because otherwise drivers > will be responsible for unpreparing and disabling clocks themselves and > ultimately handling the reference counts on their own. This is > undesirable. The patch automatically encodes this information using the > type system so that no misuse can occur. > > Patch 4 adds guards that prepare and/or enable a clock for the lifetime > of the guard without consuming the Clk, so that a driver can keep a > long-lived Clk and enable it for scoped sections. > > Patch 5 makes things more convenient by offering devres-managed APIs. Thi= s > lets drivers set clock parameters once and forget about lifetime > management. > > Patch 6 adds ExclusiveClk, which holds rate exclusivity over a Clk > in any state until it is dropped. > > Patch 7 uses it in pwm-th1520 to lock the clock rate for the lifetime of > the driver data. Except for the devres one, Acked-by: Danilo Krummrich Constraining the driver facing types with the Device lifetime is fin= e for me to address in a follow up series.