Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 5 Sep 2025 23:29:02 GMT
From:      "Bjoern A. Zeeb" <bz@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 81cb7c4c8e7b - main - LinuxKPI: rename from_timer() to timer_container_of()
Message-ID:  <202509052329.585NT2ph029291@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=81cb7c4c8e7bc4951c77fe64a63a847ed6abee38

commit 81cb7c4c8e7bc4951c77fe64a63a847ed6abee38
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2025-09-04 20:23:57 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2025-09-05 23:24:15 +0000

    LinuxKPI: rename from_timer() to timer_container_of()
    
    With Linux 6.16 from_timer() got renamed to timer_container_of(); add
    the LINUXKPI_VERSION check with a default to the current version.
    Update all in-tree consumers (apart from wireless drivers managed
    otherwise).
    
    Sponsored by:   The FreeBSD Foundation (initially)
    MFC after:      3 days
    Reviewed by:    dumbbell
    Differential Revision:  https://reviews.freebsd.org/D52073
---
 sys/compat/linuxkpi/common/include/linux/timer.h | 5 +++++
 sys/compat/linuxkpi/common/src/linux_80211.c     | 2 +-
 sys/dev/irdma/irdma_cm.c                         | 2 +-
 sys/dev/irdma/irdma_utils.c                      | 4 ++--
 sys/dev/qat/qat_common/adf_gen4_timer.c          | 2 +-
 5 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/sys/compat/linuxkpi/common/include/linux/timer.h b/sys/compat/linuxkpi/common/include/linux/timer.h
index a635f0faea59..bd06e3158fa3 100644
--- a/sys/compat/linuxkpi/common/include/linux/timer.h
+++ b/sys/compat/linuxkpi/common/include/linux/timer.h
@@ -49,8 +49,13 @@ extern unsigned long linux_timer_hz_mask;
 
 #define	TIMER_IRQSAFE	0x0001
 
+#if defined(LINUXKPI_VERSION) && (LINUXKPI_VERSION < 61600)
 #define	from_timer(var, arg, field)					\
         container_of(arg, typeof(*(var)), field)
+#else
+#define	timer_container_of(var, arg, field)				\
+    container_of(arg, typeof(*(var)), field)
+#endif
 
 #define	timer_setup(timer, func, flags) do {				\
 	CTASSERT(((flags) & ~TIMER_IRQSAFE) == 0);			\
diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c
index f0881773726f..d00734001a59 100644
--- a/sys/compat/linuxkpi/common/src/linux_80211.c
+++ b/sys/compat/linuxkpi/common/src/linux_80211.c
@@ -7814,7 +7814,7 @@ lkpi_wiphy_delayed_work_timer(struct timer_list *tl)
 {
 	struct wiphy_delayed_work *wdwk;
 
-	wdwk = from_timer(wdwk, tl, timer);
+	wdwk = timer_container_of(wdwk, tl, timer);
         wiphy_work_queue(wdwk->wiphy, &wdwk->work);
 }
 
diff --git a/sys/dev/irdma/irdma_cm.c b/sys/dev/irdma/irdma_cm.c
index 450fae662dd8..d4d4f328fb43 100644
--- a/sys/dev/irdma/irdma_cm.c
+++ b/sys/dev/irdma/irdma_cm.c
@@ -1316,7 +1316,7 @@ irdma_cm_timer_tick(struct timer_list *t)
 	struct irdma_timer_entry *send_entry, *close_entry;
 	struct list_head *list_core_temp;
 	struct list_head *list_node;
-	struct irdma_cm_core *cm_core = from_timer(cm_core, t, tcp_timer);
+	struct irdma_cm_core *cm_core = timer_container_of(cm_core, t, tcp_timer);
 	struct irdma_sc_vsi *vsi;
 	u32 settimer = 0;
 	unsigned long timetosend;
diff --git a/sys/dev/irdma/irdma_utils.c b/sys/dev/irdma/irdma_utils.c
index 5fc37022981f..038f1980082b 100644
--- a/sys/dev/irdma/irdma_utils.c
+++ b/sys/dev/irdma/irdma_utils.c
@@ -876,7 +876,7 @@ irdma_terminate_done(struct irdma_sc_qp *qp, int timeout_occurred)
 static void
 irdma_terminate_timeout(struct timer_list *t)
 {
-	struct irdma_qp *iwqp = from_timer(iwqp, t, terminate_timer);
+	struct irdma_qp *iwqp = timer_container_of(iwqp, t, terminate_timer);
 	struct irdma_sc_qp *qp = &iwqp->sc_qp;
 
 	irdma_terminate_done(qp, 1);
@@ -1528,7 +1528,7 @@ static void
 irdma_hw_stats_timeout(struct timer_list *t)
 {
 	struct irdma_vsi_pestat *pf_devstat =
-	from_timer(pf_devstat, t, stats_timer);
+	timer_container_of(pf_devstat, t, stats_timer);
 	struct irdma_sc_vsi *sc_vsi = pf_devstat->vsi;
 
 	if (sc_vsi->dev->hw_attrs.uk_attrs.hw_rev >= IRDMA_GEN_2)
diff --git a/sys/dev/qat/qat_common/adf_gen4_timer.c b/sys/dev/qat/qat_common/adf_gen4_timer.c
index 96b65cdff181..2c74d09418e5 100644
--- a/sys/dev/qat/qat_common/adf_gen4_timer.c
+++ b/sys/dev/qat/qat_common/adf_gen4_timer.c
@@ -57,7 +57,7 @@ end:
 static void
 timer_handler(struct timer_list *tl)
 {
-	struct adf_int_timer *int_timer = from_timer(int_timer, tl, timer);
+	struct adf_int_timer *int_timer = timer_container_of(int_timer, tl, timer);
 	struct adf_accel_dev *accel_dev = int_timer->accel_dev;
 	struct adf_hb_timer_data *hb_timer_data = NULL;
 	u64 timeout_val = adf_get_next_timeout(int_timer->timeout_val);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202509052329.585NT2ph029291>