Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild

Pull kbuild misc changes from Michal Marek:
"In the non-critical part of kbuild, I have
- Some make coccicheck improvements and two new tests
- Support for a cleaner html output in scripts/kernel-doc, named
html5 (no, it does not play videos, yet)

BTW, Randy wants to route further kernel-doc patches through the
kbuild tree."

* 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild:
Update SmPL/Coccinelle section of MAINTAINERS
coccicheck: Add the rep+ctxt mode
scripts/coccinelle/tests/odd_ptr_err.cocci: semantic patch for IS_ERR/PTR_ERR inconsistency
scripts/tags.sh: Add magic for pci access functions
scripts/coccinelle: ptr_ret: Add ternary operator version
scripts/kernel-doc: drop maintainer
scripts/kernel-doc: added support for html5

+369 -17
+3 -8
MAINTAINERS
··· 1958 1958 F: drivers/platform/x86/classmate-laptop.c 1959 1959 1960 1960 COCCINELLE/Semantic Patches (SmPL) 1961 - M: Julia Lawall <julia@diku.dk> 1961 + M: Julia Lawall <Julia.Lawall@lip6.fr> 1962 1962 M: Gilles Muller <Gilles.Muller@lip6.fr> 1963 - M: Nicolas Palix <npalix.work@gmail.com> 1964 - L: cocci@diku.dk (moderated for non-subscribers) 1963 + M: Nicolas Palix <nicolas.palix@imag.fr> 1964 + L: cocci@systeme.lip6.fr (moderated for non-subscribers) 1965 1965 W: http://coccinelle.lip6.fr/ 1966 1966 S: Supported 1967 1967 F: scripts/coccinelle/ ··· 2422 2422 S: Maintained 2423 2423 F: Documentation/hwmon/dme1737 2424 2424 F: drivers/hwmon/dme1737.c 2425 - 2426 - DOCBOOK FOR DOCUMENTATION 2427 - M: Randy Dunlap <rdunlap@xenotime.net> 2428 - S: Maintained 2429 - F: scripts/kernel-doc 2430 2425 2431 2426 DOCKING STATION DRIVER 2432 2427 M: Shaohua Li <shaohua.li@intel.com>
+3
scripts/coccicheck
··· 95 95 $SPATCH -D report $FLAGS -sp_file $COCCI $OPT $OPTIONS -no_show_diff || \ 96 96 $SPATCH -D context $FLAGS -sp_file $COCCI $OPT $OPTIONS || \ 97 97 $SPATCH -D org $FLAGS -sp_file $COCCI $OPT $OPTIONS -no_show_diff || exit 1 98 + elif [ "$MODE" = "rep+ctxt" ] ; then 99 + $SPATCH -D report $FLAGS -sp_file $COCCI $OPT $OPTIONS -no_show_diff && \ 100 + $SPATCH -D context $FLAGS -sp_file $COCCI $OPT $OPTIONS || exit 1 98 101 else 99 102 $SPATCH -D $MODE $FLAGS -sp_file $COCCI $OPT $OPTIONS || exit 1 100 103 fi
+26
scripts/coccinelle/api/ptr_ret.cocci
··· 30 30 - if (IS_ERR(ptr)) return PTR_ERR(ptr); return 0; 31 31 + return PTR_RET(ptr); 32 32 33 + @depends on patch@ 34 + expression ptr; 35 + @@ 36 + 37 + - (IS_ERR(ptr) ? PTR_ERR(ptr) : 0) 38 + + PTR_RET(ptr) 39 + 33 40 @r1 depends on !patch@ 34 41 expression ptr; 35 42 position p1; ··· 51 44 52 45 * if@p2 (IS_ERR(ptr)) return PTR_ERR(ptr); return 0; 53 46 47 + @r3 depends on !patch@ 48 + expression ptr; 49 + position p3; 50 + @@ 51 + 52 + * IS_ERR@p3(ptr) ? PTR_ERR(ptr) : 0 53 + 54 54 @script:python depends on org@ 55 55 p << r1.p1; 56 56 @@ ··· 67 53 68 54 @script:python depends on org@ 69 55 p << r2.p2; 56 + @@ 57 + 58 + coccilib.org.print_todo(p[0], "WARNING: PTR_RET can be used") 59 + 60 + @script:python depends on org@ 61 + p << r3.p3; 70 62 @@ 71 63 72 64 coccilib.org.print_todo(p[0], "WARNING: PTR_RET can be used") ··· 85 65 86 66 @script:python depends on report@ 87 67 p << r2.p2; 68 + @@ 69 + 70 + coccilib.report.print_report(p[0], "WARNING: PTR_RET can be used") 71 + 72 + @script:python depends on report@ 73 + p << r3.p3; 88 74 @@ 89 75 90 76 coccilib.report.print_report(p[0], "WARNING: PTR_RET can be used")
+65
scripts/coccinelle/tests/odd_ptr_err.cocci
··· 1 + /// PTR_ERR should access the value just tested by IS_ERR 2 + //# There can be false positives in the patch case, where it is the call 3 + //# IS_ERR that is wrong. 4 + /// 5 + // Confidence: High 6 + // Copyright: (C) 2012 Julia Lawall, INRIA. GPLv2. 7 + // Copyright: (C) 2012 Gilles Muller, INRIA. GPLv2. 8 + // URL: http://coccinelle.lip6.fr/ 9 + // Comments: 10 + // Options: -no_includes -include_headers 11 + 12 + virtual patch 13 + virtual context 14 + virtual org 15 + virtual report 16 + 17 + @depends on patch@ 18 + expression e,e1; 19 + @@ 20 + 21 + ( 22 + if (IS_ERR(e)) { ... PTR_ERR(e) ... } 23 + | 24 + if (IS_ERR(e=e1)) { ... PTR_ERR(e) ... } 25 + | 26 + if (IS_ERR(e)) 27 + { ... 28 + PTR_ERR( 29 + - e1 30 + + e 31 + ) 32 + ... } 33 + ) 34 + 35 + @r depends on !patch@ 36 + expression e,e1; 37 + position p1,p2; 38 + @@ 39 + 40 + ( 41 + if (IS_ERR(e)) { ... PTR_ERR(e) ... } 42 + | 43 + if (IS_ERR(e=e1)) { ... PTR_ERR(e) ... } 44 + | 45 + *if (IS_ERR@p1(e)) 46 + { ... 47 + * PTR_ERR@p2(e1) 48 + ... } 49 + ) 50 + 51 + @script:python depends on org@ 52 + p1 << r.p1; 53 + p2 << r.p2; 54 + @@ 55 + 56 + cocci.print_main("inconsistent IS_ERR and PTR_ERR",p1) 57 + cocci.print_secs("PTR_ERR",p2) 58 + 59 + @script:python depends on report@ 60 + p1 << r.p1; 61 + p2 << r.p2; 62 + @@ 63 + 64 + msg = "inconsistent IS_ERR and PTR_ERR, PTR_ERR on line %s" % (p2[0].line) 65 + coccilib.report.print_report(p1[0],msg)
+266 -7
scripts/kernel-doc
··· 6 6 ## Copyright (C) 2000, 1 Tim Waugh <twaugh@redhat.com> ## 7 7 ## Copyright (C) 2001 Simon Huggins ## 8 8 ## Copyright (C) 2005-2012 Randy Dunlap ## 9 + ## Copyright (C) 2012 Dan Luedtke ## 9 10 ## ## 10 11 ## #define enhancements by Armin Kuster <akuster@mvista.com> ## 11 12 ## Copyright (c) 2000 MontaVista Software, Inc. ## ··· 36 35 # Small fixes (like spaces vs. \s in regex) 37 36 # -- Tim Jansen <tim@tjansen.de> 38 37 38 + # 25/07/2012 - Added support for HTML5 39 + # -- Dan Luedtke <mail@danrl.de> 39 40 40 41 # 41 42 # This will read a 'c' file and scan for embedded comments in the ··· 47 44 # Note: This only supports 'c'. 48 45 49 46 # usage: 50 - # kernel-doc [ -docbook | -html | -text | -man | -list ] [ -no-doc-sections ] 51 - # [ -function funcname [ -function funcname ...] ] c file(s)s > outputfile 47 + # kernel-doc [ -docbook | -html | -html5 | -text | -man | -list ] 48 + # [ -no-doc-sections ] 49 + # [ -function funcname [ -function funcname ...] ] 50 + # c file(s)s > outputfile 52 51 # or 53 - # [ -nofunction funcname [ -function funcname ...] ] c file(s)s > outputfile 52 + # [ -nofunction funcname [ -function funcname ...] ] 53 + # c file(s)s > outputfile 54 54 # 55 - # Set output format using one of -docbook -html -text or -man. Default is man. 55 + # Set output format using one of -docbook -html -html5 -text or -man. 56 + # Default is man. 56 57 # The -list format is for internal use by docproc. 57 58 # 58 59 # -no-doc-sections ··· 189 182 my $local_gt = "\\\\\\\\gt:"; 190 183 my $blankline_html = $local_lt . "p" . $local_gt; # was "<p>" 191 184 185 + # html version 5 186 + my %highlights_html5 = ( $type_constant, "<span class=\"const\">\$1</span>", 187 + $type_func, "<span class=\"func\">\$1</span>", 188 + $type_struct_xml, "<span class=\"struct\">\$1</span>", 189 + $type_env, "<span class=\"env\">\$1</span>", 190 + $type_param, "<span class=\"param\">\$1</span>" ); 191 + my $blankline_html5 = $local_lt . "br /" . $local_gt; 192 + 192 193 # XML, docbook format 193 194 my %highlights_xml = ( "([^=])\\\"([^\\\"<]+)\\\"", "\$1<quote>\$2</quote>", 194 195 $type_constant, "<constant>\$1</constant>", ··· 326 311 $output_mode = "html"; 327 312 %highlights = %highlights_html; 328 313 $blankline = $blankline_html; 314 + } elsif ($cmd eq "-html5") { 315 + $output_mode = "html5"; 316 + %highlights = %highlights_html5; 317 + $blankline = $blankline_html5; 329 318 } elsif ($cmd eq "-man") { 330 319 $output_mode = "man"; 331 320 %highlights = %highlights_man; ··· 372 353 # continue execution near EOF; 373 354 374 355 sub usage { 375 - print "Usage: $0 [ -v ] [ -docbook | -html | -text | -man | -list ]\n"; 356 + print "Usage: $0 [ -docbook | -html | -html5 | -text | -man | -list ]\n"; 376 357 print " [ -no-doc-sections ]\n"; 377 358 print " [ -function funcname [ -function funcname ...] ]\n"; 378 359 print " [ -nofunction funcname [ -nofunction funcname ...] ]\n"; 360 + print " [ -v ]\n"; 379 361 print " c source file(s) > outputfile\n"; 380 362 print " -v : verbose output, more warnings & other info listed\n"; 381 363 exit 1; ··· 470 450 # confess "output_highlight got called with no args?\n"; 471 451 # } 472 452 473 - if ($output_mode eq "html" || $output_mode eq "xml") { 453 + if ($output_mode eq "html" || $output_mode eq "html5" || 454 + $output_mode eq "xml") { 474 455 $contents = local_unescape($contents); 475 456 # convert data read & converted thru xml_escape() into &xyz; format: 476 457 $contents =~ s/\\\\\\/\&/g; ··· 481 460 die $@ if $@; 482 461 # print STDERR "contents af:$contents\n"; 483 462 463 + # strip whitespaces when generating html5 464 + if ($output_mode eq "html5") { 465 + $contents =~ s/^\s+//; 466 + $contents =~ s/\s+$//; 467 + } 484 468 foreach $line (split "\n", $contents) { 485 469 if (! $output_preformatted) { 486 470 $line =~ s/^\s*//; ··· 506 480 } 507 481 } 508 482 509 - #output sections in html 483 + # output sections in html 510 484 sub output_section_html(%) { 511 485 my %args = %{$_[0]}; 512 486 my $section; ··· 664 638 print "</ul>\n"; 665 639 } 666 640 print "<hr>\n"; 641 + } 642 + 643 + # output sections in html5 644 + sub output_section_html5(%) { 645 + my %args = %{$_[0]}; 646 + my $section; 647 + 648 + foreach $section (@{$args{'sectionlist'}}) { 649 + print "<section>\n"; 650 + print "<h1>$section</h1>\n"; 651 + print "<p>\n"; 652 + output_highlight($args{'sections'}{$section}); 653 + print "</p>\n"; 654 + print "</section>\n"; 655 + } 656 + } 657 + 658 + # output enum in html5 659 + sub output_enum_html5(%) { 660 + my %args = %{$_[0]}; 661 + my ($parameter); 662 + my $count; 663 + my $html5id; 664 + 665 + $html5id = $args{'enum'}; 666 + $html5id =~ s/[^a-zA-Z0-9\-]+/_/g; 667 + print "<article class=\"enum\" id=\"enum:". $html5id . "\">"; 668 + print "<h1>enum " . $args{'enum'} . "</h1>\n"; 669 + print "<ol class=\"code\">\n"; 670 + print "<li>"; 671 + print "<span class=\"keyword\">enum</span> "; 672 + print "<span class=\"identifier\">" . $args{'enum'} . "</span> {"; 673 + print "</li>\n"; 674 + $count = 0; 675 + foreach $parameter (@{$args{'parameterlist'}}) { 676 + print "<li class=\"indent\">"; 677 + print "<span class=\"param\">" . $parameter . "</span>"; 678 + if ($count != $#{$args{'parameterlist'}}) { 679 + $count++; 680 + print ","; 681 + } 682 + print "</li>\n"; 683 + } 684 + print "<li>};</li>\n"; 685 + print "</ol>\n"; 686 + 687 + print "<section>\n"; 688 + print "<h1>Constants</h1>\n"; 689 + print "<dl>\n"; 690 + foreach $parameter (@{$args{'parameterlist'}}) { 691 + print "<dt>" . $parameter . "</dt>\n"; 692 + print "<dd>"; 693 + output_highlight($args{'parameterdescs'}{$parameter}); 694 + print "</dd>\n"; 695 + } 696 + print "</dl>\n"; 697 + print "</section>\n"; 698 + output_section_html5(@_); 699 + print "</article>\n"; 700 + } 701 + 702 + # output typedef in html5 703 + sub output_typedef_html5(%) { 704 + my %args = %{$_[0]}; 705 + my ($parameter); 706 + my $count; 707 + my $html5id; 708 + 709 + $html5id = $args{'typedef'}; 710 + $html5id =~ s/[^a-zA-Z0-9\-]+/_/g; 711 + print "<article class=\"typedef\" id=\"typedef:" . $html5id . "\">\n"; 712 + print "<h1>typedef " . $args{'typedef'} . "</h1>\n"; 713 + 714 + print "<ol class=\"code\">\n"; 715 + print "<li>"; 716 + print "<span class=\"keyword\">typedef</span> "; 717 + print "<span class=\"identifier\">" . $args{'typedef'} . "</span>"; 718 + print "</li>\n"; 719 + print "</ol>\n"; 720 + output_section_html5(@_); 721 + print "</article>\n"; 722 + } 723 + 724 + # output struct in html5 725 + sub output_struct_html5(%) { 726 + my %args = %{$_[0]}; 727 + my ($parameter); 728 + my $html5id; 729 + 730 + $html5id = $args{'struct'}; 731 + $html5id =~ s/[^a-zA-Z0-9\-]+/_/g; 732 + print "<article class=\"struct\" id=\"struct:" . $html5id . "\">\n"; 733 + print "<hgroup>\n"; 734 + print "<h1>" . $args{'type'} . " " . $args{'struct'} . "</h1>"; 735 + print "<h2>". $args{'purpose'} . "</h2>\n"; 736 + print "</hgroup>\n"; 737 + print "<ol class=\"code\">\n"; 738 + print "<li>"; 739 + print "<span class=\"type\">" . $args{'type'} . "</span> "; 740 + print "<span class=\"identifier\">" . $args{'struct'} . "</span> {"; 741 + print "</li>\n"; 742 + foreach $parameter (@{$args{'parameterlist'}}) { 743 + print "<li class=\"indent\">"; 744 + if ($parameter =~ /^#/) { 745 + print "<span class=\"param\">" . $parameter ."</span>\n"; 746 + print "</li>\n"; 747 + next; 748 + } 749 + my $parameter_name = $parameter; 750 + $parameter_name =~ s/\[.*//; 751 + 752 + ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next; 753 + $type = $args{'parametertypes'}{$parameter}; 754 + if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) { 755 + # pointer-to-function 756 + print "<span class=\"type\">$1</span> "; 757 + print "<span class=\"param\">$parameter</span>"; 758 + print "<span class=\"type\">)</span> "; 759 + print "(<span class=\"args\">$2</span>);"; 760 + } elsif ($type =~ m/^(.*?)\s*(:.*)/) { 761 + # bitfield 762 + print "<span class=\"type\">$1</span> "; 763 + print "<span class=\"param\">$parameter</span>"; 764 + print "<span class=\"bits\">$2</span>;"; 765 + } else { 766 + print "<span class=\"type\">$type</span> "; 767 + print "<span class=\"param\">$parameter</span>;"; 768 + } 769 + print "</li>\n"; 770 + } 771 + print "<li>};</li>\n"; 772 + print "</ol>\n"; 773 + 774 + print "<section>\n"; 775 + print "<h1>Members</h1>\n"; 776 + print "<dl>\n"; 777 + foreach $parameter (@{$args{'parameterlist'}}) { 778 + ($parameter =~ /^#/) && next; 779 + 780 + my $parameter_name = $parameter; 781 + $parameter_name =~ s/\[.*//; 782 + 783 + ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next; 784 + print "<dt>" . $parameter . "</dt>\n"; 785 + print "<dd>"; 786 + output_highlight($args{'parameterdescs'}{$parameter_name}); 787 + print "</dd>\n"; 788 + } 789 + print "</dl>\n"; 790 + print "</section>\n"; 791 + output_section_html5(@_); 792 + print "</article>\n"; 793 + } 794 + 795 + # output function in html5 796 + sub output_function_html5(%) { 797 + my %args = %{$_[0]}; 798 + my ($parameter, $section); 799 + my $count; 800 + my $html5id; 801 + 802 + $html5id = $args{'function'}; 803 + $html5id =~ s/[^a-zA-Z0-9\-]+/_/g; 804 + print "<article class=\"function\" id=\"func:". $html5id . "\">\n"; 805 + print "<hgroup>\n"; 806 + print "<h1>" . $args{'function'} . "</h1>"; 807 + print "<h2>" . $args{'purpose'} . "</h2>\n"; 808 + print "</hgroup>\n"; 809 + print "<ol class=\"code\">\n"; 810 + print "<li>"; 811 + print "<span class=\"type\">" . $args{'functiontype'} . "</span> "; 812 + print "<span class=\"identifier\">" . $args{'function'} . "</span> ("; 813 + print "</li>"; 814 + $count = 0; 815 + foreach $parameter (@{$args{'parameterlist'}}) { 816 + print "<li class=\"indent\">"; 817 + $type = $args{'parametertypes'}{$parameter}; 818 + if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) { 819 + # pointer-to-function 820 + print "<span class=\"type\">$1</span> "; 821 + print "<span class=\"param\">$parameter</span>"; 822 + print "<span class=\"type\">)</span> "; 823 + print "(<span class=\"args\">$2</span>)"; 824 + } else { 825 + print "<span class=\"type\">$type</span> "; 826 + print "<span class=\"param\">$parameter</span>"; 827 + } 828 + if ($count != $#{$args{'parameterlist'}}) { 829 + $count++; 830 + print ","; 831 + } 832 + print "</li>\n"; 833 + } 834 + print "<li>)</li>\n"; 835 + print "</ol>\n"; 836 + 837 + print "<section>\n"; 838 + print "<h1>Arguments</h1>\n"; 839 + print "<p>\n"; 840 + print "<dl>\n"; 841 + foreach $parameter (@{$args{'parameterlist'}}) { 842 + my $parameter_name = $parameter; 843 + $parameter_name =~ s/\[.*//; 844 + 845 + ($args{'parameterdescs'}{$parameter_name} ne $undescribed) || next; 846 + print "<dt>" . $parameter . "</dt>\n"; 847 + print "<dd>"; 848 + output_highlight($args{'parameterdescs'}{$parameter_name}); 849 + print "</dd>\n"; 850 + } 851 + print "</dl>\n"; 852 + print "</section>\n"; 853 + output_section_html5(@_); 854 + print "</article>\n"; 855 + } 856 + 857 + # output DOC: block header in html5 858 + sub output_blockhead_html5(%) { 859 + my %args = %{$_[0]}; 860 + my ($parameter, $section); 861 + my $count; 862 + my $html5id; 863 + 864 + foreach $section (@{$args{'sectionlist'}}) { 865 + $html5id = $section; 866 + $html5id =~ s/[^a-zA-Z0-9\-]+/_/g; 867 + print "<article class=\"doc\" id=\"doc:". $html5id . "\">\n"; 868 + print "<h1>$section</h1>\n"; 869 + print "<p>\n"; 870 + output_highlight($args{'sections'}{$section}); 871 + print "</p>\n"; 872 + } 873 + print "</article>\n"; 667 874 } 668 875 669 876 sub output_section_xml(%) {
+6 -2
scripts/tags.sh
··· 154 154 --regex-c++='/__CLEARPAGEFLAG_NOOP\(([^,)]*).*/__ClearPage\1/' \ 155 155 --regex-c++='/TESTCLEARFLAG_FALSE\(([^,)]*).*/TestClearPage\1/' \ 156 156 --regex-c++='/__TESTCLEARFLAG_FALSE\(([^,)]*).*/__TestClearPage\1/' \ 157 - --regex-c++='/_PE\(([^,)]*).*/PEVENT_ERRNO__\1/' 157 + --regex-c++='/_PE\(([^,)]*).*/PEVENT_ERRNO__\1/' \ 158 + --regex-c='/PCI_OP_READ\(([a-z]*[a-z]).*[1-4]\)/pci_bus_read_config_\1/' \ 159 + --regex-c='/PCI_OP_WRITE\(([a-z]*[a-z]).*[1-4]\)/pci_bus_write_config_\1/' 158 160 159 161 all_kconfigs | xargs $1 -a \ 160 162 --langdef=kconfig --language-force=kconfig \ ··· 199 197 --regex='/__CLEARPAGEFLAG_NOOP\(([^,)]*).*/__ClearPage\1/' \ 200 198 --regex='/TESTCLEARFLAG_FALSE\(([^,)]*).*/TestClearPage\1/' \ 201 199 --regex='/__TESTCLEARFLAG_FALSE\(([^,)]*).*/__TestClearPage\1/' \ 202 - --regex='/_PE\(([^,)]*).*/PEVENT_ERRNO__\1/' 200 + --regex='/_PE\(([^,)]*).*/PEVENT_ERRNO__\1/' \ 201 + --regex='/PCI_OP_READ\(([a-z]*[a-z]).*[1-4]\)/pci_bus_read_config_\1/' \ 202 + --regex='/PCI_OP_WRITE\(([a-z]*[a-z]).*[1-4]\)/pci_bus_write_config_\1/' 203 203 204 204 all_kconfigs | xargs $1 -a \ 205 205 --regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/\3/'