diff options
author | Herbert Poetzl <herbert@13thfloor.at> | 2007-02-08 12:32:43 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-02-21 10:35:20 -0500 |
commit | 8eec14295e03f9dfe2be7bb75c8004a5fa867cdb (patch) | |
tree | fe5533f0d6957e456bbba4c420e9abb9a3fae358 /drivers/media/dvb/ttpci/av7110.c | |
parent | 2a9f8b5d25beacd034369fca416b548cbf931561 (diff) |
V4L/DVB (5208): Kthread API conversion for dvb_frontend and av7110
dvb kernel_thread to kthread API port.
It is running fine here, including module load/unload and software suspend
(which doesn't work as expected with or without this patch :).
I didn't convert the dvb_ca_en50221 as I do not have such an interface, but
if the conversion process is fine with the v4l-dvb maintainers, it should not
be a problem to send a patch for that too ...
Acked-by: Oliver Endriss <o.endriss@gmx.de>
Signed-off-by: Herbert Poetzl <herbert@13thfloor.at>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Oliver Endriss <o.endriss@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/dvb/ttpci/av7110.c')
-rw-r--r-- | drivers/media/dvb/ttpci/av7110.c | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/drivers/media/dvb/ttpci/av7110.c b/drivers/media/dvb/ttpci/av7110.c index bb213d836c90..29ed532ba966 100644 --- a/drivers/media/dvb/ttpci/av7110.c +++ b/drivers/media/dvb/ttpci/av7110.c | |||
@@ -51,6 +51,7 @@ | |||
51 | #include <linux/firmware.h> | 51 | #include <linux/firmware.h> |
52 | #include <linux/crc32.h> | 52 | #include <linux/crc32.h> |
53 | #include <linux/i2c.h> | 53 | #include <linux/i2c.h> |
54 | #include <linux/kthread.h> | ||
54 | 55 | ||
55 | #include <asm/system.h> | 56 | #include <asm/system.h> |
56 | 57 | ||
@@ -223,11 +224,10 @@ static void recover_arm(struct av7110 *av7110) | |||
223 | 224 | ||
224 | static void av7110_arm_sync(struct av7110 *av7110) | 225 | static void av7110_arm_sync(struct av7110 *av7110) |
225 | { | 226 | { |
226 | av7110->arm_rmmod = 1; | 227 | if (av7110->arm_thread) |
227 | wake_up_interruptible(&av7110->arm_wait); | 228 | kthread_stop(av7110->arm_thread); |
228 | 229 | ||
229 | while (av7110->arm_thread) | 230 | av7110->arm_thread = NULL; |
230 | msleep(1); | ||
231 | } | 231 | } |
232 | 232 | ||
233 | static int arm_thread(void *data) | 233 | static int arm_thread(void *data) |
@@ -238,17 +238,11 @@ static int arm_thread(void *data) | |||
238 | 238 | ||
239 | dprintk(4, "%p\n",av7110); | 239 | dprintk(4, "%p\n",av7110); |
240 | 240 | ||
241 | lock_kernel(); | ||
242 | daemonize("arm_mon"); | ||
243 | sigfillset(¤t->blocked); | ||
244 | unlock_kernel(); | ||
245 | |||
246 | av7110->arm_thread = current; | ||
247 | |||
248 | for (;;) { | 241 | for (;;) { |
249 | timeout = wait_event_interruptible_timeout(av7110->arm_wait, | 242 | timeout = wait_event_interruptible_timeout(av7110->arm_wait, |
250 | av7110->arm_rmmod, 5 * HZ); | 243 | kthread_should_stop(), 5 * HZ); |
251 | if (-ERESTARTSYS == timeout || av7110->arm_rmmod) { | 244 | |
245 | if (-ERESTARTSYS == timeout || kthread_should_stop()) { | ||
252 | /* got signal or told to quit*/ | 246 | /* got signal or told to quit*/ |
253 | break; | 247 | break; |
254 | } | 248 | } |
@@ -276,7 +270,6 @@ static int arm_thread(void *data) | |||
276 | av7110->arm_errors = 0; | 270 | av7110->arm_errors = 0; |
277 | } | 271 | } |
278 | 272 | ||
279 | av7110->arm_thread = NULL; | ||
280 | return 0; | 273 | return 0; |
281 | } | 274 | } |
282 | 275 | ||
@@ -2338,6 +2331,7 @@ static int __devinit av7110_attach(struct saa7146_dev* dev, | |||
2338 | const int length = TS_WIDTH * TS_HEIGHT; | 2331 | const int length = TS_WIDTH * TS_HEIGHT; |
2339 | struct pci_dev *pdev = dev->pci; | 2332 | struct pci_dev *pdev = dev->pci; |
2340 | struct av7110 *av7110; | 2333 | struct av7110 *av7110; |
2334 | struct task_struct *thread; | ||
2341 | int ret, count = 0; | 2335 | int ret, count = 0; |
2342 | 2336 | ||
2343 | dprintk(4, "dev: %p\n", dev); | 2337 | dprintk(4, "dev: %p\n", dev); |
@@ -2622,9 +2616,12 @@ static int __devinit av7110_attach(struct saa7146_dev* dev, | |||
2622 | printk ("dvb-ttpci: Warning, firmware version 0x%04x is too old. " | 2616 | printk ("dvb-ttpci: Warning, firmware version 0x%04x is too old. " |
2623 | "System might be unstable!\n", FW_VERSION(av7110->arm_app)); | 2617 | "System might be unstable!\n", FW_VERSION(av7110->arm_app)); |
2624 | 2618 | ||
2625 | ret = kernel_thread(arm_thread, (void *) av7110, 0); | 2619 | thread = kthread_run(arm_thread, (void *) av7110, "arm_mon"); |
2626 | if (ret < 0) | 2620 | if (IS_ERR(thread)) { |
2621 | ret = PTR_ERR(thread); | ||
2627 | goto err_stop_arm_9; | 2622 | goto err_stop_arm_9; |
2623 | } | ||
2624 | av7110->arm_thread = thread; | ||
2628 | 2625 | ||
2629 | /* set initial volume in mixer struct */ | 2626 | /* set initial volume in mixer struct */ |
2630 | av7110->mixer.volume_left = volume; | 2627 | av7110->mixer.volume_left = volume; |