Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp1198528rbb; Mon, 26 Feb 2024 01:41:50 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVCh5LqcbRW6dYRxEThap6ZWCNZSVZnCtuYv+YKh0ahqMz1N79yRGY6F4HGexx5Bay0mjcWpDSnIuQCsmqCKmpntw5yT6wq2H/Vzu9pJA== X-Google-Smtp-Source: AGHT+IESzoGvel5b2NtqU3AWMFaWx8GL4Ww1RoF7HiB0+rrXqMYEsAFp71D7EO8jMJiLqVg0bKe0 X-Received: by 2002:a05:6a21:3512:b0:1a0:eac1:c4c8 with SMTP id zc18-20020a056a21351200b001a0eac1c4c8mr4873435pzb.43.1708940510207; Mon, 26 Feb 2024 01:41:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708940510; cv=pass; d=google.com; s=arc-20160816; b=sJ0naNpOxhSqIr7fxhlg8O1IqMzZ1hE2BzE8L+Lu1H7zKgFG3PjHgesmh4e3KiAruT FelfvnTYqwnPB0mETTsulkl0Cz185f/Z7Yelljto6DEAUA/pKhC6bau3fAlkr5q8f2qb 4Y63wFT849iUBIg/trd7eUjGCdI7CGyoV+IeOgveYWSDWWReb4Xsk/TCxCKccoI0MMJo qlXBX3+3pgoWQkpS9VZZIRqDHHwgrHGCwLyGIJ6OyRuQ0K9n75IDFfYmkBy87Eqj/KmG 3Lf1GA0YV2GuNfyBTBFpaPu8rTSae112TGUUsAnxSxeXfCdTl/ewBaADIuuPQEDW8Bhd fsZg== 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:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=lVqQ7Rjy5L8DAOM0lDlFnwur37SLSiQdNyMxMNLovDA=; fh=szTVn1nz9e2aFeEQqArI8lIa+Yy++R7oXDK9gA9WHhM=; b=Yz2JMiA/AzNtLMUgzwJyTs9kgFIBZ5tkUj6HPrWEixAd8tLCQIgz4Kus/cQOGdf34u HYIWteW62Bf9VR6ftUOWo/8ivpFsK8GfrTIpMm4Tef6RJQi7QOzLsiV5XjvnvHufx8oX ilZTMc/TCSo3rzrC832/rsbOKJl9smn6VnhWNgyIj+PFLrEvXyBfxD3VxRwWTU+LxmW7 x3KolyoIj0UyPmln7aV4IdkpeKo5f0Ne9v/bIsHpPzKP0yp0gPfFPirUg+MTegrotFbb GT7hQ8aR8rw91TRet1Y3PrufEpmO5CjW4MoXULtOAQ/xFJCkIcXQTbznNDg+wagIok2x 0kbQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@toblux-com.20230601.gappssmtp.com header.s=20230601 header.b=xDyB9ESE; arc=pass (i=1 dkim=pass dkdomain=toblux-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-81004-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81004-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id ds13-20020a17090b08cd00b0028e63fbc789si5276828pjb.107.2024.02.26.01.41.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 01:41:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-81004-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@toblux-com.20230601.gappssmtp.com header.s=20230601 header.b=xDyB9ESE; arc=pass (i=1 dkim=pass dkdomain=toblux-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-81004-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81004-linux.lists.archive=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id E606D2813D8 for ; Mon, 26 Feb 2024 09:41:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D78DC79DC5; Mon, 26 Feb 2024 09:05:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=toblux-com.20230601.gappssmtp.com header.i=@toblux-com.20230601.gappssmtp.com header.b="xDyB9ESE" Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (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 5D8D71CD2B for ; Mon, 26 Feb 2024 09:05:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708938339; cv=none; b=L2DtvnOCHvokt45PgVZS/PcxiU8mHM3Iu8zA875YMFX2uag9QPaiUTp11g3XaoglJ3Xh8h54YT6cn9bo5GszDk3ycfsvRTm/92LjUkb3Dft7H1iYlCZ32b8iVVLJbOfVClj/L2QwJxSKY+9uFIzl3GcuqAK6mJ59Bg9Vsjz+Xas= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708938339; c=relaxed/simple; bh=krkPkE2Z5L0UxpKDRAB4tBQ/QZXyjRxjCqMUWq6zpk0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=F6Wj+BwGKqW419+O6zP5YlwgJ1ruo9UyHuecZPS4kyj4y5efFzvbqspKfJZt82NpdCzVyNk9uoMCzeBRrSdDCqIupy3LzaqrVJ7bjWmhBdx5+Zvs76FahszXG+MxfrJCtNLHxAIHFmzR1GEbfM9FXE+RaSYZkn7Xwys+gZuQtpA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=toblux.com; spf=none smtp.mailfrom=toblux.com; dkim=pass (2048-bit key) header.d=toblux-com.20230601.gappssmtp.com header.i=@toblux-com.20230601.gappssmtp.com header.b=xDyB9ESE; arc=none smtp.client-ip=209.85.128.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=toblux.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=toblux.com Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-412a8b79b46so554715e9.1 for ; Mon, 26 Feb 2024 01:05:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toblux-com.20230601.gappssmtp.com; s=20230601; t=1708938337; x=1709543137; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=lVqQ7Rjy5L8DAOM0lDlFnwur37SLSiQdNyMxMNLovDA=; b=xDyB9ESESOcNO8RZYRw2RQqRlb+kFDo2yy3tPUfl4dy0ru6tb/0UwPQ8SR9G9Cg6Ki Gnte6G8MdbNJ0x7r8qs7G0g5z0yyQRxksay8ZogvzrtMqwqdGXakxYZh3+yLWdliEsvk Rr7q8JGymAXMCWv5dF5fU9PhxkE19I6BnmREmbEgNtFzloQ1VlXMrPcFe7Z10h0W/BXG 5M1QuxZ4r388Pw9q+VUU1OBg9VE06cVNpjDek11mHVyumStI6miG+2NLEdRWiCVmvWCs Yp0uxGc0Fx26bkrFfZtNbR2k1k6ugIqx1tfj4tl7KGfsy0pRD8DwdusXBnfNP1IORoRP wMVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708938337; x=1709543137; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lVqQ7Rjy5L8DAOM0lDlFnwur37SLSiQdNyMxMNLovDA=; b=N3P2ejJkjJtULszpsYKM6pfPaUnQ3QVW3boVgK0VIk4+AK+pt+ek0sBKSIU29Qarwh 2hc1+rRymWFU0FiZhmtX+zSQx62GSqoz9AaOR5RUcxvTch5RdFdKVUWSSchNnEJLLLGr 8UBKAXvxop8LxX5EH9zcZfuhzo0xTYe52R2SOuU+dSbg1qvHEpZWQSv0fx8zJbwpLpZh gcYqRqyqWszX3uJc6M1dEiEujUdverFESMC1tn5WeU4mYYSWipiMULxnphp2zreH7P3P kI8oYNKUNCxq1kbCjgFoNSSYi8dGemZSKXce0hZAMLHLroKCyLA0dEN5GDaqdPFU9Sz1 Lnjw== X-Forwarded-Encrypted: i=1; AJvYcCUeeZeDMGBt1AtMDx4YmJivF54isI0BayWu0EhlciZCo6GJek5rpVwO9FQo+/0zcJa1Z/LoLyzvjnwpcR7wgO0AK/KmDD52w7anJPWq X-Gm-Message-State: AOJu0Yw50eneta9YIhfgzHb0E37BJN2H0RjsK2vEDqK0q+JfK6wxPjFe LZb1/MIidK+CNqYl2u1q6yB3BPisK4/qTAq9ZwFuAqULqle9wzITL0F1VWhWzn8= X-Received: by 2002:a05:600c:444d:b0:412:9842:c4f2 with SMTP id v13-20020a05600c444d00b004129842c4f2mr5387610wmn.12.1708938336615; Mon, 26 Feb 2024 01:05:36 -0800 (PST) Received: from fedora.fritz.box (aftr-82-135-80-35.dynamic.mnet-online.de. [82.135.80.35]) by smtp.gmail.com with ESMTPSA id jd17-20020a05600c68d100b004129335947fsm11283074wmb.8.2024.02.26.01.05.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 01:05:36 -0800 (PST) From: Thorsten Blum To: thorsten.blum@toblux.com Cc: anna-maria@linutronix.de, frederic@kernel.org, jstultz@google.com, liaochang1@huawei.com, linux-kernel@vger.kernel.org, peterz@infradead.org, tglx@linutronix.de Subject: [PATCH v2] time: Use div64_ul() instead of do_div() Date: Mon, 26 Feb 2024 10:03:06 +0100 Message-ID: <20240226090305.117120-2-thorsten.blum@toblux.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Fixes Coccinelle/coccicheck warning reported by do_div.cocci. Compared to do_div(), div64_ul() does not implicitly cast the divisor and does not unnecessarily calculate the remainder. Signed-off-by: Thorsten Blum --- Changes in v2: - s/div64_long/div64_ul/ as suggested by Chang Liao --- kernel/time/jiffies.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/time/jiffies.c b/kernel/time/jiffies.c index bc4db9e5ab70..fccee15e94d5 100644 --- a/kernel/time/jiffies.c +++ b/kernel/time/jiffies.c @@ -91,7 +91,7 @@ int register_refined_jiffies(long cycles_per_second) /* shift_hz stores hz<<8 for extra accuracy */ shift_hz = (u64)cycles_per_second << 8; shift_hz += cycles_per_tick/2; - do_div(shift_hz, cycles_per_tick); + shift_hz = div64_ul(shift_hz, cycles_per_tick); /* Calculate nsec_per_tick using shift_hz */ nsec_per_tick = (u64)NSEC_PER_SEC << 8; nsec_per_tick += (u32)shift_hz/2; -- 2.43.2