2021-10-21 08:46:45

by Cai,Huoqing

[permalink] [raw]
Subject: [PATCH] x86: Make use of the helper macro kthread_run()

Repalce kthread_create/wake_up_process() with kthread_run()
to simplify the code.

Signed-off-by: Cai Huoqing <[email protected]>
---
arch/x86/kernel/apm_32.c | 3 +--
arch/x86/mm/pat/cpa-test.c | 6 ++----
2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/arch/x86/kernel/apm_32.c b/arch/x86/kernel/apm_32.c
index 241dda687eb9..0bc62af68ac5 100644
--- a/arch/x86/kernel/apm_32.c
+++ b/arch/x86/kernel/apm_32.c
@@ -2347,7 +2347,7 @@ static int __init apm_init(void)

proc_create_single("apm", 0, NULL, proc_apm_show);

- kapmd_task = kthread_create(apm, NULL, "kapmd");
+ kapmd_task = kthread_run(apm, NULL, "kapmd");
if (IS_ERR(kapmd_task)) {
pr_err("disabled - Unable to start kernel thread\n");
err = PTR_ERR(kapmd_task);
@@ -2355,7 +2355,6 @@ static int __init apm_init(void)
remove_proc_entry("apm", NULL);
return err;
}
- wake_up_process(kapmd_task);

if (num_online_cpus() > 1 && !smp) {
printk(KERN_NOTICE
diff --git a/arch/x86/mm/pat/cpa-test.c b/arch/x86/mm/pat/cpa-test.c
index 0612a73638a8..8022a5769a45 100644
--- a/arch/x86/mm/pat/cpa-test.c
+++ b/arch/x86/mm/pat/cpa-test.c
@@ -266,10 +266,8 @@ static int start_pageattr_test(void)
{
struct task_struct *p;

- p = kthread_create(do_pageattr_test, NULL, "pageattr-test");
- if (!IS_ERR(p))
- wake_up_process(p);
- else
+ p = kthread_run(do_pageattr_test, NULL, "pageattr-test");
+ if (IS_ERR(p))
WARN_ON(1);

return 0;
--
2.25.1