From 96b9b00e9e8f7771c45723ec0c869db9f2260585 Mon Sep 17 00:00:00 2001 From: Andy Walls Date: Tue, 25 Nov 2008 20:02:45 -0500 Subject: cx18: Change work_queue teardown to work for kernels earlier than 2.6.22 From: Andy Walls For kernels earlier than 2.6.22, we can't cancel work, so we have to flush the work queue to completion before destroying it. Priority: normal Signed-off-by: Andy Walls --- linux/drivers/media/video/cx18/cx18-driver.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'linux/drivers/media/video') diff --git a/linux/drivers/media/video/cx18/cx18-driver.c b/linux/drivers/media/video/cx18/cx18-driver.c index 198fdf9a6..57fcce84b 100644 --- a/linux/drivers/media/video/cx18/cx18-driver.c +++ b/linux/drivers/media/video/cx18/cx18-driver.c @@ -918,6 +918,7 @@ int cx18_init_on_first_open(struct cx18 *cx) return 0; } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 22) static void cx18_cancel_epu_work_orders(struct cx18 *cx) { int i; @@ -925,6 +926,7 @@ static void cx18_cancel_epu_work_orders(struct cx18 *cx) 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); @@ -938,11 +940,20 @@ static void cx18_remove(struct pci_dev *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); -- cgit v1.2.3