public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/3] Clk improvements
@ 2026-01-07 15:09 Daniel Almeida
  2026-01-07 15:09 ` [PATCH v3 1/3] rust: clk: use the type-state pattern Daniel Almeida
                   ` (2 more replies)
  0 siblings, 3 replies; 68+ messages in thread
From: Daniel Almeida @ 2026-01-07 15:09 UTC (permalink / raw)
  To: 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 Kleine-König, Michael Turquette, Stephen Boyd,
	Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Trevor Gross
  Cc: linux-pm, linux-kernel, dri-devel, linux-riscv, linux-pwm,
	linux-clk, rust-for-linux, Daniel Almeida

This series contains a few improvements that simplifies clock handling for
drivers.

Patch 1 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 2 makes things more convenient by offering devres-managed APIs. This
lets drivers set clock parameters once and forget about lifetime
management.

Patch 3 converts clk.rs to the newer kernel-vertical style in order to make
future changes easier.

This depends on Alice Ryhl's series [0].

[0]: https://lore.kernel.org/rust-for-linux/20251218-clk-send-sync-v3-0-e48b2e2f1eac@google.com/

---
Changes in v3:
- Rebased on top of 6.19-rc4
- Dropped patch 1 (from Alice), added her series as a dependency instead
- Fixed Tyr, PWM_TH1520 drivers
- Changed clk.rs imports to kernel-vertical style
- Added support get_optional shortcut for Prepared and Enabled (i.e.:
  Clk::<Enabled>::get_optional())
- Fixed misplaced #[inline] tag

Thanks, Danilo {
  - Moved the devres changes into its own patch
  - Require &Device<Bound> for all functions where a &Device is used
  - Account for con_in in SAFETY comments where applicable
  - Added backticks
}

- Link to v2: https://lore.kernel.org/r/20250910-clk-type-state-v2-0-1b97c11bb631@collabora.com

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

---
Daniel Almeida (3):
      rust: clk: use the type-state pattern
      rust: clk: add devres-managed clks
      rust: clk: use 'kernel vertical style' for imports

 drivers/cpufreq/rcpufreq_dt.rs |   2 +-
 drivers/gpu/drm/tyr/driver.rs  |  31 +--
 drivers/pwm/pwm_th1520.rs      |  17 +-
 rust/kernel/clk.rs             | 466 +++++++++++++++++++++++++++++------------
 rust/kernel/cpufreq.rs         |   8 +-
 5 files changed, 346 insertions(+), 178 deletions(-)
---
base-commit: 9ace4753a5202b02191d54e9fdf7f9e3d02b85eb
change-id: 20250909-clk-type-state-c01aa7dd551d
prerequisite-change-id: 20250904-clk-send-sync-3cfa7f4e1ce2:v3
prerequisite-patch-id: 13476f9e7e7c3bdbcab42912948953743381b1e0
prerequisite-patch-id: 8f91583384bb4516afcac66d21ac08b3982747b2
prerequisite-patch-id: b2ad5ecbd9a395b622bc04f891b5bb276f6f6b16

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


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

end of thread, other threads:[~2026-02-12 16:50 UTC | newest]

Thread overview: 68+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-07 15:09 [PATCH v3 0/3] Clk improvements Daniel Almeida
2026-01-07 15:09 ` [PATCH v3 1/3] rust: clk: use the type-state pattern Daniel Almeida
2026-01-08  8:07   ` Maxime Ripard
2026-01-08 13:57     ` Miguel Ojeda
2026-01-08 14:18       ` Daniel Almeida
2026-01-08 14:14     ` Daniel Almeida
2026-01-19 10:45       ` Maxime Ripard
2026-01-19 12:13         ` Daniel Almeida
2026-01-19 12:35         ` Alice Ryhl
2026-01-19 12:54           ` Daniel Almeida
2026-01-19 13:13             ` Danilo Krummrich
2026-01-19 14:18               ` Maxime Ripard
2026-01-19 14:37                 ` Danilo Krummrich
2026-01-22 13:44                   ` Maxime Ripard
2026-01-23  0:29                     ` Daniel Almeida
2026-02-04  9:15                       ` Maxime Ripard
2026-02-04 12:43                         ` Daniel Almeida
2026-02-04 14:34                           ` Maxime Ripard
2026-02-09  9:50                             ` Boris Brezillon
2026-02-11 16:37                               ` Maxime Ripard
2026-02-11 16:47                                 ` Danilo Krummrich
2026-02-12  7:59                                   ` Maxime Ripard
2026-02-12  8:52                                     ` Alice Ryhl
2026-02-12  9:23                                     ` Danilo Krummrich
2026-02-12 14:01                                       ` Danilo Krummrich
2026-02-12 16:50                                         ` Maxime Ripard
2026-02-12 11:45                                     ` Miguel Ojeda
2026-02-12  8:16                                 ` Alice Ryhl
2026-02-12 13:38                                   ` Maxime Ripard
2026-02-12 14:02                                     ` Alice Ryhl
2026-02-12 16:48                                       ` Maxime Ripard
2026-01-23 10:25                     ` Danilo Krummrich
2026-01-19 12:57           ` Gary Guo
2026-01-19 14:27           ` Maxime Ripard
2026-02-03 10:39           ` Boris Brezillon
2026-02-03 11:26             ` Boris Brezillon
2026-02-03 14:53               ` Boris Brezillon
2026-02-03 13:33             ` Daniel Almeida
2026-02-03 13:42               ` Gary Guo
2026-02-03 13:55                 ` Daniel Almeida
2026-02-03 14:33                   ` Boris Brezillon
2026-02-03 14:08               ` Boris Brezillon
2026-02-03 16:28                 ` Daniel Almeida
2026-02-03 16:55                   ` Boris Brezillon
2026-02-03 16:59                   ` Gary Guo
2026-02-03 19:26                     ` Daniel Almeida
2026-02-03 19:43                       ` Boris Brezillon
2026-02-03 20:36                       ` Gary Guo
2026-02-04  8:11                         ` Boris Brezillon
2026-02-04  9:18                           ` Maxime Ripard
2026-01-19 14:26         ` Gary Guo
2026-01-19 15:44           ` Daniel Almeida
2026-01-19 14:20   ` Gary Guo
2026-01-19 15:22     ` Miguel Ojeda
2026-01-19 15:36       ` Gary Guo
2026-01-19 15:46         ` Miguel Ojeda
2026-01-19 16:10           ` Gary Guo
2026-02-02 16:10     ` Boris Brezillon
2026-02-03  9:09       ` Boris Brezillon
2026-02-03  9:47         ` Boris Brezillon
2026-02-03 13:37         ` Daniel Almeida
2026-02-03 14:18           ` Boris Brezillon
2026-02-03  9:17   ` Boris Brezillon
2026-02-03 13:35     ` Daniel Almeida
2026-01-07 15:09 ` [PATCH v3 2/3] rust: clk: add devres-managed clks Daniel Almeida
2026-01-19 14:33   ` Gary Guo
2026-01-07 15:09 ` [PATCH v3 3/3] rust: clk: use 'kernel vertical style' for imports Daniel Almeida
2026-01-08  7:53   ` Maxime Ripard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox