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

Revision 3263, 47.2 KB (checked in by khali, 8 years ago)

Fix typo breaking f71805f. Reported by Willy Tarreau.

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