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 CB3F5392828 for ; Mon, 13 Apr 2026 08:23:03 +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=1776068586; cv=none; b=bc+u3XEmIFDPjG0F8QKNw2WxrFKbY4A4yU0NXCWJAQjT941sqaeXziO0vthgWbXsY1xeI1hhUQ0JxnF+tp3ZJL3a0MTZkcSuUAKV2OlKBYd7KSYjwmvFYTFATZmd5HIHpKf/YAeD0dGkFgO+6bbhdcpokU0FmgouSrX6VvXfd80= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776068586; c=relaxed/simple; bh=qGeWQVhMjC7e2+y+jR9VtEfINKTAjCbOH7cmol+ifYk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=WvwxncU+5xpEy1G28rz0Om5Q/L5TquNDeY4RusuIXdG7UTroV7XaaXqr5H4rTX4v+3x21IUHs+2Opblow5aftDy+qd+Brkus6bCgdKUup8klyyQZmrweE9UmT0kztnBrtVQVeoAHUUve8EKQtQCIKCuAy8i3dcZa9TU/nGyBjYk= 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=R2U87kC/; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=x7Kga/6y; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=TeNXuzLz; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=MB/DfU0s; 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="R2U87kC/"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="x7Kga/6y"; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="TeNXuzLz"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="MB/DfU0s" 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 D448D5BD1F; Mon, 13 Apr 2026 08:23:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1776068582; 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=CytfHDJlka5R49ZBFaoL/vMdpH/yt10dVXYbSlxuFmQ=; b=R2U87kC/pdZIVfHZHfUbvC8Lv1AI/ippUWDxO1R/gFsZ7L7qLOjihLODY49McANinvBYeg l0VmgcwhgqOPvHeg+9RZ+Ml5OVTRaBaN+VwQg1gsT8pA+VUJwQzkqNDoLp+L5h6Wvud6Lw zRX6TJ0rfGjVonSbAFG//RzKfJRnwNU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1776068582; 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=CytfHDJlka5R49ZBFaoL/vMdpH/yt10dVXYbSlxuFmQ=; b=x7Kga/6y2JpSRW9r/EVMJpOOn/lEursVWXMeq/R8nXFxd2Gdsx2YayFHhD0rECxKmfcASr C0xQ/JaI5Zi6isBA== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=TeNXuzLz; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b="MB/DfU0s" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1776068581; 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=CytfHDJlka5R49ZBFaoL/vMdpH/yt10dVXYbSlxuFmQ=; b=TeNXuzLzXvqOaPwQzlS01o/DAe29wnBkuathHMeXoWTyK1o1teAGE7wP1f5OEKIXvqBhtD 3WLDIgm5497Zifw0QXGKLUj3+kXKTZlYyXmi8wRTHPfi2GOC+zpGV9xxVxrI2YzUY95NBC wNq585WyfOomv0fs+ZJkYwlTGI+io5A= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1776068581; 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=CytfHDJlka5R49ZBFaoL/vMdpH/yt10dVXYbSlxuFmQ=; b=MB/DfU0soM9nAHPxL9Mnt1R+gT8YWZkIwzNZ9gGJoN6XLoSk2DNyeVDcVSI7kDEGAei5iS YWuByrjwWLXJiWCw== 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 E35614ADB4; Mon, 13 Apr 2026 08:23:00 +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 ehc4NeSn3GnrCQAAD6G6ig (envelope-from ); Mon, 13 Apr 2026 08:23:00 +0000 Date: Mon, 13 Apr 2026 10:22:51 +0200 From: Petr Vorel To: Simon Glass Cc: linux-kernel@vger.kernel.org, Joe Perches , Andy Whitcroft , Dwaipayan Ray , Lukas Bulwahn , Kory Maincent , Tom Rini , Kuan-Wei Chiu Subject: Re: [PATCH v3 1/2] checkpatch: Allow to pass config directory Message-ID: <20260413082251.GA117516@pevik> Reply-To: Petr Vorel References: <20260408120603.54351-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]; NEURAL_HAM_SHORT(-0.20)[-1.000]; R_DKIM_ALLOW(-0.20)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; 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]; FUZZY_RATELIMITED(0.00)[rspamd.com]; ARC_NA(0.00)[]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; RCVD_TLS_ALL(0.00)[]; DKIM_TRACE(0.00)[suse.cz:+]; RCVD_COUNT_TWO(0.00)[2]; DBL_BLOCKED_OPENRESOLVER(0.00)[checkpatch.pl:url,chromium.org:email,suse.cz:dkim,suse.cz:replyto,suse.cz:email,imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; FREEMAIL_CC(0.00)[vger.kernel.org,perches.com,canonical.com,gmail.com,bootlin.com,konsulko.com]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:104:10:150:64:97:from,2a07:de40:b281:106:10:150:64:167:received]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; MISSING_XM_UA(0.00)[]; RCPT_COUNT_SEVEN(0.00)[9]; RCVD_VIA_SMTP_AUTH(0.00)[]; TAGGED_RCPT(0.00)[]; REPLYTO_EQ_FROM(0.00)[] X-Rspamd-Queue-Id: D448D5BD1F X-Spam-Flag: NO X-Spam-Score: -2.21 X-Spam-Level: > Hi Petr, > On Wed, 8 Apr 2026 at 06:06, Petr Vorel wrote: > > checkpatch.pl searches for .checkpatch.conf in $HOME, $CWD/.scripts > > and $CWD. Allow to pass a single directory via 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). > > Although it'd be more convenient for user to add --conf-dir option > > (instead of using environment variable), code would get ugly because > > options from the configuration file needs to be read before processing > > command line options with Getopt::Long. > > While at it, document directories and environment variable in help. > > Signed-off-by: Petr Vorel > > --- > > Changes in v3: > > * CHECKPATCH_CONFIG_DIR can point to only single directory (':' would > > make it not finding the directory, Simon). > > * Avoid join undef string (Simon). > > * Don't use $ENV{$env_config_dir} twice (Joe). > > * Pass new variables to which_conf() instead of using global. > > Link to v2: > > https://lore.kernel.org/lkml/20260224181623.89904-1-pvorel@suse.cz/ > > Link to v1: > > https://lore.kernel.org/lkml/20260202144221.76765-2-pvorel@suse.cz/ > > scripts/checkpatch.pl | 16 +++++++++++++--- > > 1 file changed, 13 insertions(+), 3 deletions(-) > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl > > index 0492d6afc9a1f..58f3d5a98204c 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,11 @@ 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 a directory > > +specified by \$$env_config_dir environment variable, or > > +(if variable not defined) in path: '$def_configuration_dirs' > > EOM > > exit($exitcode); > > @@ -237,7 +244,7 @@ sub list_types { > > exit($exitcode); > > } > > -my $conf = which_conf($configuration_file); > > +my $conf = which_conf($configuration_file, $env_config_dir, $def_configuration_dirs); > > if (-f $conf) { > > my @conf_args; > > open(my $conffile, '<', "$conf") > > @@ -1531,9 +1538,12 @@ sub which { > > } > > sub which_conf { > > - my ($conf) = @_; > > + my ($conf, $env_key, $paths) = @_; > > + my $env_dir = $ENV{$env_key}; > > + > > + return "$env_dir/$conf" if (defined($env_dir)); > > - foreach my $path (split(/:/, ".:$ENV{HOME}:.scripts")) { > > + foreach my $path (split(/:/, $paths)) { > > if (-e "$path/$conf") { > > return "$path/$conf"; > > } > > -- > > 2.53.0 > Reviewed-by: Simon Glass Thank you! I'll probably send v4, but I will not dare to add your RBT due changes I will add. Thanks for a careful review! > Some nits: > When CHECKPATCH_CONFIG_DIR is set but the file doesn't exist there, > the default paths are silently skipped. A warning would help catch > typos. I was thinking about it as well. Probably worth to add it => v4. > The commit message says the search order is "$HOME, $CWD/.scripts and > $CWD" but the code has ".:$HOME:.scripts" (CWD first). +1, thanks! > 'Allow to pass' -> 'Allow passing' +1, thanks! Kind regards, Petr > Regards, > Simon