mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Teoh <htmldeveloper@gmail.com>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Greg KH <greg@kroah.com>, Paul Lin <paul_lin@ralinktech.com>
Subject: Re: [PATCH] replace kernel_thread() with kthread_run() in RT2870
Date: Sat, 14 Mar 2009 12:07:30 +0800	[thread overview]
Message-ID: <804dabb00903132107k10fe11efo1622877d4a535500@mail.gmail.com> (raw)
In-Reply-To: <804dabb00903132101o6bf812c1r1efd02d069b5c7fa@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 508 bytes --]

Sorry, mixed up the patches with another patch.   Here is the correct
one.   Thanks.


On Sat, Mar 14, 2009 at 12:01 PM, Peter Teoh <htmldeveloper@gmail.com> wrote:
> As advised by Greg KH:
>
> http://lkml.org/lkml/2009/3/13/131
>
> Replaced the usage of kernel_thread() with kthread_run().   Compiled
> successfully, but not tested as I don't have the hardware.
>
> (parsed by scripts/checkpatch.pl as well).
>
> Thanks.
>
> --
> Regards,
> Peter Teoh
>



-- 
Regards,
Peter Teoh

[-- Attachment #2: rt2870_kernel_thread.patch --]
[-- Type: text/x-diff, Size: 2586 bytes --]

Replace use of kernel_thread() with kthread_run(), as the former is deprecated.

Signed-off-by: Peter Teoh <htmldeveloper@gmail.com>

diff --git a/drivers/staging/rt2870/common/2870_rtmp_init.c b/drivers/staging/rt2870/common/2870_rtmp_init.c
index 9f5143b..9a81d0e 100644
--- a/drivers/staging/rt2870/common/2870_rtmp_init.c
+++ b/drivers/staging/rt2870/common/2870_rtmp_init.c
@@ -765,7 +765,7 @@ NDIS_STATUS	 CreateThreads(
 {
 	PRTMP_ADAPTER pAd = net_dev->ml_priv;
 	POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie;
-	pid_t pid_number = -1;
+	struct task_struct *tsk;
 
 	//init_MUTEX(&(pAd->usbdev_semaphore));
 
@@ -780,35 +780,38 @@ NDIS_STATUS	 CreateThreads(
 
 	// Creat MLME Thread
 	pObj->MLMEThr_pid= THREAD_PID_INIT_VALUE;
-	pid_number = kernel_thread(MlmeThread, pAd, CLONE_VM);
-	if (pid_number < 0)
-	{
+	tsk = kthread_run(MlmeThread, pAd, pAd->net_dev->name);
+
+	if (IS_ERR(tsk)) {
 		printk (KERN_WARNING "%s: unable to start Mlme thread\n",pAd->net_dev->name);
 		return NDIS_STATUS_FAILURE;
 	}
-	pObj->MLMEThr_pid = GET_PID(pid_number);
+
+	pObj->MLMEThr_pid = get_pid(task_pid(tsk));
 	// Wait for the thread to start
 	wait_for_completion(&(pAd->mlmeComplete));
 
 	// Creat Command Thread
 	pObj->RTUSBCmdThr_pid= THREAD_PID_INIT_VALUE;
-	pid_number = kernel_thread(RTUSBCmdThread, pAd, CLONE_VM);
-	if (pid_number < 0)
+	tsk = kthread_run(RTUSBCmdThread, pAd, pAd->net_dev->name);
+
+	if (IS_ERR(tsk) < 0)
 	{
 		printk (KERN_WARNING "%s: unable to start RTUSBCmd thread\n",pAd->net_dev->name);
 		return NDIS_STATUS_FAILURE;
 	}
-	pObj->RTUSBCmdThr_pid = GET_PID(pid_number);
+
+	pObj->RTUSBCmdThr_pid = get_pid(task_pid(tsk));
 	wait_for_completion(&(pAd->CmdQComplete));
 
 	pObj->TimerQThr_pid= THREAD_PID_INIT_VALUE;
-	pid_number = kernel_thread(TimerQThread, pAd, CLONE_VM);
-	if (pid_number < 0)
+	tsk = kthread_run(TimerQThread, pAd, pAd->net_dev->name);
+	if (IS_ERR(tsk) < 0)
 	{
 		printk (KERN_WARNING "%s: unable to start TimerQThread\n",pAd->net_dev->name);
 		return NDIS_STATUS_FAILURE;
 	}
-	pObj->TimerQThr_pid = GET_PID(pid_number);
+	pObj->TimerQThr_pid = get_pid(task_pid(tsk));
 	// Wait for the thread to start
 	wait_for_completion(&(pAd->TimerQComplete));
 
diff --git a/drivers/staging/rt2870/rt_linux.h b/drivers/staging/rt2870/rt_linux.h
index 859f9ce..9a8ed1b 100644
--- a/drivers/staging/rt2870/rt_linux.h
+++ b/drivers/staging/rt2870/rt_linux.h
@@ -44,6 +44,7 @@
 #include <linux/module.h>
 #include <linux/version.h>
 #include <linux/kernel.h>
+#include <linux/kthread.h>
 
 #include <linux/spinlock.h>
 #include <linux/init.h>

  reply	other threads:[~2009-03-14  4:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-14  4:01 Peter Teoh
2009-03-14  4:07 ` Peter Teoh [this message]
2009-03-14  6:58   ` Peter Teoh

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=804dabb00903132107k10fe11efo1622877d4a535500@mail.gmail.com \
    --to=htmldeveloper@gmail.com \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paul_lin@ralinktech.com \
    /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

all inboxes | Powered by JetHome®