From nobody Tue Jan 07 22:47:54 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YSR5k4sZHz5k6ft; Tue, 07 Jan 2025 22:47:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YSR5k47n3z4JSf; Tue, 7 Jan 2025 22:47:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736290074; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xGbllnePdhxG0OXI8hwJ3Yv61fGUrbkoEhaFszxVH1w=; b=QNB7mmqKA6vleySffZAtgpE4B4DTGpxH0TtqiDUDIh+kVzu4ZbMX0J9RGLZXUl9UAcOmgU 6fE+SHGMLVRXNr5jPTuCPi7VKeF9BIM5c2KLi5sagKt1EkvWZ0rC0hEbfbECJSPjtqJIx4 cxoVQ8w5zoOsilc5QdQeC27hTNbiP8k5Wci+iaDkRLKBQpIz/amekhTQUuHcun5Ah1MAaP d03+CwuehjePOMBUmFtpLgqYrWYfP0R+NkhREgXCBciHVNHNVuDDvHO1An+tez13iSdjiW i8YkFiWEvMlGtrPfok0qNoDzT/+U+Pi2kIja4DDMn6QeXEVgXo7hWyRbD7TzeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736290074; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xGbllnePdhxG0OXI8hwJ3Yv61fGUrbkoEhaFszxVH1w=; b=eDji284lwQAAsv7c72oU8O24v/pIiGSihROU1fYiT5bdwNzFdSpNk3Cr7641waB4zt+JJd 6/TVquc8HTX1FQu9F+yyX5sLUnC7xibDJH3Uu0UmAIk7p4PdD6M4x9ntzeM9ynqufTA4qe 6wveS+ohTDI3yMLJRt9AIrphTHSS/J6l2XxAX2xm/fhoC32eUyjeIm9kCwbK+jz2jFWWlL REMe7TMNEDlJqY3J/g+hYb0obh48DrLCRA7I22h2iqe+vXziSv6FQLEaO17a4Ub3cdx/3j OdKANZBzi6+bomLVokrULFaViW8EqkpeJptljGmzUpMMYcoGHctvKu9p+PvAzg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736290074; a=rsa-sha256; cv=none; b=TcTKsSRmt5erNUiWABNQO/dfXB8XqL08Cc6NzFwuOfLTQr5np/pylgdPSDGBG1ZKIsUZFR 3TD37G788pUIL0LnG0IcDvq8dIb9pjmzYHO937o4rNNQs9PpQaUgxf0m6TlnyAZaIfETTU axd78pDHzK6qyCAEDB3OPPvz3V/81+AWgWfI1oz0Spr6St0akfPPyD62w3K/XwmX1uMy6L ViSqX6+9PpDutZPPY8j7qdN8KOd+/l1BqdZPaAz9NeciUVXSohMCuf5JhzB4B/2yLeexBb ilfCWxtqSj6bsxrf/vHfUciUiXF6Zi3YtX82ezuxz5Egpsx97TGwYAIDzQkZaQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4YSR5k32bLzD7K; Tue, 07 Jan 2025 22:47:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 507MlsU6036335; Tue, 7 Jan 2025 22:47:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 507MlsLu036332; Tue, 7 Jan 2025 22:47:54 GMT (envelope-from git) Date: Tue, 7 Jan 2025 22:47:54 GMT Message-Id: <202501072247.507MlsLu036332@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: fd27f86dd71b - main - LinuxKPI: switch jiffies and timer->expire to unsigned long List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fd27f86dd71b7ff1df6981297095b88d1d29652e Auto-Submitted: auto-generated The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=fd27f86dd71b7ff1df6981297095b88d1d29652e commit fd27f86dd71b7ff1df6981297095b88d1d29652e Author: Bjoern A. Zeeb AuthorDate: 2024-12-28 09:57:56 +0000 Commit: Bjoern A. Zeeb CommitDate: 2025-01-07 20:00:20 +0000 LinuxKPI: switch jiffies and timer->expire to unsigned long It seems these functions work with unsigned long and not int in Linux. Start simply replacing the int where I came across it while debugging a wireless driver timer modification. Also sprinkle in some "const". Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D48318 --- sys/compat/linuxkpi/common/include/linux/jiffies.h | 28 +++++++++++----------- sys/compat/linuxkpi/common/include/linux/timer.h | 4 ++-- sys/compat/linuxkpi/common/src/linux_compat.c | 2 +- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/jiffies.h b/sys/compat/linuxkpi/common/include/linux/jiffies.h index bd05a0db0767..8346e74fb830 100644 --- a/sys/compat/linuxkpi/common/include/linux/jiffies.h +++ b/sys/compat/linuxkpi/common/include/linux/jiffies.h @@ -38,7 +38,7 @@ #define jiffies ticks #define jiffies_64 ticks -#define jiffies_to_msecs(x) ((unsigned int)(((int64_t)(int)(x)) * 1000 / hz)) +#define jiffies_to_msecs(x) ((unsigned int)(((int64_t)(unsigned long)(x)) * 1000 / hz)) #define MAX_JIFFY_OFFSET ((INT_MAX >> 1) - 1) @@ -68,7 +68,7 @@ extern uint64_t lkpi_msec2hz_rem; extern uint64_t lkpi_msec2hz_div; extern uint64_t lkpi_msec2hz_max; -static inline int +static inline unsigned long timespec_to_jiffies(const struct timespec *ts) { u64 result; @@ -78,10 +78,10 @@ timespec_to_jiffies(const struct timespec *ts) if (result > MAX_JIFFY_OFFSET) result = MAX_JIFFY_OFFSET; - return ((int)result); + return ((unsigned long)result); } -static inline int +static inline unsigned long msecs_to_jiffies(uint64_t msec) { uint64_t result; @@ -92,10 +92,10 @@ msecs_to_jiffies(uint64_t msec) if (result > MAX_JIFFY_OFFSET) result = MAX_JIFFY_OFFSET; - return ((int)result); + return ((unsigned long)result); } -static inline int +static inline unsigned long usecs_to_jiffies(uint64_t usec) { uint64_t result; @@ -106,7 +106,7 @@ usecs_to_jiffies(uint64_t usec) if (result > MAX_JIFFY_OFFSET) result = MAX_JIFFY_OFFSET; - return ((int)result); + return ((unsigned long)result); } static inline uint64_t @@ -133,17 +133,17 @@ nsecs_to_jiffies(uint64_t nsec) } static inline uint64_t -jiffies_to_nsecs(int j) +jiffies_to_nsecs(const unsigned long j) { - return ((1000000000ULL / hz) * (uint64_t)(unsigned int)j); + return ((1000000000ULL / hz) * (const uint64_t)j); } static inline uint64_t -jiffies_to_usecs(int j) +jiffies_to_usecs(const unsigned long j) { - return ((1000000ULL / hz) * (uint64_t)(unsigned int)j); + return ((1000000ULL / hz) * (const uint64_t)j); } static inline uint64_t @@ -153,10 +153,10 @@ get_jiffies_64(void) return ((uint64_t)(unsigned int)ticks); } -static inline int -linux_timer_jiffies_until(int expires) +static inline unsigned long +linux_timer_jiffies_until(unsigned long expires) { - int delta = expires - jiffies; + unsigned long delta = expires - jiffies; /* guard against already expired values */ if (delta < 1) delta = 1; diff --git a/sys/compat/linuxkpi/common/include/linux/timer.h b/sys/compat/linuxkpi/common/include/linux/timer.h index 8bea082c3e6c..f9c76222795c 100644 --- a/sys/compat/linuxkpi/common/include/linux/timer.h +++ b/sys/compat/linuxkpi/common/include/linux/timer.h @@ -42,7 +42,7 @@ struct timer_list { void (*function_415) (struct timer_list *); }; unsigned long data; - int expires; + unsigned long expires; }; extern unsigned long linux_timer_hz_mask; @@ -76,7 +76,7 @@ extern unsigned long linux_timer_hz_mask; callout_init(&(timer)->callout, 1); \ } while (0) -extern int mod_timer(struct timer_list *, int); +extern int mod_timer(struct timer_list *, unsigned long); extern void add_timer(struct timer_list *); extern void add_timer_on(struct timer_list *, int cpu); extern int del_timer(struct timer_list *); diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c index ec3ccb16b47d..35cb2fc2f3d7 100644 --- a/sys/compat/linuxkpi/common/src/linux_compat.c +++ b/sys/compat/linuxkpi/common/src/linux_compat.c @@ -1938,7 +1938,7 @@ linux_timer_callback_wrapper(void *context) } int -mod_timer(struct timer_list *timer, int expires) +mod_timer(struct timer_list *timer, unsigned long expires) { int ret;