root/lm-sensors/trunk/mkpatch/mkpatch.pl @ 2975

Revision 2975, 46.8 KB (checked in by khali, 8 years ago)

Clear temporary file on exit.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
Line 
1#!/usr/bin/perl
2
3#    mkpatch - Create patches against the Linux kernel
4#    Copyright (C) 1999  Frodo Looijaard <frodol@dds.nl>
5#    Copyright (C) 2005  Jean Delvare <khali@linux-fr.org>
6#
7#    This program is free software; you can redistribute it and/or modify
8#    it under the terms of the GNU General Public License as published by
9#    the Free Software Foundation; either version 2 of the License, or
10#    (at your option) any later version.
11#
12#    This program is distributed in the hope that it will be useful,
13#    but WITHOUT ANY WARRANTY; without even the implied warranty of
14#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15#    GNU General Public License for more details.
16#
17#    You should have received a copy of the GNU General Public License
18#    along with this program; if not, write to the Free Software
19#    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20
21use strict;
22
23use vars qw($temp);
24$temp = "mkpatch/.temp";
25
26# Generate a diff between the old kernel file and the new lm_sensors file. We
27# arrange the headers to tell us the old tree was under directory
28# `linux-old', and the new tree under `linux'.
29# $_[0]: sensors package root (like /tmp/sensors)
30# $_[1]: Linux kernel tree (like /usr/src/linux)
31# $_[2]: Name of the kernel file
32# $_[3]: Name of the patched file
33sub print_diff
34{
35  my ($package_root,$kernel_root,$kernel_file,$package_file) = @_;
36  my ($diff_command,$package_mtime,$kernel_mtime);
37
38  $diff_command = "diff -u";
39  if ( -e "$kernel_root/$kernel_file") {
40    $diff_command .= " $kernel_root/$kernel_file";
41    $kernel_mtime = (stat("$kernel_root/$kernel_file"))[9];
42  } else {
43    $diff_command .= " /dev/null";
44    $kernel_mtime = 0;
45  }
46  if ( -e "$package_root/$package_file") {
47    $diff_command .= " $package_root/$package_file";
48    $package_mtime = (stat("$package_root/$package_file"))[9];
49  } else {
50    $diff_command .= " /dev/null";
51    $package_mtime = 0;
52  }
53  open INPUT, "$diff_command|" or die "Can't execute `$diff_command'";
54  if (<INPUT>) {
55    <INPUT>;
56    print "--- linux-old/$kernel_file\t".gmtime($kernel_mtime)."\n".
57          "+++ linux/$kernel_file\t".gmtime($package_mtime)."\n";
58
59    print while <INPUT>;
60  }
61  close INPUT;
62}
63
64# This generates diffs for kernel file Documentation/Configure.help. This
65# file contains the help texts that can be displayed during `make *config'
66# for the kernel.
67# The new texts are put at the end of the file, or just before the
68# lm_sensors texts.
69# Of course, care is taken old lines are removed.
70# $_[0]: i2c package root (like /tmp/i2c)
71# $_[1]: Linux kernel tree (like /usr/src/linux)
72sub gen_Documentation_Configure_help
73{
74  my ($package_root,$kernel_root) = @_;
75  my $kernel_file = "Documentation/Configure.help";
76  my $package_file = $temp;
77
78  open INPUT,"$kernel_root/$kernel_file"
79        or die "Can't open `$kernel_root/$kernel_file'";
80  open OUTPUT,">$package_root/$package_file"
81        or die "Can't open $package_root/$package_file";
82  MAIN: while(<INPUT>) {
83    if (m@I2C mainboard interfaces@ or
84           m@Acer Labs ALI 1535@ or
85           m@Acer Labs ALI 1533 and 1543C@ or
86           m@Acer Labs ALI 1563@ or
87           m@AMD 756/766/768/8111@ or
88           m@SMBus multiplexing on the Tyan S4882@ or
89           m@AMD 8111 SMBus 2.0@ or
90           m@Apple Hydra Mac I/O@ or
91           m@Intel I801@ or
92           m@Intel I810/I815 based Mainboard@ or
93           m@Intel 82371AB PIIX4\(E\)@ or
94           m@Nvidia Nforce2@ or
95           m@Silicon Integrated Systems Corp. SiS5595 based Mainboard@ or
96           m@VIA Technologies, Inc. VT82C586B@ or
97           m@VIA Technologies, Inc. VT82C596, 596B, 686A/B, 8233@ or
98           m@3DFX Banshee / Voodoo3@ or
99           m@DEC Tsunami 21272@ or
100           m@Pseudo ISA adapter \(for hardware sensors modules\)@ or
101           m@Analog Devices ADM1021 and compatibles@ or
102           m@Analog Devices ADM1024@ or
103           m@Analog Devices ADM1025@ or
104           m@Analog Devices ADM1026@ or
105           m@Analog Devices ADM1030, ADM1031@ or
106           m@Analog Devices ADM9240 and compatibles@ or
107           m@Asus ASB100@ or
108           m@Dallas DS1621 and DS1625@ or
109           m@Fujitsu-Siemens Hermes@ or
110           m@Fujitsu-Siemens Poseidon@ or
111           m@Fujitsu-Siemens Scylla@ or
112           m@Genesys Logic GL518SM@ or
113           m@Genesys Logic GL520SM@ or
114           m@HP Maxilife@ or
115           m@Intel Xeon Thermal Sensor@ or
116           m@ITE 8705, 8712, Sis950@ or
117           m@Maxim MAX1619@ or
118           m@Maxim MAX6650, MAX6651@ or
119           m@Myson MTP008@ or
120           m@National Semiconductor LM63@ or
121           m@National Semiconductor LM75 and compatibles@ or
122           m@National Semiconductor LM78@ or
123           m@National Semiconductor LM80@ or
124           m@National Semiconductor LM83@ or
125           m@National Semiconductor LM85@ or
126           m@National Semiconductor LM87@ or
127           m@National Semiconductor LM90@ or
128           m@National Semiconductor LM92@ or
129           m@National Semiconductor LM93@ or
130           m@National Semiconductor PC8736x@ or
131           m@Silicon Integrated Systems Corp. SiS5595 Sensor@ or
132           m@Texas Instruments THMC50 / Analog Devices ADM1022@ or
133           m@Via VT82C686A/B@ or
134           m@Winbond W83781D, W83782D, W83783S, W83627HF, AS99127F@ or
135           m@Winbond W83792D@ or
136           m@Winbond W83627HF, W83627THF, W83697HF@ or
137           m@Winbond W83L785TS-S@ or
138           m@EEprom \(DIMM\) reader@) {
139      $_ = <INPUT>;
140      $_ = <INPUT>;
141      $_ = <INPUT> while not m@^\S@ and not eof(INPUT);
142      redo MAIN;
143    }
144    if (eof(INPUT)) {
145      print OUTPUT <<'EOF'
146I2C mainboard interfaces
147CONFIG_I2C_MAINBOARD
148  Many modern mainboards have some kind of I2C interface integrated. This
149  is often in the form of a SMBus, or System Management Bus, which is
150  basically the same as I2C but which uses only a subset of the I2C
151  protocol.
152
153  You will also want the latest user-space utilties: you can find them
154  in the lm_sensors package, which you can download at
155  http://www.lm-sensors.nu
156
157Acer Labs ALI 1535
158CONFIG_I2C_ALI1535
159  If you say yes to this option, support will be included for the Acer
160  Labs ALI 1535 mainboard I2C interface. This can also be
161  built as a module.
162
163Acer Labs ALI 1533 and 1543C
164CONFIG_I2C_ALI15X3
165  If you say yes to this option, support will be included for the Acer
166  Labs ALI 1533 and 1543C mainboard I2C interfaces. This can also be
167  built as a module which can be inserted and removed while the kernel
168  is running.
169
170Acer Labs ALI 1563
171CONFIG_I2C_ALI1563
172  If you say yes to this option, support will be included for the Acer
173  Labs ALI M1563 mainboard SMBus interface. This can also be built as a
174  module.
175
176AMD 756/766/768/8111 and nVidia nForce
177CONFIG_I2C_AMD756
178  If you say yes to this option, support will be included for the AMD
179  756/766/768/8111 and nVidia nForce mainboard I2C interfaces. This can
180  also be built as a module which can be inserted and removed while the
181  kernel is running.
182
183SMBus multiplexing on the Tyan S4882
184CONFIG_I2C_AMD756_S4882
185  Enabling this option will add specific SMBus support for the Tyan
186  S4882 motherboard. On this 4-CPU board, the SMBus is multiplexed
187  over 8 different channels, where the various memory module EEPROMs
188  and temperature sensors live. Saying yes here will give you access
189  to these in addition to the trunk.
190
191AMD 8111 SMBus 2.0
192CONFIG_I2C_AMD8111
193  If you say yes to this option, support will be included for the AMD
194  8111 mainboard SMBus 2.0 interface. This can also be
195  built as a module which can be inserted and removed while the kernel
196  is running.
197
198Apple Hydra Mac I/O
199CONFIG_I2C_HYDRA
200  If you say yes to this option, support will be included for the
201  Hydra mainboard I2C interface. This can also be built as a module
202  which can be inserted and removed while the kernel is running.
203
204Intel I801
205CONFIG_I2C_I801
206  If you say yes to this option, support will be included for the
207  Intel I801 mainboard I2C interfaces. "I810" mainboard sensor chips are
208  generally located on the I801's I2C bus. This can also be
209  built as a module which can be inserted and removed while the kernel
210  is running.
211
212Intel I810/I815 based Mainboard
213CONFIG_I2C_I810
214  If you say yes to this option, support will be included for the
215  Intel I810/I815 mainboard I2C interfaces. The I2C busses these chips
216  are generally used only for video devices. For "810" mainboard sensor
217  chips, use the I801 I2C driver instead. This can also be
218  built as a module which can be inserted and removed while the kernel
219  is running.
220
221Intel 82371AB PIIX4(E) / ServerWorks OSB4 and CSB5
222CONFIG_I2C_PIIX4
223  If you say yes to this option, support will be included for the
224  Intel PIIX4, PIIX4E, and 443MX, Serverworks OSB4/CSB5,
225  and SMSC Victory66 mainboard
226  I2C interfaces. This can also be
227  built as a module which can be inserted and removed while the kernel
228  is running.
229
230Nvidia Nforce2/Nforce3 based Mainboard
231CONFIG_I2C_NFORCE2
232  If you say yes to this option, support will be included for the
233  Nvidia Nforce2 and Nforce3 families of mainboard I2C interfaces.
234  This can also be built as a module which can be inserted and removed
235  while the kernel is running.
236
237Silicon Integrated Systems Corp. SiS5595 based Mainboard
238CONFIG_I2C_SIS5595
239  If you say yes to this option, support will be included for the
240  SiS5595 mainboard I2C interfaces. For integrated sensors on the
241  Sis5595, use CONFIG_SENSORS_SIS5595. This can also be
242  built as a module which can be inserted and removed while the kernel
243  is running.
244
245Silicon Integrated Systems Corp. SiS630/730 based Mainboard
246CONFIG_I2C_SIS630
247  If you say yes to this option, support will be included for the SiS 630
248  and 730 mainboard I2C interfaces. This can also be built as a module
249  which can be inserted and removed while the kernel is running.
250
251Silicon Integrated Systems Corp. SiS645/961,645DX/961,735 based Mainboard
252CONFIG_I2C_SIS645
253  If you say yes to this option, support will be included for the SiS 645/961,
254  645DX/961 and 735 mainboard I2C interfaces. This can also be built as a module
255  which can be inserted and removed while the kernel is running.
256
257VIA Technologies, Inc. VT82C586B
258CONFIG_I2C_VIA
259  If you say yes to this option, support will be included for the VIA
260  Technologies I2C adapter found on some motherboards. This can also
261  be built as a module which can be inserted and removed while the
262  kernel is running.
263
264VIA Technologies, Inc. VT82C596, 596B, 686A/B, 8233, 8235
265CONFIG_I2C_VIAPRO
266  If you say yes to this option, support will be included for the VIA
267  Technologies I2C adapter on these chips. For integrated sensors on the
268  Via 686A/B, use CONFIG_SENSORS_VIA686A. This can also be
269  be built as a module which can be inserted and removed while the
270  kernel is running.
271
2723DFX Banshee / Voodoo3
273CONFIG_I2C_VOODOO3
274  If you say yes to this option, support will be included for the
275  3DFX Banshee and Voodoo3 I2C interfaces. The I2C busses on the these
276  chips are generally used only for video devices.
277  This can also be
278  built as a module which can be inserted and removed while the kernel
279  is running.
280
281DEC Tsunami 21272
282CONFIG_I2C_TSUNAMI
283  If you say yes to this option, support will be included for the DEC
284  Tsunami chipset I2C adapter. Requires the Alpha architecture;
285  do not enable otherwise. This can also be built as a module which
286  can be inserted and removed while the kernel is running.
287
288Pseudo ISA adapter (for hardware sensors modules)
289CONFIG_I2C_ISA
290  This provides support for accessing some hardware sensor chips over
291  the ISA bus rather than the I2C or SMBus. If you want to do this,
292  say yes here. This feature can also be built as a module which can
293  be inserted and removed while the kernel is running.
294
295  You will also need the latest user-space utilties: you can find them
296  in the lm_sensors package, which you can download at
297  http://www.lm-sensors.nu
298
299Analog Devices ADM1021 and compatibles
300CONFIG_SENSORS_ADM1021
301  If you say yes here you get support for Analog Devices ADM1021
302  and ADM1023 sensor chips and clones: Maxim MAX1617 and MAX1617A,
303  Genesys Logic GL523SM, National Semi LM84, TI THMC10 and Onsemi
304  MC1066. This can also be built as a module which can be inserted
305  and removed while the kernel is running.
306
307  You will also need the latest user-space utilties: you can find them
308  in the lm_sensors package, which you can download at
309  http://www.lm-sensors.nu
310
311Analog Devices ADM1024
312CONFIG_SENSORS_ADM1024
313  If you say yes here you get support for Analog Devices ADM1024 sensor
314  chips.  This can also be built as a module.
315
316  You will also need the latest user-space utilties: you can find them
317  in the lm_sensors package, which you can download at
318  http://www.lm-sensors.nu
319
320Analog Devices ADM1025
321CONFIG_SENSORS_ADM1025
322  If you say yes here you get support for Analog Devices ADM1025 sensor
323  chips.  This can also be built as a module which can be inserted and
324  removed while the kernel is running.
325
326  You will also need the latest user-space utilties: you can find them
327  in the lm_sensors package, which you can download at
328  http://www.lm-sensors.nu
329
330Analog Devices ADM1026
331CONFIG_SENSORS_ADM1026
332  If you say yes here you get support for Analog Devices ADM1026 sensor
333  chips.  This can also be built as a module which can be inserted and
334  removed while the kernel is running.
335
336  You will also need the latest user-space utilties: you can find them
337  in the lm_sensors package, which you can download at
338  http://www.lm-sensors.nu
339
340Analog Devices ADM1030, ADM1031
341CONFIG_SENSORS_ADM1031
342  If you say yes here you get support for Analog Devices ADM1030 and
343  ADM1031 sensor chips.  This can also be built as a module which can
344  be inserted and removed while the kernel is running.
345
346  You will also need the latest user-space utilties: you can find them
347  in the lm_sensors package, which you can download at
348  http://www.lm-sensors.nu/
349
350Analog Devices ADM9240 and compatibles
351CONFIG_SENSORS_ADM9240
352  If you say yes here you get support for Analog Devices ADM9240
353  sensor chips and clones: the Dallas Semiconductor DS1780 and
354  the National Semiconductor LM81. This can also be built as a
355  module which can be inserted and removed while the kernel is
356  running.
357
358  You will also need the latest user-space utilties: you can find them
359  in the lm_sensors package, which you can download at
360  http://www.lm-sensors.nu
361
362Asus ASB100
363CONFIG_SENSORS_ASB100
364  If you say yes here you get support for the Asus ASB100 (aka
365  "Bach") sensor chip.  This can also be built as a module.
366
367  You will also need the latest user-space utilities: you can find
368  them in the lm_sensors package, which you can download at
369  http://www.lm-sensors.nu/
370
371Dallas DS1621 and DS1625
372CONFIG_SENSORS_DS1621
373  If you say yes here you get support for the Dallas DS1621 and DS1625x
374  sensor chips.  This can also be built as a module.
375
376  You will also need the latest user-space utilties: you can find them
377  in the lm_sensors package, which you can download at
378  http://www.lm-sensors.nu
379
380Fujitsu-Siemens Hermes
381CONFIG_SENSORS_FSCHER
382  If you say yes here you get support for the Fujitsu-Siemens Hermes
383  sensor chip.  This can also be built as a module.
384
385  You will also need the latest user-space utilties: you can find them
386  in the lm_sensors package, which you can download at
387  http://www.lm-sensors.nu/
388
389Fujitsu-Siemens Poseidon
390CONFIG_SENSORS_FSCPOS
391  If you say yes here you get support for the Fujitsu-Siemens Poseidon
392  sensor chip.  This can also be built as a module.
393
394  You will also need the latest user-space utilties: you can find them
395  in the lm_sensors package, which you can download at
396  http://www.lm-sensors.nu
397
398Fujitsu-Siemens Scylla
399CONFIG_SENSORS_FSCSCY
400  If you say yes here you get support for the Fujitsu-Siemens Scylla
401  sensor chip.  This can also be built as a module. This driver may/should
402  also work with the following Fujitsu-Siemens chips: "Poseidon",
403  "Poseidon II" and "Hydra". You may have to force loading of the module
404  for motherboards in these cases. Be careful - those motherboards have
405  not been tested with this driver.
406
407  You will also need the latest user-space utilties: you can find them
408  in the lm_sensors package, which you can download at
409  http://www.lm-sensors.nu
410
411Genesys Logic GL518SM
412CONFIG_SENSORS_GL518SM
413  If you say yes here you get support for Genesys Logic GL518SM sensor
414  chips.  This can also be built as a module which can be inserted and
415  removed while the kernel is running.
416
417  You will also need the latest user-space utilties: you can find them
418  in the lm_sensors package, which you can download at
419  http://www.lm-sensors.nu
420
421Genesys Logic GL520SM
422CONFIG_SENSORS_GL520SM
423  If you say yes here you get support for Genesys Logic GL518SM sensor
424  chips.  This can also be built as a module which can be inserted and
425  removed while the kernel is running.
426
427  You will also need the latest user-space utilties: you can find them
428  in the lm_sensors package, which you can download at
429  http://www.lm-sensors.nu
430
431HP Maxilife
432CONFIG_SENSORS_MAXILIFE
433  If you say yes here you get support for the HP Maxilife
434  sensor chip.  This can also be built as a module.
435
436  You will also need the latest user-space utilties: you can find them
437  in the lm_sensors package, which you can download at
438  http://www.lm-sensors.nu
439
440Intel Xeon Thermal Sensor
441CONFIG_SENSORS_XEONTEMP
442  If you say yes here you get support for the Intel Xeon processor
443  built-in thermal sensor. This can also be built as a module which
444  can be inserted and removed while the kernel is running.
445
446  You will also need the latest user-space utilities: you can find them
447  in the lm_sensors package, which you can download at
448  http://www.lm-sensors.nu/
449
450ITE 8705, 8712, Sis950
451CONFIG_SENSORS_IT87
452  If you say yes here you get support for the ITE 8705 and 8712 and
453  SiS950 sensor chips.  This can also be built as a module.
454
455  You will also need the latest user-space utilties: you can find them
456  in the lm_sensors package, which you can download at
457  http://www.lm-sensors.nu
458
459Maxim MAX1619
460CONFIG_SENSORS_MAX1619
461  If you say yes here you get support for the Maxim MAX1619 sensor
462  chips.  This can also be built as a module.
463
464  You will also need the latest user-space utilties: you can find them
465  in the lm_sensors package, which you can download at
466  http://www.lm-sensors.nu/
467
468Maxim MAX6650, MAX6651
469CONFIG_SENSORS_MAX6650
470  If you say yes here you get support for the Maxim MAX6650 and
471  MAX6651 sensor chips.  This can also be built as a module.
472
473  You will also need the latest user-space utilties: you can find them
474  in the lm_sensors package, which you can download at
475  http://www.lm-sensors.nu
476
477Myson MTP008
478CONFIG_SENSORS_MTP008
479  If you say yes here you get support for the Myson MTP008
480  sensor chip.  This can also be built as a module.
481
482  You will also need the latest user-space utilties: you can find them
483  in the lm_sensors package, which you can download at
484  http://www.lm-sensors.nu
485
486National Semiconductor LM63
487CONFIG_SENSORS_LM63
488  If you say yes here you get support for National Semiconductor LM63
489  sensor chips.  This can also be built as a module which can be inserted
490  and removed while the kernel is running.
491
492  You will also need the latest user-space utilties: you can find them
493  in the lm_sensors package, which you can download at
494  http://www.lm-sensors.nu/
495
496National Semiconductor LM75 and compatibles
497CONFIG_SENSORS_LM75
498  If you say yes here you get support for National Semiconductor LM75
499  sensor chips and clones: Dallas Semiconductor DS75 and DS1775 (in
500  9-bit precision mode), and TelCom (now Microchip) TCN75. This can
501  also be built as a module which can be inserted and removed while
502  the kernel is running.
503
504  You will also need the latest user-space utilties: you can find them
505  in the lm_sensors package, which you can download at
506  http://www.lm-sensors.nu
507
508National Semiconductor LM78
509CONFIG_SENSORS_LM78
510  If you say yes here you get support for National Semiconductor LM78
511  sensor chips family: the LM78-J and LM79. Many clone chips will
512  also work at least somewhat with this driver. This can also be built
513  as a module which can be inserted and removed while the kernel is
514  running.
515
516  You will also need the latest user-space utilties: you can find them
517  in the lm_sensors package, which you can download at
518  http://www.lm-sensors.nu
519
520National Semiconductor LM80
521CONFIG_SENSORS_LM80
522  If you say yes here you get support for National Semiconductor LM80
523  sensor chips. This can also be built as a module which can be
524  inserted and removed while the kernel is running.
525
526  You will also need the latest user-space utilties: you can find them
527  in the lm_sensors package, which you can download at
528  http://www.lm-sensors.nu
529
530National Semiconductor LM83
531CONFIG_SENSORS_LM83
532  If you say yes here you get support for the National Semiconductor
533  LM83 sensor chip.  This can also be built as a module.
534
535  You will also need the latest user-space utilities: you can find
536  them in the lm_sensors package, which you can download at
537  http://www.lm-sensors.nu/
538
539National Semiconductor LM85
540CONFIG_SENSORS_LM85
541  If you say yes here you get support for National Semiconductor LM85
542  sensor chips and compatibles.  Compatible chips include the Analog
543  Devices ADM1027 and ADT7463 and SMSC EMC6D100 and EMC6D101.  This
544  can also be built as a module which can be inserted and removed
545  while the kernel is running.
546
547  You will also need the latest user-space utilties: you can find them
548  in the lm_sensors package, which you can download at
549  http://www.lm-sensors.nu
550
551National Semiconductor LM87
552CONFIG_SENSORS_LM87
553  If you say yes here you get support for National Semiconductor LM87
554  sensor chips. This can also be built as a module which can be
555  inserted and removed while the kernel is running.
556
557  You will also need the latest user-space utilties: you can find them
558  in the lm_sensors package, which you can download at
559  http://www.lm-sensors.nu
560
561National Semiconductor LM90
562CONFIG_SENSORS_LM90
563  If you say yes here you get support for the National Semiconductor
564  LM90, LM89 and LM99, Analog Devices ADM1032 and ADT7461, and Maxim
565  MAX6657 and MAX6658 sensor chips.  This can also be built as a module.
566
567  You will also need the latest user-space utilities: you can find
568  them in the lm_sensors package, which you can download at
569  http://www.lm-sensors.nu/
570
571National Semiconductor LM92
572CONFIG_SENSORS_LM92
573  If you say yes here you get support for National Semiconductor LM92
574  sensor chips. This can also be built as a module which can be
575  inserted and removed while the kernel is running.
576
577  You will also need the latest user-space utilties: you can find them
578  in the lm_sensors package, which you can download at
579  http://www.lm-sensors.nu
580
581National Semiconductor LM93
582CONFIG_SENSORS_LM93
583  If you say yes here you get support for National Semiconductor LM93
584  sensor chips.  This can also be built as a module which can be inserted
585  and removed while the kernel is running.
586
587  You will also need the latest user-space utilties: you can find them
588  in the lm_sensors package, which you can download at
589  http://www.lm-sensors.nu/
590
591National Semiconductor PC8736x Sensors
592CONFIG_SENSORS_PC87360
593  If you say yes here you get support for the integrated hardware
594  monitoring in the National Semicoductor PC87360, PC87363, PC87364,
595  PC87365 and PC87366 Super I/O chips. This can also be built as a
596  module which can be inserted and removed while the kernel is
597  running.
598
599  You will also need the latest user-space utilities: you can find them
600  in the lm_sensors package, which you can download at
601  http://www.lm-sensors.nu/
602
603Philips PCF8574
604CONFIG_SENSORS_PCF8574
605  If you say yes here you get support for the Philips PCF8574
606  I2C 8-bit Parallel I/O device.
607  This can also be built as a module which can be
608  inserted and removed while the kernel is running.
609
610  You will also need the latest user-space utilties: you can find them
611  in the lm_sensors package, which you can download at
612  http://www.lm-sensors.nu
613
614Philips PCF8591
615CONFIG_SENSORS_PCF8591
616  If you say yes here you get support for the Philips PCF8591
617  I2C Quad D/A + Single A/D I/O device.
618  This can also be built as a module which can be
619  inserted and removed while the kernel is running.
620
621  You will also need the latest user-space utilties: you can find them
622  in the lm_sensors package, which you can download at
623  http://www.lm-sensors.nu
624
625Silicon Integrated Systems Corp. SiS5595 Sensor
626CONFIG_SENSORS_SIS5595
627  If you say yes here you get support for the integrated sensors in
628  SiS5595 South Bridges. This can also be built as a module
629  which can be inserted and removed while the kernel is running.
630
631  You will also need the latest user-space utilties: you can find them
632  in the lm_sensors package, which you can download at
633  http://www.lm-sensors.nu
634
635SMSC47M1xx Super I/O Fan Support
636CONFIG_SENSORS_SMSC47M1
637  If you say yes here you get support for the integrated fan
638  monitoring and control in the SMSC 47M1xx Super I/O chips.
639  This can also be built as a module
640  which can be inserted and removed while the kernel is running.
641
642  You will also need the latest user-space utilties: you can find them
643  in the lm_sensors package, which you can download at
644  http://www.lm-sensors.nu
645
646Texas Instruments THMC50 / Analog Devices ADM1022
647CONFIG_SENSORS_THMC50
648  If you say yes here you get support for Texas Instruments THMC50
649  sensor chips and clones: the Analog Devices ADM1022.
650  This can also be built as a module which
651  can be inserted and removed while the kernel is running.
652
653  You will also need the latest user-space utilties: you can find them
654  in the lm_sensors package, which you can download at
655  http://www.lm-sensors.nu
656
657Via VT82C686A/B
658CONFIG_SENSORS_VIA686A
659  If you say yes here you get support for the integrated sensors in
660  Via 686A/B South Bridges. This can also be built as a module
661  which can be inserted and removed while the kernel is running.
662
663  You will also need the latest user-space utilties: you can find them
664  in the lm_sensors package, which you can download at
665  http://www.lm-sensors.nu
666
667Via VT1211 Sensors
668CONFIG_SENSORS_VT1211
669  If you say yes here you get support for the integrated sensors in
670  the Via VT1211 Super I/O device. This can also be built as a module
671  which can be inserted and removed while the kernel is running.
672
673  You will also need the latest user-space utilties: you can find them
674  in the lm_sensors package, which you can download at
675  http://www.lm-sensors.nu
676
677Via VT8231 Sensors
678CONFIG_SENSORS_VT8231
679  If you say yes here you get support for the integrated sensors in
680  the Via VT8231 device. This can also be built as a module
681  which can be inserted and removed while the kernel is running.
682
683  You will also need the latest user-space utilties: you can find them
684  in the lm_sensors package, which you can download at
685  http://www.lm-sensors.nu
686
687Winbond W83781D, W83782D, W83783S, W83627HF, AS99127F
688CONFIG_SENSORS_W83781D
689  If you say yes here you get support for the Winbond W8378x series
690  of sensor chips: the W83781D, W83782D, W83783S and W83682HF,
691  and the similar Asus AS99127F. This
692  can also be built as a module which can be inserted and removed
693  while the kernel is running.
694
695  You will also need the latest user-space utilties: you can find them
696  in the lm_sensors package, which you can download at
697  http://www.lm-sensors.nu
698
699Winbond W83792D
700CONFIG_SENSORS_W83792D
701  If you say yes here you get support for the Winbond W83792D
702  sensor chips.
703
704  You will also need the latest user-space utilties: you can find them
705  in the lm_sensors package, which you can download at
706  http://www.lm-sensors.nu/
707
708Winbond W83627HF, W83627THF, W83697HF
709CONFIG_SENSORS_W83627HF
710  If you say yes here you get support for the Winbond W836x7 series
711  of sensor chips: the Winbond W83627HF, W83627THF and W83697HF. This
712  can also be built as a module which can be inserted and removed
713  while the kernel is running.
714
715  You will also need the latest user-space utilities: you can find
716  them in the lm_sensors package, which you can download at
717  http://www.lm-sensors.nu/
718
719Winbond W83L785TS-S
720CONFIG_SENSORS_W83L785TS
721  If you say yes here you get support for the Winbond W83L785TS-S
722  sensor chip.  This can also be built as a module.
723
724  You will also need the latest user-space utilities: you can find
725  them in the lm_sensors package, which you can download at
726  http://www.lm-sensors.nu/
727
728EEprom (DIMM) reader
729CONFIG_SENSORS_EEPROM
730  If you say yes here you get read-only access to the EEPROM data
731  available on modern memory DIMMs, and which could theoretically
732  also be available on other devices. This can also be built as a
733  module which can be inserted and removed while the kernel is
734  running.
735
736  You will also need the latest user-space utilties: you can find them
737  in the lm_sensors package, which you can download at
738  http://www.lm-sensors.nu
739
740EOF
741    }
742    print OUTPUT;
743  }
744  close INPUT;
745  close OUTPUT;
746  print_diff $package_root,$kernel_root,$kernel_file,$package_file;
747}
748
749
750# This generates diffs for the main Linux Makefile.
751# Three lines which add drivers/sensors/sensors.a to the DRIVERS list are
752# put just before the place where the architecture Makefile is included.
753# Of course, care is taken old lines are removed.
754# $_[0]: sensors package root (like /tmp/sensors)
755# $_[1]: Linux kernel tree (like /usr/src/linux)
756sub gen_Makefile
757{
758  my ($package_root,$kernel_root) = @_;
759  my $kernel_file = "Makefile";
760  my $package_file = $temp;
761  my $type = 0;
762  my $pr1 = 0;
763
764  open INPUT,"$kernel_root/$kernel_file"
765        or die "Can't open `$kernel_root/$kernel_file'";
766  open OUTPUT,">$package_root/$package_file"
767        or die "Can't open $package_root/$package_file";
768  `grep -q -s 'i2c\.o' "$kernel_root/$kernel_file"`;
769  $type = 2 if ! $?;
770  MAIN: while(<INPUT>) {
771    $type = 1 if !$type and (m@^DRIVERS-\$@);
772    if (m@DRIVERS-\$\(CONFIG_SENSORS\)@) {
773      $_ = <INPUT>;
774      redo MAIN;
775    } elsif (m@CONFIG_SENSORS@) {
776      $_ = <INPUT> while not m@endif@;
777      $_ = <INPUT>;
778      $_ = <INPUT> if m@^$@;
779      redo MAIN;
780    }
781    if ($type == 1 and m@^DRIVERS \+= \$\(DRIVERS-y\)@) {
782      print OUTPUT <<'EOF';
783DRIVERS-$(CONFIG_SENSORS) += drivers/sensors/sensors.a
784EOF
785      $pr1 = 1;
786    }
787    if ($type == 2 and m@^DRIVERS .*= \$\(DRIVERS-y\)@) {
788      print OUTPUT <<'EOF';
789DRIVERS-$(CONFIG_SENSORS) += drivers/sensors/sensor.o
790EOF
791      $pr1 = 1;
792    }
793    if ($type == 0 and m@include arch/\$\(ARCH\)/Makefile@) {
794      print OUTPUT <<'EOF';
795ifeq ($(CONFIG_SENSORS),y)
796DRIVERS := $(DRIVERS) drivers/sensors/sensors.a
797endif
798
799EOF
800      $pr1 = 1;
801    }
802    print OUTPUT;
803  }
804  close INPUT;
805  close OUTPUT;
806  die "Automatic patch generation for main `Makefile' failed.\n".
807      "See our home page http://www.lm-sensors.nu for assistance!" if $pr1 == 0;
808  print_diff $package_root,$kernel_root,$kernel_file,$package_file;
809}
810
811# This generates diffs for drivers/Makefile
812# First, `sensors' is added to the ALL_SUB_DIRS list. Next, a couple of lines
813# to add sensors to the SUB_DIRS and/or MOD_SUB_DIRS lists is put right before
814# Rules.make is included.
815# Of course, care is taken old lines are removed.
816# $_[0]: sensors package root (like /tmp/sensors)
817# $_[1]: Linux kernel tree (like /usr/src/linux)
818sub gen_drivers_Makefile
819{
820  my ($package_root,$kernel_root) = @_;
821  my $kernel_file = "drivers/Makefile";
822  my $package_file = $temp;
823  my $sensors_present;
824  my $pr1 = 0;
825  my $pr2 = 0;
826  my $new_style = 0;
827
828  open INPUT,"$kernel_root/$kernel_file"
829        or die "Can't open `$kernel_root/$kernel_file'";
830  open OUTPUT,">$package_root/$package_file"
831        or die "Can't open $package_root/$package_file";
832  MAIN: while(<INPUT>) {
833    if (m@^mod-subdirs\s*:=@) {
834      $new_style = 1;
835    }
836    if ((! $new_style and m@^ALL_SUB_DIRS\s*:=@) or m@^mod-subdirs\s*:=@) {
837      $pr1 = 1;
838      $sensors_present = 0;
839      while (m@\\$@) {
840        $sensors_present = 1 if m@sensors@;
841        print OUTPUT;
842        $_ = <INPUT>;
843      }
844      $sensors_present = 1 if m@sensors@;
845      s@$@ sensors@ if (not $sensors_present);
846      print OUTPUT;
847      $_ = <INPUT>;
848      redo MAIN;
849    } 
850    if (m@^ifeq.*CONFIG_SENSORS@) {
851      $_ = <INPUT> while not m@^endif@;
852      $_ = <INPUT>;
853      $_ = <INPUT> if m@^$@;
854      redo MAIN;
855    } 
856    if (m@^subdir.*CONFIG_SENSORS@) {
857      $_ = <INPUT>;
858      redo MAIN;
859    }
860    if (!$pr2 and (m@^include \$\(TOPDIR\)/Rules.make$@ or m@^subdir-\$\(CONFIG_ACPI@)) {
861      $pr2 = 1;
862      if ($new_style) {
863      print OUTPUT <<'EOF';
864subdir-$(CONFIG_SENSORS)        += sensors
865EOF
866      } else {
867      print OUTPUT <<'EOF';
868ifeq ($(CONFIG_SENSORS),y)
869SUB_DIRS += sensors
870MOD_SUB_DIRS += sensors
871else
872  ifeq ($(CONFIG_SENSORS),m)
873  MOD_SUB_DIRS += sensors
874  endif
875endif
876
877EOF
878      }
879    }
880    print OUTPUT;
881  }
882  close INPUT;
883  close OUTPUT;
884  die "Automatic patch generation for `drivers/Makefile' failed.\n".
885      "See our home page http://www.lm-sensors.nu for assistance!" if $pr1 == 0 or $pr2 == 0;
886  print_diff $package_root,$kernel_root,$kernel_file,$package_file;
887}
888
889# This generates diffs for drivers/char/Config.in
890# It adds a line just before CONFIG_APM or main_menu_option lines to include
891# the sensors Config.in.
892# Of course, care is taken old lines are removed.
893# $_[0]: sensors package root (like /tmp/sensors)
894# $_[1]: Linux kernel tree (like /usr/src/linux)
895sub gen_drivers_char_Config_in
896{
897  my ($package_root,$kernel_root) = @_;
898  my $kernel_file = "drivers/char/Config.in";
899  my $package_file = $temp;
900  my $pr1 = 0;
901
902  open INPUT,"$kernel_root/$kernel_file"
903        or die "Can't open `$kernel_root/$kernel_file'";
904  open OUTPUT,">$package_root/$package_file"
905        or die "Can't open $package_root/$package_file";
906  MAIN: while(<INPUT>) {
907    if (m@source drivers/i2c/Config.in@) {
908      $pr1 = 1;
909      print OUTPUT;
910      print OUTPUT "\nsource drivers/sensors/Config.in\n";
911      $_ = <INPUT>;
912      redo MAIN;
913    }
914    if (m@sensors@) {
915      $_ = <INPUT>;
916      $_ = <INPUT> if m@^$@;
917      redo MAIN;
918    }
919    print OUTPUT;
920  }
921  close INPUT;
922  close OUTPUT;
923  die "Automatic patch generation for `drivers/char/Config.in' failed.\n".
924      "See our home page http://www.lm-sensors.nu for assistance!" if $pr1 == 0;
925  print_diff $package_root,$kernel_root,$kernel_file,$package_file;
926}
927 
928# This generates diffs for drivers/i2c/Config.in
929# Several adapter drivers that are included in the lm_sensors package are
930# added at the first and onlu sensors marker.
931# Of course, care is taken old lines are removed.
932# $_[0]: sensors package root (like /tmp/sensors)
933# $_[1]: Linux kernel tree (like /usr/src/linux)
934sub gen_drivers_i2c_Config_in
935{
936  my ($package_root,$kernel_root) = @_;
937  my $kernel_file = "drivers/i2c/Config.in";
938  my $package_file = "$temp";
939  my $pr1 = 0;
940
941  open INPUT,"$kernel_root/$kernel_file"
942        or die "Can't open `$kernel_root/$kernel_file'";
943  open OUTPUT,">$package_root/$package_file"
944        or die "Can't open $package_root/$package_file";
945  while(<INPUT>) {
946    if (m@sensors code starts here@) {
947      $pr1++;
948      print OUTPUT;
949      while (<INPUT>) {
950        last if m@sensors code ends here@;
951      }
952      print OUTPUT << 'EOF';
953  bool 'I2C mainboard interfaces' CONFIG_I2C_MAINBOARD
954  if [ "$CONFIG_I2C_MAINBOARD" = "y" ]; then
955    dep_tristate '  Acer Labs ALI 1535' CONFIG_I2C_ALI1535 $CONFIG_I2C
956    dep_tristate '  Acer Labs ALI 1533 and 1543C' CONFIG_I2C_ALI15X3 $CONFIG_I2C
957    dep_tristate '  Acer Labs ALI 1563' CONFIG_I2C_ALI1563 $CONFIG_I2C
958    dep_tristate '  Apple Hydra Mac I/O' CONFIG_I2C_HYDRA $CONFIG_I2C_ALGOBIT
959    dep_tristate '  AMD 756/766/768/8111 and nVidia nForce' CONFIG_I2C_AMD756 $CONFIG_I2C
960    if [ "$CONFIG_I2C_AMD756" != "n" ]; then
961      dep_tristate '    SMBus multiplexing on the Tyan S4882' CONFIG_I2C_AMD756_S4882 $CONFIG_I2C_AMD756
962    fi
963    dep_tristate '  AMD 8111 SMBus 2.0' CONFIG_I2C_AMD8111 $CONFIG_I2C
964    if [ "$CONFIG_ALPHA" = "y" ]; then
965      dep_tristate '  DEC Tsunami I2C interface' CONFIG_I2C_TSUNAMI $CONFIG_I2C_ALGOBIT
966    fi
967    dep_tristate '  Intel 82801AA, AB, BA, DB' CONFIG_I2C_I801 $CONFIG_I2C
968    dep_tristate '  Intel i810AA/AB/E and i815' CONFIG_I2C_I810 $CONFIG_I2C_ALGOBIT
969    dep_tristate '  Intel 82371AB PIIX4(E), 443MX, ServerWorks OSB4/CSB5, SMSC Victory66' CONFIG_I2C_PIIX4 $CONFIG_I2C
970    dep_tristate '  Nvidia Nforce2/Nforce3' CONFIG_I2C_NFORCE2 $CONFIG_I2C
971    dep_tristate '  SiS 5595' CONFIG_I2C_SIS5595 $CONFIG_I2C
972    dep_tristate '  SiS 630/730' CONFIG_I2C_SIS630 $CONFIG_I2C
973    dep_tristate '  SiS 645/961,645DX/961,735' CONFIG_I2C_SIS645 $CONFIG_I2C $CONFIG_HOTPLUG
974    dep_tristate '  Savage 4' CONFIG_I2C_SAVAGE4 $CONFIG_I2C_ALGOBIT
975    dep_tristate '  VIA Technologies, Inc. VT82C586B' CONFIG_I2C_VIA $CONFIG_I2C_ALGOBIT
976    dep_tristate '  VIA Technologies, Inc. VT596A/B, 686A/B, 8231, 8233, 8233A, 8235' CONFIG_I2C_VIAPRO $CONFIG_I2C
977    dep_tristate '  Voodoo3 I2C interface' CONFIG_I2C_VOODOO3 $CONFIG_I2C_ALGOBIT
978    dep_tristate '  Pseudo ISA adapter (for some hardware sensors)' CONFIG_I2C_ISA $CONFIG_I2C
979  fi
980
981EOF
982    }
983    print OUTPUT;
984  }
985  close INPUT;
986  close OUTPUT;
987  die "Automatic patch generation for `drivers/i2c/Config.in' failed.\n".
988      "See our home page http://www.lm-sensors.nu for assistance!" if $pr1 != 1;
989  print_diff $package_root,$kernel_root,$kernel_file,$package_file;
990}
991
992sub gen_drivers_sensors_Makefile
993{
994  my ($package_root,$kernel_root) = @_;
995  my $kernel_file = "drivers/sensors/Makefile";
996  my $package_file = $temp;
997
998  open OUTPUT,">$package_root/$package_file"
999        or die "Can't open $package_root/$package_file";
1000  print OUTPUT <<'EOF';
1001#
1002# Makefile for the kernel hardware sensors drivers.
1003#
1004
1005MOD_LIST_NAME := SENSORS_MODULES
1006O_TARGET := sensor.o
1007
1008obj-$(CONFIG_SENSORS_ADM1021)   += adm1021.o
1009obj-$(CONFIG_SENSORS_ADM1024)   += adm1024.o
1010obj-$(CONFIG_SENSORS_ADM1025)   += adm1025.o
1011obj-$(CONFIG_SENSORS_ADM1026)   += adm1026.o
1012obj-$(CONFIG_SENSORS_ADM1031)   += adm1031.o
1013obj-$(CONFIG_SENSORS_ADM9240)   += adm9240.o
1014obj-$(CONFIG_SENSORS_ASB100)    += asb100.o
1015obj-$(CONFIG_SENSORS_BT869)     += bt869.o
1016obj-$(CONFIG_SENSORS_DDCMON)    += ddcmon.o
1017obj-$(CONFIG_SENSORS_DS1621)    += ds1621.o
1018obj-$(CONFIG_SENSORS_EEPROM)    += eeprom.o
1019obj-$(CONFIG_SENSORS_FSCHER)    += fscher.o
1020obj-$(CONFIG_SENSORS_FSCPOS)    += fscpos.o
1021obj-$(CONFIG_SENSORS_FSCSCY)    += fscscy.o
1022obj-$(CONFIG_SENSORS_GL518SM)   += gl518sm.o
1023obj-$(CONFIG_SENSORS_GL520SM)   += gl520sm.o
1024obj-$(CONFIG_SENSORS_IT87)      += it87.o
1025obj-$(CONFIG_SENSORS_LM63)      += lm63.o
1026obj-$(CONFIG_SENSORS_LM75)      += lm75.o
1027obj-$(CONFIG_SENSORS_LM78)      += lm78.o
1028obj-$(CONFIG_SENSORS_LM80)      += lm80.o
1029obj-$(CONFIG_SENSORS_LM83)      += lm83.o
1030obj-$(CONFIG_SENSORS_LM85)      += lm85.o
1031obj-$(CONFIG_SENSORS_LM87)      += lm87.o
1032obj-$(CONFIG_SENSORS_LM90)      += lm90.o
1033obj-$(CONFIG_SENSORS_LM92)      += lm92.o
1034obj-$(CONFIG_SENSORS_LM93)      += lm93.o
1035obj-$(CONFIG_SENSORS_MAX1619)   += max1619.o
1036obj-$(CONFIG_SENSORS_MAX6650)   += max6650.o
1037obj-$(CONFIG_SENSORS_MAXILIFE)  += maxilife.o
1038obj-$(CONFIG_SENSORS_MTP008)    += mtp008.o
1039obj-$(CONFIG_SENSORS_PC87360)   += pc87360.o
1040obj-$(CONFIG_SENSORS_PCF8574)   += pcf8574.o
1041obj-$(CONFIG_SENSORS_PCF8591)   += pcf8591.o
1042obj-$(CONFIG_SENSORS_SIS5595)   += sis5595.o
1043obj-$(CONFIG_SENSORS_SMSC47M1)  += smsc47m1.o
1044obj-$(CONFIG_SENSORS_THMC50)    += thmc50.o
1045obj-$(CONFIG_SENSORS_VIA686A)   += via686a.o
1046obj-$(CONFIG_SENSORS_VT1211)    += vt1211.o
1047obj-$(CONFIG_SENSORS_VT8231)    += vt8231.o
1048obj-$(CONFIG_SENSORS_W83781D)   += w83781d.o
1049obj-$(CONFIG_SENSORS_W83792D)   += w83792d.o
1050obj-$(CONFIG_SENSORS_W83627HF)  += w83627hf.o
1051obj-$(CONFIG_SENSORS_W83L785TS) += w83l785ts.o
1052obj-$(CONFIG_SENSORS_XEONTEMP)  += xeontemp.o
1053
1054include $(TOPDIR)/Rules.make
1055
1056EOF
1057  close OUTPUT;
1058  print_diff $package_root,$kernel_root,$kernel_file,$package_file;
1059}
1060
1061# This generates diffs for drivers/i2c/Makefile.
1062# Lines to add correct files to M_OBJS and/or L_OBJS are added just before
1063# Rules.make is included
1064# Of course, care is taken old lines are removed.
1065# $_[0]: sensors package root (like /tmp/sensors)
1066# $_[1]: Linux kernel tree (like /usr/src/linux)
1067sub gen_drivers_i2c_Makefile
1068{
1069  my ($package_root,$kernel_root) = @_;
1070  my $kernel_file = "drivers/i2c/Makefile";
1071  my $package_file = $temp;
1072  my $pr1 = 0;
1073
1074  open INPUT,"$kernel_root/$kernel_file"
1075        or die "Can't open `$kernel_root/$kernel_file'";
1076  open OUTPUT,">$package_root/$package_file"
1077        or die "Can't open $package_root/$package_file";
1078  while(<INPUT>) {
1079    if (m@sensors code starts here@) {
1080      $pr1 ++;
1081      print OUTPUT;
1082      while (<INPUT>) {
1083        last if m@sensors code ends here@;
1084      }
1085      print OUTPUT <<'EOF';
1086export-objs     += i2c-amd756.o
1087
1088obj-$(CONFIG_I2C_ALI1535)               += i2c-ali1535.o
1089obj-$(CONFIG_I2C_ALI15X3)               += i2c-ali15x3.o
1090obj-$(CONFIG_I2C_ALI1563)               += i2c-ali1563.o
1091obj-$(CONFIG_I2C_AMD756)                += i2c-amd756.o
1092obj-$(CONFIG_I2C_AMD756_S4882)          += i2c-amd756-s4882.o
1093obj-$(CONFIG_I2C_AMD8111)               += i2c-amd8111.o
1094obj-$(CONFIG_I2C_HYDRA)                 += i2c-hydra.o
1095obj-$(CONFIG_I2C_I801)                  += i2c-i801.o
1096obj-$(CONFIG_I2C_I810)                  += i2c-i810.o
1097obj-$(CONFIG_I2C_ISA)                   += i2c-isa.o
1098obj-$(CONFIG_I2C_NFORCE2)               += i2c-nforce2.o
1099obj-$(CONFIG_I2C_PIIX4)                 += i2c-piix4.o
1100obj-$(CONFIG_I2C_SIS5595)               += i2c-sis5595.o
1101obj-$(CONFIG_I2C_SIS630)                += i2c-sis630.o
1102obj-$(CONFIG_I2C_SIS645)                += i2c-sis645.o
1103obj-$(CONFIG_I2C_SAVAGE4)               += i2c-savage4.o
1104obj-$(CONFIG_I2C_TSUNAMI)               += i2c-tsunami.o
1105obj-$(CONFIG_I2C_VIA)                   += i2c-via.o
1106obj-$(CONFIG_I2C_VIAPRO)                += i2c-viapro.o
1107obj-$(CONFIG_I2C_VOODOO3)               += i2c-voodoo3.o
1108EOF
1109    }
1110    print OUTPUT;
1111  }
1112  close INPUT;
1113  close OUTPUT;
1114  die "Automatic patch generation for `drivers/i2c/Makefile' failed.\n".
1115      "See our home page http://www.lm-sensors.nu for assistance!" if $pr1 != 1;
1116  print_diff $package_root,$kernel_root,$kernel_file,$package_file;
1117}
1118
1119# Generate the diffs for the list of MAINTAINERS
1120# $_[0]: i2c package root (like /tmp/i2c)
1121# $_[1]: Linux kernel tree (like /usr/src/linux)
1122sub gen_MAINTAINERS
1123{
1124  my ($package_root,$kernel_root) = @_;
1125  my $kernel_file = "MAINTAINERS";
1126  my $package_file = $temp;
1127  my $done = 0;
1128
1129  open INPUT,"$kernel_root/$kernel_file"
1130        or die "Can't open `$kernel_root/$kernel_file'";
1131  open OUTPUT,">$package_root/$package_file"
1132        or die "Can't open $package_root/$package_file";
1133  MAIN: while(<INPUT>) {
1134    if (m@SENSORS DRIVERS@) {
1135       $_=<INPUT> while not m@^$@;
1136       $_=<INPUT>;
1137       redo MAIN;
1138    }
1139    if (not $done and (m@SGI VISUAL WORKSTATION 320 AND 540@)) {
1140      print OUTPUT <<'EOF';
1141SENSORS DRIVERS
1142L:      sensors@stimpy.netroedge.com
1143W:      http://www.lm-sensors.nu/
1144S:      Maintained
1145
1146EOF
1147      $done = 1;
1148    }
1149    print OUTPUT;
1150  }
1151  close INPUT;
1152  close OUTPUT;
1153  die "Automatic patch generation for `MAINTAINERS' failed.\n".
1154      "See our home page http://www.lm-sensors.nu for assistance!" if $done == 0;
1155  print_diff $package_root,$kernel_root,$kernel_file,$package_file;
1156}
1157
1158# Generate the diffs for dmi_scan.c and i386_ksyms.c
1159# $_[0]: i2c package root (like /tmp/i2c)
1160# $_[1]: Linux kernel tree (like /usr/src/linux)
1161sub gen_dmi_scan
1162{
1163  my ($package_root,$kernel_root) = @_;
1164  my $kernel_file = "arch/i386/kernel/dmi_scan.c";
1165  my $package_file = $temp;
1166  my $done = 0;
1167
1168  open INPUT,"$kernel_root/$kernel_file"
1169        or die "Can't open `$kernel_root/$kernel_file'";
1170  open OUTPUT,">$package_root/$package_file"
1171        or die "Can't open $package_root/$package_file";
1172  MAIN: while(<INPUT>) {
1173    if ($done == 0 && m/^\s*int is_sony_vaio_laptop;\s*$/) {
1174      print OUTPUT <<'EOF';
1175int is_unsafe_smbus;
1176EOF
1177      $done++;
1178    }
1179    if ($done == 1 && m/^\s*\* Check for a Sony Vaio system\s*$/) {
1180      print OUTPUT <<'EOF';
1181 * Don't access SMBus on IBM systems which get corrupted eeproms
1182 */
1183
1184static __init int disable_smbus(struct dmi_blacklist *d)
1185{   
1186        if (is_unsafe_smbus == 0) {
1187                is_unsafe_smbus = 1;
1188                printk(KERN_INFO "%s machine detected. Disabling SMBus accesses.\n", d->ident);
1189        }
1190        return 0;
1191}
1192
1193/*
1194EOF
1195      $done++;
1196    }
1197    if ($done == 2 && m/^\s*\{ sony_vaio_laptop, "Sony Vaio", \{ \/\* This is a Sony Vaio laptop \*\/\s*$/) {
1198      print OUTPUT <<'EOF';
1199        { disable_smbus, "IBM", {
1200                        MATCH(DMI_SYS_VENDOR, "IBM"),
1201                        NO_MATCH, NO_MATCH, NO_MATCH
1202                        } },
1203EOF
1204      $done++;
1205    }
1206    print OUTPUT;
1207  }
1208  close INPUT;
1209  close OUTPUT;
1210  die "Automatic patch generation for `$kernel_file' failed.\n".
1211      "See our home page http://www.lm-sensors.nu for assistance!" if $done != 3;
1212  print_diff $package_root,$kernel_root,$kernel_file,$package_file;
1213
1214  $kernel_file = "arch/i386/kernel/i386_ksyms.c";
1215  $done = 0;
1216
1217  open INPUT,"$kernel_root/$kernel_file"
1218        or die "Can't open `$kernel_root/$kernel_file'";
1219  open OUTPUT,">$package_root/$package_file"
1220        or die "Can't open $package_root/$package_file";
1221  MAIN: while(<INPUT>) {
1222    if ($done == 0 && m/^\s*extern int is_sony_vaio_laptop;\s*$/) {
1223      print OUTPUT <<'EOF';
1224extern int is_unsafe_smbus;
1225EXPORT_SYMBOL(is_unsafe_smbus);
1226
1227EOF
1228      $done++;
1229    }
1230    print OUTPUT;
1231  }
1232  close INPUT;
1233  close OUTPUT;
1234  die "Automatic patch generation for `$kernel_file' failed.\n".
1235      "See our home page http://www.lm-sensors.nu for assistance!" if $done != 1;
1236  print_diff $package_root,$kernel_root,$kernel_file,$package_file;
1237}
1238
1239
1240# Main function
1241sub main
1242{
1243  my ($package_root,$kernel_root,%files,%includes,$package_file,$kernel_file);
1244  my ($diff_command,$dummy,$data0,$data1,$sedscript,$version_string);
1245
1246  # --> Read the command-lineo
1247  $package_root = $ARGV[0];
1248  die "Package root `$package_root' is not found\n" 
1249        unless -d "$package_root/mkpatch";
1250  $kernel_root = $ARGV[1];
1251  die "Kernel root `$kernel_root' is not found\n" 
1252        unless -f "$kernel_root/Rules.make";
1253
1254  # --> Read FILES
1255  open INPUT, "$package_root/mkpatch/FILES" 
1256        or die "Can't open `$package_root/mkpatch/FILES'";
1257  while (<INPUT>) {
1258    ($data0,$data1) = /(\S+)\s+(\S+)/;
1259    $files{$data0} = $data1;
1260  } 
1261  close INPUT;
1262
1263  # --> Read INCLUDES
1264  open INPUT, "$package_root/mkpatch/INCLUDES" 
1265        or die "Can't open `$package_root/mkpatch/INCLUDES'";
1266  while (<INPUT>) {
1267    ($data0,$data1) = /(\S+)\s+(\S+)/;
1268    $includes{$data0} = $data1;
1269    $sedscript .= 's,(#\s*include\s*)'.$data0.'(\s*),\1'."$data1".'\2, ; ';
1270  } 
1271  close INPUT;
1272
1273  die "First apply the i2c patches to `$kernel_root'!" 
1274       if ! -d "$kernel_root/drivers/i2c";
1275
1276  # --> Read "version.h"
1277  open INPUT, "$package_root/version.h"
1278        or die "Can't open `$package_root/version.h'";
1279  $version_string .= $_ while <INPUT>;
1280  close INPUT;
1281 
1282  # --> Start generating
1283  foreach $package_file (sort keys %files) {
1284    open INPUT,"$package_root/$package_file" 
1285          or die "Can't open `$package_root/$package_file'";
1286    open OUTPUT,">$package_root/$temp"
1287          or die "Can't open `$package_root/$temp'";
1288    while (<INPUT>) {
1289      eval $sedscript;
1290      if (m@#\s*include\s*"version.h"@) {
1291        print OUTPUT $version_string;
1292      } else {
1293        print OUTPUT;
1294      }
1295    }
1296    close INPUT;
1297    close OUTPUT;
1298
1299    $kernel_file = $files{$package_file};
1300    print_diff $package_root,$kernel_root,$kernel_file,$temp;
1301  }
1302
1303  gen_Makefile $package_root, $kernel_root;
1304  gen_drivers_Makefile $package_root, $kernel_root;
1305  gen_drivers_sensors_Makefile $package_root, $kernel_root;
1306  gen_drivers_char_Config_in $package_root, $kernel_root;
1307  gen_drivers_i2c_Config_in $package_root, $kernel_root;
1308  gen_drivers_i2c_Makefile $package_root, $kernel_root;
1309  gen_Documentation_Configure_help $package_root, $kernel_root;
1310  gen_MAINTAINERS $package_root, $kernel_root;
1311  gen_dmi_scan $package_root, $kernel_root;
1312
1313  # Clear temporary file
1314  unlink("$package_root/$temp");
1315}
1316
1317main;
1318
Note: See TracBrowser for help on using the browser.