From: David Schleef Date: Fri, 7 Oct 2005 05:04:04 +0000 (+0000) Subject: Remove compatibility for 2.0 and 2.2 X-Git-Tag: r0_7_71~139 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=8f510c37833865c5acaef273601a0a52678b2110;p=comedi.git Remove compatibility for 2.0 and 2.2 --- diff --git a/comedi/comedi_fops.c b/comedi/comedi_fops.c index c8dc9b9a..8db0b10d 100644 --- a/comedi/comedi_fops.c +++ b/comedi/comedi_fops.c @@ -78,9 +78,7 @@ static int do_poll_ioctl(comedi_device *dev,unsigned int subd,void *file); void do_become_nonbusy(comedi_device *dev,comedi_subdevice *s); static int do_cancel(comedi_device *dev,comedi_subdevice *s); -#if LINUX_VERSION_CODE >= 0x020100 static int comedi_fasync (int fd, struct file *file, int on); -#endif static void init_async_buf( comedi_async *async ); static int comedi_ioctl(struct inode * inode,struct file * file, @@ -1240,22 +1238,13 @@ static int do_cancel(comedi_device *dev,comedi_subdevice *s) } -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,2,0) /* XXX */ -#define RDEV_OF_FILE(x) ((x)->f_inode->i_rdev) -#else #define RDEV_OF_FILE(x) ((x)->f_dentry->d_inode->i_rdev) -#endif -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0) void comedi_unmap(struct vm_area_struct *area) { comedi_async *async; -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,17) - async = (void *)area->vm_pte; -#else async = area->vm_private_data; -#endif async->mmap_count--; } @@ -1263,14 +1252,8 @@ void comedi_unmap(struct vm_area_struct *area) static struct vm_operations_struct comedi_vm_ops={ close: comedi_unmap, }; -/* - comedi_mmap_v22 - */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,17) -#define page_address(x) x -#endif -static int comedi_mmap_v22(struct file * file, struct vm_area_struct *vma) +static int comedi_mmap(struct file * file, struct vm_area_struct *vma) { unsigned int minor=MINOR(RDEV_OF_FILE(file)); comedi_device *dev=comedi_get_device_by_minor(minor); @@ -1295,17 +1278,10 @@ static int comedi_mmap_v22(struct file * file, struct vm_area_struct *vma) return -EINVAL; } -#if LINUX_VERSION_CODE < 0x020300 - if(vma->vm_offset != 0){ - DPRINTK("comedi: mmap() offset must be 0.\n"); - return -EINVAL; - } -#else if(vma->vm_pgoff != 0){ DPRINTK("comedi: mmap() offset must be 0.\n"); return -EINVAL; } -#endif size = vma->vm_end - vma->vm_start; if(size>async->prealloc_bufsz) @@ -1323,21 +1299,15 @@ static int comedi_mmap_v22(struct file * file, struct vm_area_struct *vma) } vma->vm_ops = &comedi_vm_ops; -#if LINUX_VERSION_CODE < 0x020300 - (void *)vma->vm_pte = async; -#else vma->vm_private_data = async; -#endif async->mmap_count++; return 0; } -#endif -#if LINUX_VERSION_CODE >= 0x020100 -static unsigned int comedi_poll_v22(struct file *file, poll_table * wait) +static unsigned int comedi_poll(struct file *file, poll_table * wait) { comedi_device *dev; comedi_subdevice *s; @@ -1376,9 +1346,8 @@ static unsigned int comedi_poll_v22(struct file *file, poll_table * wait) return mask; } -#endif -static ssize_t comedi_write_v22(struct file *file,const char *buf,size_t nbytes,loff_t *offset) +static ssize_t comedi_write(struct file *file,const char *buf,size_t nbytes,loff_t *offset) { comedi_device *dev; comedi_subdevice *s; @@ -1464,7 +1433,7 @@ static ssize_t comedi_write_v22(struct file *file,const char *buf,size_t nbytes, } -static ssize_t comedi_read_v22(struct file * file,char *buf,size_t nbytes,loff_t *offset) +static ssize_t comedi_read(struct file * file,char *buf,size_t nbytes,loff_t *offset) { comedi_device *dev; comedi_subdevice *s; @@ -1585,7 +1554,7 @@ void do_become_nonbusy(comedi_device *dev,comedi_subdevice *s) #define SEEK_CUR 1 #define SEEK_END 2 -static loff_t comedi_lseek_v22(struct file *file,loff_t offset,int origin) +static loff_t comedi_lseek(struct file *file,loff_t offset,int origin) { comedi_device *dev; loff_t new_offset; @@ -1611,7 +1580,7 @@ static loff_t comedi_lseek_v22(struct file *file,loff_t offset,int origin) return file->f_pos=new_offset; } -static int comedi_fop_open(struct inode *inode,struct file *file) +static int comedi_open(struct inode *inode,struct file *file) { unsigned int minor=MINOR(inode->i_rdev); comedi_device *dev; @@ -1675,7 +1644,7 @@ ok: return 0; } -static int comedi_close_v22(struct inode *inode,struct file *file) +static int comedi_close(struct inode *inode,struct file *file) { comedi_device *dev=comedi_get_device_by_minor(MINOR(inode->i_rdev)); comedi_subdevice *s = NULL; @@ -1705,84 +1674,33 @@ static int comedi_close_v22(struct inode *inode,struct file *file) dev->use_count--; -#if LINUX_VERSION_CODE >= 0x020100 if(file->f_flags & FASYNC){ comedi_fasync(-1,file,0); } -#endif return 0; } -#if LINUX_VERSION_CODE >= 0x020100 static int comedi_fasync (int fd, struct file *file, int on) { comedi_device *dev=comedi_get_device_by_minor(MINOR(RDEV_OF_FILE(file))); return fasync_helper(fd,file,on,&dev->async_queue); } -#endif - -/* - kernel compatibility -*/ - -#if LINUX_VERSION_CODE < 0x020100 - -static int comedi_write_v20(struct inode *inode,struct file *file,const char *buf,int nbytes) -{ - return comedi_write_v22(file,buf,nbytes,NULL); -} - -static int comedi_read_v20(struct inode *inode,struct file *file,char *buf,int nbytes) -{ - return comedi_read_v22(file,buf,nbytes,NULL); -} - -static int comedi_lseek_v20(struct inode * inode,struct file *file,off_t offset,int origin) -{ - return comedi_lseek_v22(file,offset,origin); -} - -static void comedi_close_v20(struct inode *inode,struct file *file) -{ - comedi_close_v22(inode,file); -} -#define comedi_ioctl_v20 comedi_ioctl -#define comedi_open_v20 comedi_fop_open static struct file_operations comedi_fops={ - lseek : comedi_lseek_v20, - ioctl : comedi_ioctl_v20, - open : comedi_open_v20, - release : comedi_close_v20, - read : comedi_read_v20, - write : comedi_write_v20, -}; - -#endif - -#if LINUX_VERSION_CODE >= 0x020200 - -#define comedi_ioctl_v22 comedi_ioctl -#define comedi_open_v22 comedi_fop_open - -static struct file_operations comedi_fops={ -#if LINUX_VERSION_CODE >= 0x020400 owner : THIS_MODULE, -#endif - llseek : comedi_lseek_v22, - ioctl : comedi_ioctl_v22, - open : comedi_open_v22, - release : comedi_close_v22, - read : comedi_read_v22, - write : comedi_write_v22, - mmap : comedi_mmap_v22, - poll : comedi_poll_v22, + llseek : comedi_lseek, + ioctl : comedi_ioctl, + open : comedi_open, + release : comedi_close, + read : comedi_read, + write : comedi_write, + mmap : comedi_mmap, + poll : comedi_poll, fasync : comedi_fasync, }; -#endif static struct class *comedi_class; @@ -1907,11 +1825,11 @@ void comedi_event(comedi_device *dev,comedi_subdevice *s, unsigned int mask) }else{ if(s==dev->read_subdev){ wake_up_interruptible(&dev->read_wait); - KILL_FASYNC(dev->async_queue, SIGIO, POLL_IN); + kill_fasync(&dev->async_queue, SIGIO, POLL_IN); } if(s==dev->write_subdev){ wake_up_interruptible(&dev->write_wait); - KILL_FASYNC(dev->async_queue, SIGIO, POLL_OUT); + kill_fasync(&dev->async_queue, SIGIO, POLL_OUT); } } }else{ diff --git a/comedi/comedi_ksyms.c b/comedi/comedi_ksyms.c index f84c0fe5..fb9f07ae 100644 --- a/comedi/comedi_ksyms.c +++ b/comedi/comedi_ksyms.c @@ -32,8 +32,6 @@ -#if LINUX_VERSION_CODE >= 0x020200 - /* for drivers */ EXPORT_SYMBOL(comedi_driver_register); EXPORT_SYMBOL(comedi_driver_unregister); @@ -77,7 +75,6 @@ EXPORT_SYMBOL(comedi_buf_write_alloc); EXPORT_SYMBOL(comedi_buf_read_free); EXPORT_SYMBOL(comedi_buf_memcpy_to); EXPORT_SYMBOL(comedi_buf_memcpy_from); -#endif diff --git a/comedi/drivers.c b/comedi/drivers.c index 8ed325be..b1fa9d86 100644 --- a/comedi/drivers.c +++ b/comedi/drivers.c @@ -414,7 +414,7 @@ static inline unsigned long kvirt_to_kva(unsigned long adr) { unsigned long va, kva; - va = VMALLOC_VMADDR(adr); + va = adr; kva = uvirt_to_kva(pgd_offset_k(va), va); return kva; diff --git a/comedi/proc.c b/comedi/proc.c index 8c53af03..657df6fb 100644 --- a/comedi/proc.c +++ b/comedi/proc.c @@ -35,33 +35,12 @@ //#include -#if LINUX_VERSION_CODE < 0x020100 -int comedi_read_procmem(char *buf,char **start,off_t offset,int len,int unused); - -struct proc_dir_entry comedi_proc_entry = -{ - 0, - 6, "comedi", - S_IFREG | S_IRUGO, - 1, 0, 0, - 0, NULL, - &comedi_read_procmem, -}; - -#else int comedi_read_procmem(char *buf,char **start,off_t offset,int len,int *eof,void *data); - -#endif - extern comedi_driver *comedi_drivers; -#if LINUX_VERSION_CODE < 0x020100 -int comedi_read_procmem(char *buf,char **start,off_t offset,int len,int unused) -#else int comedi_read_procmem(char *buf,char **start,off_t offset,int len,int *eof,void *data) -#endif { int i; int devices_q=0; @@ -108,24 +87,16 @@ int comedi_read_procmem(char *buf,char **start,off_t offset,int len,int *eof,voi void comedi_proc_init(void) { -#if LINUX_VERSION_CODE < 0x020100 - proc_register_dynamic(&proc_root,&comedi_proc_entry); -#else struct proc_dir_entry *comedi_proc; comedi_proc = create_proc_entry("comedi",S_IFREG | S_IRUGO,0); if(comedi_proc) comedi_proc->read_proc = comedi_read_procmem; -#endif } void comedi_proc_cleanup(void) { -#if LINUX_VERSION_CODE < 0x020100 - proc_unregister(&proc_root,comedi_proc_entry.low_ino); -#else remove_proc_entry("comedi",0); -#endif } diff --git a/include/linux/config.h b/include/linux/config.h index acae24c7..730550f0 100644 --- a/include/linux/config.h +++ b/include/linux/config.h @@ -2,9 +2,6 @@ #define __MULTI_CONFIG_H_ #include -#ifdef CONFIG_COMEDI_RTAI -//#include -#endif #include_next #endif diff --git a/include/linux/fs.h b/include/linux/fs.h deleted file mode 100644 index d75090a5..00000000 --- a/include/linux/fs.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * linux/fs.h compatibility header - */ - -#ifndef __COMPAT_LINUX_FS_H_ -#define __COMPAT_LINUX_FS_H_ - -#include - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,2,0) -/* no fasync */ -#define KILL_FASYNC(a,b,c) -#else -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) -#define KILL_FASYNC(a,b,c) kill_fasync((a),(c)) -#else -#define KILL_FASYNC(a,b,c) kill_fasync(&(a),(b),(c)) -#endif -#endif - -#include_next - -#endif - diff --git a/include/linux/highmem.h b/include/linux/highmem.h deleted file mode 100644 index 59ce466e..00000000 --- a/include/linux/highmem.h +++ /dev/null @@ -1,17 +0,0 @@ - -/* - * linux/highmem.h compatibility header - */ - -#ifndef __COMPAT_LINUX_DEVFS_FS_KERNEL_H_ -#define __COMPAT_LINUX_DEVFS_FS_KERNEL_H_ - -#include - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 0) -#else -#include_next -#endif - -#endif - diff --git a/include/linux/init.h b/include/linux/init.h deleted file mode 100644 index b57dc865..00000000 --- a/include/linux/init.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * linux/init.h compatibility header - */ - -#ifndef __COMPAT_LINUX_INIT_H_ -#define __COMPAT_LINUX_INIT_H_ - -#include - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) -#define __devinitdata __initdata -#define __exit -#endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,2,0) -#define __init -#else -#include_next -#endif - -#endif - diff --git a/include/linux/ioport.h b/include/linux/ioport.h deleted file mode 100644 index 28af4048..00000000 --- a/include/linux/ioport.h +++ /dev/null @@ -1,43 +0,0 @@ -// linux/ioport.h compatibility header - -#ifndef _COMPAT_IOPORT_H -#define _COMPAT_IOPORT_H - -#include - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,2,20) - -#define request_mem_region(start,n,name) ((void*) 1) -#define release_mem_region(start,n) - -#endif - -#include_next - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,11) - -/* 'struct resource' not defined. Define a dummy version. */ -struct resource { - int dummy; -}; - -/* Define a compatible version of request_region that returns a pointer - * to a non-NULL value on success. */ -static inline struct resource *compat__request_region(unsigned long from, - unsigned long extent, const char *name) -{ - if (check_region(from, extent) < 0) { - return (struct resource *)0; - } - request_region(from, extent, name); - return ((struct resource *)0 + 1); /* Should be non-NULL */ -} - -/* Replace existing request_region macro/function. */ -#undef request_region -#define request_region(f,e,n) compat__request_region(f,e,n) - -#endif - -#endif // _COMPAT_IOPORT_H - diff --git a/include/linux/isapnp.h b/include/linux/isapnp.h deleted file mode 100644 index 475138a8..00000000 --- a/include/linux/isapnp.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * linux/fisapnp.h compatibility header - */ - -#ifndef __COMPAT_LINUX_ISAPNP_H_ -#define __COMPAT_LINUX_ISAPNP_H_ - -#include - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,0) -#include_next -#else -#include -#endif - -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,0) -/* FIXME drivers are broken with __ISAPNP__ in 2.6. */ -#undef __ISAPNP__ -#endif - -#endif - diff --git a/include/linux/kdev_t.h b/include/linux/kdev_t.h deleted file mode 100644 index 3513fa8b..00000000 --- a/include/linux/kdev_t.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - linux/kdev_t.h compatibility header - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef __COMPAT_LINUX_KDEV_T_H_ -#define __COMPAT_LINUX_KDEV_T_H_ - -#include -#include_next - -#if 0 - -#ifndef major -#define major(x) MAJOR(x) -#endif -#ifndef minor -#define minor(x) MINOR(x) -#endif - -#endif - -#endif /* __COMPAT_LINUX_KDEV_T_H_ */ - diff --git a/include/linux/kmod.h b/include/linux/kmod.h deleted file mode 100644 index e8862e95..00000000 --- a/include/linux/kmod.h +++ /dev/null @@ -1,17 +0,0 @@ -/* - * linux/kmod.h compatibility header - */ - -#ifndef __COMPAT_LINUX_KMOD_H_ -#define __COMPAT_LINUX_KMOD_H_ - -#include - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,2,0) - -#else -#include_next -#endif - -#endif - diff --git a/include/linux/mm.h b/include/linux/mm.h index 1bde4dbf..233c2e94 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -7,13 +7,6 @@ #include -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0) -#define VM_OFFSET(a) ((a)->vm_offset) -#define page_address(page) page -#else -#define VM_OFFSET(a) ((a)->vm_pgoff * PAGE_SIZE) -#endif - #include_next #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,10) \ diff --git a/include/linux/module.h b/include/linux/module.h index 935daca9..661f34ee 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -8,12 +8,6 @@ #include -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,1,19) -#define MODULE_AUTHOR(a) -#define MODULE_DESCRIPTION(a) -#define MODULE_PARM(a,b) -#endif - #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,10) #define MODULE_LICENSE(x) #endif @@ -22,43 +16,6 @@ #define EXPORT_SYMBOL_GPL(x) EXPORT_SYMBOL(x) #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18) /* ? */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,1,0) - #ifdef MODULE - /* don't ask. It works. */ - #define THIS_MODULE ((struct module *)&mod_use_count_) - #else - #define THIS_MODULE NULL - #endif - #define __MOD_INC_USE_COUNT(x) ((*(long *)(x))++, (*(long *)(x)) |= MOD_VISITED) - #define __MOD_DEC_USE_COUNT(x) ((*(long *)(x))--, (*(long *)(x)) |= MOD_VISITED) - #define EXPORT_SYMBOL(x) -#else - #ifdef MODULE - #define THIS_MODULE &__this_module - #else - #define THIS_MODULE NULL - #endif -#endif -#endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18) /* ? */ - typedef int (*__init_module_func_t)(void); - typedef void (*__cleanup_module_func_t)(void); - #define module_init(x) \ - int init_module(void) __attribute__((alias(#x))); \ - static inline __init_module_func_t __init_module_inline(void) \ - { return x; } - #define module_exit(x) \ - void cleanup_module(void) __attribute__((alias(#x))); \ - static inline __cleanup_module_func_t __cleanup_module_inline(void) \ - { return x; } -#endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) -#define MODULE_DEVICE_TABLE(a,b) struct pci_device_id *module_device_table_unused = (b) -#endif - #include_next #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) diff --git a/include/linux/pci.h b/include/linux/pci.h index ea1f4194..19e71e42 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -7,180 +7,7 @@ #include - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,1,55) -#include -#define PCI_SUPPORT_VER1 -#else #include_next -#define PCI_SUPPORT_VER2 - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0) /* XXX */ - -struct pci_driver { - struct list_head node; - char *name; - const struct pci_device_id *id_table; /* must be non-NULL for probe to be called */ - int (*probe) (struct pci_dev *dev, const struct pci_device_id *id); /* New device inserted */ - void (*remove) (struct pci_dev *dev); /* Device removed (NULL if not a hot-plug capable driver) */ - int (*save_state) (struct pci_dev *dev, u32 state); /* Save Device Context */ - int (*suspend) (struct pci_dev *dev, u32 state); /* Device suspended */ - int (*resume) (struct pci_dev *dev); /* Device woken up */ - int (*enable_wake) (struct pci_dev *dev, u32 state, int enable); /* Enable wake event */ -}; -static inline int pci_module_init(struct pci_driver *drv) { return 0; } -static inline void pci_unregister_driver(struct pci_driver *) { return; } - -static inline int pci_enable_device(struct pci_dev *dev){return 0;} -#define pci_disable_device(x) - -#define PCI_ANY_ID (~0) - -struct pci_device_id { - unsigned int vendor, device; - unsigned int subvendor, subdevice; - unsigned int class, class_mask; - unsigned long driver_data; -}; - -// stuff for allocating pci dma buffers -#include -#include -#include -#define PCI_DMA_FROMDEVICE 0 -#define PCI_DMA_TODEVICE 0 - -static inline void *pci_alloc_consistent(struct pci_dev *hwdev, size_t size, - dma_addr_t *dma_handle) -{ - void *ret; - int gfp = GFP_KERNEL; - - if (hwdev == NULL) - gfp |= GFP_DMA; - ret = (void *) __get_free_pages(gfp, get_order(size)); - - if (ret != NULL) - { - memset(ret, 0, size); - *dma_handle = virt_to_bus(ret); - } - return ret; -} - -static inline void pci_free_consistent(struct pci_dev *hwdev, size_t size, - void *vaddr, dma_addr_t dma_handle) -{ - free_pages((unsigned long)vaddr, get_order(size)); -} - -#define pci_map_single(cookie, address, size, dir) virt_to_bus(address) -#define pci_unmap_single(cookie, address, size, dir) -#define pci_dma_sync_single(cookie, address, size, dir) - -// for getting base addresses -static inline unsigned long pci_resource_start(struct pci_dev *dev, unsigned int bar) -{ - if(dev->base_address[bar] & PCI_BASE_ADDRESS_SPACE_IO) - return dev->base_address[bar] & PCI_BASE_ADDRESS_IO_MASK; - return dev->base_address[bar] & PCI_BASE_ADDRESS_MEM_MASK; -} - -static inline unsigned long pci_resource_end(struct pci_dev *dev, unsigned int bar) -{ - return pci_resource_start(dev, bar); -} - -static inline int pci_request_regions(struct pci_dev *dev, char *name) -{ - const int max_num_base_addr = 6; - static const int fake_length = 1; - int i; - int retval = 0; - - for(i = 0; i < max_num_base_addr; i++) - { - if(dev->base_address[i]) - { - if(dev->base_address[i] & PCI_BASE_ADDRESS_SPACE_IO) - if(!request_region(pci_resource_start(dev, i), - fake_length, name)) - { - retval = -EBUSY; - break; - } - } - } - - if(retval) - { - while(--i >= 0) - { - if(dev->base_address[i] & PCI_BASE_ADDRESS_SPACE_IO) - release_region(pci_resource_start(dev, i), - fake_length); - } - } - - return retval; -} - -static inline void pci_release_regions(struct pci_dev *dev) -{ - static const int max_num_base_addr = 6; - static const int fake_length = 1; - int i; - - for(i = 0; i < max_num_base_addr; i++) - { - if(dev->base_address[i]) - { - if(dev->base_address[i] & PCI_BASE_ADDRESS_SPACE_IO) - release_region(pci_resource_start(dev, i), - fake_length); - } - } -} - -#endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,15) -static inline struct pci_dev* pci_find_subsys( unsigned int vendor, unsigned int device, - unsigned int ss_vendor, unsigned int ss_device, - const struct pci_dev *from) -{ - struct pci_dev *dev = (struct pci_dev *)from; /* ignore const */ - - while((dev=pci_find_device(vendor,device,dev))!=NULL){ - if(ss_vendor!=PCI_ANY_ID){ - u16 temp; - pci_read_config_word(dev,PCI_SUBSYSTEM_VENDOR_ID,&temp); - if(ss_vendor!=temp){ - continue; - } - } - if(ss_device!=PCI_ANY_ID){ - u16 temp; - pci_read_config_word(dev,PCI_SUBSYSTEM_ID,&temp); - if(ss_device!=temp){ - continue; - } - } - break; /* match */ - } - return dev; -} -#endif // <2.3.15 - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,2,14) -static inline void pci_set_master(struct pci_dev *dev) -{ return; } -#endif // 2.2.14 - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18) -static inline unsigned long pci_resource_len (struct pci_dev *dev, int n_base) -{ return 0; } -#endif // 2.2.18 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) #define pci_get_device pci_find_device @@ -189,8 +16,6 @@ static inline unsigned long pci_resource_len (struct pci_dev *dev, int n_base) #define pci_dev_put(x) #endif -#endif - #endif /* _COMPAT_PCI_H */ diff --git a/include/linux/poll.h b/include/linux/poll.h deleted file mode 100644 index 7f2bf9b3..00000000 --- a/include/linux/poll.h +++ /dev/null @@ -1,17 +0,0 @@ -/* - * linux/poll.h compatibility header - */ - -#ifndef __COMPAT_LINUX_POLL_H_ -#define __COMPAT_LINUX_POLL_H_ - -#include - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,2,0) - -#else -#include_next -#endif - -#endif - diff --git a/include/linux/sched.h b/include/linux/sched.h index 82bd7223..c10cc3ec 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -7,66 +7,6 @@ #include -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,2,0) -#define signal_pending(x) (((x)->signal) & (~(x)->blocked)) -#endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,2,3) -#define __wait_event(wq, condition) \ -do { \ - struct wait_queue __wait; \ - \ - __wait.task = current; \ - add_wait_queue(&wq, &__wait); \ - for (;;) { \ - current->state = TASK_UNINTERRUPTIBLE; \ - mb(); \ - if (condition) \ - break; \ - schedule(); \ - } \ - current->state = TASK_RUNNING; \ - remove_wait_queue(&wq, &__wait); \ -} while (0) - -#define wait_event(wq, condition) \ -do { \ - if (condition) \ - break; \ - __wait_event(wq, condition); \ -} while (0) - -#define __wait_event_interruptible(wq, condition, ret) \ -do { \ - struct wait_queue __wait; \ - \ - __wait.task = current; \ - add_wait_queue(&wq, &__wait); \ - for (;;) { \ - current->state = TASK_INTERRUPTIBLE; \ - mb(); \ - if (condition) \ - break; \ - if (!signal_pending(current)) { \ - schedule(); \ - continue; \ - } \ - ret = -ERESTARTSYS; \ - break; \ - } \ - current->state = TASK_RUNNING; \ - remove_wait_queue(&wq, &__wait); \ -} while (0) - -#define wait_event_interruptible(wq, condition) \ -({ \ - int __ret = 0; \ - if (!(condition)) \ - __wait_event_interruptible(wq, condition, __ret); \ - __ret; \ -}) -#endif - #include_next #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,20) diff --git a/include/linux/slab.h b/include/linux/slab.h deleted file mode 100644 index 8f0befce..00000000 --- a/include/linux/slab.h +++ /dev/null @@ -1,17 +0,0 @@ -/* - * linux/slab.h compatibility header - */ - -#ifndef __COMPAT_LINUX_SLAB_H_ -#define __COMPAT_LINUX_SLAB_H_ - -#include - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,2,0) -#include -#else -#include_next -#endif - -#endif - diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h deleted file mode 100644 index 4c3e6503..00000000 --- a/include/linux/spinlock.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * linux/spinlock.h compatibility header - */ - -#ifndef _COMPAT_SPINLOCK_H -#define _COMPAT_SPINLOCK_H - -#include - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,1,0) -/* no spinlocks */ -typedef int spinlock_t; - -#define spin_lock_init(lock) do { } while(0) -#define spin_lock(lock) (void)(lock) /* Not "unused variable". */ -#define spin_trylock(lock) (1) -#define spin_unlock_wait(lock) do { } while(0) -#define spin_unlock(lock) do { } while(0) -#define spin_lock_irq(lock) cli() -#define spin_unlock_irq(lock) sti() - -#define spin_lock_irqsave(lock, flags) \ - do { save_flags(flags); cli(); } while (0) -#define spin_unlock_irqrestore(lock, flags) \ - restore_flags(flags) - -#define SPIN_LOCK_UNLOCKED 0 - -#else -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0) -#include -#else -#include_next -#endif -#endif - - -#endif /* _COMPAT_SPINLOCK_H */ - - - - diff --git a/include/linux/timer.h b/include/linux/timer.h deleted file mode 100644 index e32f0503..00000000 --- a/include/linux/timer.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - * linux/timer.h compatibility header - */ - -#ifndef __COMPAT_LINUX_TIMER_H_ -#define __COMPAT_LINUX_TIMER_H_ - -#include - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,2,0) - -#define mod_timer(a,b) do{del_timer((a));(a)->expires=(b);add_timer((a));}while(0) -#endif - -#include_next - -#endif - diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h deleted file mode 100644 index 0da835a7..00000000 --- a/include/linux/vmalloc.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * linux/vmalloc.h compatibility header - */ - -#ifndef __COMPAT_LINUX_VMALLOC_H_ -#define __COMPAT_LINUX_VMALLOC_H_ - -#include - - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,2,0) - -#else -#include_next -#endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 2, 18) -extern inline void * vmalloc_32(unsigned long size) -{ - return vmalloc(size); -} -#endif // 2.2.18 - -#ifndef VMALLOC_VMADDR -#define VMALLOC_VMADDR(x) ((unsigned long)(x)) -#endif - -#endif - diff --git a/include/linux/wait.h b/include/linux/wait.h deleted file mode 100644 index 43a378cf..00000000 --- a/include/linux/wait.h +++ /dev/null @@ -1,16 +0,0 @@ - -#ifndef __COMPAT_LINUX_WAIT_H -#define __COMPAT_LINUX_WAIT_H - -#include - -#include_next - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,2,18) -typedef struct wait_queue *wait_queue_head_t; -#define DECLARE_WAITQUEUE(x,y) struct wait_queue x={y,NULL} -#define init_waitqueue_head(x) -#endif - -#endif -