From 32cebaf750b82639822f5f50d0aa8a4417595ada Mon Sep 17 00:00:00 2001 From: Rik Faith Date: Mon, 28 Aug 2000 19:50:52 +0000 Subject: [PATCH] Add compatibility header file to make Linux 2.4.0 kernel patches cleaner. --- linux-core/drmP.h | 8 +++----- linux-core/i810_dma.c | 3 +-- linux-core/i810_drv.c | 2 -- linux-core/mga_drv.c | 2 -- linux-core/r128_drv.c | 5 +---- linux-core/sis_drv.c | 5 +---- linux/Makefile.linux | 2 +- linux/drmP.h | 8 +++----- linux/gamma_dma.c | 3 +-- linux/gamma_drv.c | 2 -- linux/i810_dma.c | 3 +-- linux/i810_drv.c | 2 -- linux/mga_dma.c | 3 +-- linux/mga_drv.c | 2 -- linux/r128_drv.c | 5 +---- linux/sis_drv.c | 5 +---- 16 files changed, 15 insertions(+), 45 deletions(-) diff --git a/linux-core/drmP.h b/linux-core/drmP.h index b9a4dab4..d6de193d 100644 --- a/linux-core/drmP.h +++ b/linux-core/drmP.h @@ -61,6 +61,9 @@ #include #include #endif +#if LINUX_VERSION_CODE < 0x020400 +#include "compat-pre24.h" +#endif #include "drm.h" #define DRM_DEBUG_CODE 2 /* Include debugging code (if > 1, then @@ -138,11 +141,6 @@ typedef struct wait_queue *wait_queue_head_t; #endif #ifndef module_exit #define module_exit(x) void cleanup_module(void) { x(); } -#endif - - /* virt_to_page added in 2.4.0-test6 */ -#if LINUX_VERSION_CODE < 0x020400 -#define virt_to_page(kaddr) (mem_map + MAP_NR(kaddr)) #endif /* Generic cmpxchg added in 2.3.x */ diff --git a/linux-core/i810_dma.c b/linux-core/i810_dma.c index 5792bf39..14c78071 100644 --- a/linux-core/i810_dma.c +++ b/linux-core/i810_dma.c @@ -1227,7 +1227,6 @@ int i810_lock(struct inode *inode, struct file *filp, unsigned int cmd, } if (!ret) { -#if LINUX_VERSION_CODE >= 0x020400 /* KERNEL_VERSION(2,4,0) */ sigemptyset(&dev->sigmask); sigaddset(&dev->sigmask, SIGSTOP); sigaddset(&dev->sigmask, SIGTSTP); @@ -1236,7 +1235,7 @@ int i810_lock(struct inode *inode, struct file *filp, unsigned int cmd, dev->sigdata.context = lock.context; dev->sigdata.lock = dev->lock.hw_lock; block_all_signals(drm_notifier, &dev->sigdata, &dev->sigmask); -#endif + if (lock.flags & _DRM_LOCK_QUIESCENT) { DRM_DEBUG("_DRM_LOCK_QUIESCENT\n"); DRM_DEBUG("fred\n"); diff --git a/linux-core/i810_drv.c b/linux-core/i810_drv.c index 18168605..183e7fd7 100644 --- a/linux-core/i810_drv.c +++ b/linux-core/i810_drv.c @@ -642,8 +642,6 @@ int i810_unlock(struct inode *inode, struct file *filp, unsigned int cmd, - dev->lck_start)]); #endif -#if LINUX_VERSION_CODE >= 0x020400 /* KERNEL_VERSION(2,4,0) */ unblock_all_signals(); -#endif return 0; } diff --git a/linux-core/mga_drv.c b/linux-core/mga_drv.c index a4a8fe55..f6a4a43b 100644 --- a/linux-core/mga_drv.c +++ b/linux-core/mga_drv.c @@ -655,8 +655,6 @@ int mga_unlock(struct inode *inode, struct file *filp, unsigned int cmd, DRM_ERROR("\n"); } -#if LINUX_VERSION_CODE >= 0x020400 /* KERNEL_VERSION(2,4,0) */ unblock_all_signals(); -#endif return 0; } diff --git a/linux-core/r128_drv.c b/linux-core/r128_drv.c index c4eb634d..bb24b13e 100644 --- a/linux-core/r128_drv.c +++ b/linux-core/r128_drv.c @@ -656,7 +656,6 @@ int r128_lock(struct inode *inode, struct file *filp, unsigned int cmd, #endif if (!ret) { -#if LINUX_VERSION_CODE >= 0x020400 /* KERNEL_VERSION(2,4,0) */ sigemptyset(&dev->sigmask); sigaddset(&dev->sigmask, SIGSTOP); sigaddset(&dev->sigmask, SIGTSTP); @@ -665,7 +664,7 @@ int r128_lock(struct inode *inode, struct file *filp, unsigned int cmd, dev->sigdata.context = lock.context; dev->sigdata.lock = dev->lock.hw_lock; block_all_signals(drm_notifier, &dev->sigdata, &dev->sigmask); -#endif + if (lock.flags & _DRM_LOCK_READY) { /* Wait for space in DMA/FIFO */ } @@ -730,8 +729,6 @@ int r128_unlock(struct inode *inode, struct file *filp, unsigned int cmd, } #endif -#if LINUX_VERSION_CODE >= 0x020400 /* KERNEL_VERSION(2,4,0) */ unblock_all_signals(); -#endif return 0; } diff --git a/linux-core/sis_drv.c b/linux-core/sis_drv.c index 434a1ccd..06ae7988 100644 --- a/linux-core/sis_drv.c +++ b/linux-core/sis_drv.c @@ -626,7 +626,6 @@ int sis_lock(struct inode *inode, struct file *filp, unsigned int cmd, #endif if (!ret) { -#if LINUX_VERSION_CODE >= 0x020400 /* KERNEL_VERSION(2,4,0) */ sigemptyset(&dev->sigmask); sigaddset(&dev->sigmask, SIGSTOP); sigaddset(&dev->sigmask, SIGTSTP); @@ -635,7 +634,7 @@ int sis_lock(struct inode *inode, struct file *filp, unsigned int cmd, dev->sigdata.context = lock.context; dev->sigdata.lock = dev->lock.hw_lock; block_all_signals(drm_notifier, &dev->sigdata, &dev->sigmask); -#endif + if (lock.flags & _DRM_LOCK_READY) { /* Wait for space in DMA/FIFO */ } @@ -687,9 +686,7 @@ int sis_unlock(struct inode *inode, struct file *filp, unsigned int cmd, } } -#if LINUX_VERSION_CODE >= 0x020400 /* KERNEL_VERSION(2,4,0) */ unblock_all_signals(); -#endif return 0; } diff --git a/linux/Makefile.linux b/linux/Makefile.linux index 7dfb20b1..fb39374a 100644 --- a/linux/Makefile.linux +++ b/linux/Makefile.linux @@ -54,7 +54,7 @@ PROGS= drmstat DRMOBJS= init.o memory.o proc.o auth.o context.o drawable.o bufs.o \ lists.o lock.o ioctl.o fops.o vm.o dma.o ctxbitmap.o -DRMHEADERS= drm.h drmP.h +DRMHEADERS= drm.h drmP.h compat-pre24.h GAMMAOBJS= gamma_drv.o gamma_dma.o GAMMAHEADERS= gamma_drv.h $(DRMHEADERS) diff --git a/linux/drmP.h b/linux/drmP.h index b9a4dab4..d6de193d 100644 --- a/linux/drmP.h +++ b/linux/drmP.h @@ -61,6 +61,9 @@ #include #include #endif +#if LINUX_VERSION_CODE < 0x020400 +#include "compat-pre24.h" +#endif #include "drm.h" #define DRM_DEBUG_CODE 2 /* Include debugging code (if > 1, then @@ -138,11 +141,6 @@ typedef struct wait_queue *wait_queue_head_t; #endif #ifndef module_exit #define module_exit(x) void cleanup_module(void) { x(); } -#endif - - /* virt_to_page added in 2.4.0-test6 */ -#if LINUX_VERSION_CODE < 0x020400 -#define virt_to_page(kaddr) (mem_map + MAP_NR(kaddr)) #endif /* Generic cmpxchg added in 2.3.x */ diff --git a/linux/gamma_dma.c b/linux/gamma_dma.c index 4a2acfb3..96ea0455 100644 --- a/linux/gamma_dma.c +++ b/linux/gamma_dma.c @@ -804,7 +804,6 @@ int gamma_lock(struct inode *inode, struct file *filp, unsigned int cmd, drm_flush_unblock(dev, lock.context, lock.flags); /* cleanup phase */ if (!ret) { -#if LINUX_VERSION_CODE >= 0x020400 /* KERNEL_VERSION(2,4,0) */ sigemptyset(&dev->sigmask); sigaddset(&dev->sigmask, SIGSTOP); sigaddset(&dev->sigmask, SIGTSTP); @@ -813,7 +812,7 @@ int gamma_lock(struct inode *inode, struct file *filp, unsigned int cmd, dev->sigdata.context = lock.context; dev->sigdata.lock = dev->lock.hw_lock; block_all_signals(drm_notifier, &dev->sigdata, &dev->sigmask); -#endif + if (lock.flags & _DRM_LOCK_READY) gamma_dma_ready(dev); if (lock.flags & _DRM_LOCK_QUIESCENT) { diff --git a/linux/gamma_drv.c b/linux/gamma_drv.c index 1fcd1933..4a353c6f 100644 --- a/linux/gamma_drv.c +++ b/linux/gamma_drv.c @@ -564,8 +564,6 @@ int gamma_unlock(struct inode *inode, struct file *filp, unsigned int cmd, - dev->lck_start)]); #endif -#if LINUX_VERSION_CODE >= 0x020400 /* KERNEL_VERSION(2,4,0) */ unblock_all_signals(); -#endif return 0; } diff --git a/linux/i810_dma.c b/linux/i810_dma.c index 5792bf39..14c78071 100644 --- a/linux/i810_dma.c +++ b/linux/i810_dma.c @@ -1227,7 +1227,6 @@ int i810_lock(struct inode *inode, struct file *filp, unsigned int cmd, } if (!ret) { -#if LINUX_VERSION_CODE >= 0x020400 /* KERNEL_VERSION(2,4,0) */ sigemptyset(&dev->sigmask); sigaddset(&dev->sigmask, SIGSTOP); sigaddset(&dev->sigmask, SIGTSTP); @@ -1236,7 +1235,7 @@ int i810_lock(struct inode *inode, struct file *filp, unsigned int cmd, dev->sigdata.context = lock.context; dev->sigdata.lock = dev->lock.hw_lock; block_all_signals(drm_notifier, &dev->sigdata, &dev->sigmask); -#endif + if (lock.flags & _DRM_LOCK_QUIESCENT) { DRM_DEBUG("_DRM_LOCK_QUIESCENT\n"); DRM_DEBUG("fred\n"); diff --git a/linux/i810_drv.c b/linux/i810_drv.c index 18168605..183e7fd7 100644 --- a/linux/i810_drv.c +++ b/linux/i810_drv.c @@ -642,8 +642,6 @@ int i810_unlock(struct inode *inode, struct file *filp, unsigned int cmd, - dev->lck_start)]); #endif -#if LINUX_VERSION_CODE >= 0x020400 /* KERNEL_VERSION(2,4,0) */ unblock_all_signals(); -#endif return 0; } diff --git a/linux/mga_dma.c b/linux/mga_dma.c index d315954d..bbfa9497 100644 --- a/linux/mga_dma.c +++ b/linux/mga_dma.c @@ -1074,7 +1074,6 @@ int mga_lock(struct inode *inode, struct file *filp, unsigned int cmd, } if (!ret) { -#if LINUX_VERSION_CODE >= 0x020400 /* KERNEL_VERSION(2,4,0) */ sigemptyset(&dev->sigmask); sigaddset(&dev->sigmask, SIGSTOP); sigaddset(&dev->sigmask, SIGTSTP); @@ -1083,7 +1082,7 @@ int mga_lock(struct inode *inode, struct file *filp, unsigned int cmd, dev->sigdata.context = lock.context; dev->sigdata.lock = dev->lock.hw_lock; block_all_signals(drm_notifier, &dev->sigdata, &dev->sigmask); -#endif + if (lock.flags & _DRM_LOCK_QUIESCENT) { DRM_DEBUG("_DRM_LOCK_QUIESCENT\n"); mga_flush_queue(dev); diff --git a/linux/mga_drv.c b/linux/mga_drv.c index a4a8fe55..f6a4a43b 100644 --- a/linux/mga_drv.c +++ b/linux/mga_drv.c @@ -655,8 +655,6 @@ int mga_unlock(struct inode *inode, struct file *filp, unsigned int cmd, DRM_ERROR("\n"); } -#if LINUX_VERSION_CODE >= 0x020400 /* KERNEL_VERSION(2,4,0) */ unblock_all_signals(); -#endif return 0; } diff --git a/linux/r128_drv.c b/linux/r128_drv.c index c4eb634d..bb24b13e 100644 --- a/linux/r128_drv.c +++ b/linux/r128_drv.c @@ -656,7 +656,6 @@ int r128_lock(struct inode *inode, struct file *filp, unsigned int cmd, #endif if (!ret) { -#if LINUX_VERSION_CODE >= 0x020400 /* KERNEL_VERSION(2,4,0) */ sigemptyset(&dev->sigmask); sigaddset(&dev->sigmask, SIGSTOP); sigaddset(&dev->sigmask, SIGTSTP); @@ -665,7 +664,7 @@ int r128_lock(struct inode *inode, struct file *filp, unsigned int cmd, dev->sigdata.context = lock.context; dev->sigdata.lock = dev->lock.hw_lock; block_all_signals(drm_notifier, &dev->sigdata, &dev->sigmask); -#endif + if (lock.flags & _DRM_LOCK_READY) { /* Wait for space in DMA/FIFO */ } @@ -730,8 +729,6 @@ int r128_unlock(struct inode *inode, struct file *filp, unsigned int cmd, } #endif -#if LINUX_VERSION_CODE >= 0x020400 /* KERNEL_VERSION(2,4,0) */ unblock_all_signals(); -#endif return 0; } diff --git a/linux/sis_drv.c b/linux/sis_drv.c index 434a1ccd..06ae7988 100644 --- a/linux/sis_drv.c +++ b/linux/sis_drv.c @@ -626,7 +626,6 @@ int sis_lock(struct inode *inode, struct file *filp, unsigned int cmd, #endif if (!ret) { -#if LINUX_VERSION_CODE >= 0x020400 /* KERNEL_VERSION(2,4,0) */ sigemptyset(&dev->sigmask); sigaddset(&dev->sigmask, SIGSTOP); sigaddset(&dev->sigmask, SIGTSTP); @@ -635,7 +634,7 @@ int sis_lock(struct inode *inode, struct file *filp, unsigned int cmd, dev->sigdata.context = lock.context; dev->sigdata.lock = dev->lock.hw_lock; block_all_signals(drm_notifier, &dev->sigdata, &dev->sigmask); -#endif + if (lock.flags & _DRM_LOCK_READY) { /* Wait for space in DMA/FIFO */ } @@ -687,9 +686,7 @@ int sis_unlock(struct inode *inode, struct file *filp, unsigned int cmd, } } -#if LINUX_VERSION_CODE >= 0x020400 /* KERNEL_VERSION(2,4,0) */ unblock_all_signals(); -#endif return 0; }