From nobody Sat Feb 7 22:39:23 2026 Received: from out-179.mta1.migadu.com (out-179.mta1.migadu.com [95.215.58.179]) (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 1A2EE23314C for ; Mon, 13 Jan 2025 09:09:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736759368; cv=none; b=CV+bGO203dZSJmrwUPVWT3nmTOjpCdCJl1DrYRC43vyQdzYGrDh4U8bBjPjtq+Gd8EEWhCZytrxvF3X+1W1EAitpANnpl/qjJWMXJ+ewDdgJfsXReGBhM4v85euzgEUy+bNc//XJOIc0XweZcSixFN3w1VPaQaRcPar24ebMeos= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736759368; c=relaxed/simple; bh=Hw4QjYBpYNjNn2BDJE9Q217lyn6HLTlYcKsex6EsmsQ=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=pLfpO64hh6GT7oW6fy1dptvJxzPWWVza2KUgXY+7b8pN17niq/dqs3R0BEWFVu28p1We3bMxcZA9MnYxhX0t25sSbV/1BF7s3j1NUUhuJQh2esb8oyWl1HvAx3c3k4OAjysPRy2dmN1bwojnsC79vtzLjeTVXrEQepXqPhccJB4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=GocJqIUH; arc=none smtp.client-ip=95.215.58.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="GocJqIUH" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1736759355; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=jk6HJVb+Aep3vTKHHX50Pae/3gMrGVvWrzxCk4ioLos=; b=GocJqIUH4vvNWq2CTDebP56KXUq2uVOwnsvj6Ugx9fY3RjE2UwuCqPoNNRE1xDW8Pk0NfY qPTopKbyKdKyiTYawW+SbPJdurUrNiTstjff9gdIMYhpYM7gNrlS89KAAi4kc6DmKd9HLV 0wGx5ZjzMnO0e++HC6MsggXfiwkHdg0= From: Thorsten Blum To: Russell King Cc: Thorsten Blum , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RESEND PATCH] ARM: vfp: Improve data types in vfp_estimate_div128to64() Date: Mon, 13 Jan 2025 10:08:38 +0100 Message-ID: <20250113090838.402798-2-thorsten.blum@linux.dev> 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-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" The divisors mh and ml can both be u32 instead of u64. Since do_div() implicitly casts the divisors from u64 to u32, changing their data types to u32 also removes the following Coccinelle warnings reported by do_div.cocci: arch/arm/vfp/vfp.h:121:2-8: WARNING: do_div() does a 64-by-32 division, p= lease consider using div64_u64 instead. arch/arm/vfp/vfp.h:135:2-8: WARNING: do_div() does a 64-by-32 division, p= lease consider using div64_u64 instead. Use upper_32_bits() to compare 32-bit numbers instead of 64-bit numbers and to prevent the warning: left shift count >=3D width of type [-Wshift-count-overflow] Compile-tested only. Signed-off-by: Thorsten Blum --- arch/arm/vfp/vfp.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/arm/vfp/vfp.h b/arch/arm/vfp/vfp.h index e43a630f8a16..29073d89ef00 100644 --- a/arch/arm/vfp/vfp.h +++ b/arch/arm/vfp/vfp.h @@ -109,12 +109,13 @@ static inline u64 vfp_hi64multiply64(u64 n, u64 m) =20 static inline u64 vfp_estimate_div128to64(u64 nh, u64 nl, u64 m) { - u64 mh, ml, remh, reml, termh, terml, z; + u64 remh, reml, termh, terml, z; + u32 mh, ml; =20 if (nh >=3D m) return ~0ULL; mh =3D m >> 32; - if (mh << 32 <=3D nh) { + if (mh <=3D upper_32_bits(nh)) { z =3D 0xffffffff00000000ULL; } else { z =3D nh; @@ -129,7 +130,7 @@ static inline u64 vfp_estimate_div128to64(u64 nh, u64 n= l, u64 m) add128(&remh, &reml, remh, reml, mh, ml); } remh =3D (remh << 32) | (reml >> 32); - if (mh << 32 <=3D remh) { + if (mh <=3D upper_32_bits(remh)) { z |=3D 0xffffffff; } else { do_div(remh, mh); --=20 2.47.1