Changeset 3411

Show
Ignore:
Timestamp:
11/30/99 21:06:42 (13 years ago)
Author:
frodo
Message:

Patches to make it compatible with kernel 2.3.27 and newer

* Improved monitoring of /proc directories

Instead of doing:

proc_bus_i2c->fill_inode = &monitor_bus_i2c;
void monitor_bus_i2c(struct inode *inode, int fill)
{

if (fill)

MOD_INC_USE_COUNT;

else

MOD_DEC_USE_COUNT;

}

you can now simply set:

proc_bus_i2c->owner = THIS_MODULE;

and this is just as good!

* An old 2.3 problem seemingly never was resolved yet: instead of using

a *wait_queue directly, you have to use a wait_queue_head_t and
initialize it properly:

#if (LINUX_VERSION_CODE < 0x020301)
static struct wait_queue *pcf_wait = NULL;
#else
static wait_queue_head_t pcf_wait;
#endif

#if (LINUX_VERSION_CODE >= 0x020301)

init_waitqueue_head(&pcf_wait);

#endif

except for this, semantics remain the same (but using a plain
wait_queue_head_t instead of a pointer to a wait_queue)

Location:
i2c/trunk/kernel
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • i2c/trunk/kernel/i2c-core.c

    r3407 r3411  
    113113static int i2cproc_cleanup(void); 
    114114 
    115 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,58)) 
     115#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,58)) && \ 
     116    (LINUX_VERSION_CODE <= KERNEL_VERSION(2,3,27)) 
    116117static void monitor_bus_i2c(struct inode *inode, int fill); 
    117118#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,58)) */ 
     
    236237                } 
    237238                proc_entry->ops = &i2cproc_inode_operations; 
    238 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,58)) 
     239#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,27)) 
     240                proc_entry->owner = THIS_MODULE; 
     241#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,58)) 
    239242                proc_entry->fill_inode = &monitor_bus_i2c; 
    240243#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,58)) */ 
     
    530533#ifdef CONFIG_PROC_FS 
    531534 
    532 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,58)) 
     535#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,58)) && \ 
     536    (LINUX_VERSION_CODE <= KERNEL_VERSION(2,3,27)) 
    533537/* Monitor access to /proc/bus/i2c*; make unloading i2c-proc impossible 
    534538   if some process still uses it or some file in it */ 
     
    641645        } 
    642646        proc_bus_i2c->read_proc = &read_bus_i2c; 
    643 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,58)) 
     647#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,27)) 
     648        proc_bus_i2c->owner = THIS_MODULE; 
     649#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,58)) 
    644650        proc_bus_i2c->fill_inode = &monitor_bus_i2c; 
    645651#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,29)) */ 
  • i2c/trunk/kernel/i2c-elektor.c

    r3396 r3411  
    6363static int i2c_debug=0; 
    6464static struct i2c_pcf_isa gpi; 
     65#if (LINUX_VERSION_CODE < 0x020301) 
    6566static struct wait_queue *pcf_wait = NULL; 
     67#else 
     68static wait_queue_head_t pcf_wait; 
     69#endif 
    6670static int pcf_pending; 
    67  
    6871 
    6972/* ----- global defines ----------------------------------------------- */ 
     
    282285 
    283286   pcf_isa_data.data = (void *)pisa; 
     287#if (LINUX_VERSION_CODE >= 0x020301) 
     288   init_waitqueue_head(&pcf_wait); 
     289#endif 
    284290   if (pcf_isa_init() == 0) { 
    285291      if (i2c_pcf_add_bus(&pcf_isa_ops) < 0)