rust: clk: implement Send and Sync
These traits are required for drivers to embed the Clk type in their own data structures because driver data structures are usually required to be Send. Since the Clk type is thread-safe, implement the relevant traits. Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com> Reviewed-by: Danilo Krummrich <dakr@kernel.org> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Boqun Feng <boqun.feng@gmail.com> Reviewed-by: Gary Guo <gary@garyguo.net> Signed-off-by: Alice Ryhl <aliceryhl@google.com> Acked-by: Brian Masney <bmasney@redhat.com> # Active contributor to clk Link: https://patch.msgid.link/20260223-clk-send-sync-v5-1-181bf2f35652@google.com Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
This commit is contained in:
parent
0a51b384e0
commit
0c0695a9d8
1 changed files with 7 additions and 0 deletions
|
|
@ -128,6 +128,13 @@ mod common_clk {
|
|||
#[repr(transparent)]
|
||||
pub struct Clk(*mut bindings::clk);
|
||||
|
||||
// SAFETY: It is safe to call `clk_put` on another thread than where `clk_get` was called.
|
||||
unsafe impl Send for Clk {}
|
||||
|
||||
// SAFETY: It is safe to call any combination of the `&self` methods in parallel, as the
|
||||
// methods are synchronized internally.
|
||||
unsafe impl Sync for Clk {}
|
||||
|
||||
impl Clk {
|
||||
/// Gets [`Clk`] corresponding to a [`Device`] and a connection id.
|
||||
///
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue