Skip to content

Commit 54eacba

Browse files
rddunlapmasahir0y
authored andcommitted
scripts: checkversion: modernize linux/version.h search strings
Update scripts/checkversion.pl to recognize the current contents of <linux/version.h> and both of its current locations. Also update my email address. Signed-off-by: Randy Dunlap <[email protected]> Signed-off-by: Masahiro Yamada <[email protected]>
1 parent 28bbbb9 commit 54eacba

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

scripts/checkversion.pl

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#! /usr/bin/env perl
22
# SPDX-License-Identifier: GPL-2.0
33
#
4-
# checkversion find uses of LINUX_VERSION_CODE or KERNEL_VERSION
5-
# without including <linux/version.h>, or cases of
6-
# including <linux/version.h> that don't need it.
7-
# Copyright (C) 2003, Randy Dunlap <rdunlap@xenotime.net>
4+
# checkversion finds uses of all macros in <linux/version.h>
5+
# where the source files do not #include <linux/version.h>; or cases
6+
# of including <linux/version.h> where it is not needed.
7+
# Copyright (C) 2003, Randy Dunlap <rdunlap@infradead.org>
88

99
use strict;
1010

@@ -13,7 +13,8 @@
1313
my $debugging;
1414

1515
foreach my $file (@ARGV) {
16-
next if $file =~ "include/linux/version\.h";
16+
next if $file =~ "include/generated/uapi/linux/version\.h";
17+
next if $file =~ "usr/include/linux/version\.h";
1718
# Open this file.
1819
open( my $f, '<', $file )
1920
or die "Can't open $file: $!\n";
@@ -41,8 +42,11 @@
4142
$iLinuxVersion = $. if m/^\s*#\s*include\s*<linux\/version\.h>/o;
4243
}
4344

44-
# Look for uses: LINUX_VERSION_CODE, KERNEL_VERSION, UTS_RELEASE
45-
if (($_ =~ /LINUX_VERSION_CODE/) || ($_ =~ /\WKERNEL_VERSION/)) {
45+
# Look for uses: LINUX_VERSION_CODE, KERNEL_VERSION,
46+
# LINUX_VERSION_MAJOR, LINUX_VERSION_PATCHLEVEL, LINUX_VERSION_SUBLEVEL
47+
if (($_ =~ /LINUX_VERSION_CODE/) || ($_ =~ /\WKERNEL_VERSION/) ||
48+
($_ =~ /LINUX_VERSION_MAJOR/) || ($_ =~ /LINUX_VERSION_PATCHLEVEL/) ||
49+
($_ =~ /LINUX_VERSION_SUBLEVEL/)) {
4650
$fUseVersion = 1;
4751
last if $iLinuxVersion;
4852
}

0 commit comments

Comments
 (0)