mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] replace kernel_thread() with kthread_run() in RT2870
@ 2009-03-14  4:01 Peter Teoh
  2009-03-14  4:07 ` Peter Teoh
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Teoh @ 2009-03-14  4:01 UTC (permalink / raw)
  To: LKML; +Cc: Greg KH, Paul Lin

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

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

[-- Attachment #2: rt2870_kernel_thread.patch --]
[-- Type: text/x-diff, Size: 3669 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>
diff --git a/drivers/staging/usbip/usbip_common.c b/drivers/staging/usbip/usbip_common.c
index 22f93dd..3bd85b5 100644
--- a/drivers/staging/usbip/usbip_common.c
+++ b/drivers/staging/usbip/usbip_common.c
@@ -18,6 +18,7 @@
  */
 
 #include <linux/kernel.h>
+#include <linux/kthread.h>
 #include <linux/file.h>
 #include <linux/tcp.h>
 #include <linux/in.h>
@@ -406,16 +407,16 @@ void usbip_start_threads(struct usbip_device *ud)
 	/*
 	 * threads are invoked per one device (per one connection).
 	 */
-	int retval;
+	struct task_struct *tsk;
 
-	retval = kernel_thread(usbip_thread, (void *)&ud->tcp_rx, 0);
-	if (retval < 0) {
+	tsk = kthread_run(usbip_thread, (void *)&ud->tcp_rx, "usbip_tcp_rx");
+	if (IS_ERR(tsk) < 0) {
 		printk(KERN_ERR "Creating tcp_rx thread for ud %p failed.\n",
 				ud);
 		return;
 	}
-	retval = kernel_thread(usbip_thread, (void *)&ud->tcp_tx, 0);
-	if (retval < 0) {
+	tsk = kthread_run(usbip_thread, (void *)&ud->tcp_tx, "usbip_tcp_tx");
+	if (IS_ERR(tsk) < 0) {
 		printk(KERN_ERR "Creating tcp_tx thread for ud %p failed.\n",
 				ud);
 		return;

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] replace kernel_thread() with kthread_run() in RT2870
  2009-03-14  4:01 [PATCH] replace kernel_thread() with kthread_run() in RT2870 Peter Teoh
@ 2009-03-14  4:07 ` Peter Teoh
  2009-03-14  6:58   ` Peter Teoh
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Teoh @ 2009-03-14  4:07 UTC (permalink / raw)
  To: LKML; +Cc: Greg KH, Paul Lin

[-- 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>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] replace kernel_thread() with kthread_run() in RT2870
  2009-03-14  4:07 ` Peter Teoh
@ 2009-03-14  6:58   ` Peter Teoh
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Teoh @ 2009-03-14  6:58 UTC (permalink / raw)
  To: Greg KH; +Cc: LKML

Sorry Greg,

I overlooked some more changes needed.   Will resend later again.
And the original code owner "Paul Lin" does not have the  right email
as well, so I am not sure who can check on the hardware aspect.
THanks.

On Sat, Mar 14, 2009 at 12:07 PM, Peter Teoh <htmldeveloper@gmail.com> wrote:
> 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
>



-- 
Regards,
Peter Teoh

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-03-14  6:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-14  4:01 [PATCH] replace kernel_thread() with kthread_run() in RT2870 Peter Teoh
2009-03-14  4:07 ` Peter Teoh
2009-03-14  6:58   ` Peter Teoh

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®