diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index a3e23b10ae976a34dba1b9c1e72e7e6c5a83db98..a325a0c890dc8e0a49ce4992ca4735ba5b5d1530 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -328,6 +328,15 @@ while ($ARGV[0] =~ m/^-(.*)/) {
}
}
+# get kernel version from env
+sub get_kernel_version() {
+ my $version;
+
+ if (defined($ENV{'KERNELVERSION'})) {
+ $version = $ENV{'KERNELVERSION'};
+ }
+ return $version;
+}
# generate a sequence of code that will splice in highlighting information
# using the s// operator.
@@ -601,6 +610,7 @@ sub output_function_xml(%) {
print "\n";
print " ".$args{'function'}."\n";
print " 9\n";
+ print " " . get_kernel_version() . "\n";
print "\n";
print "\n";
print " ".$args{'function'}."\n";
@@ -677,6 +687,7 @@ sub output_struct_xml(%) {
print "\n";
print " ".$args{'type'}." ".$args{'struct'}."\n";
print " 9\n";
+ print " " . get_kernel_version() . "\n";
print "\n";
print "\n";
print " ".$args{'type'}." ".$args{'struct'}."\n";
@@ -761,6 +772,7 @@ sub output_enum_xml(%) {
print "\n";
print " enum ".$args{'enum'}."\n";
print " 9\n";
+ print " " . get_kernel_version() . "\n";
print "\n";
print "\n";
print " enum ".$args{'enum'}."\n";