summaryrefslogtreecommitdiff
path: root/drivers/android/binder/thread.rs
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/android/binder/thread.rs')
-rw-r--r--drivers/android/binder/thread.rs24
1 files changed, 11 insertions, 13 deletions
diff --git a/drivers/android/binder/thread.rs b/drivers/android/binder/thread.rs
index e0ea33ccfe58..1f1709a6a77a 100644
--- a/drivers/android/binder/thread.rs
+++ b/drivers/android/binder/thread.rs
@@ -15,6 +15,7 @@ use kernel::{
security,
seq_file::SeqFile,
seq_print,
+ sync::atomic::{ordering::Relaxed, Atomic},
sync::poll::{PollCondVar, PollTable},
sync::{Arc, SpinLock},
task::Task,
@@ -34,10 +35,7 @@ use crate::{
BinderReturnWriter, DArc, DLArc, DTRWrap, DeliverCode, DeliverToRead,
};
-use core::{
- mem::size_of,
- sync::atomic::{AtomicU32, Ordering},
-};
+use core::mem::size_of;
fn is_aligned(value: usize, to: usize) -> bool {
value % to == 0
@@ -284,8 +282,8 @@ const LOOPER_POLL: u32 = 0x40;
impl InnerThread {
fn new() -> Result<Self> {
fn next_err_id() -> u32 {
- static EE_ID: AtomicU32 = AtomicU32::new(0);
- EE_ID.fetch_add(1, Ordering::Relaxed)
+ static EE_ID: Atomic<u32> = Atomic::new(0);
+ EE_ID.fetch_add(1, Relaxed)
}
Ok(Self {
@@ -1568,7 +1566,7 @@ impl Thread {
#[pin_data]
struct ThreadError {
- error_code: AtomicU32,
+ error_code: Atomic<u32>,
#[pin]
links_track: AtomicTracker,
}
@@ -1576,18 +1574,18 @@ struct ThreadError {
impl ThreadError {
fn try_new() -> Result<DArc<Self>> {
DTRWrap::arc_pin_init(pin_init!(Self {
- error_code: AtomicU32::new(BR_OK),
+ error_code: Atomic::new(BR_OK),
links_track <- AtomicTracker::new(),
}))
.map(ListArc::into_arc)
}
fn set_error_code(&self, code: u32) {
- self.error_code.store(code, Ordering::Relaxed);
+ self.error_code.store(code, Relaxed);
}
fn is_unused(&self) -> bool {
- self.error_code.load(Ordering::Relaxed) == BR_OK
+ self.error_code.load(Relaxed) == BR_OK
}
}
@@ -1597,8 +1595,8 @@ impl DeliverToRead for ThreadError {
_thread: &Thread,
writer: &mut BinderReturnWriter<'_>,
) -> Result<bool> {
- let code = self.error_code.load(Ordering::Relaxed);
- self.error_code.store(BR_OK, Ordering::Relaxed);
+ let code = self.error_code.load(Relaxed);
+ self.error_code.store(BR_OK, Relaxed);
writer.write_code(code)?;
Ok(true)
}
@@ -1614,7 +1612,7 @@ impl DeliverToRead for ThreadError {
m,
"{}transaction error: {}\n",
prefix,
- self.error_code.load(Ordering::Relaxed)
+ self.error_code.load(Relaxed)
);
Ok(())
}