diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/kernel-doc | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/scripts/kernel-doc b/scripts/kernel-doc index 8bb83a100edb..0f11870116dc 100755 --- a/scripts/kernel-doc +++ b/scripts/kernel-doc | |||
@@ -1827,6 +1827,40 @@ sub reset_state { | |||
1827 | $state = 0; | 1827 | $state = 0; |
1828 | } | 1828 | } |
1829 | 1829 | ||
1830 | sub syscall_munge() { | ||
1831 | my $void = 0; | ||
1832 | |||
1833 | $prototype =~ s@[\r\n\t]+@ @gos; # strip newlines/CR's/tabs | ||
1834 | ## if ($prototype =~ m/SYSCALL_DEFINE0\s*\(\s*(a-zA-Z0-9_)*\s*\)/) { | ||
1835 | if ($prototype =~ m/SYSCALL_DEFINE0/) { | ||
1836 | $void = 1; | ||
1837 | ## $prototype = "long sys_$1(void)"; | ||
1838 | } | ||
1839 | |||
1840 | $prototype =~ s/SYSCALL_DEFINE.*\(/long sys_/; # fix return type & func name | ||
1841 | if ($prototype =~ m/long (sys_.*?),/) { | ||
1842 | $prototype =~ s/,/\(/; | ||
1843 | } elsif ($void) { | ||
1844 | $prototype =~ s/\)/\(void\)/; | ||
1845 | } | ||
1846 | |||
1847 | # now delete all of the odd-number commas in $prototype | ||
1848 | # so that arg types & arg names don't have a comma between them | ||
1849 | my $count = 0; | ||
1850 | my $len = length($prototype); | ||
1851 | if ($void) { | ||
1852 | $len = 0; # skip the for-loop | ||
1853 | } | ||
1854 | for (my $ix = 0; $ix < $len; $ix++) { | ||
1855 | if (substr($prototype, $ix, 1) eq ',') { | ||
1856 | $count++; | ||
1857 | if ($count % 2 == 1) { | ||
1858 | substr($prototype, $ix, 1) = ' '; | ||
1859 | } | ||
1860 | } | ||
1861 | } | ||
1862 | } | ||
1863 | |||
1830 | sub process_state3_function($$) { | 1864 | sub process_state3_function($$) { |
1831 | my $x = shift; | 1865 | my $x = shift; |
1832 | my $file = shift; | 1866 | my $file = shift; |
@@ -1839,11 +1873,15 @@ sub process_state3_function($$) { | |||
1839 | elsif ($x =~ /([^\{]*)/) { | 1873 | elsif ($x =~ /([^\{]*)/) { |
1840 | $prototype .= $1; | 1874 | $prototype .= $1; |
1841 | } | 1875 | } |
1876 | |||
1842 | if (($x =~ /\{/) || ($x =~ /\#\s*define/) || ($x =~ /;/)) { | 1877 | if (($x =~ /\{/) || ($x =~ /\#\s*define/) || ($x =~ /;/)) { |
1843 | $prototype =~ s@/\*.*?\*/@@gos; # strip comments. | 1878 | $prototype =~ s@/\*.*?\*/@@gos; # strip comments. |
1844 | $prototype =~ s@[\r\n]+@ @gos; # strip newlines/cr's. | 1879 | $prototype =~ s@[\r\n]+@ @gos; # strip newlines/cr's. |
1845 | $prototype =~ s@^\s+@@gos; # strip leading spaces | 1880 | $prototype =~ s@^\s+@@gos; # strip leading spaces |
1846 | dump_function($prototype,$file); | 1881 | if ($prototype =~ /SYSCALL_DEFINE/) { |
1882 | syscall_munge(); | ||
1883 | } | ||
1884 | dump_function($prototype, $file); | ||
1847 | reset_state(); | 1885 | reset_state(); |
1848 | } | 1886 | } |
1849 | } | 1887 | } |