From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 978FC322A00 for ; Thu, 26 Mar 2026 20:50:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774558237; cv=none; b=nQBx30tyZKqsCTj9nTmRf6gJrtjFyMXw8GF75ZF3eypaBkvqmNdtmFRozsq7TusXkqvQCkhpFuoKy3CKzVYgoo/0SWsHtvzJi0a+2wjIYn+VwK4Pe7HhbNBfqRLNPJctHSEK/oZgdwtOZUuT9iN+Mktdb8sFpEmbrQDDESvwwrQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774558237; c=relaxed/simple; bh=tAEqi74tP1A7NMSiClu/bvn5j3Je/resT1eqHD7KPtU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=pAznBLsR1QCckeZ3DRrx0+XJAHnzU8xJD2er+vvVT9O7Uu3IbCFgxr0AivHh1SJlr4VXRyhIaszXh1N3FbIWR3Yax7CCuRZz4sL2xAxNF/iL1l921HBaLdAiEm7+7VFU3QwTtDH4eyhFOuqCozHrZtcMO4ca0Q56rTn0NHSQVeY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz; spf=pass smtp.mailfrom=suse.cz; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=zdyMeflT; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=mwyl9CAH; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=zdyMeflT; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=mwyl9CAH; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.cz Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="zdyMeflT"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="mwyl9CAH"; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="zdyMeflT"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="mwyl9CAH" Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id A8AF44D2EC; Thu, 26 Mar 2026 20:50:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1774558233; h=from:from:reply-to:reply-to:date:date:message-id:message-id:to:to: cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=VBdemCdOoVLYRETkNjdAuN1DG7EWy1wxH+LzXtNRkaU=; b=zdyMeflTwN8tlARvr+2s0begH0DPpoK1sijPznkazHVY/E2rRwhbi0MF/1w+AItQ84kIrI jaCKAk58uR8FGSXqFsq9NE5bEuMI2JlpEYfCmNNpl44FFTpvaymlb7kJFlaIukdB6Ef6dg D2SgD0lDzkc5FPjKRTmBFamBRZV4w9Q= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1774558233; h=from:from:reply-to:reply-to:date:date:message-id:message-id:to:to: cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=VBdemCdOoVLYRETkNjdAuN1DG7EWy1wxH+LzXtNRkaU=; b=mwyl9CAHEZZ1n7ASgqs7IC6JrilH+3bgEovFIE5SPBCnGh4TdCbuwQZ+G1UWVEU2vY+Oy5 MLuWvvWiPIbdngDA== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=zdyMeflT; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=mwyl9CAH DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1774558233; h=from:from:reply-to:reply-to:date:date:message-id:message-id:to:to: cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=VBdemCdOoVLYRETkNjdAuN1DG7EWy1wxH+LzXtNRkaU=; b=zdyMeflTwN8tlARvr+2s0begH0DPpoK1sijPznkazHVY/E2rRwhbi0MF/1w+AItQ84kIrI jaCKAk58uR8FGSXqFsq9NE5bEuMI2JlpEYfCmNNpl44FFTpvaymlb7kJFlaIukdB6Ef6dg D2SgD0lDzkc5FPjKRTmBFamBRZV4w9Q= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1774558233; h=from:from:reply-to:reply-to:date:date:message-id:message-id:to:to: cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=VBdemCdOoVLYRETkNjdAuN1DG7EWy1wxH+LzXtNRkaU=; b=mwyl9CAHEZZ1n7ASgqs7IC6JrilH+3bgEovFIE5SPBCnGh4TdCbuwQZ+G1UWVEU2vY+Oy5 MLuWvvWiPIbdngDA== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 935ED4A0A3; Thu, 26 Mar 2026 20:50:31 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id 2Ck2EhecxWlaMAAAD6G6ig (envelope-from ); Thu, 26 Mar 2026 20:50:31 +0000 Date: Thu, 26 Mar 2026 21:50:20 +0100 From: Petr Vorel To: Simon Glass Cc: linux-kernel@vger.kernel.org, Andy Whitcroft , Joe Perches , Dwaipayan Ray , Lukas Bulwahn , Kory Maincent , Tom Rini , Simon Glass , Kuan-Wei Chiu Subject: Re: [PATCH v2] checkpatch: Allow to pass config directory Message-ID: <20260326205020.GA23245@pevik> Reply-To: Petr Vorel References: <20260224181623.89904-1-pvorel@suse.cz> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Spamd-Result: default: False [-2.21 / 50.00]; BAYES_HAM(-3.00)[100.00%]; SUSPICIOUS_RECIPS(1.50)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_RHS_NOT_FQDN(0.50)[]; HAS_REPLYTO(0.30)[pvorel@suse.cz]; R_DKIM_ALLOW(-0.20)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-0.998]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_TRACE(0.00)[0:+]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; FUZZY_RATELIMITED(0.00)[rspamd.com]; ARC_NA(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; RCVD_TLS_ALL(0.00)[]; DKIM_TRACE(0.00)[suse.cz:+]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; FREEMAIL_CC(0.00)[vger.kernel.org,canonical.com,perches.com,gmail.com,bootlin.com,konsulko.com]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns]; TAGGED_RCPT(0.00)[]; RCPT_COUNT_SEVEN(0.00)[10]; MISSING_XM_UA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; REPLYTO_EQ_FROM(0.00)[] X-Rspamd-Queue-Id: A8AF44D2EC X-Spam-Flag: NO X-Spam-Score: -2.21 X-Spam-Level: Hi Simon, first, thanks for your review! > Hi Petr, > On Tue, 24 Feb 2026 at 11:20, Petr Vorel wrote: > > checkpatch.pl searches for .checkpatch.conf in $HOME and .scripts > > (in current working directory). Allow to pass directory via > How about: Allow passing a directory +1 > > CHECKPATCH_CONFIG_DIR environment variable. This allows to directly use > > project configuration file for projects which vendored checkpatch.pl > > (e.g. LTP or u-boot). > > While at it, document all directories in help. > > Suggested-by: Joe Perches > > Signed-off-by: Petr Vorel > > --- > > NOTE: if you don't like the way how directories are printed in help > > (user's home directory path instead of $HOME) I can change it. > > $ ./scripts/checkpatch.pl -h > > ... > > When FILE is - read standard input. > > CONFIGURATION FILE > > Script searches for a configuration file .checkpatch.conf in path: > > $CHECKPATCH_CONFIG_DIR:.:/home/foo:.scripts > It looks like this can be a colon-separated list of dirs - perhaps > document that, if intended? It was not intended. I'd slightly prefer variable should point into single directory (that's why I did it in v1), I'll send v3. But sure, it can be list of directories if you really prefer it. > > Link to v1: > > https://lore.kernel.org/lkml/20260202144221.76765-1-pvorel@suse.cz/ > > https://lore.kernel.org/lkml/20260202144221.76765-2-pvorel@suse.cz/ > > Changes v1->v2: > > * Use environment variable instead of --conf-dir option (Joe Perches) > > NOTE: I'd slightly prefer using --conf-dir (more convenient for user). > Agreed. I don't want to fight against Joe's NACK of v1 (unless he changes his mind). > > * squash documentation into this commit > > Kind regards, > > Petr > > scripts/checkpatch.pl | 10 +++++++++- > > 1 file changed, 9 insertions(+), 1 deletion(-) > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl > > index bec7930cdd66..e47fec115ee7 100755 > > --- a/scripts/checkpatch.pl > > +++ b/scripts/checkpatch.pl > > @@ -57,6 +57,8 @@ my %ignore_type = (); > > my @ignore = (); > > my $help = 0; > > my $configuration_file = ".checkpatch.conf"; > > +my $def_configuration_dirs = ".:$ENV{HOME}:.scripts"; > > +my $env_config_dir = 'CHECKPATCH_CONFIG_DIR'; > > my $max_line_length = 100; > > my $ignore_perl_version = 0; > > my $minimum_perl_version = 5.10.0; > > @@ -146,6 +148,10 @@ Options: > > -h, --help, --version display this help and exit > > When FILE is - read standard input. > > + > > +CONFIGURATION FILE > > +Script searches for a configuration file $configuration_file in path: > > +\$$env_config_dir:$def_configuration_dirs > > EOM > > exit($exitcode); > > @@ -1531,8 +1537,10 @@ sub which { > > sub which_conf { > > my ($conf) = @_; > > + my $paths = $ENV{$env_config_dir} . ':' if exists($ENV{$env_config_dir}); > How about splitting it so that the variable cannot be undef ? > my $paths = $def_configuration_dirs; > $paths = "$ENV{$env_config_dir}:$paths" if exists($ENV{$env_config_dir}); +1, sure, thanks! Kind regards, Petr > > + $paths .= $def_configuration_dirs; > > - foreach my $path (split(/:/, ".:$ENV{HOME}:.scripts")) { > > + foreach my $path (split(/:/, $paths)) { > > if (-e "$path/$conf") { > > return "$path/$conf"; > > } > > -- > > 2.51.0 > Regards, > Simon