[RFC PATCH 4/7] drivers: android: binder: Replace `impl_has_work!` with `#[derive(HasField)]`

Boqun Feng posted 7 patches 1 week, 3 days ago
[RFC PATCH 4/7] drivers: android: binder: Replace `impl_has_work!` with `#[derive(HasField)]`
Posted by Boqun Feng 1 week, 3 days ago
`#[derive(HasField)]` offers less code and better ergonomic for defining
a struct with a Work in it. Hence replace the current usage of
`impl_has_work!()`.

Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
---
 drivers/android/binder/process.rs | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/android/binder/process.rs b/drivers/android/binder/process.rs
index 132055b4790f..2a2510e3a0cb 100644
--- a/drivers/android/binder/process.rs
+++ b/drivers/android/binder/process.rs
@@ -423,6 +423,7 @@ fn new() -> Self {
 /// Strictly speaking, there can be multiple of these per process. There is one for each binder fd
 /// that a process has opened, so processes using several binder contexts have several `Process`
 /// objects. This ensures that the contexts are fully separated.
+#[derive(HasField)]
 #[pin_data]
 pub(crate) struct Process {
     pub(crate) ctx: Arc<Context>,
@@ -451,6 +452,7 @@ pub(crate) struct Process {
 
     // Work node for deferred work item.
     #[pin]
+    #[field]
     defer_work: Work<Process>,
 
     // Links for process list in Context.
@@ -460,10 +462,6 @@ pub(crate) struct Process {
     pub(crate) stats: BinderStats,
 }
 
-kernel::impl_has_work! {
-    impl HasWork<Process> for Process { self.defer_work }
-}
-
 kernel::list::impl_list_arc_safe! {
     impl ListArcSafe<0> for Process { untracked; }
 }
-- 
2.50.1 (Apple Git-155)