Skip to content

Commit

Permalink
scripts: checkversion: modernize linux/version.h search strings
Browse files Browse the repository at this point in the history
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 <rdunlap@infradead.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
  • Loading branch information
rddunlap authored and masahir0y committed Aug 5, 2021
1 parent 28bbbb9 commit 54eacba
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions scripts/checkversion.pl
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#! /usr/bin/env perl
# SPDX-License-Identifier: GPL-2.0
#
# checkversion find uses of LINUX_VERSION_CODE or KERNEL_VERSION
# without including <linux/version.h>, or cases of
# including <linux/version.h> that don't need it.
# Copyright (C) 2003, Randy Dunlap <rdunlap@xenotime.net>
# checkversion finds uses of all macros in <linux/version.h>
# where the source files do not #include <linux/version.h>; or cases
# of including <linux/version.h> where it is not needed.
# Copyright (C) 2003, Randy Dunlap <rdunlap@infradead.org>

use strict;

Expand All @@ -13,7 +13,8 @@
my $debugging;

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

# Look for uses: LINUX_VERSION_CODE, KERNEL_VERSION, UTS_RELEASE
if (($_ =~ /LINUX_VERSION_CODE/) || ($_ =~ /\WKERNEL_VERSION/)) {
# Look for uses: LINUX_VERSION_CODE, KERNEL_VERSION,
# LINUX_VERSION_MAJOR, LINUX_VERSION_PATCHLEVEL, LINUX_VERSION_SUBLEVEL
if (($_ =~ /LINUX_VERSION_CODE/) || ($_ =~ /\WKERNEL_VERSION/) ||
($_ =~ /LINUX_VERSION_MAJOR/) || ($_ =~ /LINUX_VERSION_PATCHLEVEL/) ||
($_ =~ /LINUX_VERSION_SUBLEVEL/)) {
$fUseVersion = 1;
last if $iLinuxVersion;
}
Expand Down

0 comments on commit 54eacba

Please sign in to comment.