rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Clk improvements for 6.18
@ 2025-09-10 17:28 Daniel Almeida
  2025-09-10 17:28 ` [PATCH v2 1/2] rust: clk: implement Send and Sync Daniel Almeida
  2025-09-10 17:28 ` [PATCH v2 2/2] rust: clk: use the type-state pattern Daniel Almeida
  0 siblings, 2 replies; 13+ messages in thread
From: Daniel Almeida @ 2025-09-10 17:28 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd, Miguel Ojeda, Alex Gaynor,
	Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
	Andreas Hindborg, Alice Ryhl, Trevor Gross, Danilo Krummrich,
	Rafael J. Wysocki, Viresh Kumar
  Cc: linux-clk, rust-for-linux, linux-kernel, linux-pm, Daniel Almeida

This series contains a few improvements that will be soon needed by
drivers:

Patch 1 implements Send and Sync for Clocks, as a raw pointer precludes
the compiler from automatically implementing these traits. This will
lead to an otherwise unnecessary unsafe implementation of Send and Sync
for all drivers that use kernel::clk::Clk. It was included in this
series as it would otherwise conflict with patch 2.

Patch 2 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.

---
Changes in v2:
- Added Alice's patch as patch 1, since it is a dependency.
- Added devm helpers (like we did for Regulator<T>)
- Fixed missing clk_put() call in Drop (Danilo)
- Fixed missing parenthesis and wrong docs (Viresh)
- Removed extra "dev" parameter from "shutdown" example (Danilo)
- Removed useless type annotation from example (Danilo)
- Link to v1: https://lore.kernel.org/rust-for-linux/20250729-clk-type-state-v1-1-896b53816f7b@collabora.com/#r

---
Alice Ryhl (1):
      rust: clk: implement Send and Sync

Daniel Almeida (1):
      rust: clk: use the type-state pattern

 drivers/cpufreq/rcpufreq_dt.rs |   2 +-
 rust/kernel/clk.rs             | 405 ++++++++++++++++++++++++++++-------------
 rust/kernel/cpufreq.rs         |   8 +-
 3 files changed, 283 insertions(+), 132 deletions(-)
---
base-commit: 76eeb9b8de9880ca38696b2fb56ac45ac0a25c6c
change-id: 20250909-clk-type-state-c01aa7dd551d

Best regards,
-- 
Daniel Almeida <daniel.almeida@collabora.com>


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2025-09-21 16:18 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-10 17:28 [PATCH v2 0/2] Clk improvements for 6.18 Daniel Almeida
2025-09-10 17:28 ` [PATCH v2 1/2] rust: clk: implement Send and Sync Daniel Almeida
2025-09-10 17:49   ` Boqun Feng
2025-09-10 18:47     ` Daniel Almeida
2025-09-10 19:17       ` Boqun Feng
2025-09-20  5:06       ` Stephen Boyd
2025-09-20 10:33         ` Daniel Almeida
2025-09-21 15:48           ` Stephen Boyd
2025-09-20 17:12         ` Alice Ryhl
2025-09-20 18:43           ` Daniel Almeida
2025-09-10 17:28 ` [PATCH v2 2/2] rust: clk: use the type-state pattern Daniel Almeida
2025-09-20 10:35   ` Daniel Almeida
2025-09-21 16:18   ` Danilo Krummrich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).