Changeset 552

Show
Ignore:
Timestamp:
09/10/99 22:55:29 (14 years ago)
Author:
frodo
Message:

mkpatch change: It is now possible to call mkpatch for the I2C

package, even after the kernel was also patched for lm_sensors.
This means generating diffs now works always.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/trunk/mkpatch/mkpatch.pl

    r551 r552  
    368368# This generates diffs for drivers/i2c/Config.in 
    369369# Several adapter drivers that are included in the lm_sensors package are 
    370 # added at the bottom. 
     370# added at the first and onlu sensors marker. 
    371371# Of course, care is taken old lines are removed. 
    372372# $_[0]: sensors package root (like /tmp/sensors) 
     
    383383        or die "Can't open $package_root/$package_file"; 
    384384  while(<INPUT>) { 
    385     if (m@CONFIG_I2C_MAINBOARD@) { 
    386       $_ = <INPUT> while not m@^  fi$@; 
    387       $_ = <INPUT>; 
    388       $_ = <INPUT> if m@^$@; 
    389     } 
    390     if (m@^fi@) { 
    391       print OUTPUT << 'EOF' 
     385    if (m@sensors code starts here@) { 
     386      print OUTPUT; 
     387      while (<INPUT>) { 
     388        last if m@sensors code ends here@; 
     389      } 
     390      print OUTPUT << 'EOF'; 
    392391  bool 'I2C mainboard interfaces' CONFIG_I2C_MAINBOARD  
    393392  if [ "$CONFIG_I2C_MAINBOARD" = "y" ]; then 
     
    425424        or die "Can't open $package_root/$package_file"; 
    426425  while(<INPUT>) { 
    427     while (m@CONFIG_I2C_ALI5X3@ or m@CONFIG_I2C_HYDRA@ or m@CONFIG_I2C_PIIX4@ or 
    428         m@CONFIG_I2C_VIA@ or m@CONFIG_I2C_ISA@) { 
    429       $_ = <INPUT> while not m@^endif@; 
    430       $_ = <INPUT>; 
    431       $_ = <INPUT> if m@^$@; 
    432     } 
    433     if (m@Rules.make@) { 
    434       print OUTPUT << 'EOF' 
     426    if (m@sensors code starts here@) { 
     427      print OUTPUT; 
     428      while (<INPUT>) { 
     429        last if m@sensors code ends here@; 
     430      } 
     431      print OUTPUT << 'EOF'; 
    435432ifeq ($(CONFIG_I2C_ALI5X3),y) 
    436433  L_OBJS += i2c-ali5x3.o 
     
    493490  my $kernel_file = "drivers/i2c/i2c-core.c"; 
    494491  my $package_file = $temp; 
    495   my $right_place = 0; 
     492  my $patch_nr = 1; 
    496493 
    497494  open INPUT,"$kernel_root/$kernel_file" 
     
    500497        or die "Can't open $package_root/$package_file"; 
    501498  while(<INPUT>) { 
    502     while (m@CONFIG_I2C_ALI5X3@ or m@CONFIG_I2C_HYDRA@ or m@CONFIG_I2C_PIIX4@ or 
    503         m@CONFIG_I2C_VIA@ or m@CONFIG_I2C_ISA@) { 
    504       $_ = <INPUT> while not m@#endif@; 
    505       $_ = <INPUT>; 
    506     } 
    507     if (m@^int __init i2c_init_all@) { 
    508       $right_place = 1; 
    509       print OUTPUT << 'EOF'; 
     499    if (m@sensors code starts here@) { 
     500      print OUTPUT; 
     501      while (<INPUT>) { 
     502        last if m@sensors code ends here@; 
     503      } 
     504      if ($patch_nr == 1) { 
     505        print OUTPUT << 'EOF'; 
    510506#ifdef CONFIG_I2C_ALI5X3 
    511507        extern int i2c_ali5x3_init(void); 
     
    524520#endif 
    525521EOF 
    526     } 
    527     if ($right_place and m@return 0;@) { 
     522      } elsif ($patch_nr == 2) { 
    528523      print OUTPUT << 'EOF'; 
    529524#ifdef CONFIG_I2C_ALI5X3 
     
    543538#endif 
    544539EOF 
     540      } 
     541      $patch_nr ++; 
    545542    } 
    546543    print OUTPUT;