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 46EBE399019 for ; Mon, 20 Apr 2026 13:04:46 +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=1776690287; cv=none; b=UI1jYLpoLlDXlvEerRzqktme0qO04NNWJeAJVN1S9f+APfVPZKwW7cEprw4mBmhRQE37eLL3kRcNsX8NqRB6xVnGgn5jHo5wmm43ivzrl+ie2BwZFh2wtLPiqGhJefVmD2svD8B1lmUANptHbba3QR81o97jNMI5DKj/07tBNaQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776690287; c=relaxed/simple; bh=b0AYxPcOGbEF2tAcn7mLkMcnqt0bMoR8y1vm2LsV0AY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=k8eZUqBcTFdDfbBqvY78IVAamPdNGiwmLoUllXqaMpKLLI8POg/K2lZExAIMNp88/peav5I47gFv9iLsO9mE7toRgP9iZU2TCx45qAcAqQqTbeqT2LIbInenPi7Zh5tf5WWcmnQIFzky1Grs+oc9A+BpxKewM2N7+ogH//4pBKM= 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=jCQhiYph; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=1CriDTa/; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=jCQhiYph; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=1CriDTa/; 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="jCQhiYph"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="1CriDTa/"; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="jCQhiYph"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="1CriDTa/" Received: from imap1.dmz-prg2.suse.org (unknown [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 64DE35BDD4; Mon, 20 Apr 2026 13:04:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1776690284; 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=5QyMRWddzYFiyU1dQFkG2w+gU2S/kcjWrMm/HY8T140=; b=jCQhiYphgK3hJIJkucf7YCPve0SAk5XSWhxxFOBCpqCIwIqKqn38cT/KpvWVS6nEi2/EAe 27VdlEVKuI2a20qRQoRIb0EFHIC+nPJIzRVgWcpEQ7jqIPoJumM2anf9nyykmFtCvMEqEs eFvHXD406VEmkiq66IdZ9nrQ2AASgzw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1776690284; 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=5QyMRWddzYFiyU1dQFkG2w+gU2S/kcjWrMm/HY8T140=; b=1CriDTa/YyWUNXIhydaGrqtlp6pzaNrOssdL0GZ1Ghye2qj+Cc3z8cgqLVMrpYEm3UtIvp 4K1HmLCldNkzMRAA== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1776690284; 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=5QyMRWddzYFiyU1dQFkG2w+gU2S/kcjWrMm/HY8T140=; b=jCQhiYphgK3hJIJkucf7YCPve0SAk5XSWhxxFOBCpqCIwIqKqn38cT/KpvWVS6nEi2/EAe 27VdlEVKuI2a20qRQoRIb0EFHIC+nPJIzRVgWcpEQ7jqIPoJumM2anf9nyykmFtCvMEqEs eFvHXD406VEmkiq66IdZ9nrQ2AASgzw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1776690284; 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=5QyMRWddzYFiyU1dQFkG2w+gU2S/kcjWrMm/HY8T140=; b=1CriDTa/YyWUNXIhydaGrqtlp6pzaNrOssdL0GZ1Ghye2qj+Cc3z8cgqLVMrpYEm3UtIvp 4K1HmLCldNkzMRAA== 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 F082A593AF; Mon, 20 Apr 2026 13:04:43 +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 gimHNmsk5mm1GQAAD6G6ig (envelope-from ); Mon, 20 Apr 2026 13:04:43 +0000 Date: Mon, 20 Apr 2026 15:04:42 +0200 From: Petr Vorel To: Simon Glass Cc: linux-kernel@vger.kernel.org, Joe Perches , Dwaipayan Ray , Lukas Bulwahn Subject: Re: [PATCH v5 1/2] checkpatch: Allow passing config directory Message-ID: <20260420130442.GA477476@pevik> Reply-To: Petr Vorel References: <20260417170346.448758-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-Spam-Score: -2.00 X-Spam-Level: X-Spamd-Result: default: False [-2.00 / 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]; MIME_GOOD(-0.10)[text/plain]; TAGGED_RCPT(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; MISSING_XM_UA(0.00)[]; ARC_NA(0.00)[]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_ALL(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; RCPT_COUNT_FIVE(0.00)[5]; FROM_HAS_DN(0.00)[]; FREEMAIL_CC(0.00)[vger.kernel.org,perches.com,gmail.com]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,chromium.org:email,suse.cz:replyto,suse.cz:email]; RCVD_COUNT_TWO(0.00)[2]; REPLYTO_EQ_FROM(0.00)[] X-Spam-Flag: NO > Hi Petr, > On Sat, 18 Apr 2026 at 05:04, Petr Vorel wrote: > > checkpatch.pl searches for .checkpatch.conf in $CWD, $HOME and > > $CWD/.scripts. Allow passing 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 v5 (all by sashiko agent): > > https://sashiko.dev/#/patchset/20260415143636.272605-1-pvorel%40suse.cz > > * Move warning to don't wrongly warn when $CHECKPATCH_CONFIG_DIR is not set > > (sigh). > > Link to v4: > > https://lore.kernel.org/lkml/20260415143636.272605-1-pvorel@suse.cz/ > > Link to v3: > > https://lore.kernel.org/lkml/20260408120603.54351-1-pvorel@suse.cz/ > > 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 | 19 ++++++++++++++++--- > > 1 file changed, 16 insertions(+), 3 deletions(-) > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl > > index 0492d6afc9a1f..8f7a42da12869 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 > > +Default configuration options can be stored in $configuration_file, > > +search path: '$def_configuration_dirs' or in a directory specified by > > +\$$env_config_dir environment variable (fallback to the default search path). > > 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,15 @@ sub which { > > } > > sub which_conf { > > - my ($conf) = @_; > > + my ($conf, $env_key, $paths) = @_; > > + my $env_dir = $ENV{$env_key}; > > + > > + if (defined($env_dir)) { > > + return "$env_dir/$conf" if (-e "$env_dir/$conf"); > > + warn "$P: Can't find a readable $conf in '$env_dir', fallback to default locations: $!\n"; > Just some optional nits > I think you should drop the $! as the errno might be stale here. > 'falling back to' would read better +1 > > + } > > - 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 At this point I dare to add your RBT in next version. Kind regards, Petr