Skip to content

Commit 974593a

Browse files
committed
rust: dma: make Pool Send and Sync
1 parent 349bbef commit 974593a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

rust/kernel/dma.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,14 @@ impl<T> Pool<T> {
124124
}
125125
}
126126

127+
// SAFETY: A `Pool` is a reference (pointer) to an underlying C `struct
128+
// dma_pool`. Operations on the underlying pool is protected by a spinlock.
129+
unsafe impl<T> Send for Pool<T> {}
130+
131+
// SAFETY: A `Pool` is a reference (pointer) to an underlying C `struct
132+
// dma_pool`. Operations on the underlying pool is protected by a spinlock.
133+
unsafe impl<T> Sync for Pool<T> {}
134+
127135
impl<T> Allocator for Pool<T> {
128136
type AllocationData = *mut bindings::dma_pool;
129137
type DataSource = Arc<Pool<T>>;

0 commit comments

Comments
 (0)