From d1b7f551e6d582cd9c44d23883de1f6121907627 Mon Sep 17 00:00:00 2001 From: David Dawes Date: Thu, 17 Apr 2003 15:27:34 +0000 Subject: Fix DRM module build on 2.5.41 and later kernels (tqueue -> workqueue). --- linux-core/drmP.h | 15 ++++++++++++++- linux-core/drm_dma.c | 4 ++++ linux/drmP.h | 15 ++++++++++++++- linux/drm_dma.h | 4 ++++ linux/gamma_dma.c | 4 ++++ 5 files changed, 40 insertions(+), 2 deletions(-) diff --git a/linux-core/drmP.h b/linux-core/drmP.h index 59a445ea..efbc30c0 100644 --- a/linux-core/drmP.h +++ b/linux-core/drmP.h @@ -67,7 +67,16 @@ #include #include #endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,41) +#define HAS_WORKQUEUE 0 +#else +#define HAS_WORKQUEUE 1 +#endif +#if !HAS_WORKQUEUE #include +#else +#include +#endif #include #include #include "drm.h" @@ -206,7 +215,7 @@ static inline struct page * vmalloc_to_page(void * vmalloc_addr) } #endif -#ifndef REMAP_PAGE_RANGE_5_ARGS /* #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) */ +#ifndef REMAP_PAGE_RANGE_5_ARGS #define DRM_RPR_ARG(vma) #else #define DRM_RPR_ARG(vma) vma, @@ -615,7 +624,11 @@ typedef struct drm_device { int last_checked; /* Last context checked for DMA */ int last_context; /* Last current context */ unsigned long last_switch; /* jiffies at last context switch */ +#if !HAS_WORKQUEUE struct tq_struct tq; +#else + struct work_struct work; +#endif #if __HAVE_VBL_IRQ wait_queue_head_t vbl_queue; atomic_t vbl_received; diff --git a/linux-core/drm_dma.c b/linux-core/drm_dma.c index 71e25b3d..f14e08f0 100644 --- a/linux-core/drm_dma.c +++ b/linux-core/drm_dma.c @@ -538,10 +538,14 @@ int DRM(irq_install)( drm_device_t *dev, int irq ) dev->dma->this_buffer = NULL; #if __HAVE_DMA_IRQ_BH +#if !HAS_WORKQUEUE INIT_LIST_HEAD( &dev->tq.list ); dev->tq.sync = 0; dev->tq.routine = DRM(dma_immediate_bh); dev->tq.data = dev; +#else + INIT_WORK(&dev->work, DRM(dma_immediate_bh), dev); +#endif #endif #if __HAVE_VBL_IRQ diff --git a/linux/drmP.h b/linux/drmP.h index 59a445ea..efbc30c0 100644 --- a/linux/drmP.h +++ b/linux/drmP.h @@ -67,7 +67,16 @@ #include #include #endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,41) +#define HAS_WORKQUEUE 0 +#else +#define HAS_WORKQUEUE 1 +#endif +#if !HAS_WORKQUEUE #include +#else +#include +#endif #include #include #include "drm.h" @@ -206,7 +215,7 @@ static inline struct page * vmalloc_to_page(void * vmalloc_addr) } #endif -#ifndef REMAP_PAGE_RANGE_5_ARGS /* #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) */ +#ifndef REMAP_PAGE_RANGE_5_ARGS #define DRM_RPR_ARG(vma) #else #define DRM_RPR_ARG(vma) vma, @@ -615,7 +624,11 @@ typedef struct drm_device { int last_checked; /* Last context checked for DMA */ int last_context; /* Last current context */ unsigned long last_switch; /* jiffies at last context switch */ +#if !HAS_WORKQUEUE struct tq_struct tq; +#else + struct work_struct work; +#endif #if __HAVE_VBL_IRQ wait_queue_head_t vbl_queue; atomic_t vbl_received; diff --git a/linux/drm_dma.h b/linux/drm_dma.h index 71e25b3d..f14e08f0 100644 --- a/linux/drm_dma.h +++ b/linux/drm_dma.h @@ -538,10 +538,14 @@ int DRM(irq_install)( drm_device_t *dev, int irq ) dev->dma->this_buffer = NULL; #if __HAVE_DMA_IRQ_BH +#if !HAS_WORKQUEUE INIT_LIST_HEAD( &dev->tq.list ); dev->tq.sync = 0; dev->tq.routine = DRM(dma_immediate_bh); dev->tq.data = dev; +#else + INIT_WORK(&dev->work, DRM(dma_immediate_bh), dev); +#endif #endif #if __HAVE_VBL_IRQ diff --git a/linux/gamma_dma.c b/linux/gamma_dma.c index 5b4d84bc..6734f1c4 100644 --- a/linux/gamma_dma.c +++ b/linux/gamma_dma.c @@ -127,9 +127,13 @@ void gamma_dma_service(int irq, void *device, struct pt_regs *regs) } clear_bit(0, &dev->dma_flag); +#if !HAS_WORKQUEUE /* Dispatch new buffer */ queue_task(&dev->tq, &tq_immediate); mark_bh(IMMEDIATE_BH); +#else + schedule_work(&dev->work); +#endif } } -- cgit v1.2.3