Changeset 3433

Show
Ignore:
Timestamp:
01/19/00 00:02:53 (14 years ago)
Author:
frodo
Message:

The promised drop of kernel 2.0 and 2.1 compatibility

This resulted in a total of 389 dropped source code lines (!).

Location:
i2c/trunk
Files:
9 modified

Legend:

Unmodified
Added
Removed
  • i2c/trunk/INSTALL

    r3383 r3433  
    1818either method 1 or 3; method 2 is less well maintained. 
    1919 
    20 NOTE: OPTION 3 WILL CURRENTLY NOT WORK FOR 2.0 AND OLDER 2.1 KERNELS! 
     20NOTE: SUPPORT FOR 2.0 AND 2.1 KERNELS HAS BEEN DROPPED! 
    2121 
    2222 
  • i2c/trunk/kernel/i2c-algo-bit.c

    r3430 r3433  
    2929#include <linux/malloc.h> 
    3030#include <linux/version.h> 
    31 #if LINUX_VERSION_CODE >= 0x020135 
    3231#include <linux/init.h> 
    33 #else 
    34 #define __init  
    35 #endif 
    36  
    37 #if LINUX_VERSION_CODE >= 0x020100 
    38 #  include <asm/uaccess.h> 
    39 #else 
    40 #  include <asm/segment.h> 
    41 #endif 
    42  
    43 /* 2.0.0 kernel compatibility */ 
    44 #if LINUX_VERSION_CODE < 0x020100 
    45 #define MODULE_AUTHOR(noone) 
    46 #define MODULE_DESCRIPTION(none) 
    47 #define MODULE_PARM(no,param) 
    48 #define MODULE_PARM_DESC(no,description) 
    49 #define EXPORT_SYMBOL(noexport) 
    50 #define EXPORT_NO_SYMBOLS 
    51 #endif 
    52  
     32#include <asm/uaccess.h> 
    5333#include <linux/ioport.h> 
    5434#include <linux/errno.h> 
     
    7050/* might not like this, as they have an internal timeout of some mils   */ 
    7151/* 
    72 #if LINUX_VERSION_CODE >= 0x02016e 
    7352#define SLO_IO      jif=jiffies;while(jiffies<=jif+i2c_table[minor].veryslow)\ 
    7453                        if (need_resched) schedule(); 
    75 #else 
    76 #define SLO_IO      jif=jiffies;while(jiffies<=jif+i2c_table[minor].veryslow)\ 
    77                         if (need_resched) schedule(); 
    78 #endif 
    7954*/ 
    8055 
     
    146121                        return -ETIMEDOUT; 
    147122                } 
    148 #if LINUX_VERSION_CODE >= 0x02016e 
    149123                if (current->need_resched) 
    150124                        schedule(); 
    151 #else 
    152                 if (need_resched) 
    153                         schedule(); 
    154 #endif 
    155125        } 
    156126        DEBSTAT(printk("needed %ld jiffies\n", jiffies-start)); 
  • i2c/trunk/kernel/i2c-algo-pcf.c

    r3430 r3433  
    3131#include <linux/malloc.h> 
    3232#include <linux/version.h> 
    33 #if LINUX_VERSION_CODE >= 0x020135 
    3433#include <linux/init.h> 
    35 #else 
    36 #define __init  
    37 #endif 
    38  
    39 #if LINUX_VERSION_CODE >= 0x020100 
    40 #  include <asm/uaccess.h> 
    41 #else 
    42 #  include <asm/segment.h> 
    43 #endif 
    44  
    45  
     34#include <asm/uaccess.h> 
    4635#include <linux/ioport.h> 
    4736#include <linux/errno.h> 
    4837#include <linux/sched.h> 
    49  
    50 /* 2.0.0 kernel compatibility */ 
    51 #if LINUX_VERSION_CODE < 0x020100 
    52 #define MODULE_AUTHOR(noone) 
    53 #define MODULE_DESCRIPTION(none) 
    54 #define MODULE_PARM(no,param) 
    55 #define MODULE_PARM_DESC(no,description) 
    56 #define EXPORT_SYMBOL(noexport) 
    57 #define EXPORT_NO_SYMBOLS 
    58 #endif 
    5938 
    6039#include "i2c.h" 
     
    7554/* might not like this, as they have an internal timeout of some mils   */ 
    7655/* 
    77 #if LINUX_VERSION_CODE >= 0x02016e 
    7856#define SLO_IO      jif=jiffies;while(jiffies<=jif+i2c_table[minor].veryslow)\ 
    7957                        if (need_resched) schedule(); 
    80 #else 
    81 #define SLO_IO      jif=jiffies;while(jiffies<=jif+i2c_table[minor].veryslow)\ 
    82                         if (need_resched) schedule(); 
    83 #endif 
    8458*/ 
    8559 
     
    10882 
    10983/* --- other auxiliary functions -------------------------------------- */ 
    110  
    111 #if LINUX_VERSION_CODE < 0x02017f 
    112 static void schedule_timeout(int j) 
    113 { 
    114         current->state   = TASK_INTERRUPTIBLE; 
    115         current->timeout = jiffies + j; 
    116         schedule(); 
    117 } 
    118 #endif 
    119  
    12084 
    12185static void i2c_start(struct i2c_algo_pcf_data *adap)  
  • i2c/trunk/kernel/i2c-core.c

    r3421 r3433  
    3434/* ----- compatibility stuff ----------------------------------------------- */ 
    3535 
    36 /* 2.0.0 kernel compatibility */ 
    37 #if LINUX_VERSION_CODE < 0x020100 
    38 #define MODULE_AUTHOR(noone) 
    39 #define MODULE_DESCRIPTION(none) 
    40 #define MODULE_PARM(no,param) 
    41 #define MODULE_PARM_DESC(no,description) 
    42 #define EXPORT_SYMBOL(noexport) 
    43 #define EXPORT_NO_SYMBOLS 
    44 #endif 
    45  
    4636#include <linux/version.h> 
    47 #ifndef KERNEL_VERSION 
    48 #define KERNEL_VERSION(a,b,c) (((a) << 16) | ((b) << 8) | (c)) 
    49 #endif 
    50  
    51 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,53) 
    5237#include <linux/init.h> 
    53 #else 
    54 #define __init  
    55 #endif 
    5638 
    5739#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,1) 
     
    5941#endif 
    6042 
    61 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,1,4)) 
    62 #define copy_from_user memcpy_fromfs 
    63 #define copy_to_user memcpy_tofs 
    64 #else 
    6543#include <asm/uaccess.h> 
    66 #endif 
    6744 
    6845/* ----- global defines ---------------------------------------------------- */ 
     
    10582 */ 
    10683 
    107 /* Note that quite some things changed within the 2.1 kernel series. 
    108    Some things below are somewhat difficult to read because of this. */ 
    109  
    11084#ifdef CONFIG_PROC_FS 
    11185 
     
    11387static int i2cproc_cleanup(void); 
    11488 
    115 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,58)) && \ 
    116     (LINUX_VERSION_CODE <= KERNEL_VERSION(2,3,27)) 
     89#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,3,27)) 
    11790static void monitor_bus_i2c(struct inode *inode, int fill); 
    11891#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,58)) */ 
    119  
    120 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,29)) 
    12192 
    12293static ssize_t i2cproc_bus_read(struct file * file, char * buf,size_t count,  
     
    12495static int read_bus_i2c(char *buf, char **start, off_t offset, int len, 
    12596                           int *eof , void *private); 
    126  
    127 #else /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,1,29)) */ 
    128  
    129 static int i2cproc_bus_read(struct inode * inode, struct file * file, 
    130                             char * buf, int count); 
    131 static int read_bus_i2c(char *buf, char **start, off_t offset, int len, 
    132                         int unused); 
    133  
    134 static struct proc_dir_entry proc_bus_dir = 
    135   { 
    136     /* low_ino */       0,     /* Set by proc_register_dynamic */ 
    137     /* namelen */       3,  
    138     /* name */          "bus", 
    139     /* mode */          S_IRUGO | S_IXUGO | S_IFDIR, 
    140     /* nlink */         2,     /* Corrected by proc_register[_dynamic] */ 
    141     /* uid */           0, 
    142     /* gid */           0, 
    143     /* size */          0, 
    144 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,0,36)) 
    145     /* ops */           &proc_dir_inode_operations,  
    146 #endif 
    147   }; 
    148  
    149 static struct proc_dir_entry proc_bus_i2c_dir = 
    150   { 
    151     /* low_ino */       0,     /* Set by proc_register_dynamic */ 
    152     /* namelen */       3,  
    153     /* name */          "i2c", 
    154     /* mode */          S_IRUGO | S_IFREG, 
    155     /* nlink */         1,      
    156     /* uid */           0, 
    157     /* gid */           0, 
    158     /* size */          0, 
    159     /* ops */           NULL, 
    160     /* get_info */      &read_bus_i2c 
    161   }; 
    162  
    163 #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,29)) */ 
    16497 
    16598/* To implement the dynamic /proc/bus/i2c-? files, we need our own  
     
    223156                char name[8]; 
    224157                struct proc_dir_entry *proc_entry; 
    225 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,1,29)) 
    226                 int res; 
    227 #endif 
    228158 
    229159                sprintf(name,"i2c-%d", i); 
    230160 
    231 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,29)) 
    232161                proc_entry = create_proc_entry(name,0,proc_bus); 
    233162                if (! proc_entry) { 
     
    239168#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,27)) 
    240169                proc_entry->owner = THIS_MODULE; 
    241 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,58)) 
     170#else 
    242171                proc_entry->fill_inode = &monitor_bus_i2c; 
    243172#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,58)) */ 
    244 #else /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,1,29)) */ 
    245                 adap->proc_entry = NULL; 
    246                 if (!(proc_entry = kmalloc(sizeof(struct proc_dir_entry)+ 
    247                                            strlen(name)+1, GFP_KERNEL))) { 
    248                         printk("i2c-core.o: Out of memory!\n"); 
    249                         return -ENOMEM; 
    250                 } 
    251                 memset(proc_entry,0,sizeof(struct proc_dir_entry)); 
    252                 proc_entry->namelen = strlen(name); 
    253                 proc_entry->name = (char *) (proc_entry + 1); 
    254                 proc_entry->mode = S_IRUGO | S_IFREG; 
    255                 proc_entry->nlink = 1; 
    256                 proc_entry->ops = &i2cproc_inode_operations; 
    257          
    258                 /* Nasty stuff to keep GCC satisfied */ 
    259                 {  
    260                         char *procname; 
    261                         (const char *) procname  = proc_entry->name; 
    262                         strcpy (procname,name); 
    263                 } 
    264          
    265                 if ((res = proc_register_dynamic(&proc_bus_dir, proc_entry))) { 
    266                         printk("i2c-core.o: Could not create %s.\n",name); 
    267                         kfree(proc_entry); 
    268                         return res; 
    269                 } 
    270          
    271                 adap->proc_entry = proc_entry; 
    272 #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,29)) */ 
    273  
    274173                adap->inode = proc_entry->low_ino; 
    275174        } 
     
    307206#ifdef CONFIG_PROC_FS 
    308207        if (i2cproc_initialized) { 
    309 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,29)) 
    310208                char name[8]; 
    311209                sprintf(name,"i2c-%d", i); 
    312210                remove_proc_entry(name,proc_bus); 
    313 #else /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,1,29)) */ 
    314                 int res; 
    315                 if (adapters[i]->proc_entry) { 
    316                         if ((res = proc_unregister(&proc_bus_dir, 
    317                                           adapters[i]->proc_entry->low_ino))) { 
    318                                 printk("i2c-core.o: Deregistration of /proc " 
    319                                        "entry failed\n"); 
    320                                 ADAP_UNLOCK(); 
    321                                 return res; 
    322                         } 
    323                         kfree(adapters[i]->proc_entry); 
    324                 } 
    325 #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,29)) */ 
    326211        } 
    327212#endif /* def CONFIG_PROC_FS */ 
     
    544429#ifdef CONFIG_PROC_FS 
    545430 
    546 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,58)) && \ 
    547     (LINUX_VERSION_CODE <= KERNEL_VERSION(2,3,27)) 
     431#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,3,27)) 
    548432/* Monitor access to /proc/bus/i2c*; make unloading i2c-proc impossible 
    549433   if some process still uses it or some file in it */ 
     
    555439    MOD_DEC_USE_COUNT; 
    556440} 
    557 #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,58)) */ 
     441#endif /* (LINUX_VERSION_CODE <= KERNEL_VERSION(2,3,37)) */ 
    558442 
    559443/* This function generates the output for /proc/bus/i2c */ 
    560 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,29)) 
    561444int read_bus_i2c(char *buf, char **start, off_t offset, int len, int *eof,  
    562445                 void *private) 
    563 #else /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,1,29)) */ 
    564 int read_bus_i2c(char *buf, char **start, off_t offset, int len, int unused) 
    565 #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,29)) */ 
    566446{ 
    567447        int i; 
     
    588468 
    589469/* This function generates the output for /proc/bus/i2c-? */ 
    590 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,29)) 
    591470ssize_t i2cproc_bus_read(struct file * file, char * buf,size_t count,  
    592471                         loff_t *ppos) 
    593472{ 
    594473  struct inode * inode = file->f_dentry->d_inode; 
    595 #else (LINUX_VERSION_CODE < KERNEL_VERSION(2,1,29)) 
    596 int i2cproc_bus_read(struct inode * inode, struct file * file,char * buf, 
    597                      int count) 
    598 { 
    599 #endif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,29)) 
    600474  char *kbuf; 
    601475  struct i2c_client *client; 
     
    635509{ 
    636510 
    637 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,29)) 
    638511        struct proc_dir_entry *proc_bus_i2c; 
    639 #else 
    640         int res; 
    641 #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,29)) */ 
    642512 
    643513        i2cproc_initialized = 0; 
    644514 
    645 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,29)) 
    646515        if (! proc_bus) { 
    647516                printk("i2c-core.o: /proc/bus/ does not exist"); 
     
    658527#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,27)) 
    659528        proc_bus_i2c->owner = THIS_MODULE; 
    660 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,58)) 
     529#else 
    661530        proc_bus_i2c->fill_inode = &monitor_bus_i2c; 
    662 #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,29)) */ 
     531#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,27)) */ 
    663532        i2cproc_initialized += 2; 
    664 #else /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,1,29)) */ 
    665         /* In Linux 2.0.x, there is no /proc/bus! But I hope no other module 
    666            introduced it, or we are fucked. And 2.0.35 and earlier does not 
    667            export proc_dir_inode_operations, so we grab it from proc_net, 
    668            which also uses it. Not nice. */ 
    669         proc_bus_dir.ops = proc_net.ops; 
    670         if ((res = proc_register_dynamic(&proc_root, &proc_bus_dir))) { 
    671                 printk("i2c-core.o: Could not create /proc/bus/"); 
    672                 i2cproc_cleanup(); 
    673                 return res; 
    674         } 
    675         i2cproc_initialized ++; 
    676         if ((res = proc_register_dynamic(&proc_bus_dir, &proc_bus_i2c_dir))) { 
    677                 printk("i2c-core.o: Could not create /proc/bus/i2c\n"); 
    678                 i2cproc_cleanup(); 
    679                 return res; 
    680         } 
    681         i2cproc_initialized ++; 
    682 #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,29)) */ 
    683533        return 0; 
    684534} 
     
    688538 
    689539        if (i2cproc_initialized >= 1) { 
    690 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,29)) 
    691540                remove_proc_entry("i2c",proc_bus); 
    692541                i2cproc_initialized -= 2; 
    693 #else /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,1,29)) */ 
    694                 int res; 
    695                 if (i2cproc_initialized >= 2) { 
    696                         if ((res = proc_unregister(&proc_bus_dir, 
    697                                                   proc_bus_i2c_dir.low_ino))) { 
    698                                 printk("i2c-core.o: could not delete " 
    699                                        "/proc/bus/i2c, module not removed."); 
    700                                 return res; 
    701                         }     
    702                         i2cproc_initialized --; 
    703                 } 
    704                 if ((res = proc_unregister(&proc_root,proc_bus_dir.low_ino))) { 
    705                         printk("i2c-core.o: could not delete /proc/bus/, " 
    706                                "module not removed."); 
    707                         return res; 
    708                 }     
    709                 i2cproc_initialized --; 
    710 #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,29)) */ 
    711542        } 
    712543        return 0; 
  • i2c/trunk/kernel/i2c-dev.c

    r3421 r3433  
    3535/* #define DEBUG */ 
    3636 
    37 #ifndef KERNEL_VERSION 
    38 #define KERNEL_VERSION(a,b,c) (((a) << 16) | ((b) << 8) | (c)) 
    39 #endif 
    40  
    41 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,51) 
    4237#include <linux/init.h> 
    43 #else 
    44 #define __init 
    45 #endif 
    46  
    47 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,1,4)) 
    48 #define copy_from_user memcpy_fromfs 
    49 #define copy_to_user memcpy_tofs 
    50 #define get_user_data(to,from) ((to) = get_user(from),0) 
    51 #else 
    5238#include <asm/uaccess.h> 
    53 #define get_user_data(to,from) get_user(to,from) 
    54 #endif 
    55  
    56 /* 2.0.0 kernel compatibility */ 
    57 #if LINUX_VERSION_CODE < 0x020100 
    58 #define MODULE_AUTHOR(noone) 
    59 #define MODULE_DESCRIPTION(none) 
    60 #define MODULE_PARM(no,param) 
    61 #define MODULE_PARM_DESC(no,description) 
    62 #define EXPORT_SYMBOL(noexport) 
    63 #define EXPORT_NO_SYMBOLS 
    64 #endif 
    6539 
    6640#include "i2c.h" 
     
    7448/* struct file_operations changed too often in the 2.1 series for nice code */ 
    7549 
    76 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,70)) 
    7750static loff_t i2cdev_lseek (struct file *file, loff_t offset, int origin); 
    78 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,56)) 
    79 static long long i2cdev_lseek (struct file *file, long long offset, int origin); 
    80 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0)) 
    81 static long long i2cdev_llseek (struct inode *inode, struct file *file,  
    82                                 long long offset, int origin); 
    83 #else 
    84 static int i2cdev_lseek (struct inode *inode, struct file *file, off_t offset,  
    85                          int origin); 
    86 #endif 
    87  
    88 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,70)) 
     51 
    8952static ssize_t i2cdev_read (struct file *file, char *buf, size_t count,  
    9053                            loff_t *offset); 
    9154static ssize_t i2cdev_write (struct file *file, const char *buf, size_t count,  
    9255                             loff_t *offset); 
    93 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0)) 
    94 static long i2cdev_read (struct inode *inode, struct file *file, char *buf,  
    95                          unsigned long count); 
    96 static long i2cdev_write (struct inode *inode, struct file *file,  
    97                           const char *buf, unsigned long offset); 
    98 #else 
    99 static int i2cdev_read(struct inode *inode, struct file *file, char *buf,  
    100                        int count); 
    101 static int i2cdev_write(struct inode *inode, struct file *file,  
    102                         const char *buf, int count); 
    103 #endif 
    10456 
    10557static int i2cdev_ioctl (struct inode *inode, struct file *file,  
     
    10759static int i2cdev_open (struct inode *inode, struct file *file); 
    10860 
    109 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,31)) 
    11061static int i2cdev_release (struct inode *inode, struct file *file); 
    111 #else 
    112 static void i2cdev_release (struct inode *inode, struct file *file); 
    113 #endif 
    114  
    11562 
    11663static int i2cdev_attach_adapter(struct i2c_adapter *adap); 
     
    13683    NULL,                   /* i2cdev_mmap     */ 
    13784    i2cdev_open, 
    138 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,118) 
    13985    NULL,                   /* i2cdev_flush    */ 
    140 #endif 
    14186    i2cdev_release, 
    14287}; 
     
    170115/* Note that the lseek function is called llseek in 2.1 kernels. But things 
    171116   are complicated enough as is. */ 
    172 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,70)) 
    173117loff_t i2cdev_lseek (struct file *file, loff_t offset, int origin) 
    174 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,56)) 
    175 long long i2cdev_lseek (struct file *file, long long offset, int origin) 
    176 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0)) 
    177 long long i2cdev_llseek (struct inode *inode, struct file *file,  
    178                          long long offset, int origin) 
    179 #else 
    180 int i2cdev_lseek (struct inode *inode, struct file *file, off_t offset,  
    181                   int origin) 
    182 #endif 
    183 { 
    184 #ifdef DEBUG 
    185 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,56)) 
     118{ 
     119#ifdef DEBUG 
    186120   struct inode *inode = file->f_dentry->d_inode; 
    187 #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,70)) */ 
    188121  printk("i2c-dev,o: i2c-%d lseek to %ld bytes relative to %d.\n", 
    189122         MINOR(inode->i_rdev),(long) offset,origin); 
     
    192125} 
    193126 
    194 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,70)) 
    195127static ssize_t i2cdev_read (struct file *file, char *buf, size_t count, 
    196128                            loff_t *offset) 
    197 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0)) 
    198 static long i2cdev_read (struct inode *inode, struct file *file, char *buf, 
    199                          unsigned long count) 
    200 #else 
    201 static int i2cdev_read(struct inode *inode, struct file *file, char *buf, 
    202                        int count) 
    203 #endif 
    204129{ 
    205130  char *tmp; 
     
    207132 
    208133#ifdef DEBUG 
    209 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,70)) 
    210134   struct inode *inode = file->f_dentry->d_inode; 
    211 #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,70)) */ 
    212135#endif /* DEBUG */ 
    213136 
     
    229152} 
    230153 
    231 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,70)) 
    232154static ssize_t i2cdev_write (struct file *file, const char *buf, size_t count, 
    233155                             loff_t *offset) 
    234 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0)) 
    235 static long i2cdev_write (struct inode *inode, struct file *file, 
    236                           const char *buf, unsigned long offset) 
    237 #else 
    238 static int i2cdev_write(struct inode *inode, struct file *file, 
    239                         const char *buf, int count) 
    240 #endif 
    241156{ 
    242157  int ret; 
     
    245160 
    246161#ifdef DEBUG 
    247 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,70)) 
    248162   struct inode *inode = file->f_dentry->d_inode; 
    249 #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,70)) */ 
    250163#endif /* DEBUG */ 
    251164 
     
    436349} 
    437350 
    438 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,31)) 
    439351static int i2cdev_release (struct inode *inode, struct file *file) 
    440 #else 
    441 static void i2cdev_release (struct inode *inode, struct file *file) 
    442 #endif 
    443352{ 
    444353  unsigned int minor = MINOR(inode->i_rdev); 
     
    450359  MOD_DEC_USE_COUNT; 
    451360  i2cdev_adaps[minor]->dec_use(i2cdev_adaps[minor]); 
    452 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,31)) 
    453361   return 0; 
    454 #endif 
    455362} 
    456363 
  • i2c/trunk/kernel/i2c-elektor.c

    r3421 r3433  
    3131#include <linux/malloc.h> 
    3232#include <linux/version.h> 
    33 #if LINUX_VERSION_CODE >= 0x020135 
    3433#include <linux/init.h> 
    35 #else 
    36 #define __init  
    37 #endif 
    3834#include <asm/irq.h> 
    3935#include <asm/io.h> 
    40  
    41 /* 2.0.0 kernel compatibility */ 
    42 #if LINUX_VERSION_CODE < 0x020100 
    43 #define MODULE_AUTHOR(noone) 
    44 #define MODULE_DESCRIPTION(none) 
    45 #define MODULE_PARM(no,param) 
    46 #define MODULE_PARM_DESC(no,description) 
    47 #define EXPORT_SYMBOL(noexport) 
    48 #define EXPORT_NO_SYMBOLS 
    49 #endif 
    5036 
    5137#include "i2c.h" 
     
    129115 
    130116 
    131 #if LINUX_VERSION_CODE < 0x02017f 
    132 static void schedule_timeout(int j) 
    133 { 
    134         current->state   = TASK_INTERRUPTIBLE; 
    135         current->timeout = jiffies + j; 
    136         schedule(); 
    137 } 
    138 #endif 
    139  
    140117#if 0 
    141118static void pcf_isa_sleep(unsigned long timeout) 
     
    153130      cli(); 
    154131      if (pcf_pending == 0) { 
    155 #if LINUX_VERSION_CODE < 0x02017f 
    156          current->timeout = jiffies + timeout * HZ; 
    157          interruptible_sleep_on(&pcf_wait); 
    158 #else 
    159132         interruptible_sleep_on_timeout(&pcf_wait, timeout*HZ ); 
    160 #endif 
    161133      } 
    162134      else 
    163135         pcf_pending = 0; 
    164136      sti(); 
    165 #if LINUX_VERSION_CODE < 0x02017f 
    166       current->timeout = 0; 
    167 #endif 
    168137   } 
    169138   else { 
  • i2c/trunk/kernel/i2c-elv.c

    r3430 r3433  
    2929#include <linux/malloc.h> 
    3030#include <linux/version.h> 
    31 #if LINUX_VERSION_CODE >= 0x020135 
    3231#include <linux/init.h> 
    33 #else 
    34 #define __init  
    35 #endif 
    36  
    37 /* 2.0.0 kernel compatibility */ 
    38 #if LINUX_VERSION_CODE < 0x020100 
    39 #define MODULE_AUTHOR(noone) 
    40 #define MODULE_DESCRIPTION(none) 
    41 #define MODULE_PARM(no,param) 
    42 #define MODULE_PARM_DESC(no,description) 
    43 #define EXPORT_SYMBOL(noexport) 
    44 #define EXPORT_NO_SYMBOLS 
    45 #endif 
    46  
    47 #if LINUX_VERSION_CODE >= 0x020100 
    48 #  include <asm/uaccess.h> 
    49 #else 
    50 #  include <asm/segment.h> 
    51 #endif 
     32 
     33#include <asm/uaccess.h> 
    5234 
    5335#include <linux/ioport.h> 
  • i2c/trunk/kernel/i2c-philips-par.c

    r3430 r3433  
    2727#include <linux/ioport.h> 
    2828#include <linux/module.h> 
    29 #if LINUX_VERSION_CODE >= 0x020135 
    3029#include <linux/init.h> 
    31 #else 
    32 #define __init  
    33 #endif 
    3430#include <asm/io.h> 
    3531#include <linux/stddef.h> 
    36  
    37 /* 2.0.0 kernel compatibility */ 
    38 #if LINUX_VERSION_CODE < 0x020100 
    39 #define MODULE_AUTHOR(noone) 
    40 #define MODULE_DESCRIPTION(none) 
    41 #define MODULE_PARM(no,param) 
    42 #define MODULE_PARM_DESC(no,description) 
    43 #define EXPORT_SYMBOL(noexport) 
    44 #define EXPORT_NO_SYMBOLS 
    45 #endif 
    4632 
    4733#include "i2c.h" 
  • i2c/trunk/kernel/i2c-velleman.c

    r3430 r3433  
    2424#include <linux/ioport.h> 
    2525#include <linux/module.h> 
    26 #if LINUX_VERSION_CODE >= 0x020135 
    2726#include <linux/init.h> 
    28 #else 
    29 #define __init  
    30 #endif 
    3127#include <linux/string.h>  /* for 2.0 kernels to get NULL   */ 
    3228#include <asm/errno.h>     /* for 2.0 kernels to get ENODEV */ 
    3329#include <asm/io.h> 
    34  
    35 /* 2.0.0 kernel compatibility */ 
    36 #if LINUX_VERSION_CODE < 0x020100 
    37 #define MODULE_AUTHOR(noone) 
    38 #define MODULE_DESCRIPTION(none) 
    39 #define MODULE_PARM(no,param) 
    40 #define MODULE_PARM_DESC(no,description) 
    41 #define EXPORT_SYMBOL(noexport) 
    42 #define EXPORT_NO_SYMBOLS 
    43 #endif 
    4430 
    4531#include "i2c.h"