From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.44 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796289349; b=BgBCYRmAsvamoeHYi+zXbUvWt+83B2N3Qm+e0ctGQOD5N6iycEB1rrrep0p65kKuKlQz hzbs+cpqiTGNkho4oa52qw01TUuUufpJ9aMssSZ62SRMw8RXU258ScBZs5O81BuczGfKy vifFBoo9zsFolxKc6/IYa+J4+93cpV0xi83loi1JpC0MiQXgkHeu+rv9wSrJcvHLBiayw m0mhSy9ZEn413Auz0fpyQH9BHWRfbVLIa9oWvcT0pzDTrdKw2EawI44YQjdJb11KKvJNA s7Fmp60jsPI4YLalIlrXZofkCLt8OG9/SpooIZxLzOHvkO8ztmPPkX9xrxFpASlPVDw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796289349; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References:X-Mailer: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=4CxACTwRGNdSHKQLsBOJtdmNmvedi450YuzlwPjVEzo=; b=G5u9L9r3rItGU/qooZBrbd1RlH4CIkO8NeendCsNf0Kv9rhB6OKksgZjOyZrVrAeDipD 2qo0WMlgSO/ulwWI5LVfNiW74bleK5f5vEikfd72mpbXKTh4nQAxj3ks83ywOfOg3Ko1d y1F7uP6leq3r+CSjkIIdW1c/FQOzR6dqS8h6I5xOovpfbzwuhpq04+gOplmKeUFKHjm/B B+StusB2tmNrbzheUD+Hk7ntLB6iOG4WGtWwojmutHKvIZDlbFNT8NELQlQah3eLCUE2Z 8eNXuLl5eGWoXqTWAJDx1wsZiGcONlijMijD3o+WQurps7WWXiTX+p5J2SVTrb6KUXQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=jAERzUTK; arc=none smtp.remote-ip=209.85.128.44 Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 21BF7606A337 for ; Thu, 3 Dec 2026 09:15:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 21BF7606A337 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=jAERzUTK Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-4b467581b98so129339455e9.0 for ; Thu, 03 Dec 2026 01:15:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796289347; x=1796894147; darn=vger.kernel.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=4CxACTwRGNdSHKQLsBOJtdmNmvedi450YuzlwPjVEzo=; b=jAERzUTKeQRp5l0Igdiuf0Q8pChkgjC9DAa0qHuabSkJlh6/ugw5Ks04Iwz+N1txpJ UtSSfPsk3971OX8ASi9SIcGQPuRrczi3FFvX1MeDM3GMUudM26OxjA6R9yxJ4abfzEMf HGUJRatv11pkkOO30m4jn5/XsgF/4FBB18m8u3aewE68URGGVUa4Ylo9VFlIolvRHF9v p+qk2J+H84I3EpzJipvK7UonaO+nuYDtNkubUgrOG4HLaa9k0vYAudNu4qrpWlQwXGqh wa/hTGYdDC9E/Hc1YfqcCZT3sRo/NEP6AI5yunEjdJrismj4IKaoSYslEawmnIpTWEF0 t8BQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796289347; x=1796894147; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=4CxACTwRGNdSHKQLsBOJtdmNmvedi450YuzlwPjVEzo=; b=CTwTxjAS2HdH3mW/R3X6qTNOio1lOzfV5kYE0kgn+OVUmEyGerD6O3VZ1PiwkzwfWh abVO6mUk2f6fakerNlgW7iJ6fk++8gUT8YJ+N7iHjK0sBwGmCJDK2YItveXuaAPQjqcM hoxT0TcEhWkWUX+N8svp8w4B3D8dHwGOmT9/A59EMIA8qy+M0OMcq89QIbzeAcwDvtOs HJ4uIpf7M7XNpBUoeRnOIQxeEn81gjVvT452IVVCKkjIkD/ApG2F2vKBbKdcPNCrf9SO Ar/pdE+8HTqLGJwMPoyYocJlj8+8HCUy4v/k13QUJZVE1ik0ZvYXcVBxVjPXBf3LLA1B 9b7A== X-Forwarded-Encrypted: i=1; AL+hErHbtnRGUbqaf84zzBcHAJRTY8ERKy5fou7ojnNTcQSPDq9+NFpOlnxNM19ZEXT6x1ALKymuPWwlE/8=@vger.kernel.org X-Gm-Message-State: APuU4Z8n8RsqudhDzZohbYwsCfZyAB7u0Fq+Xdwex4OIgGtwkYGrOoO6 /Ipd75TXqzRBqHTCA8YRBNdvEz+ZHejijC0LPUqjU5l5RzLoskNaFBUC X-Gm-Gg: AZFdTZfJL0b8lS94HCwDpjNYeB/JSFGqwDmTob12hrnYjLGCMNtysGFnYbkoK4/MMUb /Cl3uePGYgjhG1aEHLGGP9E9LxJTbr4PRMekUHU/DkOEPp2Bn5jnuFYcUrz6PKPG1gOPb317dif 4nuixlVY+r6qT+SwymLcW2NVIAs4niOFSAZdrc+1ACRHHtGdMq1xHwmUaBwn0+Kp4mC5UkYJMvh YOfgrlW7sxl7668ShYNvMKOfBj+fM99huQ+i7W/jo5ZnwHjFCDFJ8o02FDIXIL4enlsk7XhbYlU RmLuVWnNtHzYBoBnfHibdb3czpJlWf+wAis40Q/be4ohsCytfy8SvB7jvqTpGt12P628h4ydRvU hBMAVzAQygDXfUeXFmchzZXvRU5UU4rKWkSDThU+VLJP1/QXBNY7wUxtZgH/BlIUk/7DrMi1+Z8 2xVwVOqN5C3uXgvmOMlcBGBNJ/t0A7yoiJyP/KOTM29rgk7E+u/Fx2iItkN1V2fio6ahfelbiUH 4bwbag4vojgvILRCkIijDJOpsgr1a0EpDO7CT89yL8kSAeg6+ErdCpmtDN2Dt2lQuSRKtHh7JoZ z3yK3Gnq+YKZB3uHcjg6XS1hwIK/FubEJg9wG8nFntxUOSA1oZ4AHAeuns86ibH0 X-Received: by 2002:a05:600c:3b8a:b0:4a3:59c9:a754 with SMTP id 5b1f17b1804b1-4bb8892da25mr829517555e9.22.1796289347352; Thu, 03 Dec 2026 01:15:47 -0800 (PST) Received: from pumpkin (82-69-66-36.dsl.in-addr.zen.co.uk. [82.69.66.36]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bbe0055020sm115688155e9.4.2026.12.03.01.15.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Dec 2026 01:15:47 -0800 (PST) Date: Thu, 3 Dec 2026 09:15:46 +0000 From: David Laight To: Romain TISSERAND Cc: Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Stephen Boyd , Brian Masney , Jerome Brunet , Maxime Ripard , Frank Oltmanns , linux-clk@vger.kernel.org, linux-sunxi@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] clk: sunxi-ng: nkm: use div64_ul() for the rate divisions Message-ID: <20261203091546.00a01892@pumpkin> In-Reply-To: <20261203073646.3099665-1-romain.tisserand@gmail.com> References: <20261118162237.1664352-1-romain.tisserand@gmail.com> <20261202224025.07df2dd1@pumpkin> <20261203073646.3099665-1-romain.tisserand@gmail.com> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; arm-unknown-linux-gnueabihf) X-Mailing-List: linux-clk@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Thu, 3 Dec 2026 08:36:45 +0100 Romain TISSERAND wrote: > Hi David, > > On Wed, 2 Dec 2026 22:40:25 +0000, David Laight wrote: > > Exactly when does the truncation happen? > > That is what actual values cause a truncation? > > None. Every NKM clock in sunxi-ng has N <= 32, K <= 4 and M <= 16, so > n * k <= 128 and m <= 16: the divisor always fits in 32 bits and > do_div() gives the exact result today. > > > And if there is one, why does it only happen on 64bit. > > Only in the sense that the divisor is an unsigned long: on 64-bit it is > 64 bits wide and do_div() takes a u32, so the conversion could in > theory drop high bits; on 32-bit unsigned long is already 32 bits, so > there is nothing to drop. With the real factor ranges it never happens > on either. > > So "on 64-bit it would be truncated" overstates it, sorry for the > misleading wording and for the Fixes: tag: there is no bug to fix. The > patch only quiets the coccinelle do_div() check the robot reported, > with no functional change. If the maintainers want it, I will send a v2 > whose commit message says just that, without the Fixes: tag; otherwise > it can simply be dropped. Coccinelle just needs ignoring (again). Type based bound checking ends up requiring something that supports indefinite length numbers. David > > Thanks, > Romain