Changeset 22
- Timestamp:
- 12/02/98 18:25:53 (10 years ago)
- Files:
-
- lm-sensors/trunk/TODO (modified) (2 diffs)
- lm-sensors/trunk/i2c/bit-mb.c (modified) (2 diffs)
- lm-sensors/trunk/kernel/busses/i2c-piix4.c (modified) (1 diff)
- lm-sensors/trunk/kernel/compat.h (modified) (1 diff)
- lm-sensors/trunk/kernel/i2c-proc.c (modified) (7 diffs)
- lm-sensors/trunk/kernel/include/compat.h (modified) (1 diff)
- lm-sensors/trunk/kernel/smbus.c (modified) (1 diff)
- lm-sensors/trunk/src/compat.h (modified) (1 diff)
- lm-sensors/trunk/src/i2c-proc.c (modified) (7 diffs)
- lm-sensors/trunk/src/piix4.c (modified) (1 diff)
- lm-sensors/trunk/src/smbus.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
lm-sensors/trunk/TODO
r20 r22 1 1 Many, many things. Most notably: 2 2 3 * 2.1 kernel tests; at this moment, only 2.0 compiles have been tried. 3 * Change the i2c modules to keep the namespace clean (EXPORT_SYMBOL does not 4 work for us; many static declarations need to be added; better ask Simon 5 Vogl first) 4 6 * Make it SMP-safe: there are no spinlocks yet. They are needed at many 5 7 places, probably (everywhere where global vars are accessed). … … 11 13 * Make lm78.c detect 'double hits', (same chip connected to both SMBus and 12 14 ISA). 15 * Better lm78 detection; insmod-time paramters to set addresses (difficult, 16 because of all i2c busses!). 13 17 * Check whether some lm78 functionality is chip-generic and can be moved to 14 18 sensors.c. lm-sensors/trunk/i2c/bit-mb.c
r4 r22 28 28 #include <linux/version.h> 29 29 30 /* When exactly was the new pci interface introduced? */ 31 #if LINUX_VERSION_CODE < 0x020100 30 #if LINUX_VERSION_CODE < 0x020136 /* 2.1.54 */ 32 31 #include <linux/bios32.h> 33 32 #endif … … 129 128 130 129 /* When exactly was the new pci interface introduced? */ 131 #if LINUX_VERSION_CODE >= 0x0201 00130 #if LINUX_VERSION_CODE >= 0x020136 /* 2.1.54 */ 132 131 133 132 static u32 find_i2c(void) lm-sensors/trunk/kernel/busses/i2c-piix4.c
r15 r22 18 18 */ 19 19 20 /* Note: New PCI (non-BIOS) interface introduced in 2.1.54! */ 21 20 22 #include <linux/module.h> 21 23 #include <linux/kernel.h> 24 #include <linux/stddef.h> 22 25 #include "smbus.h" 23 26 #include "version.h" lm-sensors/trunk/kernel/compat.h
r19 r22 38 38 #endif /* def MODULE */ 39 39 40 /* copy_from/to_usr is called memcpy_from/to_fs in 2.0 kernels; perhaps in 41 some early 2.1 kernels too? */ 40 /* copy_from/to_usr is called memcpy_from/to_fs in 2.0 kernels 41 get_user was redefined in 2.1 kernels to use two arguments, and returns 42 an error code */ 42 43 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,1,4)) 43 44 #define copy_from_user memcpy_fromfs 44 45 #define copy_to_user memcpy_tofs 45 #endif46 47 /* get_user was redefined in 2.1 kernels to use two arguments, and returns48 an error code */49 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,1,4))50 46 #define get_user_data(to,from) ((to) = get_user(from),0) 51 47 #else 48 #include <asm/uaccess.h> 52 49 #define get_user_data(to,from) get_user(to,from) 53 50 #endif lm-sensors/trunk/kernel/i2c-proc.c
r18 r22 41 41 static void i2cproc_inc_use(struct i2c_client *client); 42 42 static void i2cproc_dec_use(struct i2c_client *client); 43 static int i2cproc_bus_read(struct inode * inode, struct file * file,char * buf, 44 int count); 45 46 /* To implement the dynamic /proc/bus/i2c-? files, we need our own 47 implementation of the read hook */ 48 static struct file_operations i2cproc_operations = { 49 NULL, 50 i2cproc_bus_read, 51 }; 52 53 static struct inode_operations i2cproc_inode_operations = { 54 &i2cproc_operations 55 }; 56 57 58 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,29)) 59 60 static int i2proc_bus_read(char *buf, char **start, off_t offset, int len, 43 44 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,29)) 45 46 static ssize_t i2cproc_bus_read(struct file * file, char * buf,size_t count, 47 loff_t *ppos); 48 static int read_bus_i2c(char *buf, char **start, off_t offset, int len, 61 49 int *eof , void *private); 62 ssize_t array_read(struct file * file, char * buf,size_t count, loff_t *ppos); 63 64 #else /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,1,29)) */ 65 66 int i2cproc_bus_read(struct inode * inode, struct file * file,char * buf, 67 int count); 50 51 #else /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,1,29)) */ 52 53 static int i2cproc_bus_read(struct inode * inode, struct file * file, 54 char * buf, int count); 68 55 static int read_bus_i2c(char *buf, char **start, off_t offset, int len, 69 56 int unused); … … 100 87 101 88 #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,29)) */ 89 90 /* To implement the dynamic /proc/bus/i2c-? files, we need our own 91 implementation of the read hook */ 92 static struct file_operations i2cproc_operations = { 93 NULL, 94 i2cproc_bus_read, 95 }; 96 97 static struct inode_operations i2cproc_inode_operations = { 98 &i2cproc_operations 99 }; 100 102 101 103 102 /* Used by init/cleanup */ … … 203 202 if (i2cproc_initialized >= 1) { 204 203 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,29)) 205 if ((res = remove_proc_entry("i2c",proc_bus))) { 206 printk("i2c-proc.o: could not delete /proc/bus/i2c, module not removed."); 207 return res; 208 } 204 remove_proc_entry("i2c",proc_bus); 209 205 i2cproc_initialized -= 2; 210 206 #else /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,1,29)) */ … … 253 249 /* This function generates the output for /proc/bus/i2c-? */ 254 250 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,29)) 255 ssize_t i2cproc_read(struct file * file, char * buf,size_t count, loff_t *ppos) 251 ssize_t i2cproc_bus_read(struct file * file, char * buf,size_t count, 252 loff_t *ppos) 256 253 { 257 254 struct inode * inode = file->f_dentry->d_inode; … … 291 288 if (len < 0) 292 289 len = 0; 293 memcpy_tofs(buf,kbuf+file->f_pos,len);290 copy_to_user (buf,kbuf+file->f_pos,len); 294 291 file->f_pos += len; 295 292 kfree(kbuf); … … 347 344 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,29)) 348 345 proc_entry = create_proc_entry(name,0,proc_bus); 349 if (! proc_entry) 350 else { 346 if (! proc_entry) { 351 347 printk("i2c-proc.o: Could not create /proc/bus/%s\n",name); 352 348 kfree(client); … … 399 395 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,29)) 400 396 sprintf(name,"i2c-%d",i); 401 if ((res = remove_proc_entry(name,proc_bus))) { 402 printk("i2c-proc.o: Deregistration of /proc entry failed, " 403 "client not detached.\n"); 404 return res; 405 } 397 remove_proc_entry(name,proc_bus); 406 398 #else /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,1,29)) */ 407 399 if ((res = proc_unregister(&proc_bus_dir, lm-sensors/trunk/kernel/include/compat.h
r19 r22 38 38 #endif /* def MODULE */ 39 39 40 /* copy_from/to_usr is called memcpy_from/to_fs in 2.0 kernels; perhaps in 41 some early 2.1 kernels too? */ 40 /* copy_from/to_usr is called memcpy_from/to_fs in 2.0 kernels 41 get_user was redefined in 2.1 kernels to use two arguments, and returns 42 an error code */ 42 43 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,1,4)) 43 44 #define copy_from_user memcpy_fromfs 44 45 #define copy_to_user memcpy_tofs 45 #endif46 47 /* get_user was redefined in 2.1 kernels to use two arguments, and returns48 an error code */49 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,1,4))50 46 #define get_user_data(to,from) ((to) = get_user(from),0) 51 47 #else 48 #include <asm/uaccess.h> 52 49 #define get_user_data(to,from) get_user(to,from) 53 50 #endif lm-sensors/trunk/kernel/smbus.c
r15 r22 20 20 #include <linux/module.h> 21 21 #include <linux/kernel.h> 22 #include <linux/stddef.h> 22 23 23 24 #include "i2c.h" lm-sensors/trunk/src/compat.h
r19 r22 38 38 #endif /* def MODULE */ 39 39 40 /* copy_from/to_usr is called memcpy_from/to_fs in 2.0 kernels; perhaps in 41 some early 2.1 kernels too? */ 40 /* copy_from/to_usr is called memcpy_from/to_fs in 2.0 kernels 41 get_user was redefined in 2.1 kernels to use two arguments, and returns 42 an error code */ 42 43 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,1,4)) 43 44 #define copy_from_user memcpy_fromfs 44 45 #define copy_to_user memcpy_tofs 45 #endif46 47 /* get_user was redefined in 2.1 kernels to use two arguments, and returns48 an error code */49 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,1,4))50 46 #define get_user_data(to,from) ((to) = get_user(from),0) 51 47 #else 48 #include <asm/uaccess.h> 52 49 #define get_user_data(to,from) get_user(to,from) 53 50 #endif lm-sensors/trunk/src/i2c-proc.c
r18 r22 41 41 static void i2cproc_inc_use(struct i2c_client *client); 42 42 static void i2cproc_dec_use(struct i2c_client *client); 43 static int i2cproc_bus_read(struct inode * inode, struct file * file,char * buf, 44 int count); 45 46 /* To implement the dynamic /proc/bus/i2c-? files, we need our own 47 implementation of the read hook */ 48 static struct file_operations i2cproc_operations = { 49 NULL, 50 i2cproc_bus_read, 51 }; 52 53 static struct inode_operations i2cproc_inode_operations = { 54 &i2cproc_operations 55 }; 56 57 58 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,29)) 59 60 static int i2proc_bus_read(char *buf, char **start, off_t offset, int len, 43 44 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,29)) 45 46 static ssize_t i2cproc_bus_read(struct file * file, char * buf,size_t count, 47 loff_t *ppos); 48 static int read_bus_i2c(char *buf, char **start, off_t offset, int len, 61 49 int *eof , void *private); 62 ssize_t array_read(struct file * file, char * buf,size_t count, loff_t *ppos); 63 64 #else /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,1,29)) */ 65 66 int i2cproc_bus_read(struct inode * inode, struct file * file,char * buf, 67 int count); 50 51 #else /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,1,29)) */ 52 53 static int i2cproc_bus_read(struct inode * inode, struct file * file, 54 char * buf, int count); 68 55 static int read_bus_i2c(char *buf, char **start, off_t offset, int len, 69 56 int unused); … … 100 87 101 88 #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,29)) */ 89 90 /* To implement the dynamic /proc/bus/i2c-? files, we need our own 91 implementation of the read hook */ 92 static struct file_operations i2cproc_operations = { 93 NULL, 94 i2cproc_bus_read, 95 }; 96 97 static struct inode_operations i2cproc_inode_operations = { 98 &i2cproc_operations 99 }; 100 102 101 103 102 /* Used by init/cleanup */ … … 203 202 if (i2cproc_initialized >= 1) { 204 203 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,29)) 205 if ((res = remove_proc_entry("i2c",proc_bus))) { 206 printk("i2c-proc.o: could not delete /proc/bus/i2c, module not removed."); 207 return res; 208 } 204 remove_proc_entry("i2c",proc_bus); 209 205 i2cproc_initialized -= 2; 210 206 #else /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,1,29)) */ … … 253 249 /* This function generates the output for /proc/bus/i2c-? */ 254 250 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,29)) 255 ssize_t i2cproc_read(struct file * file, char * buf,size_t count, loff_t *ppos) 251 ssize_t i2cproc_bus_read(struct file * file, char * buf,size_t count, 252 loff_t *ppos) 256 253 { 257 254 struct inode * inode = file->f_dentry->d_inode; … … 291 288 if (len < 0) 292 289 len = 0; 293 memcpy_tofs(buf,kbuf+file->f_pos,len);290 copy_to_user (buf,kbuf+file->f_pos,len); 294 291 file->f_pos += len; 295 292 kfree(kbuf); … … 347 344 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,29)) 348 345 proc_entry = create_proc_entry(name,0,proc_bus); 349 if (! proc_entry) 350 else { 346 if (! proc_entry) { 351 347 printk("i2c-proc.o: Could not create /proc/bus/%s\n",name); 352 348 kfree(client); … … 399 395 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,29)) 400 396 sprintf(name,"i2c-%d",i); 401 if ((res = remove_proc_entry(name,proc_bus))) { 402 printk("i2c-proc.o: Deregistration of /proc entry failed, " 403 "client not detached.\n"); 404 return res; 405 } 397 remove_proc_entry(name,proc_bus); 406 398 #else /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,1,29)) */ 407 399 if ((res = proc_unregister(&proc_bus_dir, lm-sensors/trunk/src/piix4.c
r15 r22 18 18 */ 19 19 20 /* Note: New PCI (non-BIOS) interface introduced in 2.1.54! */ 21 20 22 #include <linux/module.h> 21 23 #include <linux/kernel.h> 24 #include <linux/stddef.h> 22 25 #include "smbus.h" 23 26 #include "version.h" lm-sensors/trunk/src/smbus.c
r15 r22 20 20 #include <linux/module.h> 21 21 #include <linux/kernel.h> 22 #include <linux/stddef.h> 22 23 23 24 #include "i2c.h"
