From a3709173763845c9012c1c661936182278f946a9 Mon Sep 17 00:00:00 2001 From: Brad Griffis Date: Wed, 20 Aug 2025 00:32:20 +0000 Subject: [PATCH] r8126: use conftest for hrtimer_init A function called hrtimer_setup() was added in Linux v6.13 with the intent that it would eventually replace hrtimer_init(). In Linux v6.15 the hrtimer_init() function was removed. Use conftest to call the appropriate API based on what is defined in the kernel. Bug 5466808 Change-Id: I1c1c4e81c840a058d8c4c0b1616c87cb8a8a8beb Signed-off-by: Brad Griffis Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3436079 GVS: buildbot_gerritrpt Reviewed-by: Revanth Kumar Uppala --- drivers/net/ethernet/realtek/r8126/r8126_ptp.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/ethernet/realtek/r8126/r8126_ptp.c b/drivers/net/ethernet/realtek/r8126/r8126_ptp.c index b453c88e..9c74eb1d 100644 --- a/drivers/net/ethernet/realtek/r8126/r8126_ptp.c +++ b/drivers/net/ethernet/realtek/r8126/r8126_ptp.c @@ -32,6 +32,8 @@ * US6,570,884, US6,115,776, and US6,327,625. ***********************************************************************************/ +#include + #include #include #include @@ -751,8 +753,13 @@ void rtl8126_ptp_init(struct rtl8126_private *tp) /* init a hrtimer for pps */ tp->pps_enable = 0; +#if defined(NV_HRTIMER_SETUP_PRESENT) /* Linux v6.13 */ + hrtimer_setup(&tp->pps_timer, rtl8126_hrtimer_for_pps, CLOCK_MONOTONIC, + HRTIMER_MODE_REL); +#else hrtimer_init(&tp->pps_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); tp->pps_timer.function = rtl8126_hrtimer_for_pps; +#endif /* reset the PTP related hardware bits */ rtl8126_ptp_reset(tp);