linux/rust
Markus Probst 85a5ffbd56 rust: pwm: Add UnregisteredChip wrapper around Chip
The `pwm::Registration::register` function provides no guarantee that the
function isn't called twice with the same pwm chip, which is considered
unsafe.

Add `pwm::UnregisteredChip` as wrapper around `pwm::Chip`.
Implement `pwm::UnregisteredChip::register` for the registration. This
function takes ownership of `pwm::UnregisteredChip` and therefore
guarantees that the registration can't be called twice on the same pwm
chip.

Signed-off-by: Markus Probst <markus.probst@posteo.de>
Tested-by: Michal Wilczynski <m.wilczynski@samsung.com>
Acked-by: Michal Wilczynski <m.wilczynski@samsung.com>
Link: https://patch.msgid.link/20251202-pwm_safe_register-v2-1-7a2e0d1e287f@posteo.de
[ukleinek: fixes a typo that Michal pointed out during review]
Signed-off-by: Uwe Kleine-König <ukleinek@kernel.org>
2026-01-20 18:38:05 +01:00
..
bindings USB/Thunderbolt changes for 6.19-rc1 2025-12-06 18:42:12 -08:00
helpers USB/Thunderbolt changes for 6.19-rc1 2025-12-06 18:42:12 -08:00
kernel rust: pwm: Add UnregisteredChip wrapper around Chip 2026-01-20 18:38:05 +01:00
macros Modules changes for v6.19-rc1 2025-12-06 08:27:07 -08:00
pin-init Driver core changes for 6.19-rc1 2025-12-05 21:29:02 -08:00
proc-macro2 rust: proc-macro2: add README.md 2025-11-24 17:15:40 +01:00
quote rust: quote: add README.md 2025-11-24 17:15:43 +01:00
syn rust: syn: add README.md 2025-11-24 17:15:47 +01:00
uapi Char/Misc/IIO/Binder changes for 6.18-rc1 2025-10-04 16:26:32 -07:00
.gitignore rust: support running Rust documentation tests as KUnit ones 2023-07-19 09:32:53 -06:00
.kunitconfig rust: add kunitconfig 2025-03-19 23:22:21 +01:00
bindgen_parameters mm: declare VMA flags by bit 2025-11-29 10:41:08 -08:00
build_error.rs rust: add build_error crate 2022-12-04 01:59:16 +01:00
compiler_builtins.rs ARM: 9441/1: rust: Enable Rust support for ARMv7 2025-03-26 13:31:16 +00:00
exports.c rust: exports: improve grammar in commentary 2024-10-21 17:35:33 +02:00
ffi.rs rust: replace CStr with core::ffi::CStr 2025-10-22 07:47:27 +02:00
Makefile Rust changes for v6.19 2025-12-03 14:16:49 -08:00