diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index a3e23b10ae97..a325a0c890dc 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";