The patch number 9779 was added via Mauro Carvalho Chehab <[EMAIL PROTECTED]> to http://linuxtv.org/hg/v4l-dvb master development tree.
Kernel patches in this development tree may be modified to be backward compatible with older kernels. Compatibility modifications will be removed before inclusion into the mainstream Kernel If anyone has any objections, please let us know by sending a message to: [EMAIL PROTECTED] ------ From: Mauro Carvalho Chehab <[EMAIL PROTECTED]> merge: http://linuxtv.org/hg/~awalls/v4l-dvb Signed-off-by: Mauro Carvalho Chehab <[EMAIL PROTECTED]> --- linux/drivers/media/video/cx18/cx18-driver.c | 44 +++++++++--------- linux/drivers/media/video/cx18/cx18-driver.h | 2 linux/drivers/media/video/cx18/cx18-io.h | 6 ++ linux/drivers/media/video/cx18/cx18-mailbox.c | 2 v4l/versions.txt | 2 5 files changed, 30 insertions(+), 26 deletions(-) diff -r e9fe49f4edf9 -r b744ab025ab6 linux/drivers/media/video/cx18/cx18-driver.c --- a/linux/drivers/media/video/cx18/cx18-driver.c Mon Dec 08 11:36:57 2008 -0200 +++ b/linux/drivers/media/video/cx18/cx18-driver.c Mon Dec 08 18:40:34 2008 -0200 @@ -55,9 +55,6 @@ struct cx18 *cx18_cards[CX18_MAX_CARDS]; /* Protects cx18_cards_active */ DEFINE_SPINLOCK(cx18_cards_lock); - -/* Queue for deferrable IRQ handling work for all cx18 cards in system */ -struct workqueue_struct *cx18_work_queue; /* add your revision and whatnot here */ static struct pci_device_id cx18_pci_tbl[] __devinitdata = { @@ -446,6 +443,12 @@ static int __devinit cx18_init_struct1(s spin_lock_init(&cx->lock); + cx->work_queue = create_singlethread_workqueue(cx->name); + if (cx->work_queue == NULL) { + CX18_ERR("Unable to create work hander thread\n"); + return -ENOMEM; + } + for (i = 0; i < CX18_MAX_EPU_WORK_ORDERS; i++) { cx->epu_work_order[i].cx = cx; cx->epu_work_order[i].str = cx->epu_debug_str; @@ -660,12 +663,9 @@ static int __devinit cx18_probe(struct p /* PCI Device Setup */ retval = cx18_setup_pci(cx, dev, pci_id); - if (retval != 0) { - if (retval == -EIO) - goto free_workqueue; - else if (retval == -ENXIO) - goto free_mem; - } + if (retval != 0) + goto free_workqueue; + /* save cx in the pci struct for later use */ pci_set_drvdata(dev, cx); @@ -835,6 +835,7 @@ free_mem: free_mem: release_mem_region(cx->base_addr, CX18_MEM_SIZE); free_workqueue: + destroy_workqueue(cx->work_queue); err: if (retval == 0) retval = -ENODEV; @@ -917,6 +918,7 @@ int cx18_init_on_first_open(struct cx18 return 0; } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 22) static void cx18_cancel_epu_work_orders(struct cx18 *cx) { int i; @@ -924,6 +926,7 @@ static void cx18_cancel_epu_work_orders( cancel_work_sync(&cx->epu_work_order[i].work); } +#endif static void cx18_remove(struct pci_dev *pci_dev) { struct cx18 *cx = pci_get_drvdata(pci_dev); @@ -937,11 +940,22 @@ static void cx18_remove(struct pci_dev * /* Interrupts */ cx18_sw1_irq_disable(cx, IRQ_CPU_TO_EPU | IRQ_APU_TO_EPU); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 22) cx18_sw2_irq_disable(cx, IRQ_CPU_TO_EPU_ACK | IRQ_APU_TO_EPU_ACK); cx18_halt_firmware(cx); cx18_cancel_epu_work_orders(cx); +#else + + flush_workqueue(cx->work_queue); + + cx18_sw2_irq_disable(cx, IRQ_CPU_TO_EPU_ACK | IRQ_APU_TO_EPU_ACK); + + cx18_halt_firmware(cx); +#endif + + destroy_workqueue(cx->work_queue); cx18_streams_cleanup(cx, 1); @@ -984,17 +998,8 @@ static int module_start(void) printk(KERN_INFO "cx18: Debug value must be >= 0 and <= 511!\n"); } - cx18_work_queue = create_singlethread_workqueue("cx18"); - if (cx18_work_queue == NULL) { - printk(KERN_ERR - "cx18: Unable to create work hander thread\n"); - return -ENOMEM; - } - if (pci_register_driver(&cx18_pci_driver)) { printk(KERN_ERR "cx18: Error detecting PCI card\n"); - destroy_workqueue(cx18_work_queue); - cx18_work_queue = NULL; return -ENODEV; } printk(KERN_INFO "cx18: End initialization\n"); @@ -1006,9 +1011,6 @@ static void module_cleanup(void) int i; pci_unregister_driver(&cx18_pci_driver); - - destroy_workqueue(cx18_work_queue); - cx18_work_queue = NULL; for (i = 0; i < cx18_cards_active; i++) { if (cx18_cards[i] == NULL) diff -r e9fe49f4edf9 -r b744ab025ab6 linux/drivers/media/video/cx18/cx18-driver.h --- a/linux/drivers/media/video/cx18/cx18-driver.h Mon Dec 08 11:36:57 2008 -0200 +++ b/linux/drivers/media/video/cx18/cx18-driver.h Mon Dec 08 18:40:34 2008 -0200 @@ -447,6 +447,7 @@ struct cx18 { u32 sw2_irq_mask; u32 hw2_irq_mask; + struct workqueue_struct *work_queue; struct cx18_epu_work_order epu_work_order[CX18_MAX_EPU_WORK_ORDERS]; char epu_debug_str[256]; /* CX18_EPU_DEBUG is rare: use shared space */ @@ -478,7 +479,6 @@ extern int cx18_cards_active; extern int cx18_cards_active; extern int cx18_first_minor; extern spinlock_t cx18_cards_lock; -extern struct workqueue_struct *cx18_work_queue; /*==============Prototypes==================*/ diff -r e9fe49f4edf9 -r b744ab025ab6 linux/drivers/media/video/cx18/cx18-io.h --- a/linux/drivers/media/video/cx18/cx18-io.h Mon Dec 08 11:36:57 2008 -0200 +++ b/linux/drivers/media/video/cx18/cx18-io.h Mon Dec 08 18:40:34 2008 -0200 @@ -83,10 +83,14 @@ void cx18_writel_expect(struct cx18 *cx, u32 eval, u32 mask) { int i; + u32 r; eval &= mask; for (i = 0; i < CX18_MAX_MMIO_WR_RETRIES; i++) { cx18_writel_noretry(cx, val, addr); - if (eval == (cx18_readl(cx, addr) & mask)) + r = cx18_readl(cx, addr); + if (r == 0xffffffff && eval != 0xffffffff) + continue; + if (eval == (r & mask)) break; } } diff -r e9fe49f4edf9 -r b744ab025ab6 linux/drivers/media/video/cx18/cx18-mailbox.c --- a/linux/drivers/media/video/cx18/cx18-mailbox.c Mon Dec 08 11:36:57 2008 -0200 +++ b/linux/drivers/media/video/cx18/cx18-mailbox.c Mon Dec 08 18:40:34 2008 -0200 @@ -460,7 +460,7 @@ void cx18_api_epu_cmd_irq(struct cx18 *c */ submit = epu_cmd_irq(cx, order); if (submit > 0) { - queue_work(cx18_work_queue, &order->work); + queue_work(cx->work_queue, &order->work); } } diff -r e9fe49f4edf9 -r b744ab025ab6 v4l/versions.txt --- a/v4l/versions.txt Mon Dec 08 11:36:57 2008 -0200 +++ b/v4l/versions.txt Mon Dec 08 18:40:34 2008 -0200 @@ -20,8 +20,6 @@ DVB_DRX397XD DVB_DRX397XD # Assumes struct input_dev has a dev field DVB_DM1105 -# Need cancel_work_sync -VIDEO_CX18 [2.6.20] #This driver requires HID_REQ_GET_REPORT --- Patch is available at: http://linuxtv.org/hg/v4l-dvb/rev/b744ab025ab6dbaea5f2b51083fbe0b5464cdde3 _______________________________________________ linuxtv-commits mailing list linuxtv-commits@linuxtv.org http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits