[PATCH] cowloop: fix deprecated kernel_thread() call
Denis Kirjanov <kirjanov@gmail.com
kirjanov at gmail.com
Fri Sep 18 19:28:27 UTC 2009
This fixes checkpatch warning about deprecated kernel_thread() call
Signed-off-by: Denis Kirjanov <kirjanov at gmail.com>
---
--- cowloop.c.orig 2009-09-18 21:11:46.000000000 +0400
+++ cowloop.c 2009-09-18 23:21:00.000000000 +0400
@@ -163,6 +163,7 @@ static char cowloop_version[] = "3.2";
#include <linux/hdreg.h>
#include <linux/genhd.h>
#include <linux/statfs.h>
+#include <linux/kthread.h>
#include "cowloop.h"
@@ -269,7 +270,7 @@ struct cowloop_device {
/*
** administration for interface with the kernel-thread
*/
- int pid; /* pid==0: no thread available */
+ struct task_struct *cowd_task; /* cowloop helper thread */
struct request *req; /* request to be handled now */
wait_queue_head_t waitq; /* wait-Q: thread waits for work */
char closedown; /* boolean: thread exit required */
@@ -859,7 +860,7 @@ cowlo_request(struct request_queue *q)
** when no kernel-thread is available, the request will
** produce an I/O-error
*/
- if (!cowdev->pid) {
+ if (!cowdev->cowd_task) {
printk(KERN_ERR"cowloop - no thread available\n");
__blk_end_request_cur(req, -EIO); /* request failed */
cowdev->iobusy = 0;
@@ -915,7 +916,7 @@ cowlo_daemon(struct cowloop_device *cowd
}
if (cowdev->closedown) /* module will be unloaded ? */{
- cowdev->pid = 0;
+ cowdev->cowd_task = NULL;
return 0;
}
@@ -1655,7 +1656,7 @@ cowlo_readproc(char *buf, char **start,
cowdev->state & COWWATCHDOG ? "watchdog " : "",
cowdev->opencnt,
- cowdev->pid,
+ cowdev->cowd_task->pid,
cowdev->rdoname,
cowdev->rdoreads,
cowdev->cowname,
@@ -1802,7 +1803,15 @@ cowlo_openpair(char *rdof, char *cowf, i
*/
DEBUGP(DCOW"cowloop - kickoff daemon....\n");
- cowdev->pid = kernel_thread((int (*)(void *))cowlo_daemon, cowdev, 0);
+ cowdev->cowd_task = kthread_run((int (*)(void *))cowlo_daemon,
+ cowdev, "%s", "cowloopd");
+ if (IS_ERR(cowdev->cowd_task)) {
+ retval = PTR_ERR(cowdev->cowd_task);
+ printk(KERN_WARNING "cowloop: "
+ "Unable to start thread for device %d\n",
+ minor);
+ return retval;
+ }
/*
** create a file below directory /proc/cow for this new cowdevice
@@ -1880,7 +1889,7 @@ cowlo_closepair(struct cowloop_device *c
cowdev->qfilled = 1;
wake_up_interruptible(&cowdev->waitq);
- while (cowdev->pid)
+ while (cowdev->cowd_task)
schedule();
del_gendisk(cowdev->gd); /* revert the alloc_disk() */
More information about the devel
mailing list