| 749 | | |
|---|
| 750 | | # This generates diffs for drivers/char/mem.c They are a bit intricate. |
|---|
| 751 | | # Lines are generated at the beginning to declare sensors_init_all |
|---|
| 752 | | # At the bottom, a call to sensors_init_all is added when the |
|---|
| 753 | | # new lm_sensors stuff is configured in. |
|---|
| 754 | | # Of course, care is taken old lines are removed. |
|---|
| 755 | | # $_[0]: sensors package root (like /tmp/sensors) |
|---|
| 756 | | # $_[1]: Linux kernel tree (like /usr/src/linux) |
|---|
| 757 | | sub gen_drivers_char_mem_c |
|---|
| 758 | | { |
|---|
| 759 | | my ($package_root,$kernel_root) = @_; |
|---|
| 760 | | my $kernel_file = "drivers/char/mem.c"; |
|---|
| 761 | | my $package_file = $temp; |
|---|
| 762 | | my $right_place = 0; |
|---|
| 763 | | my $done = 0; |
|---|
| 764 | | my $atstart = 1; |
|---|
| 765 | | my $pr1 = 0; |
|---|
| 766 | | my $pr2 = 0; |
|---|
| 767 | | |
|---|
| 768 | | open INPUT,"$kernel_root/$kernel_file" |
|---|
| 769 | | or die "Can't open `$kernel_root/$kernel_file'"; |
|---|
| 770 | | open OUTPUT,">$package_root/$package_file" |
|---|
| 771 | | or die "Can't open $package_root/$package_file"; |
|---|
| 772 | | MAIN: while(<INPUT>) { |
|---|
| 773 | | if ($atstart and m@#ifdef@) { |
|---|
| 774 | | $pr1 = 1; |
|---|
| 775 | | print OUTPUT << 'EOF'; |
|---|
| 776 | | #ifdef CONFIG_SENSORS |
|---|
| 777 | | extern void sensors_init_all(void); |
|---|
| 778 | | #endif |
|---|
| 779 | | EOF |
|---|
| 780 | | $atstart = 0; |
|---|
| 781 | | } |
|---|
| 782 | | if (not $right_place and m@CONFIG_SENSORS@) { |
|---|
| 783 | | $_ = <INPUT> while not m@#endif@; |
|---|
| 784 | | $_ = <INPUT>; |
|---|
| 785 | | redo MAIN; |
|---|
| 786 | | } |
|---|
| 787 | | $right_place = 1 if (m@lp_m68k_init\(\);@); |
|---|
| 788 | | if ($right_place and not $done and |
|---|
| 789 | | m@CONFIG_SENSORS@) { |
|---|
| 790 | | $_ = <INPUT> while not m@#endif@; |
|---|
| 791 | | $_ = <INPUT>; |
|---|
| 792 | | $_ = <INPUT> if m@^$@; |
|---|
| 793 | | redo MAIN; |
|---|
| 794 | | } |
|---|
| 795 | | if ($right_place and not $done and m@return 0;@) { |
|---|
| 796 | | $pr2 = 1; |
|---|
| 797 | | print OUTPUT <<'EOF'; |
|---|
| 798 | | #ifdef CONFIG_SENSORS |
|---|
| 799 | | sensors_init_all(); |
|---|
| 800 | | #endif |
|---|
| 801 | | |
|---|
| 802 | | EOF |
|---|
| 803 | | $done = 1; |
|---|
| 804 | | } |
|---|
| 805 | | print OUTPUT; |
|---|
| 806 | | } |
|---|
| 807 | | close INPUT; |
|---|
| 808 | | close OUTPUT; |
|---|
| 809 | | die "Automatic patch generation for `drivers/char/mem.c' failed.\n". |
|---|
| 810 | | "See our home page http://www.lm-sensors.nu for assistance!" if $pr1 == 0 or $pr2 == 0; |
|---|
| 811 | | print_diff $package_root,$kernel_root,$kernel_file,$package_file; |
|---|
| 812 | | } |
|---|
| 813 | | |
|---|
| 814 | | |
|---|
| 1413 | | # This generates diffs for drivers/i2c/i2c-core.c |
|---|
| 1414 | | # Lines are generated at the beginning to declare several *_init functions. |
|---|
| 1415 | | # At the bottom, calls to them are added when the sensors stuff is configured |
|---|
| 1416 | | # in. |
|---|
| 1417 | | # $_[0]: sensors package root (like /tmp/sensors) |
|---|
| 1418 | | # $_[1]: Linux kernel tree (like /usr/src/linux) |
|---|
| 1419 | | sub gen_drivers_i2c_i2c_core_c |
|---|
| 1420 | | { |
|---|
| 1421 | | my ($package_root,$kernel_root) = @_; |
|---|
| 1422 | | my $kernel_file = "drivers/i2c/i2c-core.c"; |
|---|
| 1423 | | my $package_file = $temp; |
|---|
| 1424 | | my $patch_nr = 1; |
|---|
| 1425 | | |
|---|
| 1426 | | open INPUT,"$kernel_root/$kernel_file" |
|---|
| 1427 | | or die "Can't open `$kernel_root/$kernel_file'"; |
|---|
| 1428 | | open OUTPUT,">$package_root/$package_file" |
|---|
| 1429 | | or die "Can't open $package_root/$package_file"; |
|---|
| 1430 | | while(<INPUT>) { |
|---|
| 1431 | | if (m@sensors code starts here@) { |
|---|
| 1432 | | print OUTPUT; |
|---|
| 1433 | | while (<INPUT>) { |
|---|
| 1434 | | last if m@sensors code ends here@; |
|---|
| 1435 | | } |
|---|
| 1436 | | if ($patch_nr == 1) { |
|---|
| 1437 | | print OUTPUT << 'EOF'; |
|---|
| 1438 | | #ifdef CONFIG_I2C_ALI1535 |
|---|
| 1439 | | extern int i2c_ali1535_init(void); |
|---|
| 1440 | | #endif |
|---|
| 1441 | | #ifdef CONFIG_I2C_ALI15X3 |
|---|
| 1442 | | extern int i2c_ali15x3_init(void); |
|---|
| 1443 | | #endif |
|---|
| 1444 | | #ifdef CONFIG_I2C_AMD756 |
|---|
| 1445 | | extern int i2c_amd756_init(void); |
|---|
| 1446 | | #endif |
|---|
| 1447 | | #ifdef CONFIG_I2C_AMD8111 |
|---|
| 1448 | | extern int i2c_amd8111_init(void); |
|---|
| 1449 | | #endif |
|---|
| 1450 | | #ifdef CONFIG_I2C_HYDRA |
|---|
| 1451 | | extern int i2c_hydra_init(void); |
|---|
| 1452 | | #endif |
|---|
| 1453 | | #ifdef CONFIG_I2C_I801 |
|---|
| 1454 | | extern int i2c_i801_init(void); |
|---|
| 1455 | | #endif |
|---|
| 1456 | | #ifdef CONFIG_I2C_I810 |
|---|
| 1457 | | extern int i2c_i810_init(void); |
|---|
| 1458 | | #endif |
|---|
| 1459 | | #ifdef CONFIG_I2C_ISA |
|---|
| 1460 | | extern int i2c_isa_init(void); |
|---|
| 1461 | | #endif |
|---|
| 1462 | | #ifdef CONFIG_I2C_PIIX4 |
|---|
| 1463 | | extern int i2c_piix4_init(void); |
|---|
| 1464 | | #endif |
|---|
| 1465 | | #ifdef CONFIG_I2C_SIS5595 |
|---|
| 1466 | | extern int i2c_sis5595_init(void); |
|---|
| 1467 | | #endif |
|---|
| 1468 | | #ifdef CONFIG_I2C_SIS630 |
|---|
| 1469 | | extern int i2c_sis630_init(void); |
|---|
| 1470 | | #endif |
|---|
| 1471 | | #ifdef CONFIG_I2C_SIS645 |
|---|
| 1472 | | extern int sis645_init(void); |
|---|
| 1473 | | #endif |
|---|
| 1474 | | #ifdef CONFIG_I2C_SAVAGE4 |
|---|
| 1475 | | extern int i2c_savage4_init(void); |
|---|
| 1476 | | #endif |
|---|
| 1477 | | #ifdef CONFIG_I2C_TSUNAMI |
|---|
| 1478 | | extern int i2c_tsunami_init(void); |
|---|
| 1479 | | #endif |
|---|
| 1480 | | #ifdef CONFIG_I2C_VIA |
|---|
| 1481 | | extern int i2c_via_init(void); |
|---|
| 1482 | | #endif |
|---|
| 1483 | | #ifdef CONFIG_I2C_VIAPRO |
|---|
| 1484 | | extern int i2c_vt596_init(void); |
|---|
| 1485 | | #endif |
|---|
| 1486 | | #ifdef CONFIG_I2C_VOODOO3 |
|---|
| 1487 | | extern int i2c_voodoo3_init(void); |
|---|
| 1488 | | #endif |
|---|
| 1489 | | EOF |
|---|
| 1490 | | } elsif ($patch_nr == 2) { |
|---|
| 1491 | | print OUTPUT << 'EOF'; |
|---|
| 1492 | | #ifdef CONFIG_I2C_ALI1535 |
|---|
| 1493 | | i2c_ali1535_init(); |
|---|
| 1494 | | #endif |
|---|
| 1495 | | #ifdef CONFIG_I2C_ALI15X3 |
|---|
| 1496 | | i2c_ali15x3_init(); |
|---|
| 1497 | | #endif |
|---|
| 1498 | | #ifdef CONFIG_I2C_AMD756 |
|---|
| 1499 | | i2c_amd756_init(); |
|---|
| 1500 | | #endif |
|---|
| 1501 | | #ifdef CONFIG_I2C_AMD8111 |
|---|
| 1502 | | i2c_amd8111_init(); |
|---|
| 1503 | | #endif |
|---|
| 1504 | | #ifdef CONFIG_I2C_HYDRA |
|---|
| 1505 | | i2c_hydra_init(); |
|---|
| 1506 | | #endif |
|---|
| 1507 | | #ifdef CONFIG_I2C_I801 |
|---|
| 1508 | | i2c_i801_init(); |
|---|
| 1509 | | #endif |
|---|
| 1510 | | #ifdef CONFIG_I2C_I810 |
|---|
| 1511 | | i2c_i810_init(); |
|---|
| 1512 | | #endif |
|---|
| 1513 | | #ifdef CONFIG_I2C_PIIX4 |
|---|
| 1514 | | i2c_piix4_init(); |
|---|
| 1515 | | #endif |
|---|
| 1516 | | #ifdef CONFIG_I2C_SIS5595 |
|---|
| 1517 | | i2c_sis5595_init(); |
|---|
| 1518 | | #endif |
|---|
| 1519 | | #ifdef CONFIG_I2C_SIS630 |
|---|
| 1520 | | i2c_sis630_init(); |
|---|
| 1521 | | #endif |
|---|
| 1522 | | #ifdef CONFIG_I2C_SIS645 |
|---|
| 1523 | | sis645_init(); |
|---|
| 1524 | | #endif |
|---|
| 1525 | | #ifdef CONFIG_I2C_SAVAGE4 |
|---|
| 1526 | | i2c_savage4_init(); |
|---|
| 1527 | | #endif |
|---|
| 1528 | | #ifdef CONFIG_I2C_TSUNAMI |
|---|
| 1529 | | i2c_tsunami_init(); |
|---|
| 1530 | | #endif |
|---|
| 1531 | | #ifdef CONFIG_I2C_VIA |
|---|
| 1532 | | i2c_via_init(); |
|---|
| 1533 | | #endif |
|---|
| 1534 | | #ifdef CONFIG_I2C_VIAPRO |
|---|
| 1535 | | i2c_vt596_init(); |
|---|
| 1536 | | #endif |
|---|
| 1537 | | #ifdef CONFIG_I2C_VOODOO3 |
|---|
| 1538 | | i2c_voodoo3_init(); |
|---|
| 1539 | | #endif |
|---|
| 1540 | | #ifdef CONFIG_I2C_ISA |
|---|
| 1541 | | i2c_isa_init(); |
|---|
| 1542 | | #endif |
|---|
| 1543 | | EOF |
|---|
| 1544 | | } |
|---|
| 1545 | | $patch_nr ++; |
|---|
| 1546 | | } |
|---|
| 1547 | | print OUTPUT; |
|---|
| 1548 | | } |
|---|
| 1549 | | close INPUT; |
|---|
| 1550 | | close OUTPUT; |
|---|
| 1551 | | die "Automatic patch generation for `drivers/i2c/i2c-core.c' failed.\n". |
|---|
| 1552 | | "See our home page http://www.lm-sensors.nu for assistance!" if $patch_nr != 3; |
|---|
| 1553 | | print_diff $package_root,$kernel_root,$kernel_file,$package_file; |
|---|
| 1554 | | } |
|---|
| 1555 | | |
|---|