Skip to content

Commit 334eb69

Browse files
committed
rust: kernel: allow a few non_send_fields_in_send_ty Clippy cases
Signed-off-by: Miguel Ojeda <[email protected]>
1 parent f7ba6db commit 334eb69

File tree

4 files changed

+5
-0
lines changed

4 files changed

+5
-0
lines changed

rust/kernel/gpio.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ unsafe impl<T: Chip> Sync for Registration<T> {}
218218
// SAFETY: Registration with and unregistration from the gpio subsystem can happen from any thread.
219219
// Additionally, `T::Data` (which is dropped during unregistration) is `Send`, so it is ok to move
220220
// `Registration` to different threads.
221+
#[allow(clippy::non_send_fields_in_send_ty)]
221222
unsafe impl<T: Chip> Send for Registration<T> {}
222223

223224
impl<T: Chip> Default for Registration<T> {
@@ -399,6 +400,7 @@ mod irqchip {
399400
// SAFETY: Registration with and unregistration from the gpio subsystem (including irq chips for
400401
// them) can happen from any thread. Additionally, `T::Data` (which is dropped during
401402
// unregistration) is `Send`, so it is ok to move `Registration` to different threads.
403+
#[allow(clippy::non_send_fields_in_send_ty)]
402404
unsafe impl<T: ChipWithIrqChip> Send for RegistrationWithIrqChip<T> where T::Data: Send {}
403405

404406
struct FlowHandler<T: ChipWithIrqChip>(PhantomData<T>);

rust/kernel/sync/condvar.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ pub struct CondVar {
3535
}
3636

3737
// SAFETY: `CondVar` only uses a `struct wait_queue_head`, which is safe to use on any thread.
38+
#[allow(clippy::non_send_fields_in_send_ty)]
3839
unsafe impl Send for CondVar {}
3940

4041
// SAFETY: `CondVar` only uses a `struct wait_queue_head`, which is safe to use on multiple threads

rust/kernel/sync/mutex.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ pub struct Mutex<T: ?Sized> {
4040
}
4141

4242
// SAFETY: `Mutex` can be transferred across thread boundaries iff the data it protects can.
43+
#[allow(clippy::non_send_fields_in_send_ty)]
4344
unsafe impl<T: ?Sized + Send> Send for Mutex<T> {}
4445

4546
// SAFETY: `Mutex` serialises the interior mutability it provides, so it is `Sync` as long as the

rust/kernel/sync/seqlock.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ pub struct SeqLock<L: CreatableLock + ?Sized> {
6060

6161
// SAFETY: `SeqLock` can be transferred across thread boundaries iff the data it protects and the
6262
// underlying lock can.
63+
#[allow(clippy::non_send_fields_in_send_ty)]
6364
unsafe impl<L: CreatableLock + Send> Send for SeqLock<L> where L::Inner: Send {}
6465

6566
// SAFETY: `SeqLock` allows concurrent access to the data it protects by both readers and writers,

0 commit comments

Comments
 (0)