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

Revision 4050, 47.3 KB (checked in by khali, 7 years ago)

i2c-piix4: Add ATI IXP200, IXP300, IXP400 support (2.6 backport)

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