Skip to contentSkip to conversation

workqueue: rust: sync with `WORK_CPU_UNBOUND` change

PATCH Applied Miguel Ojeda 3 participants 3 messages Feb 1, 2024 Rust

lore
Share & tools
lore

Miguel Ojeda

author maintainer
#0 lore raw

PATCH 1/1 workqueue: rust: sync with `WORK_CPU_UNBOUND` change

Commit e563d0a7cdc1 ("workqueue: Break up enum definitions and give names to the types") gives a name to the enum where WORK_CPU_UNBOUND was defined, so bindgen changes its output from e.g.:

    pub type _bindgen_ty_10 = core::ffi::c_uint;
    pub const WORK_CPU_UNBOUND: _bindgen_ty_10 = 64;

to e.g.:

    pub type wq_misc_consts = core::ffi::c_uint;
    pub const wq_misc_consts_WORK_CPU_UNBOUND: wq_misc_consts = 64;

Thus update Rust's side to match the change (which requires a slight reformat of the code), fixing the build error.

Fixes e563d0a7cdc1 ("workqueue: Break up enum definitions and give names to the types")

---
Tejun: here is the formal patch as you requested. Please feel free to either take it or to rebase to fix the old commit. Thanks!

 rust/kernel/workqueue.rs | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
rust/kernel/workqueue.rs +5 -1
index 498397877376..d00231e18007 100644
@@ -199,7 +199,11 @@ pub fn enqueue<W, const ID: u64>(&self, w: W) -> W::EnqueueOutput
         // stay valid until we call the function pointer in the `work_struct`, so the access is ok.
         unsafe {
             w.__enqueue(move |work_ptr| {
-                bindings::queue_work_on(bindings::WORK_CPU_UNBOUND as _, queue_ptr, work_ptr)
+                bindings::queue_work_on(
+                    bindings::wq_misc_consts_WORK_CPU_UNBOUND as _,
+                    queue_ptr,
+                    work_ptr,
+                )
             })
         }
     }

base-commit: 15930da42f8981dc42c19038042947b475b19f47 --
2.43.0

Reviewed-by on v1 1/1
#1 lore raw
Quoted 12 lines · Miguel Ojeda

Commit e563d0a7cdc1 ("workqueue: Break up enum definitions and give names to the types") gives a name to the enum where WORK_CPU_UNBOUND was defined, so bindgen changes its output from e.g.:

    pub type _bindgen_ty_10 = core::ffi::c_uint;
    pub const WORK_CPU_UNBOUND: _bindgen_ty_10 = 64;

to e.g.:

    pub type wq_misc_consts = core::ffi::c_uint;
    pub const wq_misc_consts_WORK_CPU_UNBOUND: wq_misc_consts = 64;
Quoted 6 lines

Thus update Rust's side to match the change (which requires a slight reformat of the code), fixing the build error.

Fixes e563d0a7cdc1 ("workqueue: Break up enum definitions and give names to the types")

Regards,
Boqun

Quoted 29 lines

---
Tejun: here is the formal patch as you requested. Please feel free to either take it or to rebase to fix the old commit. Thanks!

 rust/kernel/workqueue.rs | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
rust/kernel/workqueue.rs +5 -1
index 498397877376..d00231e18007 100644
@@ -199,7 +199,11 @@ pub fn enqueue<W, const ID: u64>(&self, w: W) -> W::EnqueueOutput
         // stay valid until we call the function pointer in the `work_struct`, so the access is ok.
         unsafe {
             w.__enqueue(move |work_ptr| {
-                bindings::queue_work_on(bindings::WORK_CPU_UNBOUND as _, queue_ptr, work_ptr)
+                bindings::queue_work_on(
+                    bindings::wq_misc_consts_WORK_CPU_UNBOUND as _,
+                    queue_ptr,
+                    work_ptr,
+                )
             })
         }
     }

base-commit: 15930da42f8981dc42c19038042947b475b19f47 --
2.43.0

Applied
#2 lore raw
In reply to Miguel Ojeda
Quoted 12 lines · Miguel Ojeda

Commit e563d0a7cdc1 ("workqueue: Break up enum definitions and give names to the types") gives a name to the enum where WORK_CPU_UNBOUND was defined, so bindgen changes its output from e.g.:

    pub type _bindgen_ty_10 = core::ffi::c_uint;
    pub const WORK_CPU_UNBOUND: _bindgen_ty_10 = 64;

to e.g.:

    pub type wq_misc_consts = core::ffi::c_uint;
    pub const wq_misc_consts_WORK_CPU_UNBOUND: wq_misc_consts = 64;
Quoted 6 lines

Thus update Rust's side to match the change (which requires a slight reformat of the code), fixing the build error.

Fixes e563d0a7cdc1 ("workqueue: Break up enum definitions and give names to the types")

Applied to wq/for-6.9.

Thanks.

Signature · 1 line
tejun