From nobody Sat Sep 26 13:18:37 2026 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 E258247D44A for ; Tue, 1 Sep 2026 10:56:55 +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=1788260217; cv=none; b=UT+tyIy9XqBzxnb+usskETiUc125uLgf7IWZPRnJtJQAz5hz2vShwcl+kcpQBLeJq8MWMxxYTY16/7tOT+ERuMt89YcyrkBZOc9DSogC6GOGhWZSc7r0ujs20Z4M9zVoR4vdFIt2ib7/7VcpqzTuBQvkxI2NDJ4txAOQZDW6Y4U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788260217; c=relaxed/simple; bh=RJ6zKruVzQnI5WCIPqtFLSCYpserc4n/SPQFVNwEUsE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JGTcwaWzT/em39QNlZ9dFTVhZcPN656gO3rpdGZkUSBpYDmSdyW9L3deLiICF8PnCHfbz+a0knHNaINIcJrwrXwfyK2IFsBDknMwr/UgFYGkcmAthagySXRq991lQQh0GiYC9rCW1Beck1GFqArnWZc/+/1ffweJRYs6fGPQW/o= 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=qhtHQOC4; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=ycD9aY1p; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b=gWNvPbu7; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=hYPPoRt+; 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="qhtHQOC4"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="ycD9aY1p"; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.b="gWNvPbu7"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="hYPPoRt+" 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-out1.suse.de (Postfix) with ESMTPS id B0CD921CB2; Tue, 1 Sep 2026 10:56:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1788260209; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=R+7Qx4CI9o1js0Nlw/i22xMrJvCdBD7kjE9bczpka3k=; b=qhtHQOC4Q9aBl+IjOuofMEJtVhdwcdNGMfR+hUoPZU+wmTpN3G9HJm4mW/7JwJ/aI710jv s6pN6rbL3HoR2KIJWXoZS56CqjJQ5q5WqzzJ0R9y3X4d40Bga0GZe+wTN33vDfZ7EmHmja 4sPSRv5RFSefNjFMXz/6dCtaq8xzevk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1788260209; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=R+7Qx4CI9o1js0Nlw/i22xMrJvCdBD7kjE9bczpka3k=; b=ycD9aY1p75+kw/DyCvhD+Nu0FeN8sPH2YLCazyPCDvB0Ow3GkI/lFPgYF5lQXdrE1Dae92 tU4gEYP+MOuKRHBA== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1788260205; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=R+7Qx4CI9o1js0Nlw/i22xMrJvCdBD7kjE9bczpka3k=; b=gWNvPbu7EMMmDxO7/IG8McmJE6ZvrNoHzswQaH3wt4uG/R+ZAjnP3FyukVjd7Bq+Hqy/rI o5Aac9GjZ/3bLlWl6XkSCkPe9a6CYzDV0ThrK6bzS9IRvcmNP3zYRu1RBamQ7gOhKidNHP 4teexcgyFmihuXsR2icbO24XGfI4n7Y= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1788260205; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=R+7Qx4CI9o1js0Nlw/i22xMrJvCdBD7kjE9bczpka3k=; b=hYPPoRt+FLK9D/QuA/8Zuk9t3JMsyEX8kuSJHWLKvTpvqtyEGugiDTmt6fTysSsgoPh1ai 3+Q7OWhsBDVUErAg== 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 3DCD41369E; Tue, 1 Sep 2026 10:56:45 +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 UDHuDW2vlmrRGwAAD6G6ig (envelope-from ); Tue, 01 Sep 2026 10:56:45 +0000 From: Petr Vorel To: linux-kernel@vger.kernel.org Cc: Petr Vorel , Andrew Morton , Andy Whitcroft , Joe Perches , Dwaipayan Ray , Lukas Bulwahn , Cryolitia PukNgae Subject: [PATCH v5 1/5] checkpatch: Add more userspace directories to is_userspace() Date: Tue, 1 Sep 2026 12:56:38 +0200 Message-ID: <20260901105642.851234-2-pvorel@suse.cz> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260901105642.851234-1-pvorel@suse.cz> References: <20260901105642.851234-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-Transfer-Encoding: quoted-printable X-Spam-Level: X-Spam-Score: -5.30 X-Spam-Flag: NO X-Spamd-Result: default: False [-5.30 / 50.00]; REPLY(-4.00)[]; BAYES_HAM(-3.00)[100.00%]; SUSPICIOUS_RECIPS(1.50)[]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCVD_VIA_SMTP_AUTH(0.00)[]; FREEMAIL_CC(0.00)[suse.cz,linux-foundation.org,canonical.com,perches.com,gmail.com,uniontech.com]; TAGGED_RCPT(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_SEVEN(0.00)[8]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.cz:email,suse.cz:mid,imap1.dmz-prg2.suse.org:helo]; TO_DN_SOME(0.00)[]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; FREEMAIL_ENVRCPT(0.00)[gmail.com] Content-Type: text/plain; charset="utf-8" arch/ directory contains subdirectories with userspace tools (at least arch/*/tools/ and arch/*/boot/tools/). Add check to consider any arch/.*/tools/ subdirectory as userspace tools directory. This helps not only to strscpy() checks but also to CamelCase checks in the next commit to be more precise. Follow-up: 99b70ece33d8 ("checkpatch: suppress strscpy warnings for userspa= ce tools") Signed-off-by: Petr Vorel --- Changes v4->v5 (all by sashiko): * Explicitly match the directory separator in new entries for is_userspace() scripts/checkpatch.pl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index f424dafce5bc..b8702f6bc9b5 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2667,7 +2667,9 @@ sub exclude_global_initialisers { =20 sub is_userspace { my ($realfile) =3D @_; - return ($realfile =3D~ m@^tools/@ || $realfile =3D~ m@^scripts/@); + return ($realfile =3D~ m@^tools/@ || + $realfile =3D~ m@^scripts/@ || + $realfile =3D~ m@^arch/.*/tools/@); } =20 sub process { --=20 2.55.0 From nobody Sat Sep 26 13:18:37 2026 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 5955E39AD51 for ; Tue, 1 Sep 2026 10:56:52 +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=1788260214; cv=none; b=B2x+SLdQptycy/NHydvi5/3wwflbwzSPhobScf/10P1+BjAV5C5qyoc4H+8GKAmi0ZU8S42QXuznQlHN29Cznd8+UriftlP5q6iRwqxrkRrF40z2RcVYv1RISCdH5Sqms0odDGi48BRfajd5BVk5eHSzUkqMgObA8JiA8qAm71U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788260214; c=relaxed/simple; bh=Ko6vUTqGj5K3GB4rTAKDIeTwpnYNzLmH29khSvV861A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=STOuXsAVZ4FmJkcurIe5aeVXWJIahmXgXHaR6915MwQmud+TzIs/3xycAyuRUiK/Xp4yjrahUZFjBMIlkDGaFCzAfIi7My19StaFJ8jsfgp0kRzJLRgUsLGIKAIZagfZPhyxIavwns3py4bKQF6JImd1WN1tUWkg7l2X+tcUjV0= 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=0YsgmOUc; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=AkRy82ij; 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="0YsgmOUc"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="AkRy82ij" 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 F3DD221CB7; Tue, 1 Sep 2026 10:56:45 +0000 (UTC) Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1788260206; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WcAJPgihOEDmv1nHcIKnWxG+FM4RrbB/EjKcaO2mNjo=; b=0YsgmOUcqyAtGVpAffnoa8U4hqbaC8oh7Xdgbr7FBZK7TvcH5Mr418N76KGedYBhz6uJjj +DbGbXdvQ2tGEEl5M4l9RFbAq+rR+ThwhhxCAzkEAsuHb1gG/cH7U09gRJldZUbdT7A7fK EnGjtpRyie7ICtOVE6SuUOCU2qf/38M= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1788260206; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WcAJPgihOEDmv1nHcIKnWxG+FM4RrbB/EjKcaO2mNjo=; b=AkRy82ijjMDUuGjyLxmUldyFjngLoPJm97AkoFqOpYRMqb+nuEte0jQ5/vM8hTO6aB1Orr l3M3eNYvX3haS2AA== 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 7C875136B2; Tue, 1 Sep 2026 10:56:45 +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 ALotHW2vlmrRGwAAD6G6ig (envelope-from ); Tue, 01 Sep 2026 10:56:45 +0000 From: Petr Vorel To: linux-kernel@vger.kernel.org Cc: Petr Vorel , Andrew Morton , Andy Whitcroft , Joe Perches , Dwaipayan Ray , Lukas Bulwahn , Cryolitia PukNgae Subject: [PATCH v5 2/5] checkpatch: Ignore format macros for userspace tools Date: Tue, 1 Sep 2026 12:56:39 +0200 Message-ID: <20260901105642.851234-3-pvorel@suse.cz> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260901105642.851234-1-pvorel@suse.cz> References: <20260901105642.851234-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-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: F3DD221CB7 X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Rspamd-Action: no action X-Spam-Flag: NO X-Spam-Score: -4.00 X-Spam-Level: X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Spamd-Result: default: False [-4.00 / 50.00]; REPLY(-4.00)[]; TAGGED_RCPT(0.00)[] Content-Type: text/plain; charset="utf-8" Constants from are used only in userspace tools, they are from ISO C99, let's don't report it: arch/mips/boot/tools/relocs.c:572: CHECK: Avoid CamelCase: arch/s390/tools/relocs.c:52: CHECK: Avoid CamelCase: tools/testing/selftests/mm/vm_util.c:244: CHECK: Avoid CamelCase: Signed-off-by: Petr Vorel --- The same as in v4. scripts/checkpatch.pl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index b8702f6bc9b5..b458c7f22684 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -5950,6 +5950,8 @@ sub process { #Ignore SI style variants like nS, mV and dB #(ie: max_uV, regulator_min_uA_show, RANGE_mA_VALUE) $var !~ /^(?:[a-z0-9_]*|[A-Z0-9_]*)?_?[a-z][A-Z](?:_[a-z0-9_]+|_[A-= Z0-9_]+)?$/ && +#Ignore format macros (e.g. PRIu64, SCNu64) + (is_userspace($realfile) ? $var !~ /^(?:PRI|SCN)[dioux][A-Z0-9]+$/ = : 1) && #Ignore some three character SI units explicitly, like MiB and KHz $var !~ /^(?:[a-z_]*?)_?(?:[KMGT]iB|[KMGT]?Hz)(?:_[a-z_]+)?$/) { while ($var =3D~ m{\b($Ident)}g) { --=20 2.55.0 From nobody Sat Sep 26 13:18:37 2026 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 A95903A6B7F for ; Tue, 1 Sep 2026 10:56:52 +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=1788260215; cv=none; b=ZWI+1/+pPrNb0FsWL01SdBo+B4FOIJQcYypg5sV2OUOHG9hJHbLD1CGB8ztl0vxfim0vFS+rqB9GYlu79jxA8z9SOt2SQOb3YiiXjf/OCJePtM4FYmFj830L11BodM3y1tI0MGD8kxCwpnaHW+DSpsvZTVq98NKLKpftspCzkm4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788260215; c=relaxed/simple; bh=2dkcy9q8aUxhvulCMv23lkdDYUK+aaqyQ8PDyVFMtCs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=IOQVhwXf4edCq7GlO9rYjdJEPUJLbH8NakPGJ/nO6Z9hayFqdI+wxqEs63Q96FhMXw5g5LnKKvgrKMHG7LRAUEcdPauA8Rb4eaJslotiMjEH3oCNVlu11i6HfT/FtYQoz9OkEe6SJH/kgPB+Er/ImVKRxEOF+6hL3gEehcQ0Tl8= 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=X7ltb4nr; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=b1WZieW0; 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="X7ltb4nr"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="b1WZieW0" 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 44D161FB3B; Tue, 1 Sep 2026 10:56:46 +0000 (UTC) Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1788260206; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6YrnX0TiZfKkzbR6al953cuN6ojb584mWviRS5jyvxI=; b=X7ltb4nrjCfm5vaQM34poLnn8sBHFrtkc2FhutzniWUhXcmIiL0Dayi664Xd91u1z7Mx7b 0+skxNyhq40Mbj1NjxuQ0dTIWdKT6FvRH7pQBvvOli+bKhbmOvCsi1C7JnmZ/7hxGEUVO4 aKbOxeC87d8U4g/mxxCFz9gpIBfDgDM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1788260206; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6YrnX0TiZfKkzbR6al953cuN6ojb584mWviRS5jyvxI=; b=b1WZieW0NysnXBqCbGR5QjWEGAi+D02JC8CHIX4RfgiwM2khr3j60UFHp6tsody9IXL35B FsJcZLg5MCKm/UCA== 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 C45F0136C7; Tue, 1 Sep 2026 10:56:45 +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 wEE+Lm2vlmrRGwAAD6G6ig (envelope-from ); Tue, 01 Sep 2026 10:56:45 +0000 From: Petr Vorel To: linux-kernel@vger.kernel.org Cc: Petr Vorel , Andrew Morton , Andy Whitcroft , Joe Perches , Dwaipayan Ray , Lukas Bulwahn , Cryolitia PukNgae Subject: [PATCH v5 3/5] checkpatch: Add --userspace to force userspace rules Date: Tue, 1 Sep 2026 12:56:40 +0200 Message-ID: <20260901105642.851234-4-pvorel@suse.cz> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260901105642.851234-1-pvorel@suse.cz> References: <20260901105642.851234-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-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 44D161FB3B X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Rspamd-Action: no action X-Spam-Flag: NO X-Spam-Score: -4.00 X-Spam-Level: X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Spamd-Result: default: False [-4.00 / 50.00]; REPLY(-4.00)[]; TAGGED_RCPT(0.00)[] Content-Type: text/plain; charset="utf-8" Also allow to use --no-userspace for userspace projects which vendored checkpatch.pl and use --userspace globally to be able switch it off for files with kernel code. Signed-off-by: Petr Vorel --- Changes v4->v5 (all by sashiko): * Allow --no-userspace to override setup in the config (using undef instead of 0, separate checks in is_userspace()) scripts/checkpatch.pl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index b458c7f22684..ead35e6abba7 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -63,6 +63,7 @@ my $env_config_dir =3D 'CHECKPATCH_CONFIG_DIR'; my $max_line_length =3D 100; my $ignore_perl_version =3D 0; my $spdx_cxx_comments =3D 0; +my $userspace; my $minimum_perl_version =3D 5.10.0; my $min_conf_desc_length =3D 4; my $spelling_file =3D "$D/spelling.txt"; @@ -143,6 +144,7 @@ Options: (required by old toolchains), allow also C++ comments (//). NOTE: it should *not* be used for Linux mainl= ine. + --userspace Force rules specific for userspace. --codespell Use the codespell dictionary for spelling/typ= os (default:$codespellfile) --codespellfile Use this codespell dictionary @@ -358,6 +360,7 @@ GetOptions( 'codespell!' =3D> \$codespell, 'codespellfile=3Ds' =3D> \$user_codespellfile, 'typedefsfile=3Ds' =3D> \$typedefsfile, + 'userspace!' =3D> \$userspace, 'color=3Ds' =3D> \$color, 'no-color' =3D> \$color, #keep old behaviors of -nocolor 'nocolor' =3D> \$color, #keep old behaviors of -nocolor @@ -2667,6 +2670,9 @@ sub exclude_global_initialisers { =20 sub is_userspace { my ($realfile) =3D @_; + + return $userspace if (defined $userspace); + return ($realfile =3D~ m@^tools/@ || $realfile =3D~ m@^scripts/@ || $realfile =3D~ m@^arch/.*/tools/@); --=20 2.55.0 From nobody Sat Sep 26 13:18:37 2026 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 5A0AF47B439 for ; Tue, 1 Sep 2026 10:56:52 +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=1788260214; cv=none; b=GbzG/9dTMHyuhIUf5CJQ9jUf3MKiqhzKNOjXQRrutGT8H/dlaog17b0uRCiaf5k88KeNzpPQJiUct1GpYWfeK87f54bf3ZtuIjKIxLTAyCElSzMW2m0U5K2sxJ17UgeqedbAbuyXwOWwcM5pZHrDi/R3LGx1zqhfn1u5ob2PqKc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788260214; c=relaxed/simple; bh=f3wAQpmY2yF/PVGt7SV44lLnL3WpuJjNaHlOr7AfVlo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=G+APb9Q+nlvzsOS83WDB/sx8gCVXhGIhnCS+h/oIlmf8OeuhvAjzYwDONASCoyKhaHvbZSoa0AL/ufH+STJwJygJi2+wSsPZv4AwENGnMRFE3YrYEnrkZohKQeoIueBncI5vw4XZHNFw67wqEsQcMmWnrwYZdsn0Waq0YeHQzbk= 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=A6izO27D; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b=kuc+Hz9q; 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="A6izO27D"; dkim=permerror (0-bit key) header.d=suse.cz header.i=@suse.cz header.b="kuc+Hz9q" 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 8A67621CB8; Tue, 1 Sep 2026 10:56:46 +0000 (UTC) Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1788260206; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bTGPq561EINv0mMTaBbg0oLGrrPZ46VSW6hycYBsFUU=; b=A6izO27DNJGsO68WvAOO7MmylZq5XtQiKw3UHAMdjRQ9upS7o3/tlYniJ9PCsMR0gATUQs EvTDGIALpDHG5KKn7+2257x1FNTRL9EdLBftw3IIgdTSQk+ULWbOu4wkA+Px3AFgvJQ6qY JO+58vm1mw89SLqzrvLWck+dfVYAeiE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1788260206; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bTGPq561EINv0mMTaBbg0oLGrrPZ46VSW6hycYBsFUU=; b=kuc+Hz9qKOAOCnw5lvIMirKNmBZSPfsCCdp5bMEaf61QCeeWe0PtJ1dZ2yeehri7cNJp7d 9Ndkte3ihPt9IICA== 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 12129136CB; Tue, 1 Sep 2026 10:56:46 +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 KIswA26vlmrRGwAAD6G6ig (envelope-from ); Tue, 01 Sep 2026 10:56:46 +0000 From: Petr Vorel To: linux-kernel@vger.kernel.org Cc: Petr Vorel , Andrew Morton , Andy Whitcroft , Joe Perches , Dwaipayan Ray , Lukas Bulwahn , Cryolitia PukNgae Subject: [PATCH v5 4/5] checkpatch: Factor out the check for UAPI files Date: Tue, 1 Sep 2026 12:56:41 +0200 Message-ID: <20260901105642.851234-5-pvorel@suse.cz> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260901105642.851234-1-pvorel@suse.cz> References: <20260901105642.851234-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-Transfer-Encoding: quoted-printable X-Spam-Level: X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Queue-Id: 8A67621CB8 X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 50.00]; REPLY(-4.00)[]; TAGGED_RCPT(0.00)[] X-Rspamd-Action: no action X-Spam-Flag: NO X-Spam-Score: -4.00 Content-Type: text/plain; charset="utf-8" DRY. Signed-off-by: Petr Vorel --- New in v5. scripts/checkpatch.pl | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index ead35e6abba7..97bf952b0fbc 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2678,6 +2678,11 @@ sub is_userspace { $realfile =3D~ m@^arch/.*/tools/@); } =20 +sub is_uapi { + my ($realfile) =3D @_; + return $realfile =3D~ m@^include/uapi/@; +} + sub process { my $filename =3D shift; =20 @@ -4673,7 +4678,7 @@ sub process { ERROR("MALFORMED_INCLUDE", "malformed #include filename\n" . $herecurr); } - if ($path =3D~ "^uapi/" && $realfile =3D~ m@\binclude/uapi/@) { + if ($path =3D~ "^uapi/" && is_uapi($realfile)) { ERROR("UAPI_INCLUDE", "No #include in ...include/uapi/... should use a uapi/ path pref= ix\n" . $herecurr); } @@ -6683,7 +6688,7 @@ sub process { } =20 # don't use __constant_ functions outside of include/uapi/ - if ($realfile !~ m@^include/uapi/@ && + if (!is_uapi($realfile) && $line =3D~ /(__constant_(?:htons|ntohs|[bl]e(?:16|32|64)_to_cpu|cpu_= to_[bl]e(?:16|32|64)))\s*\(/) { my $constant_func =3D $1; my $func =3D $constant_func; @@ -6846,7 +6851,7 @@ sub process { } =20 # Check for __inline__ and __inline, prefer inline - if ($realfile !~ m@\binclude/uapi/@ && + if (!is_uapi($realfile) && $line =3D~ /\b(__inline__|__inline)\b/) { if (WARN("INLINE", "plain inline is preferred over $1\n" . $herecurr) && @@ -6857,7 +6862,7 @@ sub process { } =20 # Check for compiler attributes - if ($realfile !~ m@\binclude/uapi/@ && + if (!is_uapi($realfile) && $rawline =3D~ /\b__attribute__\s*\(\s*($balanced_parens)\s*\)/) { my $attr =3D $1; $attr =3D~ s/\s*\(\s*(.*)\)\s*/$1/; @@ -6931,7 +6936,7 @@ sub process { } =20 # check for c99 types like uint8_t used outside of uapi/ and tools/ - if ($realfile !~ m@\binclude/uapi/@ && + if (!is_uapi($realfile) && $realfile !~ m@\btools/@ && $line =3D~ /\b($Declare)\s*$Ident\s*[=3D;,\[]/) { my $type =3D $1; @@ -7424,7 +7429,7 @@ sub process { } =20 # check for #defines like: 1 << that could be BIT(digit), it is no= t exported to uapi - if ($realfile !~ m@^include/uapi/@ && + if (!is_uapi($realfile) && $line =3D~ /#\s*define\s+\w+\s+\(?\s*1\s*([ulUL]*)\s*\<\<\s*(?:\d+|$= Ident)\s*\)?/) { my $ull =3D ""; $ull =3D "_ULL" if (defined($1) && $1 =3D~ /ll/i); --=20 2.55.0 From nobody Sat Sep 26 13:18:37 2026 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 3EBCD2AF1D for ; Tue, 1 Sep 2026 10:56:52 +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=1788260215; cv=none; b=uuzDTGMAhqiYAR3eskgwNBeRJhBqZRmVNeHy9jlY/x8VDtod/LcnINenu5KjCYKIBsqVmeqvnXy+p4fypq2oWLuQ4YX4zwJIFooE95TCHWS70SCKblTz3Cr6xrsylGH6772W/s6lavug+kRA+3HAboWtkyBv2nD2ffFHsjD9GZM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788260215; c=relaxed/simple; bh=B6huL/iMPS6Oxy/eyqo7uPI64Jwh1jUlHac/14kS3FE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=IOKcFeWx2axlmTy6sAJd4xYUL02KqTWXAYvmb+BFdsI+RpOKbaI0eO9OYProaMnH+lpKLDfVTZjuk3/utOji4p2ey6L69i38AilwZ2azY5qRwPwty2mvSs9UTeJahz7X8u0C66eSaY8anupa4+xnrYpVShgXza5KJWzn22le9qQ= 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; 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 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 44E8B21EFF; Tue, 1 Sep 2026 10:56:50 +0000 (UTC) Authentication-Results: smtp-out1.suse.de; none 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 560CD136CC; Tue, 1 Sep 2026 10:56:46 +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 uI/vE26vlmrRGwAAD6G6ig (envelope-from ); Tue, 01 Sep 2026 10:56:46 +0000 From: Petr Vorel To: linux-kernel@vger.kernel.org Cc: Petr Vorel , Andrew Morton , Andy Whitcroft , Joe Perches , Dwaipayan Ray , Lukas Bulwahn , Cryolitia PukNgae Subject: [PATCH v5 5/5] checkpatch: Skip kernel specific checks for userspace Date: Tue, 1 Sep 2026 12:56:42 +0200 Message-ID: <20260901105642.851234-6-pvorel@suse.cz> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260901105642.851234-1-pvorel@suse.cz> References: <20260901105642.851234-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-Transfer-Encoding: quoted-printable X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spam-Level: X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Queue-Id: 44E8B21EFF X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 50.00]; REPLY(-4.00)[]; TAGGED_RCPT(0.00)[] X-Rspamd-Action: no action X-Spam-Flag: NO X-Spam-Score: -4.00 Content-Type: text/plain; charset="utf-8" These check are kernel specific, do not warn about it when testing userspace code: * BIT_MACRO * LONG_UDELAY * MSLEEP * PREFER_KERNEL_TYPES * USLEEP_RANGE Follow-up: 99b70ece33d8 ("checkpatch: suppress strscpy warnings for userspa= ce tools") Signed-off-by: Petr Vorel --- New in v5. scripts/checkpatch.pl | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 97bf952b0fbc..0dac0ffa009b 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -6701,7 +6701,7 @@ sub process { } =20 # prefer usleep_range over udelay - if ($line =3D~ /\budelay\s*\(\s*(\d+)\s*\)/) { + if (!is_uapi($realfile) && $line =3D~ /\budelay\s*\(\s*(\d+)\s*\)/) { my $delay =3D $1; # ignore udelay's < 10, however if (! ($delay < 10) ) { @@ -6715,7 +6715,7 @@ sub process { } =20 # warn about unexpectedly long msleep's - if ($line =3D~ /\bmsleep\s*\((\d+)\);/) { + if (!is_uapi($realfile) && $line =3D~ /\bmsleep\s*\((\d+)\);/) { if ($1 < 20) { WARN("MSLEEP", "msleep < 20ms can sleep for up to 20ms; see function description= of msleep().\n" . $herecurr); @@ -6936,8 +6936,7 @@ sub process { } =20 # check for c99 types like uint8_t used outside of uapi/ and tools/ - if (!is_uapi($realfile) && - $realfile !~ m@\btools/@ && + if (!is_uapi($realfile) && !is_userspace($realfile) && $line =3D~ /\b($Declare)\s*$Ident\s*[=3D;,\[]/) { my $type =3D $1; if ($type =3D~ /\b($typeC99Typedefs)\b/) { @@ -7429,7 +7428,7 @@ sub process { } =20 # check for #defines like: 1 << that could be BIT(digit), it is no= t exported to uapi - if (!is_uapi($realfile) && + if (!is_uapi($realfile) && !is_userspace($realfile) && $line =3D~ /#\s*define\s+\w+\s+\(?\s*1\s*([ulUL]*)\s*\<\<\s*(?:\d+|$= Ident)\s*\)?/) { my $ull =3D ""; $ull =3D "_ULL" if (defined($1) && $1 =3D~ /ll/i); --=20 2.55.0