From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (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 2AD27361654 for ; Mon, 23 Feb 2026 21:38:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771882723; cv=none; b=V3LssG+y6pf/Do8tkMO8NrGCKvoEUaR1Aoi4hnoniVtnifD3DnD3RM0GxV+L/AiGyMfAnU7GYBvHJpTYEtPj48tR+wSBywmoFpBRFzgH3t9o+91RWuIc3XDf6+H1JnRgR4swMdogl6K2meN5w2g19tq+TSnkanIX8YQdAz0XMbs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771882723; c=relaxed/simple; bh=no9Yp1ZTkDeWv7/V8kfgb6dDZ0tI+dO5tzEq1uF+Nks=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=CGNNjESSw2L1E0UMVSFVSQtku3xg623B1LkLCUByJjhWzm/8KnzjCskmnsB8r3y3g79W91YS6/iMSwxK58LayCzGvWF0xFfAYPDSZ8BPGzEKdJI7f7Jb8ITUHlndq+gi5SQ+L3rZEQVDinH7cZd3jVNT36/lReQ3r2HoWRTyeCI= 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=d1KF/Mzj; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=QmtfYbs8; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=d1KF/Mzj; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=QmtfYbs8; arc=none smtp.client-ip=195.135.223.131 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="d1KF/Mzj"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="QmtfYbs8"; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="d1KF/Mzj"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="QmtfYbs8" 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-out2.suse.de (Postfix) with ESMTPS id 10EB65BCC9; Mon, 23 Feb 2026 21:38:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1771882720; 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=erUxSqsgXw0QVZHyMk/JAiEl7mGJbkH/XSZT40uB1yk=; b=d1KF/Mzjk9kxMReaOEVuAycjzYw1cWEM2GSlYxqxSuSHVW4JTLQtECIYxhUYpR07VT+zFo 1whlREBv3FX+UXjJ9O1vV97A2M+DIcM85cF8Me/s8lD3eOIiGM74JkXoK/QEMIFkpH3zkN 000cqSdxADGKx6e38i1KY/f+SQXhmhY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1771882720; 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=erUxSqsgXw0QVZHyMk/JAiEl7mGJbkH/XSZT40uB1yk=; b=QmtfYbs8V44wxS7w9ChaGX8jtlk73ABMfM55/mRAQUOHryi1ct4ztLmGLHIOVKcqnVeM6H Td7McxQDNKy7fxBA== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b="d1KF/Mzj"; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=QmtfYbs8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1771882720; 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=erUxSqsgXw0QVZHyMk/JAiEl7mGJbkH/XSZT40uB1yk=; b=d1KF/Mzjk9kxMReaOEVuAycjzYw1cWEM2GSlYxqxSuSHVW4JTLQtECIYxhUYpR07VT+zFo 1whlREBv3FX+UXjJ9O1vV97A2M+DIcM85cF8Me/s8lD3eOIiGM74JkXoK/QEMIFkpH3zkN 000cqSdxADGKx6e38i1KY/f+SQXhmhY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1771882720; 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=erUxSqsgXw0QVZHyMk/JAiEl7mGJbkH/XSZT40uB1yk=; b=QmtfYbs8V44wxS7w9ChaGX8jtlk73ABMfM55/mRAQUOHryi1ct4ztLmGLHIOVKcqnVeM6H Td7McxQDNKy7fxBA== 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 BEA303EA68; Mon, 23 Feb 2026 21:38:39 +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 QIpyLN/InGn7MwAAD6G6ig (envelope-from ); Mon, 23 Feb 2026 21:38:39 +0000 Date: Mon, 23 Feb 2026 22:38:33 +0100 From: Petr Vorel To: Joe Perches Cc: linux-kernel@vger.kernel.org, Andy Whitcroft , Dwaipayan Ray , Lukas Bulwahn , Kory Maincent , Tom Rini , Simon Glass , Kuan-Wei Chiu Subject: Re: [PATCH 2/2] checkpatch: Add --conf-dir option Message-ID: <20260223213833.GA22557@pevik> Reply-To: Petr Vorel References: <20260202144221.76765-1-pvorel@suse.cz> <20260202144221.76765-2-pvorel@suse.cz> <985cf97c90eb50cc6b205939b013fb16420243e1.camel@perches.com> <20260223155326.GB19338@pevik> <38980cd5299bbf9939e40a3a1f2b0c98e20c5f34.camel@perches.com> 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: <38980cd5299bbf9939e40a3a1f2b0c98e20c5f34.camel@perches.com> 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)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; ARC_NA(0.00)[]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; FUZZY_RATELIMITED(0.00)[rspamd.com]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; FREEMAIL_CC(0.00)[vger.kernel.org,canonical.com,gmail.com,bootlin.com,konsulko.com]; DKIM_TRACE(0.00)[suse.cz:+]; RCVD_COUNT_TWO(0.00)[2]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCVD_TLS_ALL(0.00)[]; RCPT_COUNT_SEVEN(0.00)[9]; TAGGED_RCPT(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; MISSING_XM_UA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; REPLYTO_EQ_FROM(0.00)[] X-Rspamd-Queue-Id: 10EB65BCC9 X-Spam-Flag: NO X-Spam-Score: -2.21 X-Spam-Level: > 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. > > Thanks for a hint. If there is a chance it will be accepted I'll have look on > > it. We would certainly appreciated not having to carry yet another checkpatch.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 Makefile. > > Then we have b4 configuration, where we also use checkpatch.pl options. > > 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 ugly. > > Also, allowing to pass a configuration file (quite common feature for any > > software) would allow to run checkpatch.pl with different configs for different > > projects. > Right now the HOME environment variable is used in which_conf. Yes (and that's not enough for the case I described). > Perhaps prepend a CHECKPATCH_CONFIG environment where the right > .checkpatch.conf would be found? Sure, if you prefer not processing @ARGV twice (and modifying it), using environment variable works as well. The reason I touched @ARGV was to be slightly more convenient for user with a bit more complicated code. But when variable is properly documented, there is practically no difference (if I ignore the fact that in the future somebody writes bash-completion support, which will ignore environment variables). Anyway, thanks for being open to the idea. I'll send a patch based on the code you proposed. Kind regards, Petr > Maybe something like the below and executed with something like > $ CHECKPATCH_CONFIG= 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) = @_; > - foreach my $path (split(/:/, ".:$ENV{HOME}:.scripts")) { > + my $env_config_path = 'CHECKPATCH_CONFIG'; > + my $paths = $ENV{$env_config_path} . ':' if exists($ENV{$env_config_path}); > + $paths .= ".:$ENV{'HOME'}:.scripts"; > + > + foreach my $path (split(/:/, $paths)) { > if (-e "$path/$conf") { > return "$path/$conf"; > }