aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/ivtv
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-08-07 15:42:58 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-08-07 15:42:58 -0400
commit3b7433b8a8a83c87972065b1852b7dcae691e464 (patch)
tree93fa2c003f8baef5ab0733b53bac77961ed5240c /drivers/media/video/ivtv
parent4a386c3e177ca2fbc70c9283d0b46537844763a0 (diff)
parent6ee0578b4daaea01c96b172c6aacca43fd9807a6 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq: (55 commits) workqueue: mark init_workqueues() as early_initcall() workqueue: explain for_each_*cwq_cpu() iterators fscache: fix build on !CONFIG_SYSCTL slow-work: kill it gfs2: use workqueue instead of slow-work drm: use workqueue instead of slow-work cifs: use workqueue instead of slow-work fscache: drop references to slow-work fscache: convert operation to use workqueue instead of slow-work fscache: convert object to use workqueue instead of slow-work workqueue: fix how cpu number is stored in work->data workqueue: fix mayday_mask handling on UP workqueue: fix build problem on !CONFIG_SMP workqueue: fix locking in retry path of maybe_create_worker() async: use workqueue for worker pool workqueue: remove WQ_SINGLE_CPU and use WQ_UNBOUND instead workqueue: implement unbound workqueue workqueue: prepare for WQ_UNBOUND implementation libata: take advantage of cmwq and remove concurrency limitations workqueue: fix worker management invocation without pending works ... Fixed up conflicts in fs/cifs/* as per Tejun. Other trivial conflicts in include/linux/workqueue.h, kernel/trace/Kconfig and kernel/workqueue.c
Diffstat (limited to 'drivers/media/video/ivtv')
-rw-r--r--drivers/media/video/ivtv/ivtv-driver.c26
-rw-r--r--drivers/media/video/ivtv/ivtv-driver.h8
-rw-r--r--drivers/media/video/ivtv/ivtv-irq.c15
-rw-r--r--drivers/media/video/ivtv/ivtv-irq.h2
4 files changed, 24 insertions, 27 deletions
diff --git a/drivers/media/video/ivtv/ivtv-driver.c b/drivers/media/video/ivtv/ivtv-driver.c
index 90daa6e751d8..07c5c18a25cb 100644
--- a/drivers/media/video/ivtv/ivtv-driver.c
+++ b/drivers/media/video/ivtv/ivtv-driver.c
@@ -705,6 +705,8 @@ done:
705 */ 705 */
706static int __devinit ivtv_init_struct1(struct ivtv *itv) 706static int __devinit ivtv_init_struct1(struct ivtv *itv)
707{ 707{
708 struct sched_param param = { .sched_priority = 99 };
709
708 itv->base_addr = pci_resource_start(itv->pdev, 0); 710 itv->base_addr = pci_resource_start(itv->pdev, 0);
709 itv->enc_mbox.max_mbox = 2; /* the encoder has 3 mailboxes (0-2) */ 711 itv->enc_mbox.max_mbox = 2; /* the encoder has 3 mailboxes (0-2) */
710 itv->dec_mbox.max_mbox = 1; /* the decoder has 2 mailboxes (0-1) */ 712 itv->dec_mbox.max_mbox = 1; /* the decoder has 2 mailboxes (0-1) */
@@ -716,13 +718,17 @@ static int __devinit ivtv_init_struct1(struct ivtv *itv)
716 spin_lock_init(&itv->lock); 718 spin_lock_init(&itv->lock);
717 spin_lock_init(&itv->dma_reg_lock); 719 spin_lock_init(&itv->dma_reg_lock);
718 720
719 itv->irq_work_queues = create_singlethread_workqueue(itv->v4l2_dev.name); 721 init_kthread_worker(&itv->irq_worker);
720 if (itv->irq_work_queues == NULL) { 722 itv->irq_worker_task = kthread_run(kthread_worker_fn, &itv->irq_worker,
721 IVTV_ERR("Could not create ivtv workqueue\n"); 723 itv->v4l2_dev.name);
724 if (IS_ERR(itv->irq_worker_task)) {
725 IVTV_ERR("Could not create ivtv task\n");
722 return -1; 726 return -1;
723 } 727 }
728 /* must use the FIFO scheduler as it is realtime sensitive */
729 sched_setscheduler(itv->irq_worker_task, SCHED_FIFO, &param);
724 730
725 INIT_WORK(&itv->irq_work_queue, ivtv_irq_work_handler); 731 init_kthread_work(&itv->irq_work, ivtv_irq_work_handler);
726 732
727 /* start counting open_id at 1 */ 733 /* start counting open_id at 1 */
728 itv->open_id = 1; 734 itv->open_id = 1;
@@ -1006,7 +1012,7 @@ static int __devinit ivtv_probe(struct pci_dev *pdev,
1006 /* PCI Device Setup */ 1012 /* PCI Device Setup */
1007 retval = ivtv_setup_pci(itv, pdev, pci_id); 1013 retval = ivtv_setup_pci(itv, pdev, pci_id);
1008 if (retval == -EIO) 1014 if (retval == -EIO)
1009 goto free_workqueue; 1015 goto free_worker;
1010 if (retval == -ENXIO) 1016 if (retval == -ENXIO)
1011 goto free_mem; 1017 goto free_mem;
1012 1018
@@ -1218,8 +1224,8 @@ free_mem:
1218 release_mem_region(itv->base_addr + IVTV_REG_OFFSET, IVTV_REG_SIZE); 1224 release_mem_region(itv->base_addr + IVTV_REG_OFFSET, IVTV_REG_SIZE);
1219 if (itv->has_cx23415) 1225 if (itv->has_cx23415)
1220 release_mem_region(itv->base_addr + IVTV_DECODER_OFFSET, IVTV_DECODER_SIZE); 1226 release_mem_region(itv->base_addr + IVTV_DECODER_OFFSET, IVTV_DECODER_SIZE);
1221free_workqueue: 1227free_worker:
1222 destroy_workqueue(itv->irq_work_queues); 1228 kthread_stop(itv->irq_worker_task);
1223err: 1229err:
1224 if (retval == 0) 1230 if (retval == 0)
1225 retval = -ENODEV; 1231 retval = -ENODEV;
@@ -1363,9 +1369,9 @@ static void ivtv_remove(struct pci_dev *pdev)
1363 ivtv_set_irq_mask(itv, 0xffffffff); 1369 ivtv_set_irq_mask(itv, 0xffffffff);
1364 del_timer_sync(&itv->dma_timer); 1370 del_timer_sync(&itv->dma_timer);
1365 1371
1366 /* Stop all Work Queues */ 1372 /* Kill irq worker */
1367 flush_workqueue(itv->irq_work_queues); 1373 flush_kthread_worker(&itv->irq_worker);
1368 destroy_workqueue(itv->irq_work_queues); 1374 kthread_stop(itv->irq_worker_task);
1369 1375
1370 ivtv_streams_cleanup(itv, 1); 1376 ivtv_streams_cleanup(itv, 1);
1371 ivtv_udma_free(itv); 1377 ivtv_udma_free(itv);
diff --git a/drivers/media/video/ivtv/ivtv-driver.h b/drivers/media/video/ivtv/ivtv-driver.h
index bd084df4448a..102071246218 100644
--- a/drivers/media/video/ivtv/ivtv-driver.h
+++ b/drivers/media/video/ivtv/ivtv-driver.h
@@ -51,7 +51,7 @@
51#include <linux/unistd.h> 51#include <linux/unistd.h>
52#include <linux/pagemap.h> 52#include <linux/pagemap.h>
53#include <linux/scatterlist.h> 53#include <linux/scatterlist.h>
54#include <linux/workqueue.h> 54#include <linux/kthread.h>
55#include <linux/mutex.h> 55#include <linux/mutex.h>
56#include <linux/slab.h> 56#include <linux/slab.h>
57#include <asm/uaccess.h> 57#include <asm/uaccess.h>
@@ -260,7 +260,6 @@ struct ivtv_mailbox_data {
260#define IVTV_F_I_DEC_PAUSED 20 /* the decoder is paused */ 260#define IVTV_F_I_DEC_PAUSED 20 /* the decoder is paused */
261#define IVTV_F_I_INITED 21 /* set after first open */ 261#define IVTV_F_I_INITED 21 /* set after first open */
262#define IVTV_F_I_FAILED 22 /* set if first open failed */ 262#define IVTV_F_I_FAILED 22 /* set if first open failed */
263#define IVTV_F_I_WORK_INITED 23 /* worker thread was initialized */
264 263
265/* Event notifications */ 264/* Event notifications */
266#define IVTV_F_I_EV_DEC_STOPPED 28 /* decoder stopped event */ 265#define IVTV_F_I_EV_DEC_STOPPED 28 /* decoder stopped event */
@@ -666,8 +665,9 @@ struct ivtv {
666 /* Interrupts & DMA */ 665 /* Interrupts & DMA */
667 u32 irqmask; /* active interrupts */ 666 u32 irqmask; /* active interrupts */
668 u32 irq_rr_idx; /* round-robin stream index */ 667 u32 irq_rr_idx; /* round-robin stream index */
669 struct workqueue_struct *irq_work_queues; /* workqueue for PIO/YUV/VBI actions */ 668 struct kthread_worker irq_worker; /* kthread worker for PIO/YUV/VBI actions */
670 struct work_struct irq_work_queue; /* work entry */ 669 struct task_struct *irq_worker_task; /* task for irq_worker */
670 struct kthread_work irq_work; /* kthread work entry */
671 spinlock_t dma_reg_lock; /* lock access to DMA engine registers */ 671 spinlock_t dma_reg_lock; /* lock access to DMA engine registers */
672 int cur_dma_stream; /* index of current stream doing DMA (-1 if none) */ 672 int cur_dma_stream; /* index of current stream doing DMA (-1 if none) */
673 int cur_pio_stream; /* index of current stream doing PIO (-1 if none) */ 673 int cur_pio_stream; /* index of current stream doing PIO (-1 if none) */
diff --git a/drivers/media/video/ivtv/ivtv-irq.c b/drivers/media/video/ivtv/ivtv-irq.c
index fea1ec33b0df..9b4faf009196 100644
--- a/drivers/media/video/ivtv/ivtv-irq.c
+++ b/drivers/media/video/ivtv/ivtv-irq.c
@@ -71,19 +71,10 @@ static void ivtv_pio_work_handler(struct ivtv *itv)
71 write_reg(IVTV_IRQ_ENC_PIO_COMPLETE, 0x44); 71 write_reg(IVTV_IRQ_ENC_PIO_COMPLETE, 0x44);
72} 72}
73 73
74void ivtv_irq_work_handler(struct work_struct *work) 74void ivtv_irq_work_handler(struct kthread_work *work)
75{ 75{
76 struct ivtv *itv = container_of(work, struct ivtv, irq_work_queue); 76 struct ivtv *itv = container_of(work, struct ivtv, irq_work);
77 77
78 DEFINE_WAIT(wait);
79
80 if (test_and_clear_bit(IVTV_F_I_WORK_INITED, &itv->i_flags)) {
81 struct sched_param param = { .sched_priority = 99 };
82
83 /* This thread must use the FIFO scheduler as it
84 is realtime sensitive. */
85 sched_setscheduler(current, SCHED_FIFO, &param);
86 }
87 if (test_and_clear_bit(IVTV_F_I_WORK_HANDLER_PIO, &itv->i_flags)) 78 if (test_and_clear_bit(IVTV_F_I_WORK_HANDLER_PIO, &itv->i_flags))
88 ivtv_pio_work_handler(itv); 79 ivtv_pio_work_handler(itv);
89 80
@@ -975,7 +966,7 @@ irqreturn_t ivtv_irq_handler(int irq, void *dev_id)
975 } 966 }
976 967
977 if (test_and_clear_bit(IVTV_F_I_HAVE_WORK, &itv->i_flags)) { 968 if (test_and_clear_bit(IVTV_F_I_HAVE_WORK, &itv->i_flags)) {
978 queue_work(itv->irq_work_queues, &itv->irq_work_queue); 969 queue_kthread_work(&itv->irq_worker, &itv->irq_work);
979 } 970 }
980 971
981 spin_unlock(&itv->dma_reg_lock); 972 spin_unlock(&itv->dma_reg_lock);
diff --git a/drivers/media/video/ivtv/ivtv-irq.h b/drivers/media/video/ivtv/ivtv-irq.h
index f879a5822e71..1e84433737cc 100644
--- a/drivers/media/video/ivtv/ivtv-irq.h
+++ b/drivers/media/video/ivtv/ivtv-irq.h
@@ -46,7 +46,7 @@
46 46
47irqreturn_t ivtv_irq_handler(int irq, void *dev_id); 47irqreturn_t ivtv_irq_handler(int irq, void *dev_id);
48 48
49void ivtv_irq_work_handler(struct work_struct *work); 49void ivtv_irq_work_handler(struct kthread_work *work);
50void ivtv_dma_stream_dec_prepare(struct ivtv_stream *s, u32 offset, int lock); 50void ivtv_dma_stream_dec_prepare(struct ivtv_stream *s, u32 offset, int lock);
51void ivtv_unfinished_dma(unsigned long arg); 51void ivtv_unfinished_dma(unsigned long arg);
52 52