recent kernels have finally stopped exporting kernel_thread, since a deprecation circa 2006. This patch attempts to convert to the newer kernel kthread API, particularly in random.c
Signed-off-by: Russell Senior <[email protected]> --- target/linux/generic/files/crypto/ocf/random.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/target/linux/generic/files/crypto/ocf/random.c b/target/linux/generic/files/crypto/ocf/random.c index a5f2f64..32ead76 100644 --- a/target/linux/generic/files/crypto/ocf/random.c +++ b/target/linux/generic/files/crypto/ocf/random.c @@ -49,6 +49,7 @@ #include <linux/unistd.h> #include <linux/poll.h> #include <linux/random.h> +#include <linux/kthread.h> #include <cryptodev.h> #ifdef CONFIG_OCF_FIPS @@ -79,6 +80,7 @@ struct random_op { void *arg; }; +static struct task_struct *random_thread; static int random_proc(void *arg); static pid_t randomproc = (pid_t) -1; @@ -141,13 +143,13 @@ crypto_rregister( spin_lock_irqsave(&random_lock, flags); list_add_tail(&rops->random_list, &random_ops); if (!started) { - randomproc = kernel_thread(random_proc, NULL, CLONE_FS|CLONE_FILES); - if (randomproc < 0) { - ret = randomproc; - printk("crypto: crypto_rregister cannot start random thread; " - "error %d", ret); - } else + random_thread = kthread_run(random_proc, NULL, "ocf-random"); + if (IS_ERR(random_thread)) { + ret = PTR_ERR(random_thread); + } else { + randomproc = random_thread->pid; started = 1; + } } spin_unlock_irqrestore(&random_lock, flags); @@ -172,7 +174,7 @@ crypto_runregister_all(u_int32_t driverid) spin_lock_irqsave(&random_lock, flags); if (list_empty(&random_ops) && started) - kill_proc(randomproc, SIGKILL, 1); + kthread_stop(random_thread); spin_unlock_irqrestore(&random_lock, flags); return(0); } @@ -203,7 +205,6 @@ random_proc(void *arg) sprintf(current->comm, "ocf-random"); #else daemonize("ocf-random"); - allow_signal(SIGKILL); #endif (void) get_fs(); -- 1.7.12 -- Russell Senior, President [email protected] _______________________________________________ openwrt-devel mailing list [email protected] https://lists.openwrt.org/mailman/listinfo/openwrt-devel
