From patchwork Mon Mar 4 10:56:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 209501 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:fa17:b0:10a:f01:a869 with SMTP id ju23csp1347828dyc; Mon, 4 Mar 2024 03:08:09 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU5YaChUOXDHP+Ig2p5/N4qvhTSE1iCFdr9HtD59/WLc5dMMYAU6DhMc94sJJfrqf9gOdsXWB69efrjDV1u3NBQjKu7IA== X-Google-Smtp-Source: AGHT+IHlG0Mx/UAZosZ8XHPDI68hXx7bsiNc/zEtTDubfMmb4A2MbK792VAOXG5tCAIqd6tSX4uJ X-Received: by 2002:a17:907:b01:b0:a44:9260:3190 with SMTP id h1-20020a1709070b0100b00a4492603190mr6855868ejl.0.1709550489039; Mon, 04 Mar 2024 03:08:09 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709550489; cv=pass; d=google.com; s=arc-20160816; b=Xc5piDVnxxWO8ENv/wMrZ2LAOEo4t/LYuj+F3UBrzu+YEJeR6nx4YpOS26lAdP/5lp J4vF9cFnm29HY8kPTFALLp5iQ4oFh0Rkt/P67Mrg5K8xQ1njMZRJ0piu3a3sJcLcExSK MiBt8Jq5bvdgdZWxXZGls+MNIaJUy5KLAh6fyPYuXoC/HAZKXeXXwzIGEdCWIZ+TMC73 nNvxS6mX2uErgWsHBOfJgkTqD4JcIlNZ730ln3PSOWHdItoQJLtEXCintykDGYIiX0j1 ltXmA0UJvjxGchM2CbN6nQsx84vB6EXV2DGS0qyTWxFM+oXKtLowxihMoa3IV1Ruhg4F wSOA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=x1vSC5WKNKZ/basfxLIhiGp8zqjcF0FXODMLStxf1fo=; fh=Re6SSzu9QzMpaRuirZ2UqpnIvvxr2r1dKGdBxh+ErKo=; b=OIaRBVVHV/Qm+bOVuigzn2ixbfr4cpXbmG2JWOO1vWDaGGzXstMpQqL1XJJxhJh2gQ Sas7X/TusqsX3JIjB/pX6KIA/646lZl5y/Gf/BpE4TnUgY55YpC+vym+C6LZkWmEc/hG a2vXeLx87ZtM+wSlVvuZW6oDqusNOaBR+66MCz1CUHsEn/l8VUZu4ut8Dxcce6Pi//uc WgdUWsn6ICRzEJ9O5937gBXpvo5T8AnWrzBD8Mex1AlTSkhMscTkJJzdtXabE/QiaGEK 3LlEhamK5GwM4fcmsi8RaVyK6jE7za2pz2GlRukLwu+1YtTjDmE7eixUSx2wFHI/U0lT rhlw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-90464-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90464-ouuuleilei=gmail.com@vger.kernel.org" Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 25-20020a170906319900b00a4421013c3dsi3918517ejy.480.2024.03.04.03.08.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 03:08:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-90464-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-90464-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90464-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 70B031F23889 for ; Mon, 4 Mar 2024 10:56:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 56949383B4; Mon, 4 Mar 2024 10:56:34 +0000 (UTC) Received: from albert.telenet-ops.be (albert.telenet-ops.be [195.130.137.90]) (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 B1E4C25760 for ; Mon, 4 Mar 2024 10:56:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.130.137.90 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709549792; cv=none; b=FtVRhfDaJUKmfzGPA+iymYNMe0xoONNGHj3nXeiKRAl2CKcsFZUG+p907KlOob6F36c2MJLuGXt0HPfIyKoYzxcLQ6OvMIaMMWJGbpyDQas0MNI6H2VVmmR3UH/mnpXwCa6Ymxv/01pNl7AlTB6d28/j4YE0If42Kh++JWJve7A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709549792; c=relaxed/simple; bh=J0ys2nCMeqQznpcv3TvixEojj3WOQhbihu0iZmOz7CM=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=CqVHyo5ivR2+iq2UHCkEpr4W0bXY7OSQgf/iCXXjxHHQKT1C9PPN7qJ1BBz4c6dFql/HJISnHv1LP4Y0+wAVqaLpnRHKkMzVVsXV2syYA0AK54JzFhCmcpGLV8ZNgN6IH8pGgPT/QWiylO9V9Llin9FnkioD8YyvPvMGV92xi8c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=glider.be; spf=none smtp.mailfrom=linux-m68k.org; arc=none smtp.client-ip=195.130.137.90 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=glider.be Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux-m68k.org Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed40:2716:1247:52e8:4f90]) by albert.telenet-ops.be with bizsmtp id uawR2B0022qflky06awRS0; Mon, 04 Mar 2024 11:56:27 +0100 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtp (Exim 4.95) (envelope-from ) id 1rh5zR-002I7A-8W; Mon, 04 Mar 2024 11:56:25 +0100 Received: from geert by rox.of.borg with local (Exim 4.95) (envelope-from ) id 1rh5zc-007bnl-UC; Mon, 04 Mar 2024 11:56:24 +0100 From: Geert Uytterhoeven To: Peter Zijlstra , Ingo Molnar , Will Deacon , Waiman Long , Boqun Feng , Arnd Bergmann Cc: linux-kernel@vger.kernel.org, linux-sh@vger.kernel.org, linux-s390@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH v2] locking/spinlocks: Make __raw_* lock ops static Date: Mon, 4 Mar 2024 11:56:20 +0100 Message-Id: <78c366485bff13753de758fd27fb6b465ed2850a.1709549641.git.geert+renesas@glider.be> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792593613403210919 X-GMAIL-MSGID: 1792593613403210919 If CONFIG_GENERIC_LOCKBREAK=y and CONFIG_DEBUG_LOCK_ALLOC=n (e.g. sh/sdk7786_defconfig): kernel/locking/spinlock.c:68:17: warning: no previous prototype for '__raw_spin_lock' [-Wmissing-prototypes] kernel/locking/spinlock.c:80:26: warning: no previous prototype for '__raw_spin_lock_irqsave' [-Wmissing-prototypes] kernel/locking/spinlock.c:98:17: warning: no previous prototype for '__raw_spin_lock_irq' [-Wmissing-prototypes] kernel/locking/spinlock.c:103:17: warning: no previous prototype for '__raw_spin_lock_bh' [-Wmissing-prototypes] kernel/locking/spinlock.c:68:17: warning: no previous prototype for '__raw_read_lock' [-Wmissing-prototypes] kernel/locking/spinlock.c:80:26: warning: no previous prototype for '__raw_read_lock_irqsave' [-Wmissing-prototypes] kernel/locking/spinlock.c:98:17: warning: no previous prototype for '__raw_read_lock_irq' [-Wmissing-prototypes] kernel/locking/spinlock.c:103:17: warning: no previous prototype for '__raw_read_lock_bh' [-Wmissing-prototypes] kernel/locking/spinlock.c:68:17: warning: no previous prototype for '__raw_write_lock' [-Wmissing-prototypes] kernel/locking/spinlock.c:80:26: warning: no previous prototype for '__raw_write_lock_irqsave' [-Wmissing-prototypes] kernel/locking/spinlock.c:98:17: warning: no previous prototype for '__raw_write_lock_irq' [-Wmissing-prototypes] kernel/locking/spinlock.c:103:17: warning: no previous prototype for '__raw_write_lock_bh' [-Wmissing-prototypes] All __raw_* lock ops are internal functions without external callers. Hence fix this by making them static. Note that if CONFIG_GENERIC_LOCKBREAK=y, no lock ops are inlined, as all of CONFIG_INLINE_*_LOCK* depend on !GENERIC_LOCKBREAK. Signed-off-by: Geert Uytterhoeven Acked-by: Waiman Long --- Compile-tested on all defconfigs that have CONFIG_GENERIC_LOCKBREAK=y: - sh/sdk7786_defconfig, - sh/shx3_defconfig, - s390/debug_defconfig, and also on s390/debug_defconfig after changing: CONFIG_DEBUG_LOCK_ALLOC=n CONFIG_DEBUG_WW_MUTEX_SLOWPATH=n CONFIG_LOCK_STAT=n CONFIG_PROVE_LOCKING=n v2: - Add Acked-by, - Drop RFC, - Improve patch description. --- kernel/locking/spinlock.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/kernel/locking/spinlock.c b/kernel/locking/spinlock.c index 8475a0794f8c5ad2..7009b568e6255d64 100644 --- a/kernel/locking/spinlock.c +++ b/kernel/locking/spinlock.c @@ -65,7 +65,7 @@ EXPORT_PER_CPU_SYMBOL(__mmiowb_state); * towards that other CPU that it should break the lock ASAP. */ #define BUILD_LOCK_OPS(op, locktype) \ -void __lockfunc __raw_##op##_lock(locktype##_t *lock) \ +static void __lockfunc __raw_##op##_lock(locktype##_t *lock) \ { \ for (;;) { \ preempt_disable(); \ @@ -77,7 +77,7 @@ void __lockfunc __raw_##op##_lock(locktype##_t *lock) \ } \ } \ \ -unsigned long __lockfunc __raw_##op##_lock_irqsave(locktype##_t *lock) \ +static unsigned long __lockfunc __raw_##op##_lock_irqsave(locktype##_t *lock) \ { \ unsigned long flags; \ \ @@ -95,12 +95,12 @@ unsigned long __lockfunc __raw_##op##_lock_irqsave(locktype##_t *lock) \ return flags; \ } \ \ -void __lockfunc __raw_##op##_lock_irq(locktype##_t *lock) \ +static void __lockfunc __raw_##op##_lock_irq(locktype##_t *lock) \ { \ _raw_##op##_lock_irqsave(lock); \ } \ \ -void __lockfunc __raw_##op##_lock_bh(locktype##_t *lock) \ +static void __lockfunc __raw_##op##_lock_bh(locktype##_t *lock) \ { \ unsigned long flags; \ \