Changeset 3828

Show
Ignore:
Timestamp:
07/25/03 09:56:42 (11 years ago)
Author:
khali
Message:

Moved from lk2-4; see that branch for additional history.

Location:
i2c/trunk
Files:
2 added
23 modified

Legend:

Unmodified
Added
Removed
  • i2c/trunk/CHANGES

    r3789 r3828  
    1818----------------------------------------------------------------------------- 
    1919 
    20 2.8.0 (2003????) 
     202.8.0 (20030714) 
     21  Interface changes: 
     22        - File i2c-dev.h: remove all userspace code, moved to 
     23                          i2c-dev.h in lm_sensors2 package 
     24        - Struct i2c_adapter: remove inc_use() and dec_use(), add owner, 
     25                              remove client_count, replace semaphore lock 
     26                              with semaphores bus and list. 
     27        - Struct i2c_algorithm: add owner 
     28        - Struct i2c_driver: remove inc_use() and dec_use() 
     29        - Struct i2c_msg: type changes; add err and done 
     30        - Struct i2c_smbus_ioctl_data, i2c_rdwr_ioctl_data: type changes 
     31        - Remove controlling_mod argument in i2c_register_entry() 
     32        - Remove i2c_inc_use_client() and i2c_dec_use_client() 
     33        - Add i2c_client_command() 
     34  Makefiles: Handle multiple UTS_RELEASE definitions in linux/version.h; 
     35             Remove old gzipped modules; remove old misc directory if empty; 
     36             Don't use /usr/include headers for modules; 
     37             Remove pre-2.4 installation method; 
     38             Run depmod after module installation 
     39  Modules (all): Cleanups including 
     40        - C99 initializers 
     41        - Remove #ifdef MODULE 
     42        - Remove #ifndef THIS_MODULE 
     43        - Remove #ifndef MODULE_LICENSE 
     44        - Remove init_MUTEX #define 
     45        - Remove EXPORT_NO_SYMBOLS 
     46        - Remove dummy xxx_command() definitions 
     47        - Use module_init() and module_exit() 
    2148  drivers (several): make spinlock_t's static 
    22   i2c-algo-biths.[ch]: Rewrite of i2c-algo-bit with improved bus timing and 
    23            error handling. This is not a drop-in replacement for i2c-algo-bit. 
    24            Interface subject to change. 
     49  i2c-algo-biths.[ch]: (new) Rewrite of i2c-algo-bit with improved 
     50                       bus timing and error handling. 
     51                       This is not a drop-in replacement for i2c-algo-bit. 
     52                       Interface subject to change. 
     53  i2c-core.c: Rewrite locking; 
     54              Remove initialization of other modules in i2c_init_all() 
     55  i2c-dev.c: Fixes from kernel 2.4.21-rc7 
    2556  i2c-id.h: add IDs for i2c-algo-biths, W83627HF, LM85, nForce2, OMAHA, GUIDE, 
    2657            MPC107, IXP2000, IXP425, IOP3XX, UDA1342, S3VIA 
    2758  i2c-proc.c: Fix ignore and probe tests 
    28   i2c.h: Add fields for detailed delivery report in i2c_msg. 
     59  mkpatch: Remove patching of drivers/char/mem.c 
    2960 
    30612.7.0 (20021208) 
  • i2c/trunk/INSTALL

    r3723 r3828  
    11These are the installation instructions for the i2c package. 
    2  
    3 There are three ways in which you can compile and install this package. Each 
    4 has its own strong points. They are: 
     2This package is ONLY for 2.4 kernels 2.4.9 or later !!! 
     3 
     4There are three ways in which you can compile and install this package. 
     5Option 1 is much easier and is recommended. 
    56 
    67 1. Complete separate from kernel compilation 
     8    (only for 2.4 kernels 2.4.9 or later) 
    79    This will generate a set of modules which can be inserted and removed 
    8     as needed; nothing will be written into the kernel tree; 
     10    as needed; nothing will be written into the kernel tree. 
    911 
    1012 2. Semi-integrated into the kernel  
     13    (only for 2.4 kernels 2.4.9 or later) 
    1114    This will add some files to your kernel tree, but has the advantage 
    1215    that module symbols are supported; the end result is functionally very  
     
    1417 
    1518 3. Patching of the kernel 
     19    (only for 2.4 kernels 2.4.13 or later) 
    1620    This will patch your kernel source tree. You must recompile your kernel 
    1721    to take advantage of this. But it makes it possible to compile drivers 
     
    2226method 2 is less well maintained. 
    2327 
    24 NOTE: SUPPORT FOR 2.0 AND 2.1 KERNELS HAS BEEN DROPPED! 
    25 NOTE: METHOD 3 ONLY WORKS FOR 2.2 KERNELS AND 2.4 KERNELS (2.4.0 OR LATER) 
     28NOTE: SUPPORT FOR KERNELS 2.0.0 - 2.4.8 HAS BEEN DROPPED! 
     29      2.4.9 OR LATER REQUIRED! 
     30 
     31FOR 2.5 KERNELS, Do not attempt to compile this package. 
     32                 Use the drivers already in the 2.5 kernel development tree. 
    2633 
    2734 
     
    119126BUILD_SYSTEM (both) (default: lm_sensors) 
    120127  The build system which is used. lm_sensors corresponds with compilation 
    121   option 1; i2c with compilatin option 2. 
     128  option 1; i2c with compilation option 2. 
    122129SHELL (both) (default: /bin/sh) 
    123130  You may have to specify the full path to Bash here, if /bin/sh is some 
     
    168175 
    169176There is a special script which should be able to generate diffs against 
    170 any 2.2 and 2.4 kernel (2.4.0 and later). Note that 2.3 kernels are no  
     177any 2.4 kernel (2.4.13 and later). Note that older kernels are no  
    171178longer supported. 
    172179Please report any problems to our mailinglist. Note that it may fail,  
  • i2c/trunk/Makefile

    r3753 r3828  
    6060#   /lib/modules/2.2.15-ac9/misc 
    6161#MODDIR := /lib/modules/`grep UTS_RELEASE $(LINUX_HEADERS)/linux/version.h|cut -f 2 -d'"'`/misc 
    62 MODPREF := /lib/modules/`grep UTS_RELEASE $(LINUX_HEADERS)/linux/version.h|cut -f 2 -d'"'` 
     62#MODPREF := /lib/modules/`grep UTS_RELEASE $(LINUX_HEADERS)/linux/version.h|cut -f 2 -d'"'` 
    6363#MODPREF := /lib/modules/$(KERNELVERSION) 
     64MODPREF := /lib/modules/$(shell $(CC) -I$(LINUX_HEADERS) -E etc/config.c | grep uts_release |cut -f 2 -d'"') 
    6465 
    6566# This is the directory into which the header files will be installed. 
     
    105106# Some often-used commands with default options 
    106107MKDIR := mkdir -p 
     108RMDIR := rmdir 
    107109RM := rm -f 
    108110CC := gcc 
     
    117119# MODCFLAGS is to create in-kernel object files (modules) 
    118120 
    119 CFLAGS := -I$(LINUX_HEADERS) -O2 -DLM_SENSORS 
     121CPPFLAGS := -I$(LINUX_HEADERS) 
     122CFLAGS := -Wall -O2 -DLM_SENSORS 
    120123 
    121124ifeq ($(WARN),1) 
    122 CFLAGS += -Wall -Wstrict-prototypes -Wshadow -Wpointer-arith -Wcast-qual \ 
     125CFLAGS += -W -Wstrict-prototypes -Wshadow -Wpointer-arith -Wcast-qual \ 
    123126          -Wcast-align -Wwrite-strings -Wnested-externs -Winline 
    124127endif 
     
    139142 
    140143ifeq ($(SMP),1) 
    141 MODCFLAGS += -D__SMP__ 
     144MODCPPFLAGS += -D__SMP__ 
    142145endif 
    143146 
    144147ifeq ($(MODVER),1) 
    145 MODCFLAGS += -DMODVERSIONS -include $(LINUX_HEADERS)/linux/modversions.h 
    146 endif 
     148MODCPPFLAGS += -DMODVERSIONS -include $(LINUX_HEADERS)/linux/modversions.h 
     149endif 
     150 
     151# This magic is from the kernel Makefile. 
     152# Extra cflags for kbuild 2.4.  The default is to forbid includes by kernel code 
     153# from user space headers. 
     154kbuild_2_4_nostdinc := -nostdinc $(shell LC_ALL=C $(CC) -print-search-dirs | sed -ne 's/install: \(.*\)/-I \1include/gp') 
     155MODCPPFLAGS += $(CPPFLAGS) $(kbuild_2_4_nostdinc) 
    147156 
    148157.PHONY: dep 
     
    165174 
    166175all :: 
     176ifeq ($(shell if grep -q '^CONFIG_I2C=y' $(LINUX)/.config; then echo 1; fi),1) 
     177        @echo "*************** WARNING *************************** WARNING ***************" 
     178        @echo "***                                                                     ***" 
     179        @echo "*** You have I2C support built into your kernel (CONFIG_I2C=y). Unless  ***" 
     180        @echo "*** you know what you are doing, installing our version of i2c will not ***" 
     181        @echo "*** work. Newly built i2c modules probably won't load. Other modules    ***" 
     182        @echo "*** that rely on the i2c layer, such as lm_sensors, will fail to        ***" 
     183        @echo "*** compile. Please consider compiling your kernel again with I2C       ***" 
     184        @echo "*** support enabled as modules or disabled.                             ***" 
     185        @echo "***                                                                     ***" 
     186        @echo "*************** WARNING *************************** WARNING ***************" 
     187endif 
    167188 
    168189install :: all 
     190        @echo "*** The depmod command below may generate errors. We are aware of the" 
     191        @echo "*** problem and are working on a solution. You should ignore them for now." 
     192ifeq ($(DESTDIR),) 
     193        -/sbin/depmod -a 
     194else 
     195        -/sbin/depmod -a -b $(DESTDIR) 
     196endif 
     197        @echo "*** Installation successful!" 
     198        @echo "*** Important notes:" 
     199        @echo "*** 1* Due to a change in our i2c structures, i2c-related drivers from" 
     200        @echo "***    the Linux kernel and from external sources won't work with this" 
     201        @echo "***    version of i2c. Such drivers include commonly used video drivers" 
     202        @echo "***    such as bttv and zoran, and less commonly used ones such as" 
     203        @echo "***    i2c-matroxfb. If you really need these, then you shouldn't use our" 
     204        @echo "***    i2c package. If you can leave without them, you should make sure" 
     205        @echo "***    such drivers do not exist on your system anymore. Loading them" 
     206        @echo "***    now would result in a severe system crash. We are working on the" 
     207        @echo "***    problem and will soon submit a complete i2c patch for inclusion in" 
     208        @echo "***    the Linux 2.4 kernel." 
     209        @echo "*** 2* The i2c-elektor and i2c-pcf-epp modules were not built. If you" 
     210        @echo "***    need them, you have to use compilation option 3 as described in" 
     211        @echo "***    the INSTALL file." 
    169212 
    170213clean:: 
     
    180223# .o files are used for modules 
    181224%.o: %.c 
    182         $(CC) $(MODCFLAGS) -c $< -o $@ 
     225        $(CC) $(MODCPPFLAGS) $(MODCFLAGS) -c $< -o $@ 
    183226 
    184227%.d: %.c 
    185         $(CC) -M -MG $(MODCFLAGS) $< | \ 
     228        $(CC) -M -MG $(MODCPPFLAGS) $(MODCFLAGS) $< | \ 
    186229        sed -e 's@^\(.*\)\.o:@$*.d $*.o: Makefile '`dirname $*.d`/Module.mk' @' > $@ 
    187230 
  • i2c/trunk/QUICKSTART

    r3484 r3828  
    33system, and may cause problems. 
    44 
    5 Quickstart: 
     5Quickstart for compiling outside the kernel. 
     6This is by far the EASIEST METHOD. 
     7Other methods are described in INSTALL. 
     8------------------------------------------ 
     9 
     10  * Verify you are running a 2.4 kernel, 2.4.9 or later. 
     11 
    612  * Make sure you have the kernel tree corresponding to your current 
    7     kernel in /usr/src/linux. Distribution kernels usually won't do, 
    8     compile your own from a 'vanilla' tree (get one from 
    9     ftp://ftp.kernel/org/pub/linux/kernel/). 
     13    kernel in /lib/modules/(uname -r)/build. 
     14    Even if the source is there, it may not correspond to your running 
     15    kernel. If so, you will have to recompile your kernel. 
     16 
     17  * Do `lsmod'. If there are any old i2c or sensors modules loaded, 
     18    you MUST remove them (as root) with `rmmod'. 
     19 
     20  * Verify that your i2c support in the kernel is configured as 
     21    modules or is disabled. If it is compiled-in, you obviously 
     22    cannot replace it with modules in the next step. 
     23 
    1024  * Do a `make' followed by a `make install'. The warnings about .d 
    1125    files at the start are harmless. 
     26 
    1227  * Make sure you do a `depmod -a'. 
     28 
    1329  * That's all (but you need client drivers from some other source to do  
    14     anything interesting) 
     30    anything interesting - see the lm_sensors page: 
     31    http://secure.netroedge.com/~lm78/ 
  • i2c/trunk/README

    r3555 r3828  
    1 These are the updated i2c drivers, also known as the `Simon Vogl' drivers. 
     1These package includes the basic i2c drivers. 
     2This package is ONLY for 2.4 kernels 2.4.9 or later !!! 
    23 
    3 Updated means: more updated than the ones found in the current kernels. 
     4ADDITIONALLY, i2c-2.8.0 is not API compatible to earlier i2c 
     5releases due to struct changes; therefore you must NOT ENABLE 
     6any other i2c drivers (e.g. bttv) in the 2.4 kernel. 
     7Do NOT use lm-sensors 2.8.0 or i2c-2.8.0 if you require bttv. 
    48 
    5 If you have used this package before, please read IMPORTANT_CHANGES! 
     9FOR 2.5 KERNELS, Do not attempt to compile this package. 
     10                 Use the drivers already in the 2.5 kernel development tree. 
     11 
     12============================================================================= 
    613 
    714There are basically two kinds of i2c drivers: drivers for busses and drivers 
     
    2128 
    2229You can reach the developers of this package at their mailing list, at 
    23 linux-i2c@pelican.tk.uni-linz.ac.at. 
     30sensors@stimpy.netroedge.com. 
  • i2c/trunk/TODO

    r3663 r3828  
    33------------------------------------------------ 
    44 
    5 * Send 2.6.3 patch to Marcelo (2.6.1 in kernel 2.4.13) 
     5* Send 2.8.0 patch to Marcelo (2.6.1 in kernel 2.4.13) 
    66 
    7 * Send 2.6.4 patch to Linus (2.6.3 in kernel 2.5.24) 
    8  
    9 * SMBus 2.0 
     7* SMBus 2.0 Completion 
    108  SMBus 2.0 adds PEC, ARP, and a block process call message. 
    11   All is complete in release 2.6.4 except: 
     9  All is complete in release 2.6.4 except for: 
    1210        - SW PEC for Word Data and Process Call. No place to put PEC 
    1311          in the current i2c_smbus_data structure. 
     12  For a summary of SMBus protocol support, see 
     13        http://www2.lm-sensors.nu/~lm78/protocol.html 
    1414 
    1515* Timing considerations in SMBus emulation with i2c-algo-bit (D.E.): 
     16  (Note that some of these changes are implemented in i2c-algo-biths) 
    1617  The Smbus defines a minimum frequency of 10 KHZ for driving the bus, while 
    1718  the I2C does not define any minimum frequency. 
  • i2c/trunk/doc/writing-clients

    r3704 r3828  
    2525address. 
    2626 
    27   struct i2c_driver foo_driver 
    28   {   
    29     /* name           */  "Foo version 2.3 and later driver", 
    30     /* id             */  I2C_DRIVERID_FOO, 
    31     /* flags          */  I2C_DF_NOTIFY, 
    32     /* attach_adapter */  &foo_attach_adapter, 
    33     /* detach_client  */  &foo_detach_client, 
    34     /* command        */  &foo_command,   /* May be NULL */ 
    35     /* inc_use        */  &foo_inc_use,   /* May be NULL */ 
    36     /* dec_use        */  &foo_dec_use    /* May be NULL */ 
     27  static struct i2c_driver foo_driver = { 
     28    .owner          = THIS_MODULE, 
     29    .name           = "Foo version 2.3 driver", 
     30    .id             = I2C_DRIVERID_FOO, /* usually from i2c-id.h */ 
     31    .flags          = I2C_DF_NOTIFY, 
     32    .attach_adapter = &foo_attach_adapter, 
     33    .detach_client  = &foo_detach_client, 
     34    .command        = &foo_command /* may be NULL */ 
    3735  } 
    3836  
     
    5149below. 
    5250 
    53  
    54 Module usage count 
    55 ================== 
    56  
    57 If your driver can also be compiled as a module, there are moments at  
    58 which the module can not be removed from memory. For example, when you 
    59 are doing a lengthy transaction, or when you create a /proc directory, 
    60 and some process has entered that directory (this last case is the 
    61 main reason why these call-backs were introduced). 
    62  
    63 To increase or decrease the module usage count, you can use the 
    64 MOD_{INC,DEC}_USE_COUNT macros. They must be called from the module 
    65 which needs to get its usage count changed; that is why each driver 
    66 module has to implement its own callback. 
    67  
    68   void foo_inc_use (struct i2c_client *client) 
    69   { 
    70   #ifdef MODULE 
    71     MOD_INC_USE_COUNT; 
    72   #endif 
    73   } 
    74  
    75   void foo_dec_use (struct i2c_client *client) 
    76   { 
    77   #ifdef MODULE 
    78     MOD_DEC_USE_COUNT; 
    79   #endif 
    80   } 
    81  
    82 Do not call these call-back functions directly; instead, use one of the 
    83 following functions defined in i2c.h: 
    84   void i2c_inc_use_client(struct i2c_client *); 
    85   void i2c_dec_use_client(struct i2c_client *); 
    86  
    87 You should *not* increase the module count just because a device is 
    88 detected and a client created. This would make it impossible to remove 
    89 an adapter driver!  
     51There use to be two additional fields in this structure, inc_use et dec_use, 
     52for module usage count, but these fields were obsoleted and removed. 
    9053 
    9154 
  • i2c/trunk/kernel/Module.mk

    r3788 r3828  
    7171KERNELTARGETS += $(MODULE_DIR)/i2c-pport.o 
    7272endif 
    73 ifeq ($(shell if grep -q '^CONFIG_I2C_IOP3XX=y' $(LINUX)/.config; then echo 1; fi),1) 
    74 KERNELTARGETS += $(MODULE_DIR)/i2c-iop3xx.o 
    75 endif 
     73#ifeq ($(shell if grep -q '^CONFIG_I2C_IOP3XX=y' $(LINUX)/.config; then echo 1; fi),1) 
     74#KERNELTARGETS += $(MODULE_DIR)/i2c-iop3xx.o 
     75#endif 
    7676# 
    7777# No CONFIG option for this yet (not in mkpatch) 
     
    9595all-kernel: $(KERNELTARGETS) 
    9696all :: all-kernel 
    97         echo KERNELTARGETS $(KERNELTARGETS) 
    9897 
    9998# 
     
    104103install-kernel: all-kernel 
    105104        if [ -n "$(KERNELTARGETS)" ] ; then \ 
    106           if [ -d "$(DESTDIR)$(MODPREF)/kernel" ] ; then \ 
    107             $(MKDIR) $(DESTDIR)$(MODPREF)/kernel/drivers/i2c ; \ 
    108             $(INSTALL) -o root -g root -m 644 $(KERNELTARGETS) $(DESTDIR)$(MODPREF)/kernel/drivers/i2c ; \ 
    109             for i in $(KERNELTARGETS) ; do \ 
    110               $(RM) $(DESTDIR)$(MODPREF)/misc/`basename $$i` ; \ 
    111             done \ 
    112           else \ 
    113             $(MKDIR) $(DESTDIR)$(MODPREF)/misc ; \ 
    114             $(INSTALL) -o root -g root -m 644 $(KERNELTARGETS) $(DESTDIR)$(MODPREF)/misc ; \ 
    115           fi \ 
     105          $(MKDIR) $(DESTDIR)$(MODPREF)/kernel/drivers/i2c ; \ 
     106          $(INSTALL) -o root -g root -m 644 $(KERNELTARGETS) $(DESTDIR)$(MODPREF)/kernel/drivers/i2c ; \ 
     107          for i in $(KERNELTARGETS) ; do \ 
     108            $(RM) $(DESTDIR)$(MODPREF)/misc/`basename $$i` $(DESTDIR)$(MODPREF)/misc/`basename $$i`.gz $(DESTDIR)$(MODPREF)/kernel/drivers/i2c/`basename $$i`.gz ; \ 
     109          done ; \ 
     110          for i in i2c-elektor.o i2c-pcf-epp.o ; do \ 
     111            $(RM) $(DESTDIR)$(MODPREF)/misc/`basename $$i` $(DESTDIR)$(MODPREF)/misc/`basename $$i`.gz $(DESTDIR)$(MODPREF)/kernel/drivers/i2c/`basename $$i` $(DESTDIR)$(MODPREF)/kernel/drivers/i2c/`basename $$i`.gz ; \ 
     112          done ; \ 
     113          $(RMDIR) $(DESTDIR)$(MODPREF)/misc 2> /dev/null || true ; \ 
    116114        fi 
    117115        if [ -n "$(KERNELINCLUDES)" ] ; then \ 
    118116          $(MKDIR) $(DESTDIR)$(LINUX_INCLUDE_DIR) ; \ 
    119         $(INSTALL) -o root -g root -m 644 $(KERNELINCLUDES) $(DESTDIR)$(LINUX_INCLUDE_DIR) ; \ 
     117          $(INSTALL) -o root -g root -m 644 $(KERNELINCLUDES) $(DESTDIR)$(LINUX_INCLUDE_DIR) ; \ 
    120118        fi 
    121119install :: install-kernel 
  • i2c/trunk/kernel/i2c-algo-bit.c

    r3765 r3828  
    9999                        return -ETIMEDOUT; 
    100100                } 
     101#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) 
     102                if (current->need_resched) 
     103                        schedule(); 
     104#else 
    101105                cond_resched(); 
     106#endif 
    102107        } 
    103108        DEBSTAT(printk(KERN_DEBUG "needed %ld jiffies\n", jiffies-start)); 
     
    504509} 
    505510 
    506 static u32 bit_func(struct i2c_adapter *adap) 
     511static u32 bit_func(struct i2c_adapter *i2c_adap) 
    507512{ 
    508513        return I2C_FUNC_SMBUS_EMUL | I2C_FUNC_10BIT_ADDR |  
     
    526531int i2c_bit_add_bus(struct i2c_adapter *adap) 
    527532{ 
    528         int i; 
    529533        struct i2c_algo_bit_data *bit_adap = adap->algo_data; 
    530534 
  • i2c/trunk/kernel/i2c-algo-biths.c

    r3765 r3828  
    167167                                return; 
    168168                        } 
     169#ifdef cond_resched 
    169170                        cond_resched(); 
     171#else 
     172                        if (current->need_resched) { 
     173                                set_current_state(TASK_UNINTERRUPTIBLE); 
     174                                schedule_timeout(1); 
     175                        } 
     176#endif 
    170177                } 
    171178                adap->set_timer(adap); 
  • i2c/trunk/kernel/i2c-algo-pcf.c

    r3765 r3828  
    443443int i2c_pcf_add_bus(struct i2c_adapter *adap) 
    444444{ 
    445         int i, status; 
     445        int i; 
    446446        struct i2c_algo_pcf_data *pcf_adap = adap->algo_data; 
    447447 
  • i2c/trunk/kernel/i2c-core.c

    r3768 r3828  
    2222   SMBus 2.0 support by Mark Studebaker <mdsxyz123@yahoo.com>                */ 
    2323 
    24 /* $Id$ */ 
     24/* i2c-core.c,v 1.91.2.2 2003/01/21 10:00:19 kmalkki Exp */ 
    2525 
    2626#include <linux/module.h> 
     
    298298} 
    299299 
    300 int i2c_check_addr (struct i2c_adapter *adapter, int addr) 
     300static int __i2c_check_addr (struct i2c_adapter *adapter, int addr) 
    301301{ 
    302302        int i; 
    303         down(&adapter->list); 
    304303        for (i = 0; i < I2C_CLIENT_MAX ; i++)  
    305304                if (adapter->clients[i] && (adapter->clients[i]->addr == addr)) 
    306305                        return -EBUSY; 
     306 
     307        return 0; 
     308} 
     309 
     310int i2c_check_addr (struct i2c_adapter *adapter, int addr) 
     311{ 
     312        int rval; 
     313 
     314        down(&adapter->list); 
     315        rval = __i2c_check_addr(adapter, addr); 
    307316        up(&adapter->list); 
    308         return 0; 
     317 
     318        return rval; 
    309319} 
    310320 
     
    380390} 
    381391 
    382 static int i2c_inc_use_client(struct i2c_client *client) 
    383 { 
    384  
    385         if (!try_module_get(client->driver->owner)) 
    386                 return -ENODEV; 
    387         if (!try_module_get(client->adapter->owner)) { 
    388                 module_put(client->driver->owner); 
    389                 return -ENODEV; 
    390         } 
    391  
    392         return 0; 
     392static void i2c_inc_use_client(struct i2c_client *client) 
     393{ 
     394        if(client->driver->owner) 
     395                __MOD_INC_USE_COUNT(client->driver->owner); 
     396        if(client->adapter->owner) 
     397                __MOD_INC_USE_COUNT(client->adapter->owner); 
    393398} 
    394399 
    395400static void i2c_dec_use_client(struct i2c_client *client) 
    396401{ 
    397         module_put(client->driver->owner); 
    398         module_put(client->adapter->owner); 
     402        if(client->driver->owner) 
     403                __MOD_DEC_USE_COUNT(client->driver->owner); 
     404        if(client->adapter->owner) 
     405                __MOD_DEC_USE_COUNT(client->adapter->owner); 
    399406} 
    400407 
     
    470477int i2c_use_client(struct i2c_client *client) 
    471478{ 
    472         if (!i2c_inc_use_client(client)) 
    473                 return -ENODEV; 
    474  
    475479        if (client->flags & I2C_CLIENT_ALLOW_USE) { 
    476480                if (client->flags & I2C_CLIENT_ALLOW_MULTIPLE_USE) 
    477481                        client->usage_count++; 
    478482                else if (client->usage_count > 0)  
    479                         goto busy; 
     483                        return -EBUSY; 
    480484                else  
    481485                        client->usage_count++; 
    482486        } 
    483487 
     488        i2c_inc_use_client(client); 
     489 
    484490        return 0; 
    485  busy: 
    486         i2c_dec_use_client(client); 
    487         return -EBUSY; 
    488491} 
    489492 
     
    14121415} 
    14131416 
     1417/* leave this in for now simply to make patching easier so we don't have 
     1418   to remove the call in drivers/char/mem.c */ 
     1419int __init i2c_init_all(void) 
     1420{ 
     1421        return 0; 
     1422} 
     1423 
    14141424EXPORT_SYMBOL(i2c_add_adapter); 
    14151425EXPORT_SYMBOL(i2c_del_adapter); 
  • i2c/trunk/kernel/i2c-dev.c

    r3765 r3828  
    3636#include <linux/slab.h> 
    3737#include <linux/smp_lock.h> 
     38#ifdef CONFIG_DEVFS_FS 
    3839#include <linux/devfs_fs_kernel.h> 
     40#endif 
    3941#include <linux/init.h> 
    4042#include "i2c.h" 
     
    7678#define I2CDEV_ADAPS_MAX I2C_ADAP_MAX 
    7779static struct i2c_adapter *i2cdev_adaps[I2CDEV_ADAPS_MAX]; 
     80#ifdef CONFIG_DEVFS_FS 
     81static devfs_handle_t devfs_i2c[I2CDEV_ADAPS_MAX]; 
     82static devfs_handle_t devfs_handle = NULL; 
     83#endif 
    7884 
    7985static struct i2c_driver i2cdev_driver = { 
     
    207213                        return -EFAULT; 
    208214 
     215                /* Put an arbritrary limit on the number of messages that can 
     216                 * be sent at once */ 
     217                if (rdwr_arg.nmsgs > 42) 
     218                        return -EINVAL; 
     219                
    209220                rdwr_pa = (struct i2c_msg *) 
    210221                        kmalloc(rdwr_arg.nmsgs * sizeof(struct i2c_msg),  
     
    221232                        { 
    222233                                res = -EFAULT; 
     234                                break; 
     235                        } 
     236                        /* Limit the size of the message to a sane amount */ 
     237                        if (rdwr_pa[i].len > 8192) { 
     238                                res = -EINVAL; 
    223239                                break; 
    224240                        } 
     
    233249                                rdwr_pa[i].len)) 
    234250                        { 
    235                                 kfree(rdwr_pa[i].buf); 
    236251                                res = -EFAULT; 
    237252                                break; 
    238253                        } 
     254                } 
     255                if (res < 0) { 
     256                        int j; 
     257                        for (j = 0; j < i; ++j) 
     258                                kfree(rdwr_pa[j].buf); 
     259                        kfree(rdwr_pa); 
     260                        return res; 
    239261                } 
    240262                if (!res)  
     
    362384 
    363385        /* registered with adapter, passed as client to user */ 
    364         client->adapter = file->private_data; 
     386        client->adapter = i2cdev_adaps[minor]; 
    365387        file->private_data = client; 
    366388 
    367         /* use adapter module, i2c-dev handled with fops */ 
    368         if (!try_module_get(client->adapter->owner)) { 
    369                 kfree(client); 
    370                 return -ENODEV; 
    371         } 
     389        if(client->adapter->owner) 
     390                __MOD_INC_USE_COUNT(client->adapter->owner); 
    372391 
    373392#ifdef DEBUG 
     
    386405        client = file->private_data; 
    387406        file->private_data = NULL; 
    388         module_put(client->adapter->owner); 
     407        if(client->adapter->owner) 
     408                __MOD_DEC_USE_COUNT(client->adapter->owner); 
    389409        kfree(client); 
    390410#ifdef DEBUG 
     
    397417{ 
    398418        int i; 
    399         char name[12]; 
     419        char name[8]; 
    400420 
    401421        if ((i = i2c_adapter_id(adap)) < 0) { 
     
    408428        } 
    409429 
    410         sprintf (name, "i2c/%d", i); 
     430        sprintf (name, "%d", i); 
    411431        if (! i2cdev_adaps[i]) { 
    412432                i2cdev_adaps[i] = adap; 
    413                 devfs_register (NULL, name, 
     433#ifdef CONFIG_DEVFS_FS 
     434                devfs_i2c[i] = devfs_register (devfs_handle, name, 
    414435                        DEVFS_FL_DEFAULT, I2C_MAJOR, i, 
    415436                        S_IFCHR | S_IRUSR | S_IWUSR, 
    416437                        &i2cdev_fops, adap); 
     438#endif 
    417439                printk(KERN_DEBUG "i2c-dev.o: Registered '%s' as minor %d\n",adap->name,i); 
    418440        } else { 
    419441                /* This is actually a detach_adapter call! */ 
    420                 devfs_remove("i2c/%d", i); 
     442#ifdef CONFIG_DEVFS_FS 
     443                devfs_unregister(devfs_i2c[i]); 
     444#endif 
    421445                i2cdev_adaps[i] = NULL; 
    422446#ifdef DEBUG 
     
    445469        printk(KERN_INFO "i2c-dev.o: i2c /dev entries driver module version %s (%s)\n", I2C_VERSION, I2C_DATE); 
    446470 
     471#ifdef CONFIG_DEVFS_FS 
     472        if (devfs_register_chrdev(I2C_MAJOR, "i2c", &i2cdev_fops)) { 
     473#else 
    447474        if (register_chrdev(I2C_MAJOR,"i2c",&i2cdev_fops)) { 
     475#endif 
    448476                printk(KERN_ERR "i2c-dev.o: unable to get major %d for i2c bus\n", 
    449477                       I2C_MAJOR); 
    450478                return -EIO; 
    451479        } 
    452         devfs_mk_dir(NULL, "i2c", NULL); 
     480#ifdef CONFIG_DEVFS_FS 
     481        devfs_handle = devfs_mk_dir(NULL, "i2c", NULL); 
     482#endif 
    453483        if ((res = i2c_add_driver(&i2cdev_driver))) { 
    454484                printk(KERN_ERR "i2c-dev.o: Driver registration failed, module not inserted.\n"); 
    455                 devfs_remove("i2c"); 
     485#ifdef CONFIG_DEVFS_FS 
     486                devfs_unregister(devfs_handle); 
     487#endif 
    456488                unregister_chrdev(I2C_MAJOR,"i2c"); 
    457489                return res; 
     
    463495{ 
    464496        i2c_del_driver(&i2cdev_driver); 
    465         devfs_remove("i2c"); 
     497#ifdef CONFIG_DEVFS_FS 
     498        devfs_unregister(devfs_handle); 
     499#endif 
    466500        unregister_chrdev(I2C_MAJOR,"i2c"); 
    467501} 
  • i2c/trunk/kernel/i2c-dev.h

    r3765 r3828  
    2727#include <linux/types.h> 
    2828 
     29#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,18) 
     30#define minor(d) MINOR(d) 
     31#endif 
     32 
    2933/* Some IOCTL commands are defined in <linux/i2c.h> */ 
    3034/* Note: 10-bit addresses are NOT supported! */ 
     
    3236/* This is the structure as used in the I2C_SMBUS ioctl call */ 
    3337struct i2c_smbus_ioctl_data { 
    34         char read_write; 
     38        __u8 read_write; 
    3539        __u8 command; 
    36         int size; 
     40        __u32 size; 
    3741        union i2c_smbus_data *data; 
    3842}; 
     
    4145struct i2c_rdwr_ioctl_data { 
    4246        struct i2c_msg *msgs;   /* pointers to i2c_msgs */ 
    43         int nmsgs;              /* number of i2c_msgs */ 
     47        __u32 nmsgs;            /* number of i2c_msgs */ 
    4448}; 
    4549 
  • i2c/trunk/kernel/i2c-id.h

    r3789 r3828  
    153153#define I2C_DRIVERID_W83627HF 1038 
    154154#define I2C_DRIVERID_LM85 1039 
     155#define I2C_DRIVERID_LM83 1040 
     156#define I2C_DRIVERID_SAA1064 1041 
    155157 
    156158/* 
  • i2c/trunk/kernel/i2c-pcf-epp.c

    r3765 r3828  
    22/* i2c-pcf-epp.c i2c-hw access for PCF8584 style EPP parallel port adapters  */ 
    33/* ------------------------------------------------------------------------- */ 
     4/*   Copyright (C) 1998-99 Hans Berglund 
     5 
     6    This program is free software; you can redistribute it and/or modify 
     7    it under the terms of the GNU General Public License as published by 
     8    the Free Software Foundation; either version 2 of the License, or 
     9    (at your option) any later version. 
     10 
     11    This program is distributed in the hope that it will be useful, 
     12    but WITHOUT ANY WARRANTY; without even the implied warranty of 
     13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     14    GNU General Public License for more details. 
     15 
     16    You should have received a copy of the GNU General Public License 
     17    along with this program; if not, write to the Free Software 
     18    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                */ 
     19/* ------------------------------------------------------------------------- */ 
     20 
     21/* With some changes from Ryosuke Tajima <rosk@jsk.t.u-tokyo.ac.jp> */ 
    422 
    523#include <linux/kernel.h> 
     
    252270MODULE_AUTHOR("Hans Berglund <hb@spacetec.no> \n modified by Ryosuke Tajima <rosk@jsk.t.u-tokyo.ac.jp>"); 
    253271MODULE_DESCRIPTION("I2C-Bus adapter routines for PCF8584 EPP parallel port adapter"); 
     272MODULE_LICENSE("GPL"); 
    254273 
    255274MODULE_PARM(base, "i"); 
  • i2c/trunk/kernel/i2c-proc.c

    r3780 r3828  
    3636#include <asm/uaccess.h> 
    3737 
    38 static int i2c_create_name(char **name, const char *prefix, 
    39                                struct i2c_adapter *adapter, int addr); 
    4038static int i2c_parse_reals(int *nrels, void *buffer, int bufsize, 
    4139                               long *results, int magnitude); 
    42 static int i2c_write_reals(int nrels, void *buffer, int *bufsize, 
     40static int i2c_write_reals(int nrels, void *buffer, size_t *bufsize, 
    4341                               long *results, int magnitude); 
    4442static int i2c_proc_chips(ctl_table * ctl, int write, 
     
    5553static struct i2c_client *i2c_clients[SENSORS_ENTRY_MAX]; 
    5654 
    57 static ctl_table sysctl_table[] = { 
    58         {CTL_DEV, "dev", NULL, 0, 0555}, 
    59         {0}, 
    60         {DEV_SENSORS, "sensors", NULL, 0, 0555}, 
    61         {0}, 
    62         {0, NULL, NULL, 0, 0555}, 
    63         {0} 
    64 }; 
    65  
    6655static ctl_table i2c_proc_dev_sensors[] = { 
    6756        {SENSORS_CHIPS, "chips", NULL, 0, 0644, NULL, &i2c_proc_chips, 
     
    7160 
    7261static ctl_table i2c_proc_dev[] = { 
    73         {DEV_SENSORS, "sensors", NULL, 0, 0555, i2c_proc_dev_sensors, NULL}, 
     62        {DEV_SENSORS, "sensors", NULL, 0, 0555, i2c_proc_dev_sensors}, 
    7463        {0}, 
    7564}; 
     
    7766 
    7867static ctl_table i2c_proc[] = { 
    79         {CTL_DEV, "dev", NULL, 0, 0555, i2c_proc_dev, NULL}, 
     68        {CTL_DEV, "dev", NULL, 0, 0555, i2c_proc_dev}, 
    8069        {0} 
    8170}; 
     
    8877   a LM75 chip on the third i2c bus at address 0x4e).   
    8978   name is allocated first. */ 
    90 static int i2c_create_name(char **name, const char *prefix, 
    91                         struct i2c_adapter *adapter, int addr) 
    92 { 
    93         char name_buffer[50]; 
    94         int id, i, end; 
    95         if (i2c_is_isa_adapter(adapter)) 
     79static char *generate_name(struct i2c_client *client, const char *prefix) 
     80{ 
     81        struct i2c_adapter *adapter = client->adapter; 
     82        int addr = client->addr; 
     83        char name_buffer[50], *name; 
     84 
     85        if (i2c_is_isa_adapter(adapter)) { 
    9686                sprintf(name_buffer, "%s-isa-%04x", prefix, addr); 
    97         else if (!adapter->algo->smbus_xfer && !adapter->algo->master_xfer) { 
    98                 /* dummy adapter, generate prefix */ 
     87        } else if (adapter->algo->smbus_xfer || adapter->algo->master_xfer) { 
     88                int id = i2c_adapter_id(adapter); 
     89                if (id < 0) 
     90                        return ERR_PTR(-ENOENT); 
     91                sprintf(name_buffer, "%s-i2c-%d-%02x", prefix, id, addr); 
     92        } else {        /* dummy adapter, generate prefix */ 
     93                int end, i; 
     94 
    9995                sprintf(name_buffer, "%s-", prefix); 
    10096                end = strlen(name_buffer); 
    101                 for(i = 0; i < 32; i++) { 
    102                         if(adapter->algo->name[i] == ' ') 
     97 
     98                for (i = 0; i < 32; i++) { 
     99                        if (adapter->algo->name[i] == ' ') 
    103100                                break; 
    104101                        name_buffer[end++] = tolower(adapter->algo->name[i]); 
    105102                } 
     103 
    106104                name_buffer[end] = 0; 
    107105                sprintf(name_buffer + end, "-%04x", addr); 
    108         } else { 
    109                 if ((id = i2c_adapter_id(adapter)) < 0) 
    110                         return -ENOENT; 
    111                 sprintf(name_buffer, "%s-i2c-%d-%02x", prefix, id, addr); 
    112         } 
    113         *name = kmalloc(strlen(name_buffer) + 1, GFP_KERNEL); 
    114         if (!*name) { 
    115                 printk (KERN_WARNING "i2c_create_name: not enough memory\n"); 
    116                 return -ENOMEM; 
    117         } 
    118         strcpy(*name, name_buffer); 
    119         return 0; 
     106        } 
     107 
     108        name = kmalloc(strlen(name_buffer) + 1, GFP_KERNEL); 
     109        if (!name) 
     110                return ERR_PTR(-ENOMEM); 
     111        strcpy(name, name_buffer); 
     112        return name; 
    120113} 
    121114 
     
    128121   this function must be updated!  */ 
    129122int i2c_register_entry(struct i2c_client *client, const char *prefix, 
    130                            ctl_table * ctl_template) 
    131 { 
    132         int i, res, len, id; 
    133         ctl_table *new_table, *client_tbl, *tbl; 
    134         char *name; 
    135         struct ctl_table_header *new_header; 
    136  
    137         if ((res = i2c_create_name(&name, prefix, client->adapter, 
    138                                        client->addr))) return res; 
    139  
    140         for (id = 0; id < SENSORS_ENTRY_MAX; id++) 
    141                 if (!i2c_entries[id]) { 
    142                         break; 
    143                 } 
    144         if (id == SENSORS_ENTRY_MAX) { 
    145                 kfree(name); 
    146                 return -ENOMEM; 
    147         } 
    148  
    149         id += 256; 
    150          
    151         len = 0; 
     123                       struct ctl_table *ctl_template) 
     124{ 
     125        struct { struct ctl_table root[2], dev[2], sensors[2]; } *tbl; 
     126        struct ctl_table_header *hdr; 
     127        struct ctl_table *tmp, *leaf; 
     128        const char *name; 
     129        int id, len = 0; 
     130 
     131        name = generate_name(client, prefix); 
     132        if (IS_ERR(name)) 
     133                return PTR_ERR(name); 
     134 
     135        for (id = 0; id < SENSORS_ENTRY_MAX; id++) { 
     136                if (!i2c_entries[id]) 
     137                        goto free_slot; 
     138        } 
     139 
     140        goto out_free_name; 
     141 
     142 free_slot: 
    152143        while (ctl_template[len].procname) 
    153144                len++; 
    154         if (!(new_table = kmalloc(sizeof(sysctl_table) + sizeof(ctl_table) * (len + 1),  
    155                                   GFP_KERNEL))) { 
    156                 kfree(name); 
    157                 return -ENOMEM; 
    158         } 
    159  
    160         memcpy(new_table, sysctl_table, sizeof(sysctl_table)); 
    161         tbl = new_table; /* sys/ */ 
    162         tbl = tbl->child = tbl + 2; /* dev/ */ 
    163         tbl = tbl->child = tbl + 2; /* sensors/ */       
    164         client_tbl = tbl->child = tbl + 2; /* XX-chip-YY-ZZ/ */ 
    165  
    166         client_tbl->procname = name; 
    167         client_tbl->ctl_name = id; 
    168         client_tbl->child = client_tbl + 2; 
    169  
    170         /* Next the client sysctls. --km */ 
    171         tbl = client_tbl->child; 
    172         memcpy(tbl, ctl_template, sizeof(ctl_table) * (len+1)); 
    173         for (i = 0; i < len; i++) 
    174                 tbl[i].extra2 = client; 
    175  
    176         if (!(new_header = register_sysctl_table(new_table, 0))) { 
    177                 printk(KERN_ERR "i2c-proc.o: error: sysctl interface not supported by kernel!\n"); 
    178                 kfree(new_table); 
    179                 kfree(name); 
    180                 return -EPERM; 
    181         } 
    182  
    183         i2c_entries[id - 256] = new_header; 
    184  
    185         i2c_clients[id - 256] = client; 
    186  
    187 #ifdef DEBUG 
    188         if (!new_header || !new_header->ctl_table || 
    189             !new_header->ctl_table->child || 
    190             !new_header->ctl_table->child->child || 
    191             !new_header->ctl_table->child->child->de ) { 
    192                 printk 
    193                     (KERN_ERR "i2c-proc.o: NULL pointer when trying to install fill_inode fix!\n"); 
    194                 return id; 
    195         } 
    196 #endif                          /* DEBUG */ 
    197         client_tbl->de->owner = client->driver->owner; 
    198         return id; 
     145        tbl = kmalloc(sizeof(*tbl) + sizeof(ctl_table) * (len + 1),  
     146                                  GFP_KERNEL); 
     147        if (!tbl) 
     148                goto out_free_name; 
     149        memset(tbl, 0, sizeof(*tbl)); 
     150 
     151        /* The client sysctls */ 
     152        leaf = (struct ctl_table *) (tbl + 1); 
     153        memcpy(leaf, ctl_template, sizeof(ctl_table) * (len+1)); 
     154        for (tmp = leaf; tmp->ctl_name; tmp++) 
     155                tmp->extra2 = client; 
     156 
     157        tbl->sensors->ctl_name = id+256; 
     158        tbl->sensors->procname = name; 
     159        tbl->sensors->mode = 0555; 
     160        tbl->sensors->child = leaf; 
     161 
     162        tbl->dev->ctl_name = DEV_SENSORS; 
     163        tbl->dev->procname = "sensors"; 
     164        tbl->dev->mode = 0555; 
     165        tbl->dev->child = tbl->sensors; 
     166 
     167        tbl->root->ctl_name = CTL_DEV; 
     168        tbl->root->procname = "dev"; 
     169        tbl->root->mode = 0555; 
     170        tbl->root->child = tbl->dev; 
     171 
     172        hdr = register_sysctl_table(tbl->root, 0); 
     173        if (!hdr) 
     174                goto out_free_tbl; 
     175 
     176        i2c_entries[id] = hdr; 
     177        i2c_clients[id] = client; 
     178 
     179        return (id + 256);      /* XXX(hch) why?? */ 
     180 
     181 out_free_tbl: 
     182        kfree(tbl); 
     183 out_free_name: 
     184        kfree(name); 
     185        return -ENOMEM; 
    199186} 
    200187 
    201188void i2c_deregister_entry(int id) 
    202189{ 
    203         ctl_table *table; 
    204         char *temp; 
    205  
    206         id -= 256;       
     190        id -= 256; 
     191 
    207192        if (i2c_entries[id]) { 
    208                 table = i2c_entries[id]->ctl_table; 
    209                 unregister_sysctl_table(i2c_entries[id]); 
    210                 /* 2-step kfree needed to keep gcc happy about const points */ 
    211                 (const char *) temp = table[4].procname; 
    212                 kfree(temp); 
    213                 kfree(table); 
    214                 i2c_entries[id] = NULL; 
    215                 i2c_clients[id] = NULL; 
    216         } 
     193                struct ctl_table_header *hdr = i2c_entries[id]; 
     194                struct ctl_table *tbl = hdr->ctl_table; 
     195 
     196                unregister_sysctl_table(hdr); 
     197                kfree(tbl->child->child->procname); 
     198                kfree(tbl); /* actually the whole anonymous struct */ 
     199        } 
     200 
     201        i2c_entries[id] = NULL; 
     202        i2c_clients[id] = NULL; 
    217203} 
    218204 
     
    518504} 
    519505 
    520 static int i2c_write_reals(int nrels, void *buffer, int *bufsize, 
     506static int i2c_write_reals(int nrels, void *buffer, size_t *bufsize, 
    521507                         long *results, int magnitude) 
    522508{ 
  • i2c/trunk/kernel/i2c-velleman.c

    r3765 r3828  
    2525#include <linux/module.h> 
    2626#include <linux/init.h> 
     27#include <linux/errno.h> 
    2728#include <linux/delay.h> 
    2829#include "i2c.h" 
  • i2c/trunk/kernel/i2c.h

    r3765 r3828  
    2929#define _LINUX_I2C_H 
    3030 
    31 #define I2C_DATE "20021208" 
    32 #define I2C_VERSION "2.7.0" 
     31#define I2C_DATE "20030714" 
     32#define I2C_VERSION "2.8.0" 
    3333 
    3434#include <linux/module.h> 
    3535#include <linux/types.h> 
     36#include <linux/errno.h> 
     37#include <asm/semaphore.h> 
    3638#include "i2c-id.h" 
    37 #include <asm/semaphore.h> 
     39 
     40#include <linux/version.h> 
     41#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,10) 
     42#define MODULE_LICENSE(x) 
     43#endif 
    3844 
    3945/* --- General options ------------------------------------------------ */ 
     
    350356struct i2c_msg { 
    351357        __u16 addr;     /* slave address                        */ 
    352         unsigned short flags;            
     358        __u16 flags;             
    353359#define I2C_M_TEN       0x10    /* we have a ten bit chip address       */ 
    354360#define I2C_M_RD        0x01 
     
    357363#define I2C_M_IGNORE_NAK        0x1000 
    358364#define I2C_M_NO_RD_ACK         0x0800 
    359         short len;              /* msg length                           */ 
    360         char *buf;              /* pointer to msg data                  */ 
     365        __u16 len;              /* msg length                           */ 
     366        __u8 *buf;              /* pointer to msg data                  */ 
    361367        int err; 
    362368        short done; 
  • i2c/trunk/mkpatch/Config.in

    r3765 r3828  
    4545   fi 
    4646 
     47# This is needed for automatic patch generation: sensors code starts here 
     48# This is needed for automatic patch generation: sensors code ends here 
     49 
    4750   dep_tristate 'I2C device interface' CONFIG_I2C_CHARDEV $CONFIG_I2C 
    4851   dep_tristate 'I2C /proc interface (required for hardware sensors)' CONFIG_I2C_PROC $CONFIG_I2C $CONFIG_SYSCTL 
  • i2c/trunk/mkpatch/FILES

    r3765 r3828  
     1kernel/i2c-adap-ibm_ocp.c       drivers/i2c/i2c-adap-ibm_ocp.c 
     2kernel/i2c-algo-8xx.c           drivers/i2c/i2c-algo-8xx.c 
     3kernel/i2c-algo-bit.c           drivers/i2c/i2c-algo-bit.c 
     4kernel/i2c-algo-ibm_ocp.c       drivers/i2c/i2c-algo-ibm_ocp.c 
     5kernel/i2c-algo-pcf.c           drivers/i2c/i2c-algo-pcf.c 
    16kernel/i2c-core.c               drivers/i2c/i2c-core.c 
    27kernel/i2c-dev.c                drivers/i2c/i2c-dev.c 
    3 kernel/i2c-proc.c               drivers/i2c/i2c-proc.c 
    4 kernel/i2c-algo-8xx.c           drivers/i2c/i2c-algo-8xx.c 
    5 kernel/i2c-algo-bit.c           drivers/i2c/i2c-algo-bit.c 
    6 kernel/i2c-algo-biths.c         drivers/i2c/i2c-algo-biths.c 
    7 kernel/i2c-algo-ibm_ocp.c       drivers/i2c/i2c-algo-ibm_ocp.c 
    8 kernel/i2c-algo-pcf.c           drivers/i2c/i2c-algo-pcf.c 
    98kernel/i2c-elektor.c            drivers/i2c/i2c-elektor.c 
    109kernel/i2c-elv.c                drivers/i2c/i2c-elv.c 
     
    1312kernel/i2c-philips-par.c        drivers/i2c/i2c-philips-par.c 
    1413kernel/i2c-pport.c              drivers/i2c/i2c-pport.c 
     14kernel/i2c-proc.c               drivers/i2c/i2c-proc.c 
    1515kernel/i2c-rpx.c                drivers/i2c/i2c-rpx.c 
    1616kernel/i2c-velleman.c           drivers/i2c/i2c-velleman.c 
    1717kernel/i2c.h                    include/linux/i2c.h 
    18 kernel/i2c-id.h                 include/linux/i2c-id.h 
    1918kernel/i2c-dev.h                include/linux/i2c-dev.h 
    20 kernel/i2c-proc.h               include/linux/i2c-proc.h 
    2119kernel/i2c-algo-8xx.h           include/linux/i2c-algo-8xx.h 
    2220kernel/i2c-algo-bit.h           include/linux/i2c-algo-bit.h 
    23 kernel/i2c-algo-biths.h         include/linux/i2c-algo-biths.h 
    2421kernel/i2c-algo-ibm_ocp.h       include/linux/i2c-algo-ibm_ocp.h 
    2522kernel/i2c-algo-pcf.h           include/linux/i2c-algo-pcf.h 
     23kernel/i2c-elektor.h            include/linux/i2c-elektor.h 
     24kernel/i2c-id.h                 include/linux/i2c-id.h 
    2625kernel/i2c-pcf8584.h            include/linux/i2c-pcf8584.h 
     26kernel/i2c-proc.h               include/linux/i2c-proc.h 
    2727doc/dev-interface               Documentation/i2c/dev-interface 
    2828doc/functionality               Documentation/i2c/functionality 
    29 doc/i2c-old-porting             Documentation/i2c/i2c-old-porting 
    3029doc/i2c-pport                   Documentation/i2c/i2c-pport 
    3130doc/i2c-protocol                Documentation/i2c/i2c-protocol 
  • i2c/trunk/mkpatch/INCLUDES

    r3765 r3828  
    11"i2c.h"                 <linux/i2c.h> 
    2 "i2c-id.h"              <linux/i2c-id.h> 
    32"i2c-dev.h"             <linux/i2c-dev.h> 
    4 "i2c-proc.h"            <linux/i2c-proc.h> 
    53"i2c-algo-bit.h"        <linux/i2c-algo-bit.h> 
    6 "i2c-algo-biths.h"      <linux/i2c-algo-biths.h> 
    74"i2c-algo-pcf.h"        <linux/i2c-algo-pcf.h> 
    85"i2c-pcf8584.h"         <linux/i2c-pcf8584.h> 
     6"i2c-id.h"              <linux/i2c-id.h> 
     7"i2c-proc.h"            <linux/i2c-proc.h> 
    98"i2c-algo-8xx.h"        <linux/i2c-algo-8xx.h> 
    109"i2c-algo-ibm_ocp.h"    <linux/i2c-algo-ibm_ocp.h> 
  • i2c/trunk/mkpatch/mkpatch.pl

    r3765 r3828  
    1 #!/usr/bin/perl 
     1#!/usr/bin/perl -w 
    22 
    33#    mkpatch - Create patches against the Linux kernel 
     
    3838  my ($diff_command,$dummy); 
    3939 
    40   $diff_command = "diff -u"; 
    41   $diff_command .= " $kernel_root/$kernel_file "; 
    42   $diff_command .= " $package_root/$package_file "; 
     40  $diff_command = "diff -u2"; 
     41  if ( -e "$kernel_root/$kernel_file") { 
     42    $diff_command .= " $kernel_root/$kernel_file "; 
     43  } else { 
     44    $diff_command .= " /dev/null "; 
     45  } 
     46  if ( -e "$package_root/$package_file") { 
     47    $diff_command .= " $package_root/$package_file "; 
     48  } else { 
     49    $diff_command .= " /dev/null"; 
     50  } 
    4351  open INPUT, "$diff_command|" or die "Can't call `$diff_command'"; 
    44   if (<INPUT>) { 
    45       print "--- linux-old/$kernel_file\t".`date`; 
    46   } 
    47   if (<INPUT>) { 
    48       print "+++ linux/$kernel_file\t".`date`; 
    49   } 
     52  $dummy = <INPUT>; 
     53  $dummy = <INPUT>; 
     54  print "--- linux-old/$kernel_file\t".`date`; 
     55  print "+++ linux/$kernel_file\t".`date`; 
     56     
    5057  while (<INPUT>) { 
    5158    print; 
     
    5461} 
    5562 
     63# Find all the lm_sensors code in a file 
     64# $_[0]: Linux kernel tree (like /usr/src/linux) 
     65# $_[1]: Name of the kernel file 
     66# Returns a list of strings with the sensors codes 
     67sub find_sensors_code 
     68{ 
     69  my ($kernel_root,$kernel_file) = @_; 
     70  my @res; 
     71  open INPUT, "$kernel_root/$kernel_file"  
     72       or return @res; 
     73  while (<INPUT>) { 
     74    if (m@sensors code starts here@) { 
     75      push @res,""; 
     76      while (<INPUT>) { 
     77        last if m@sensors code ends here@; 
     78        $res[$#res] .= $_; 
     79      } 
     80    } 
     81  } 
     82  return @res;     
     83}  
     84 
     85# Here we generate diffs for all kernel files mentioned in OLDI2C  
     86# which change the invocation # `#include <linux/i2c.h>' to  
     87# `#include <linux/i2c-old.h>'. But first, we generate diffs to copy 
     88# file <linux/i2c.h> to <linux/i2c-old.h>, if the kernel does not have 
     89# this file yet. 
     90# $_[0]: sensors package root (like /tmp/sensors) 
     91# $_[1]: Linux kernel tree (like /usr/src/linux) 
     92sub patch_old_i2c 
     93{ 
     94  my ($package_root,$kernel_root) = @_; 
     95  my (@files,$file,$f); 
     96  # If i2c.c does not exist, either we renamed it earlier, or there is no 
     97  # i2c support in this kernel at all. 
     98  return if not -e "$kernel_root/drivers/char/i2c.c"; 
     99 
     100  print_diff $kernel_root,$kernel_root,"include/linux/i2c-old.h",  
     101             "include/linux/i2c.h"; 
     102 
     103 
     104  open INPUT, "$package_root/mkpatch/OLDI2C"  
     105        or die "Can't open `$package_root/mkpatch/OLDI2C'"; 
     106  @files = <INPUT>; 
     107  close INPUT; 
     108 
     109  foreach $f (@files,"drivers/char/i2c-old.c") { 
     110    $file = $f; # Ugly, but seemingly needed to run on Perl 5.6. 
     111    chomp $file; 
     112    if ($file eq "drivers/char/i2c-old.c") { 
     113      open INPUT, "$kernel_root/drivers/char/i2c.c" 
     114            or next; 
     115    } else {  
     116      open INPUT, "$kernel_root/$file" 
     117           or next; 
     118    } 
     119    open OUTPUT, ">$package_root/$temp" 
     120           or die "Can't open `$package_root/$temp'"; 
     121    while (<INPUT>) { 
     122      s@(\s*#\s*include\s*)<linux/i2c.h>@$1<linux/i2c-old.h>@; 
     123      print OUTPUT; 
     124    } 
     125    close INPUT; 
     126    close OUTPUT; 
     127    print_diff $package_root,$kernel_root,$file,$temp; 
     128  } 
     129  print_diff "/dev",$kernel_root,"drivers/char/i2c.c","null"; 
     130  gen_drivers_char_Makefile $package_root, $kernel_root; 
     131} 
    56132 
    57133# This generates diffs for kernel file Documentation/Configure.help. This 
     
    274350} 
    275351 
     352# This generates diffs for the main Linux Makefile. 
     353# Three lines which add drivers/i2c/i2.a to the DRIVERS list are put just 
     354# before the place where the architecture Makefile is included. 
     355# Of course, care is taken old lines are removed. 
     356# $_[0]: i2c package root (like /tmp/i2c) 
     357# $_[1]: Linux kernel tree (like /usr/src/linux) 
     358sub gen_Makefile 
     359{ 
     360  my ($package_root,$kernel_root) = @_; 
     361  my $kernel_file = "Makefile"; 
     362  my $package_file = $temp; 
     363  my $printed = 0; 
     364  my $new_style = 0; 
     365 
     366  open INPUT,"$kernel_root/$kernel_file" 
     367        or die "Can't open `$kernel_root/$kernel_file'"; 
     368  open OUTPUT,">$package_root/$package_file" 
     369        or die "Can't open $package_root/$package_file"; 
     370  MAIN: while(<INPUT>) { 
     371    if (m@^DRIVERS :=@) { 
     372       $new_style = 1; 
     373    } 
     374    if (m@DRIVERS-\$\(CONFIG_I2C\)@) { 
     375      $_ = <INPUT>; 
     376      redo MAIN; 
     377    } elsif (m@CONFIG_I2C@) { 
     378      $_ = <INPUT> while not m@endif@; 
     379      $_ = <INPUT>; 
     380      $_ = <INPUT> if m@^$@; 
     381      redo MAIN; 
     382    } 
     383    if (not $printed and m@DRIVERS-\$\(CONFIG_PHONE\)@) { 
     384      if ($new_style) { 
     385        print OUTPUT << 'EOF'; 
     386DRIVERS-$(CONFIG_I2C) += drivers/i2c/i2c.a 
     387EOF 
     388      } else { 
     389        print OUTPUT << 'EOF'; 
     390DRIVERS-$(CONFIG_I2C) += drivers/i2c/i2c.o 
     391EOF 
     392      } 
     393      $printed = 1; 
     394    } elsif (not $printed and  
     395        (m@include arch/\$\(ARCH\)/Makefile@ or m@CONFIG_SENSORS@ or 
     396         m@CONFIG_PHONE@ )) { 
     397      print OUTPUT <<'EOF'; 
     398ifeq ($(CONFIG_I2C),y) 
     399DRIVERS := $(DRIVERS) drivers/i2c/i2c.a 
     400endif 
     401 
     402EOF 
     403      $printed = 1; 
     404    } 
     405    print OUTPUT; 
     406  } 
     407  close INPUT; 
     408  close OUTPUT; 
     409  die "Automatic patch generation for main `Makefile' failed.\n". 
     410      "See our home page http://www.lm-sensors.nu for assistance!" if $printed == 0; 
     411  print_diff $package_root,$kernel_root,$kernel_file,$package_file; 
     412} 
     413 
    276414# This generates diffs for drivers/Makefile 
     415# First, `i2c' is added to the ALL_SUB_DIRS list. Next, a couple of lines 
     416# to add i2c to the SUB_DIRS and/or MOD_SUB_DIRS lists is put right before 
     417# Rules.make is included. 
     418# Of course, care is taken old lines are removed. 
    277419# $_[0]: i2c package root (like /tmp/i2c) 
    278420# $_[1]: Linux kernel tree (like /usr/src/linux) 
     
    285427  my $printed = 0; 
    286428  my $added = 0; 
     429  my $new_style = 0; 
    287430 
    288431  open INPUT,"$kernel_root/$kernel_file" 
     
    291434        or die "Can't open $package_root/$package_file"; 
    292435  MAIN: while(<INPUT>) { 
     436    if (m@^mod-subdirs\s*:=@) { 
     437       $new_style = 1; 
     438    } 
     439    if ((! $new_style and m@^ALL_SUB_DIRS\s*:=@) or m@^mod-subdirs\s*:=@ ) { 
     440      $added = 1; 
     441      $i2c_present = 0; 
     442      while (m@\\$@) { 
     443        $i2c_present = 1 if m@i2c@; 
     444        print OUTPUT; 
     445        $_ = <INPUT>; 
     446      } 
     447      $i2c_present = 1 if m@i2c@; 
     448      s@$@ i2c@ if (not $i2c_present); 
     449      print OUTPUT; 
     450      $_ = <INPUT>; 
     451      redo MAIN; 
     452    }  
    293453    if (m@^ifeq.*CONFIG_I2C@) { 
    294454      $_ = <INPUT> while not m@^endif@; 
     
    301461      redo MAIN; 
    302462    } 
     463# 2.5 kernels 
     464#   if (m@^obj.*CONFIG_I2C@) { 
     465#   } 
    303466    if (not $printed and 
    304         (m@^ifeq \(\$\(CONFIG_ACPI\),y\)$@ or 
     467        (m@^include \$\(TOPDIR\)/Rules.make$@ or 
     468         m@^ifeq \(\$\(CONFIG_ACPI\),y\)$@ or 
    305469         m@^ifeq \(\$\(CONFIG_SENSORS\),y\)@) or 
    306470         m@^subdir-\$\(CONFIG_ACPI\)@) { 
     471      if ($new_style) { 
    307472        print OUTPUT <<'EOF'; 
    308473subdir-$(CONFIG_I2C)            += i2c 
    309474EOF 
    310         $printed = 1; 
     475      } else { 
     476        print OUTPUT <<'EOF'; 
     477ifeq ($(CONFIG_I2C),y) 
     478SUB_DIRS += i2c 
     479MOD_SUB_DIRS += i2c 
     480else 
     481  ifeq ($(CONFIG_I2C),m) 
     482  MOD_SUB_DIRS += i2c 
     483  endif 
     484endif 
     485 
     486EOF 
     487      } 
     488      $printed = 1; 
    311489    } 
    312490    print OUTPUT; 
     
    319497} 
    320498 
     499# This generates diffs for drivers/char/Makefile 
     500# It changes all occurences of `i2c.o' to `i2c-old.o'. 
     501# $_[0]: i2c package root (like /tmp/i2c) 
     502# $_[1]: Linux kernel tree (like /usr/src/linux) 
     503sub gen_drivers_char_Makefile 
     504{ 
     505  my ($package_root,$kernel_root) = @_; 
     506  my $kernel_file = "drivers/char/Makefile"; 
     507  my $package_file = $temp; 
     508  open INPUT,"$kernel_root/$kernel_file" 
     509        or die "Can't open `$kernel_root/$kernel_file'"; 
     510  open OUTPUT,">$package_root/$package_file" 
     511        or die "Can't open $package_root/$package_file"; 
     512  while(<INPUT>) { 
     513    s@i2c\.o@i2c-old\.o@; 
     514    print OUTPUT; 
     515  } 
     516  close INPUT; 
     517  close OUTPUT; 
     518  print_diff $package_root,$kernel_root,$kernel_file,$package_file; 
     519} 
    321520 
    322521# This generates diffs for drivers/i2c/Makefile 
     522# for either 'old style' or 'new style'. 
     523# Don't bother putting in 'old style' support for new architectures 
     524# like 8xx, IBM405, or StrongARM since they aren't supported 
     525# in old kernels anyway. 
    323526sub gen_drivers_i2c_Makefile 
    324527{ 
     
    327530  my $package_file = $temp; 
    328531  my $use_new_format = 0; 
     532  if (-e "$kernel_root/$kernel_file") { 
     533    `grep -q -s 'i2c\.o' "$kernel_root/$kernel_file"`; 
     534     $use_new_format = ! $?; 
     535  } 
    329536 
    330537  open OUTPUT,">$package_root/$package_file" 
    331538        or die "Can't open $package_root/$package_file"; 
    332   print OUTPUT <<'EOF'; 
     539  if ($use_new_format) { 
     540    print OUTPUT <<'EOF'; 
    333541# 
    334542# Makefile for the kernel i2c bus driver. 
     
    357565obj-$(CONFIG_I2C_FRODO)         += i2c-frodo.o 
    358566 
    359 EOF 
    360  
     567# This is needed for automatic patch generation: sensors code starts here 
     568# This is needed for automatic patch generation: sensors code ends here 
     569 
     570include $(TOPDIR)/Rules.make 
     571 
     572EOF 
     573  } else { 
     574    print OUTPUT <<'EOF'; 
     575# 
     576# Makefile for the kernel i2c bus driver. 
     577# 
     578 
     579SUB_DIRS     := 
     580MOD_SUB_DIRS := $(SUB_DIRS) 
     581ALL_SUB_DIRS := $(SUB_DIRS) 
     582MOD_LIST_NAME := I2C_MODULES 
     583 
     584L_TARGET := i2c.a 
     585MX_OBJS :=   
     586M_OBJS  :=  
     587LX_OBJS := 
     588L_OBJS  :=  
     589 
     590# ----- 
     591# i2c core components 
     592# ----- 
     593 
     594ifeq ($(CONFIG_I2C),y) 
     595  LX_OBJS += i2c-core.o 
     596else 
     597  ifeq ($(CONFIG_I2C),m) 
     598    MX_OBJS += i2c-core.o 
     599  endif 
     600endif 
     601 
     602ifeq ($(CONFIG_I2C_CHARDEV),y) 
     603  L_OBJS += i2c-dev.o 
     604else 
     605  ifeq ($(CONFIG_I2C_CHARDEV),m) 
     606    M_OBJS += i2c-dev.o 
     607  endif 
     608endif 
     609 
     610ifeq ($(CONFIG_I2C_PROC),y) 
     611  LX_OBJS += i2c-proc.o 
     612else 
     613  ifeq ($(CONFIG_I2C_PROC),m) 
     614    MX_OBJS += i2c-proc.o 
     615  endif 
     616endif 
     617 
     618# ----- 
     619# Bit banging adapters... 
     620# ----- 
     621 
     622ifeq ($(CONFIG_I2C_ALGOBIT),y) 
     623  LX_OBJS += i2c-algo-bit.o 
     624else 
     625  ifeq ($(CONFIG_I2C_ALGOBIT),m) 
     626    MX_OBJS += i2c-algo-bit.o 
     627  endif 
     628endif 
     629 
     630ifeq ($(CONFIG_I2C_PHILIPSPAR),y) 
     631  L_OBJS += i2c-philips-par.o 
     632else 
     633  ifeq ($(CONFIG_I2C_PHILIPSPAR),m) 
     634    M_OBJS += i2c-philips-par.o 
     635  endif 
     636endif 
     637 
     638ifeq ($(CONFIG_I2C_ELV),y) 
     639  L_OBJS += i2c-elv.o 
     640else 
     641  ifeq ($(CONFIG_I2C_ELV),m) 
     642    M_OBJS += i2c-elv.o 
     643  endif 
     644endif 
     645 
     646ifeq ($(CONFIG_I2C_VELLEMAN),y) 
     647  L_OBJS += i2c-velleman.o 
     648else 
     649  ifeq ($(CONFIG_I2C_VELLEMAN),m) 
     650    M_OBJS += i2c-velleman.o 
     651  endif 
     652endif 
     653 
     654 
     655 
     656# ----- 
     657# PCF components 
     658# ----- 
     659 
     660ifeq ($(CONFIG_I2C_ALGOPCF),y) 
     661  LX_OBJS += i2c-algo-pcf.o 
     662else 
     663  ifeq ($(CONFIG_I2C_ALGOPCF),m) 
     664    MX_OBJS += i2c-algo-pcf.o 
     665  endif 
     666endif 
     667 
     668ifeq ($(CONFIG_I2C_ELEKTOR),y) 
     669  L_OBJS += i2c-elektor.o 
     670else 
     671  ifeq ($(CONFIG_I2C_ELEKTOR),m) 
     672    M_OBJS += i2c-elektor.o 
     673  endif 
     674endif 
     675 
     676# This is needed for automatic patch generation: sensors code starts here 
     677# This is needed for automatic patch generation: sensors code ends here 
     678 
     679include $(TOPDIR)/Rules.make 
     680 
     681EOF 
     682  } 
    361683  close OUTPUT; 
    362684  print_diff $package_root,$kernel_root,$kernel_file,$package_file; 
    363685} 
    364686 
     687# This generates diffs for drivers/char/Config.in 
     688# It adds a line just before CONFIG_APM or main_menu_option lines to include 
     689# the I2C Config.in. 
     690# Of course, care is taken old lines are removed. 
     691# $_[0]: i2c package root (like /tmp/i2c) 
     692# $_[1]: Linux kernel tree (like /usr/src/linux) 
     693sub gen_drivers_char_Config_in 
     694{ 
     695  my ($package_root,$kernel_root) = @_; 
     696  my $kernel_file = "drivers/char/Config.in"; 
     697  my $package_file = $temp; 
     698  my $ready = 0; 
     699  my $printed = 0; 
     700 
     701  open INPUT,"$kernel_root/$kernel_file" 
     702        or die "Can't open `$kernel_root/$kernel_file'"; 
     703  open OUTPUT,">$package_root/$package_file" 
     704        or die "Can't open $package_root/$package_file"; 
     705  MAIN: while(<INPUT>) { 
     706    if (m@i2c@) { 
     707      $_ = <INPUT>; 
     708      $_ = <INPUT> if (m@^$@); 
     709      redo MAIN; 
     710    } 
     711    if ($ready and not $printed and  
     712        (m@^mainmenu_option@ or m@CONFIG_APM@ or m@CONFIG_ALPHA_BOOK1@ or 
     713         m@source drivers/sensors/Config.in@)) { 
     714      $printed = 1; 
     715      print OUTPUT <<'EOF'; 
     716source drivers/i2c/Config.in 
     717 
     718EOF 
     719    } 
     720    $ready = 1 if (m@^mainmenu_option@); 
     721    print OUTPUT; 
     722  } 
     723  close INPUT; 
     724  close OUTPUT; 
     725  die "Automatic patch generation for `drivers/char/Config.in' failed.\n". 
     726      "See our home page http://www.lm-sensors.nu for assistance!" if $printed == 0; 
     727  print_diff $package_root,$kernel_root,$kernel_file,$package_file; 
     728} 
    365729  
    366730# Generate the diffs for the list of MAINTAINERS 
     
    418782        unless -d "$package_root/mkpatch"; 
    419783  $kernel_root = $ARGV[1]; 
     784  die "Kernel root `$kernel_root' is not found\n"  
     785        unless -f "$kernel_root/Rules.make"; 
     786 
     787  patch_old_i2c $package_root, $kernel_root; 
     788          
    420789 
    421790  # --> Read FILES 
     
    434803    ($data0,$data1) = /(\S+)\s+(\S+)/; 
    435804    $includes{$data0} = $data1; 
    436     $sedscript .= 's,(#\s*include\s*)'.$data0.'(\s*),\1'."$data1".'\2, ; '; 
     805    $sedscript .= 's,(#\s*include\s*)'.$data0.'(\s*),$1'."$data1".'$2, ; '; 
    437806  }  
    438807  close INPUT; 
     
    441810  foreach $package_file (sort keys %files) { 
    442811    $kernel_file = $files{$package_file}; 
     812    @sensors_subs = find_sensors_code "$kernel_root","$kernel_file"; 
    443813    open INPUT, "$package_root/$package_file" 
     814      or open INPUT, "/dev/null" 
    444815         or die "Can't open `$package_root/$package_file'"; 
    445816    open OUTPUT, ">$package_root/$temp" 
     
    447818    while (<INPUT>) { 
    448819      eval $sedscript; 
     820      if (m@sensors code starts here@) { 
     821        print OUTPUT; 
     822        while (<INPUT>) { 
     823           last if m@sensors code ends here@; 
     824        } 
     825        print OUTPUT $sensors_subs[0]; 
     826        shift @sensors_subs 
     827      } 
    449828      print OUTPUT; 
    450829    } 
     
    457836#  gen_drivers_Makefile $package_root, $kernel_root; 
    458837#  gen_drivers_i2c_Makefile $package_root, $kernel_root; 
    459 #  gen_Documentation_Configure_help $package_root, $kernel_root; 
     838#  gen_drivers_char_Config_in $package_root, $kernel_root; 
     839   gen_Documentation_Configure_help $package_root, $kernel_root; 
     840#  gen_MAINTAINERS $package_root, $kernel_root; 
    460841} 
    461842