From mboxrd@z Thu Jan 1 00:00:00 1970 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 02780329C74 for ; Mon, 23 Feb 2026 17:08:26 +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=1771866509; cv=none; b=sksgyVKfxXWbV7PISDAgwEbQ5slZNWiGWBhqqnl/gEU5dQnEBjmxrJvbdat2v0vM92FrqQ9pdsG+QRpF/ZnEPMQS70fuiJp1a9ZV4nMC0wuZEtUUsIUU5ra9xLUFrvc5CzR6TIohfUE75CGg+yXZqOYpkWfZ7CCPoaEQX1a9Ed4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771866509; c=relaxed/simple; bh=NG7FITmeO634LZpz3UY3+CpNonWaX2rLbZduH7oRiZI=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=akZ89rihFf5daciBZctkbuAZlBCmDxpCykMv9BTZ5AHG0KARY321RveRsghFThjssQYSVIyAkQ1gE1wwgYtEDbey0ybQ2W7nOXD8vshi1xs45C+4CPkPl2b1XzIsxbJVvpHSOchpVbNIvdLUS1XX/Q2mZL/E+WEISu/kB0GQ9Vg= 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 omf14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 9571316026F; Mon, 23 Feb 2026 17:08:19 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf14.hostedemail.com (Postfix) with ESMTPA id 076D332; Mon, 23 Feb 2026 17:08:16 +0000 (UTC) Message-ID: <38980cd5299bbf9939e40a3a1f2b0c98e20c5f34.camel@perches.com> Subject: Re: [PATCH 2/2] checkpatch: Add --conf-dir option From: Joe Perches To: Petr Vorel Cc: linux-kernel@vger.kernel.org, Andy Whitcroft , Dwaipayan Ray , Lukas Bulwahn , Kory Maincent , Tom Rini , Simon Glass , Kuan-Wei Chiu Date: Mon, 23 Feb 2026 09:08:16 -0800 In-Reply-To: <20260223155326.GB19338@pevik> References: <20260202144221.76765-1-pvorel@suse.cz> <20260202144221.76765-2-pvorel@suse.cz> <985cf97c90eb50cc6b205939b013fb16420243e1.camel@perches.com> <20260223155326.GB19338@pevik> Content-Type: text/plain; charset="ISO-8859-1" 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-Rspamd-Server: rspamout06 X-Rspamd-Queue-Id: 076D332 X-Stat-Signature: yhfbnuop6otqd7xfo7p73s7udrari59z X-Session-Marker: 6A6F6540706572636865732E636F6D X-Session-ID: U2FsdGVkX1/0RIc6rjEmEDAbIvUHdixz0ZnvRtzeonA= X-HE-Tag: 1771866496-393251 X-HE-Meta: U2FsdGVkX18UZn8CEicr6+YULDM25zqEzFWj9fSXTtkEq9VbPvc5PyL5MAt4iDY9QHfctMhfXj5RjfBS+m7awM1epKj27SRoC/8c7D/HdFl9weM/6uKwy/q1FK+wt7dN/98ugtiE4EGF3bBcORftFPmPxLvWYW+jwLHwUE8KJYJSEEaRld/Ty5rJv+W7GmkFwYkMepRszpWUCrPPC0A57luhAqwG93zS64FhLWg9j2ExCB6WGt83mMJBz90vMlnPxLoWB/bRgh/arueUCs4UrFkaYoV1Sm+kG8z7BV50G1v93cs0V+ML+yLjyshR7GJ2 On Mon, 2026-02-23 at 16:53 +0100, Petr Vorel wrote: > On Mon, 2026-02-02 at 15:42 +0100, Petr Vorel wrote: > > > This allows to directly use project configuration file for projects > > > which vendored checkpatch.pl (e.g. LTP or u-boot). [] > > Extend 'sub which_conf {' and the perhaps the code that uses it > > if you really need this capability. >=20 > Thanks for a hint. If there is a chance it will be accepted I'll have loo= k on > it. We would certainly appreciated not having to carry yet another checkp= atch.pl > patch in LTP. [] > > Though I think it's not all that useful. [] > We use LTP in makefile targets run from various subdirectories. For that = we > define our checkpatch.pl options (--ignore list and others) in certain Ma= kefile. > Then we have b4 configuration, where we also use checkpatch.pl options. >=20 > Mixing cd to rootdir and passing path to the sources is of course doable > (to reach config file in .scripts in project root directory) but quite ug= ly. >=20 > Also, allowing to pass a configuration file (quite common feature for any > software) would allow to run checkpatch.pl with different configs for dif= ferent > projects. Right now the HOME environment variable is used in which_conf. Perhaps prepend a CHECKPATCH_CONFIG environment where the right .checkpatch.conf would be found? Maybe something like the below and executed with something like $ CHECKPATCH_CONFIG=3D checkpatch.pl etc... --- diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index e56374662ff7..355542d7d5a9 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -1532,7 +1532,11 @@ sub which { sub which_conf { my ($conf) =3D @_; =20 - foreach my $path (split(/:/, ".:$ENV{HOME}:.scripts")) { + my $env_config_path =3D 'CHECKPATCH_CONFIG'; + my $paths =3D $ENV{$env_config_path} . ':' if exists($ENV{$env_config_pat= h}); + $paths .=3D ".:$ENV{'HOME'}:.scripts"; + + foreach my $path (split(/:/, $paths)) { if (-e "$path/$conf") { return "$path/$conf"; }