From: Xiaobo Liu <cppcoffee@gmail.com>
To: rust-for-linux@vger.kernel.org
Cc: ojeda@kernel.org, Xiaobo Liu <cppcoffee@gmail.com>
Subject: [PATCH] rust: helpers: move list_lru and task_work helpers out of binder.c
Date: Tue, 23 Jun 2026 17:39:19 +0800 [thread overview]
Message-ID: <20260623093919.3543473-1-cppcoffee@gmail.com> (raw)
The helpers in binder.c wrap generic list_lru and task_work inline
functions and have nothing to do with binder. Move them to mm.c and
task_work.c respectively, where they belong by subsystem.
Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
---
rust/helpers/binder.c | 27 ---------------------------
rust/helpers/helpers.c | 2 +-
rust/helpers/mm.c | 14 ++++++++++++++
rust/helpers/task_work.c | 9 +++++++++
4 files changed, 24 insertions(+), 28 deletions(-)
delete mode 100644 rust/helpers/binder.c
create mode 100644 rust/helpers/task_work.c
diff --git a/rust/helpers/binder.c b/rust/helpers/binder.c
deleted file mode 100644
index a2327f1b3..000000000
--- a/rust/helpers/binder.c
+++ /dev/null
@@ -1,27 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-
-/*
- * Copyright (C) 2025 Google LLC.
- */
-
-#include <linux/list_lru.h>
-#include <linux/task_work.h>
-
-__rust_helper unsigned long rust_helper_list_lru_count(struct list_lru *lru)
-{
- return list_lru_count(lru);
-}
-
-__rust_helper unsigned long rust_helper_list_lru_walk(struct list_lru *lru,
- list_lru_walk_cb isolate,
- void *cb_arg,
- unsigned long nr_to_walk)
-{
- return list_lru_walk(lru, isolate, cb_arg, nr_to_walk);
-}
-
-__rust_helper void rust_helper_init_task_work(struct callback_head *twork,
- task_work_func_t func)
-{
- init_task_work(twork, func);
-}
diff --git a/rust/helpers/helpers.c b/rust/helpers/helpers.c
index 998e31052..fe0883b33 100644
--- a/rust/helpers/helpers.c
+++ b/rust/helpers/helpers.c
@@ -43,7 +43,6 @@
#include "atomic_ext.c"
#include "auxiliary.c"
#include "barrier.c"
-#include "binder.c"
#include "bitmap.c"
#include "bitops.c"
#include "blk.c"
@@ -93,6 +92,7 @@
#include "string.c"
#include "sync.c"
#include "task.c"
+#include "task_work.c"
#include "time.c"
#include "uaccess.c"
#include "usb.c"
diff --git a/rust/helpers/mm.c b/rust/helpers/mm.c
index b5540997b..941984feb 100644
--- a/rust/helpers/mm.c
+++ b/rust/helpers/mm.c
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
+#include <linux/list_lru.h>
#include <linux/mm.h>
#include <linux/sched/mm.h>
@@ -8,6 +9,19 @@ __rust_helper void rust_helper_mmgrab(struct mm_struct *mm)
mmgrab(mm);
}
+__rust_helper unsigned long rust_helper_list_lru_count(struct list_lru *lru)
+{
+ return list_lru_count(lru);
+}
+
+__rust_helper unsigned long rust_helper_list_lru_walk(struct list_lru *lru,
+ list_lru_walk_cb isolate,
+ void *cb_arg,
+ unsigned long nr_to_walk)
+{
+ return list_lru_walk(lru, isolate, cb_arg, nr_to_walk);
+}
+
__rust_helper void rust_helper_mmdrop(struct mm_struct *mm)
{
mmdrop(mm);
diff --git a/rust/helpers/task_work.c b/rust/helpers/task_work.c
new file mode 100644
index 000000000..5bdb752cb
--- /dev/null
+++ b/rust/helpers/task_work.c
@@ -0,0 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include <linux/task_work.h>
+
+__rust_helper void rust_helper_init_task_work(struct callback_head *twork,
+ task_work_func_t func)
+{
+ init_task_work(twork, func);
+}
--
2.34.1
next reply other threads:[~2026-06-23 9:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-23 9:39 Xiaobo Liu [this message]
2026-06-23 9:52 ` [PATCH] rust: helpers: move list_lru and task_work helpers out of binder.c Miguel Ojeda
2026-06-23 10:24 ` [PATCH v2] " Xiaobo Liu
2026-06-23 11:42 ` Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260623093919.3543473-1-cppcoffee@gmail.com \
--to=cppcoffee@gmail.com \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox