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 <bgriffis@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3436079
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Revanth Kumar Uppala <ruppala@nvidia.com>
This commit is contained in:
Brad Griffis
2025-08-20 00:32:20 +00:00
committed by mobile promotions
parent c959e9d1dc
commit a370917376

View File

@@ -32,6 +32,8 @@
* US6,570,884, US6,115,776, and US6,327,625. * US6,570,884, US6,115,776, and US6,327,625.
***********************************************************************************/ ***********************************************************************************/
#include <nvidia/conftest.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/version.h> #include <linux/version.h>
#include <linux/pci.h> #include <linux/pci.h>
@@ -751,8 +753,13 @@ void rtl8126_ptp_init(struct rtl8126_private *tp)
/* init a hrtimer for pps */ /* init a hrtimer for pps */
tp->pps_enable = 0; 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); hrtimer_init(&tp->pps_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
tp->pps_timer.function = rtl8126_hrtimer_for_pps; tp->pps_timer.function = rtl8126_hrtimer_for_pps;
#endif
/* reset the PTP related hardware bits */ /* reset the PTP related hardware bits */
rtl8126_ptp_reset(tp); rtl8126_ptp_reset(tp);