Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D8C70125D0 for ; Wed, 22 Apr 2026 00:01:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=216.40.44.13 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776816077; cv=none; b=pnhJ+7zkAxJZvmzvhUN2FB8S+e2zzaR+IF0UpbaX+vDLnUEvz00WYQY7yhXsbJ7xEdR+dbVGLmycjDBIviRSqYL/iZ3/m4as5wPUfiP5BPhNqIyJ3wXKSk4NVk+8VZ+j9l47AKiGiQgUDRLqtkCLUMorPVEmqFtNjo7i17r2Bko= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776816077; c=relaxed/simple; bh=BXhwEUzcXFmtfIutmpOUxLsTQ6F1lw7YQk+uKEix2YQ=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=MUu787W+E0h2n7aX/7dyP8In+4HsK4LfkbVCRpvPNfXiaxfUD4jJqJGX0zaEa6cHJlokPqTGk9fVcW7lBlt3YfVLrfN1BpIOCkpBAAaeYoKQ58Us08dQSIeNfpk0al2l2c9Q1gMv4NmrUBxGGKin6aEhJffJltYW10ZHTw6RBgM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=perches.com; spf=pass smtp.mailfrom=perches.com; arc=none smtp.client-ip=216.40.44.13 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=perches.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=perches.com Received: from omf06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 67E9B1613F8; Wed, 22 Apr 2026 00:01:08 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf06.hostedemail.com (Postfix) with ESMTPA id F33352000F; Wed, 22 Apr 2026 00:01:05 +0000 (UTC) Message-ID: Subject: Re: [PATCH v8 2/2] checkpatch: Add option to not force /* */ for SPDX From: Joe Perches To: Petr Vorel , linux-kernel@vger.kernel.org, Andrew Morton Cc: Simon Glass , Dwaipayan Ray , Lukas Bulwahn Date: Tue, 21 Apr 2026 17:01:04 -0700 In-Reply-To: <20260421211408.383972-2-pvorel@suse.cz> References: <20260421211408.383972-1-pvorel@suse.cz> <20260421211408.383972-2-pvorel@suse.cz> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.58.3 (3.58.3-1.fc43) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Stat-Signature: s5qq5omdhf1ykr1gmi7zea51xejb5b9y X-Rspamd-Server: rspamout08 X-Rspamd-Queue-Id: F33352000F X-Session-Marker: 6A6F6540706572636865732E636F6D X-Session-ID: U2FsdGVkX1+bVWFyjMQAeX+gXR/i3jWZgt5lMj6azY4= X-HE-Tag: 1776816065-478966 X-HE-Meta: U2FsdGVkX18CS/GqYw685/OzFML8IQj9qalWt4dPysmUo4F4KtYcWGktz5uKrEPFNUqfb775HaYlVq6zXWtO5fwpQMU6xHY1DYMuuS1MQ7CXI3GJsBNesXMjaQKFTOk8jhXSjER0W8LCVUtFB+dVzx8Se25uUTV3oAqsqoJDEVbrlmGyVFotDkRqRc4/5Uen++uwtmJr/6nNwPfSEd1F5UH0Hs0AVrkmd1DtpoFJ63XTTHMIQpwQO9iLRiD+GKTo/hKrFxtJvkNqqNiOTZ0+rw4ixhND5mLKsGHNJypx1TCB5YA2vhl5k4wgM+JEt2+Ru5X7ReFWU8fqU/h+iEcAT8gW0iIsBL4+dHEc1uEBOAb863dMkoJhQsMy7IqAx73spEU2n5GyIN9stg08aO5v4pbZfEGZfYrQpzOuPe/ZTdk= On Tue, 2026-04-21 at 23:14 +0200, Petr Vorel wrote: > Add option --spdx-cxx-comments to not force C comments (/* */) for SPDX, > but allow also C++ comments (//). >=20 > As documented in aa19a176df95d6, this is required for some old > toolchains still have older assembler tools which cannot handle C++ > style comments. This avoids forcing this for projects which vendored > checkpatch.pl (e.g. LTP or u-boot). >=20 > Reviewed-by: Simon Glass <[sjg@chromium.org](mailto:sjg@chromium.org)> > Signed-off-by: Petr Vorel <[pvorel@suse.cz](mailto:pvorel@suse.cz)> Acked-by: Joe Perches > --- > The same as in v6 and v7. >=20 > Link to v7: > [https://lore.kernel.org/lkml/20260421103851.508142-2-pvorel@suse.cz/](ht= tps://lore.kernel.org/lkml/20260421103851.508142-2-pvorel@suse.cz/) >=20 > Link to v6: > [https://lore.kernel.org/lkml/20260420133014.484162-2-pvorel@suse.cz/](ht= tps://lore.kernel.org/lkml/20260420133014.484162-2-pvorel@suse.cz/) >=20 > Link to v5: > [https://lore.kernel.org/lkml/20260417170346.448758-2-pvorel@suse.cz/](ht= tps://lore.kernel.org/lkml/20260417170346.448758-2-pvorel@suse.cz/) >=20 > Link to v4: > [https://lore.kernel.org/lkml/20260415143636.272605-2-pvorel@suse.cz/](ht= tps://lore.kernel.org/lkml/20260415143636.272605-2-pvorel@suse.cz/) >=20 > Link to v3: > [https://lore.kernel.org/lkml/20260408120603.54351-2-pvorel@suse.cz/](htt= ps://lore.kernel.org/lkml/20260408120603.54351-2-pvorel@suse.cz/) > Documentation/dev-tools/checkpatch.rst | 7 +++++++ > scripts/checkpatch.pl | 23 ++++++++++++++++++----- > 2 files changed, 25 insertions(+), 5 deletions(-) >=20 > diff --git a/Documentation/dev-tools/checkpatch.rst b/Documentation/dev-t= ools/checkpatch.rst > index 010dfcd615afc..6139a08c34cd8 100644 > --- a/Documentation/dev-tools/checkpatch.rst > +++ b/Documentation/dev-tools/checkpatch.rst > @@ -184,6 +184,13 @@ Available options: > Override checking of perl version. Runtime errors may be encountered= after > enabling this flag if the perl version does not meet the minimum spec= ified. > =20 > + - --spdx-cxx-comments > + > + Don't force C comments ``/* */`` for SPDX license (required by old > + toolchains), allow also C++ comments ``//``. > + > + NOTE: it should *not* be used for Linux mainline. > + > - --codespell > =20 > Use the codespell dictionary for checking spelling errors. > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl > index 8b44b3a6a4dd3..0d18771f1b013 100755 > --- a/scripts/checkpatch.pl > +++ b/scripts/checkpatch.pl > @@ -62,6 +62,7 @@ my $def_configuration_dirs_help =3D '.:$HOME:.scripts'; > my $env_config_dir =3D 'CHECKPATCH_CONFIG_DIR'; > my $max_line_length =3D 100; > my $ignore_perl_version =3D 0; > +my $spdx_cxx_comments =3D 0; > my $minimum_perl_version =3D 5.10.0; > my $min_conf_desc_length =3D 4; > my $spelling_file =3D "$D/spelling.txt"; > @@ -138,6 +139,10 @@ Options: > file. It's your fault if there's no backup= or git > --ignore-perl-version override checking of perl version. expect > runtime errors. > + --spdx-cxx-comments don't force C comments (/* */) for SPDX lic= ense > + (required by old toolchains), allow also C+= + > + comments (//). > + NOTE: it should *not* be used for Linux mai= nline. > --codespell Use the codespell dictionary for spelling/t= ypos > (default:$codespellfile) > --codespellfile Use this codespell dictionary > @@ -347,6 +352,7 @@ GetOptions( > 'fix!' =3D> \$fix, > 'fix-inplace!' =3D> \$fix_inplace, > 'ignore-perl-version!' =3D> \$ignore_perl_version, > + 'spdx-cxx-comments!' =3D> \$spdx_cxx_comments, > 'debug=3Ds' =3D> \%debug, > 'test-only=3Ds' =3D> \$tst_only, > 'codespell!' =3D> \$codespell, > @@ -3815,26 +3821,33 @@ sub process { > $checklicenseline =3D 2; > } elsif ($rawline =3D~ /^\+/) { > my $comment =3D ""; > - if ($realfile =3D~ /\.(h|s|S)$/) { > - $comment =3D '/*'; > - } elsif ($realfile =3D~ /\.(c|rs|dts|dtsi)$/) { > + if ($realfile =3D~ /\.(c|rs|dts|dtsi)$/) { > $comment =3D '//'; > } elsif (($checklicenseline =3D=3D 2) || $realfile =3D~ /\.(sh|pl|py= |awk|tc|yaml)$/) { > $comment =3D '#'; > } elsif ($realfile =3D~ /\.rst$/) { > $comment =3D '..'; > } > + my $pattern =3D qr{\Q$comment\E}; > + if ($realfile =3D~ /\.(h|s|S)$/) { > + $comment =3D '/*'; > + $pattern =3D qr{/\*}; > + if ($spdx_cxx_comments) { > + $comment =3D '// or /*'; > + $pattern =3D qr{//|/\*}; > + } > + } > =20 > # check SPDX comment style for .[chsS] files > if ($realfile =3D~ /\.[chsS]$/ && > $rawline =3D~ /SPDX-License-Identifier:/ && > - $rawline !~ m@^\+\s*\Q$comment\E\s*@) { > + $rawline !~ m@^\+\s*$pattern\s*@) { > WARN("SPDX_LICENSE_TAG", > "Improper SPDX comment style for '$realfile', please use '$com= ment' instead\n" . $herecurr); > } > =20 > if ($comment !~ /^$/ && > - $rawline !~ m@^\+\Q$comment\E SPDX-License-Identifier: @) { > + $rawline !~ m@^\+$pattern SPDX-License-Identifier: @) { > WARN("SPDX_LICENSE_TAG", > "Missing or malformed SPDX-License-Identifier tag in line $che= cklicenseline\n" . $herecurr); > } elsif ($rawline =3D~ /(SPDX-License-Identifier: .*)/) { >=20