From nobody Thu Apr 2 20:41:07 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 689643009FA for ; Fri, 13 Feb 2026 07:39:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770968386; cv=none; b=dZUyuXGfgDlvvm5BELSMwMrthMZ3zHb6wgED8V3C4XydedWULZvhg6FVSSQI2FdeMNKiEyNLskTgJcdK5ICEBRDXE30GOB9G1ttHZxny92AoStICgqR99eXbebwqxtjFx5s2wDmzZSnJ5bB3VIo5p86I913kdzkWy90L/TAmisE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770968386; c=relaxed/simple; bh=j034vrbnVppCVaRqPOZKRQwx40dc39NXjppZYoTZ3t8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=fX3IsMmGpttAFxjThxwSExlII2u4c10gf+SwoHoYwn0u6fmZwXJNxP9sfXmNddE4PTYB449GzO1uMJqoVb9bWprgkattXw61k/n/dH8qyMHd22lFLDT2VdVk+FVe+y6Q/YWvfRkhDqBatIqRxG/Z80gQW5f617qwR07TqEEU824= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=Z/4wc4Qk; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=IueS1IOm; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Z/4wc4Qk"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="IueS1IOm" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1770968382; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=3l+yKlSt1K5zuq02BNPpqerY/A2HiaOFFBT0RhhfwRg=; b=Z/4wc4QkGz0WIuiLzDOVoCoDKrlnjYyxKg6VRLl7sxSVwKIkHdxRGhRwCQYWBdXtEhiyhR FOeyRWiQBVg6l4H2ubRrNJ/CeGhwyDzJisTQYOjwiRrzG8xfCUGZMLrZyWg0pcY2p/Kgv2 CBU54JPb6h4VznAdlNsNfjcsQhgSkFQRHSJ3o8abLXn4SPHu1gjpluv/+l5kPcGZMlgJqn YchAuybegDA7maBk3Vp6ppjoFGdteiIwo2aCZEjz4ONQBu1l5bvH7LTe7LcviFR5wUdKuB fLjfe1A7g/7Sd2bKHHVFiI+rAWttVAFDkI9H7bS1sG4EsDE+mnUaSYy/AOuLqA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1770968382; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=3l+yKlSt1K5zuq02BNPpqerY/A2HiaOFFBT0RhhfwRg=; b=IueS1IOmxQxEyGEPQKt2zd6/uqqB4UrVk6i+6dgSx8G5zokptn0E3id9qDLSFR1SNSefzD kY6IdIO3kt/9vfCA== Date: Fri, 13 Feb 2026 08:39:29 +0100 Subject: [PATCH] ARM: clean up the memset64() C wrapper 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="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260213-arm-memset64-cleanup-v1-1-644a9735eeec@linutronix.de> X-B4-Tracking: v=1; b=H4sIAAAAAAAC/6tWKk4tykwtVrJSqFYqSi3LLM7MzwNyDHUUlJIzE vPSU3UzU4B8JSMDIzMDI0Mj3cSiXN3c1Nzi1BIzE93knNTEvNIC3WQTc4PENCNjo1QLcyWg1oK i1LTMCrCx0bG1tQDVRsTGZgAAAA== X-Change-ID: 20260212-arm-memset64-cleanup-c470af232e87 To: Russell King Cc: Matthew Wilcox , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Linus Torvalds , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1770968381; l=1659; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=j034vrbnVppCVaRqPOZKRQwx40dc39NXjppZYoTZ3t8=; b=e6IdjNcnXqRoTgbcQAEUukScuvnw8+9Pu/oa9jhaVZtMMX/aqZh/sYqSz7Q/ZP6+pcmVo2qhA /SAwScGKfuJAKQPNE29Ouu5RwUs3u5P3+Ypd5Ih5vgdGN2WAt0Q4oxL X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= The current logic to split the 64-bit argument into its 32-bit halves is byte-order specific and a bit clunky. Use a union instead which is easier to read and works in all cases. GCC still generates the same machine code. While at it, rename the arguments of the __memset64() prototype to actually reflect their semantics. Suggested-by: Linus Torvalds Signed-off-by: Thomas Wei=C3=9Fschuh --- arch/arm/include/asm/string.h | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/arch/arm/include/asm/string.h b/arch/arm/include/asm/string.h index c35250c4991b..96fc6cf460ec 100644 --- a/arch/arm/include/asm/string.h +++ b/arch/arm/include/asm/string.h @@ -39,13 +39,17 @@ static inline void *memset32(uint32_t *p, uint32_t v, _= _kernel_size_t n) } =20 #define __HAVE_ARCH_MEMSET64 -extern void *__memset64(uint64_t *, uint32_t low, __kernel_size_t, uint32_= t hi); +extern void *__memset64(uint64_t *, uint32_t first, __kernel_size_t, uint3= 2_t second); static inline void *memset64(uint64_t *p, uint64_t v, __kernel_size_t n) { - if (IS_ENABLED(CONFIG_CPU_LITTLE_ENDIAN)) - return __memset64(p, v, n * 8, v >> 32); - else - return __memset64(p, v >> 32, n * 8, v); + union { + uint64_t val; + struct { + uint32_t first, second; + }; + } word =3D { .val =3D v }; + + return __memset64(p, word.first, n * 8, word.second); } =20 /* --- base-commit: 37a93dd5c49b5fda807fd204edf2547c3493319c change-id: 20260212-arm-memset64-cleanup-c470af232e87 Best regards, --=20 Thomas Wei=C3=9Fschuh