diff --git a/drivers/block/tegra_virt_storage/tegra_hv_vblk.c b/drivers/block/tegra_virt_storage/tegra_hv_vblk.c index 324165fc..75476ee1 100644 --- a/drivers/block/tegra_virt_storage/tegra_hv_vblk.c +++ b/drivers/block/tegra_virt_storage/tegra_hv_vblk.c @@ -193,7 +193,11 @@ static void vblk_put_req(struct vsc_request *req) (vblkdev->queue_state == VBLK_QUEUE_SUSPENDED)) { complete(&vblkdev->req_queue_empty); } +#if defined(NV_TIMER_DELETE_PRESENT) /* Linux v6.15 */ + timer_delete(&req->timer); +#else del_timer(&req->timer); +#endif } } diff --git a/drivers/gpu/host1x-emu/poll.c b/drivers/gpu/host1x-emu/poll.c index d08834d5..6d5de3ed 100644 --- a/drivers/gpu/host1x-emu/poll.c +++ b/drivers/gpu/host1x-emu/poll.c @@ -1,5 +1,8 @@ // SPDX-License-Identifier: GPL-2.0-only // SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. + +#include + #include "dev.h" #include "fence.h" #include "poll.h" @@ -178,8 +181,13 @@ void host1x_poll_start(struct host1x *host) hr_timer_host = host; ktime = ktime_set(HRTIMER_TIMEOUT_SEC, host->hr_polling_intrval); +#if defined(NV_HRTIMER_SETUP_PRESENT) /* Linux v6.13 */ + hrtimer_setup(&emu_hr_timer, &timer_callback, CLOCK_MONOTONIC, + HRTIMER_MODE_REL); +#else hrtimer_init(&emu_hr_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); emu_hr_timer.function = &timer_callback; +#endif hrtimer_start(&emu_hr_timer, ktime, HRTIMER_MODE_REL); } #endif diff --git a/drivers/media/platform/tegra/cdi/cdi_mgr.c b/drivers/media/platform/tegra/cdi/cdi_mgr.c index 9dc1f327..01608aad 100644 --- a/drivers/media/platform/tegra/cdi/cdi_mgr.c +++ b/drivers/media/platform/tegra/cdi/cdi_mgr.c @@ -1782,9 +1782,14 @@ static int cdi_mgr_probe(struct platform_device *pdev) for (i = 0; i < ARRAY_SIZE(cdi_mgr->gpios); i++) { pin = &cdi_mgr->gpios[i]; pin->mgr = cdi_mgr; +#if defined(NV_HRTIMER_SETUP_PRESENT) /* Linux v6.13 */ + hrtimer_setup(&pin->timers.timer, &cdi_mgr_intr_timer, + CLOCK_MONOTONIC, HRTIMER_MODE_ABS); +#else hrtimer_init(&pin->timers.timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS); pin->timers.timer.function = &cdi_mgr_intr_timer; +#endif } if (pdev->dev.of_node) { diff --git a/drivers/media/platform/tegra/v4l2loopback/v4l2loopback.c b/drivers/media/platform/tegra/v4l2loopback/v4l2loopback.c index 1b403c7a..79b22e6f 100644 --- a/drivers/media/platform/tegra/v4l2loopback/v4l2loopback.c +++ b/drivers/media/platform/tegra/v4l2loopback/v4l2loopback.c @@ -36,6 +36,8 @@ #include #include "v4l2loopback.h" +#include + #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 0) #error This module is not supported on kernels before 4.0.0. #endif @@ -1706,8 +1708,13 @@ static int vidioc_querybuf(struct file *file, void *fh, struct v4l2_buffer *b) static void buffer_written(struct v4l2_loopback_device *dev, struct v4l2l_buffer *buf) { +#if defined(NV_TIMER_DELETE_PRESENT) /* Linux v6.15 */ + timer_delete_sync(&dev->sustain_timer); + timer_delete_sync(&dev->timeout_timer); +#else del_timer_sync(&dev->sustain_timer); del_timer_sync(&dev->timeout_timer); +#endif spin_lock_bh(&dev->list_lock); list_move_tail(&buf->list_head, &dev->outbufs_list); @@ -2274,8 +2281,13 @@ static int v4l2_loopback_close(struct file *file) atomic_dec(&dev->open_count); if (dev->open_count.counter == 0) { +#if defined(NV_TIMER_DELETE_PRESENT) /* Linux v6.15 */ + timer_delete_sync(&dev->sustain_timer); + timer_delete_sync(&dev->timeout_timer); +#else del_timer_sync(&dev->sustain_timer); del_timer_sync(&dev->timeout_timer); +#endif } try_free_buffers(dev); diff --git a/drivers/misc/bluedroid_pm.c b/drivers/misc/bluedroid_pm.c index 575e200b..aa6a89cc 100644 --- a/drivers/misc/bluedroid_pm.c +++ b/drivers/misc/bluedroid_pm.c @@ -1,7 +1,5 @@ // SPDX-License-Identifier: GPL-2.0-only -// SPDX-FileCopyrightText: Copyright (c) 2019-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. - -#include +// SPDX-FileCopyrightText: Copyright (c) 2019-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. #include @@ -267,7 +265,11 @@ static ssize_t lpm_write_proc(struct file *file, const char __user *buffer, bluedroid_pm_gpio_set_value( bluedroid_pm->ext_wake, 1); __pm_stay_awake(&bluedroid_pm->wake_lock); +#if defined(NV_TIMER_DELETE_PRESENT) /* Linux v6.15 */ + timer_delete(&bluedroid_pm_timer); +#else del_timer(&bluedroid_pm_timer); +#endif set_bit(BT_WAKE, &bluedroid_pm->flags); } else { kfree(buf); @@ -507,7 +509,11 @@ static int bluedroid_pm_remove(struct platform_device *pdev) if ((bluedroid_pm->ext_wake)) { wakeup_source_destroy(&bluedroid_pm->wake_lock); remove_bt_proc_interface(); +#if defined(NV_TIMER_DELETE_PRESENT) /* Linux v6.15 */ + timer_delete(&bluedroid_pm_timer); +#else del_timer(&bluedroid_pm_timer); +#endif } if (((bluedroid_pm->gpio_reset)) || ((bluedroid_pm->gpio_shutdown)) || diff --git a/drivers/net/can/mttcan/native/m_ttcan_linux.c b/drivers/net/can/mttcan/native/m_ttcan_linux.c index 9196a6f5..7e73a58d 100644 --- a/drivers/net/can/mttcan/native/m_ttcan_linux.c +++ b/drivers/net/can/mttcan/native/m_ttcan_linux.c @@ -1,7 +1,5 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* - * Copyright (c) 2022-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. - */ +// SPDX-License-Identifier: GPL-2.0-only +// SPDX-FileCopyrightText: Copyright (c) 2022-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. #include @@ -1954,7 +1952,11 @@ static int mttcan_remove(struct platform_device *pdev) dev_info(&dev->dev, "%s\n", __func__); +#if defined(NV_TIMER_DELETE_PRESENT) /* Linux v6.15 */ + timer_delete_sync(&priv->timer); +#else del_timer_sync(&priv->timer); +#endif mttcan_delete_sys_files(&dev->dev); unregister_mttcan_dev(dev); mttcan_unprepare_clock(priv); diff --git a/drivers/net/ethernet/nvidia/nvethernet/ether_linux.c b/drivers/net/ethernet/nvidia/nvethernet/ether_linux.c index c01eebb3..3cc344d0 100644 --- a/drivers/net/ethernet/nvidia/nvethernet/ether_linux.c +++ b/drivers/net/ethernet/nvidia/nvethernet/ether_linux.c @@ -3394,7 +3394,11 @@ int ether_close(struct net_device *ndev) int i; #ifdef ETHER_NVGRO +#if defined(NV_TIMER_DELETE_PRESENT) /* Linux v6.15 */ + timer_delete_sync(&pdata->nvgro_timer); +#else del_timer_sync(&pdata->nvgro_timer); +#endif /* TODO: purge the queues */ #endif @@ -7514,10 +7518,16 @@ int ether_probe(struct platform_device *pdev) chan = osi_dma->dma_chans[i]; atomic_set(&pdata->tx_napi[chan]->tx_usecs_timer_armed, OSI_DISABLE); +#if defined(NV_HRTIMER_SETUP_PRESENT) /* Linux v6.13 */ + hrtimer_setup(&pdata->tx_napi[chan]->tx_usecs_timer, + ether_tx_usecs_hrtimer, CLOCK_MONOTONIC, + HRTIMER_MODE_REL); +#else hrtimer_init(&pdata->tx_napi[chan]->tx_usecs_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); pdata->tx_napi[chan]->tx_usecs_timer.function = ether_tx_usecs_hrtimer; +#endif } ret = register_netdev(ndev); diff --git a/drivers/nvpps/nvpps_main.c b/drivers/nvpps/nvpps_main.c index 7c020498..9c6852c3 100644 --- a/drivers/nvpps/nvpps_main.c +++ b/drivers/nvpps/nvpps_main.c @@ -509,7 +509,11 @@ static int set_mode(struct nvpps_device_data *pdev_data, u32 mode) if (!pdev_data->only_timer_mode) { if (pdev_data->timer_inited) { pdev_data->timer_inited = false; +#if defined(NV_TIMER_DELETE_PRESENT) /* Linux v6.15 */ + timer_delete_sync(&pdev_data->timer); +#else del_timer_sync(&pdev_data->timer); +#endif } if (!pdev_data->irq_registered) { /* register IRQ handler */ @@ -1377,7 +1381,11 @@ static int nvpps_remove(struct platform_device *pdev) if (pdev_data) { if (pdev_data->timer_inited) { pdev_data->timer_inited = false; +#if defined(NV_TIMER_DELETE_PRESENT) /* Linux v6.15 */ + timer_delete_sync(&pdev_data->timer); +#else del_timer_sync(&pdev_data->timer); +#endif } if (pdev_data->mac_base_addr) { devm_iounmap(&pdev->dev, pdev_data->mac_base_addr); @@ -1385,7 +1393,11 @@ static int nvpps_remove(struct platform_device *pdev) pdev_data->mac_base_addr); } if (pdev_data->support_tsc) { +#if defined(NV_TIMER_DELETE_PRESENT) /* Linux v6.15 */ + timer_delete_sync(&pdev_data->tsc_timer); +#else del_timer_sync(&pdev_data->tsc_timer); +#endif iounmap(pdev_data->tsc_reg_map_base); } device_destroy(s_nvpps_class, pdev_data->dev->devt); diff --git a/drivers/platform/tegra/nvadsp/emc_dfs.c b/drivers/platform/tegra/nvadsp/emc_dfs.c index e0964e78..a75c5a01 100644 --- a/drivers/platform/tegra/nvadsp/emc_dfs.c +++ b/drivers/platform/tegra/nvadsp/emc_dfs.c @@ -1,21 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0-only +// SPDX-FileCopyrightText: Copyright (c) 2014-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. /* - * emc_dfs.c - * * Emc dynamic frequency scaling due to APE - * - * Copyright (C) 2014-2020, NVIDIA Corporation. All rights reserved. - * - * This software is licensed under the terms of the GNU General Public - * License version 2, as published by the Free Software Foundation, and - * may be copied, distributed, and modified under those terms. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * */ +#include #include #include #include @@ -193,7 +182,11 @@ static void emc_dfs_disable(void) einfo->rd_cnt = read64((u32)ABRIDGE_STATS_READ_0); einfo->wr_cnt = read64((u32)ABRIDGE_STATS_WRITE_0); +#if defined(NV_TIMER_DELETE_PRESENT) /* Linux v6.15 */ + timer_delete_sync(&einfo->cnt_timer); +#else del_timer_sync(&einfo->cnt_timer); +#endif } #ifdef CONFIG_DEBUG_FS diff --git a/drivers/virt/tegra/tegra_hv_vcpu_yield.c b/drivers/virt/tegra/tegra_hv_vcpu_yield.c index ca0fe099..fb263885 100644 --- a/drivers/virt/tegra/tegra_hv_vcpu_yield.c +++ b/drivers/virt/tegra/tegra_hv_vcpu_yield.c @@ -139,9 +139,14 @@ static int tegra_hv_vcpu_yield_open(struct inode *inode, struct file *filp) mutex_unlock(&data->mutex_lock); +#if defined(NV_HRTIMER_SETUP_PRESENT) /* Linux v6.13 */ + hrtimer_setup(&data->yield_timer, &timer_callback_func, + CLOCK_MONOTONIC, HRTIMER_MODE_REL_PINNED); +#else hrtimer_init(&data->yield_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_PINNED); data->yield_timer.function = &timer_callback_func; +#endif out: return ret; diff --git a/drivers/watchdog/softdog-platform.c b/drivers/watchdog/softdog-platform.c index 63857a6d..22f5191b 100644 --- a/drivers/watchdog/softdog-platform.c +++ b/drivers/watchdog/softdog-platform.c @@ -1,8 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only +// SPDX-FileCopyrightText: Copyright (c) 2014-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. /* * A platform based Software Watchdog Device - * - * SPDX-FileCopyrightText: Copyright (c) 2014-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. */ #include @@ -186,7 +185,11 @@ static int softdog_platform_probe(struct platform_device *pdev) reboot_unreg: unregister_reboot_notifier(&swdt->nb); timer_del: +#if defined(NV_TIMER_DELETE_PRESENT) /* Linux v6.15 */ + timer_delete_sync(&swdt->watchdog_ticktock); +#else del_timer_sync(&swdt->watchdog_ticktock); +#endif return ret; } @@ -194,7 +197,11 @@ static int softdog_platform_remove(struct platform_device *pdev) { struct softdog_platform_wdt *swdt = platform_get_drvdata(pdev); +#if defined(NV_TIMER_DELETE_PRESENT) /* Linux v6.15 */ + timer_delete_sync(&swdt->watchdog_ticktock); +#else del_timer_sync(&swdt->watchdog_ticktock); +#endif watchdog_unregister_device(&swdt->wdt_dev); unregister_reboot_notifier(&swdt->nb); return 0; @@ -204,7 +211,11 @@ static void softdog_platform_shutdown(struct platform_device *pdev) { struct softdog_platform_wdt *swdt = platform_get_drvdata(pdev); +#if defined(NV_TIMER_DELETE_PRESENT) /* Linux v6.15 */ + timer_delete_sync(&swdt->watchdog_ticktock); +#else del_timer_sync(&swdt->watchdog_ticktock); +#endif } #ifdef CONFIG_PM_SLEEP diff --git a/scripts/conftest/Makefile b/scripts/conftest/Makefile index f441cda7..a8060704 100644 --- a/scripts/conftest/Makefile +++ b/scripts/conftest/Makefile @@ -149,6 +149,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += fop_unsigned_offset NV_CONFTEST_FUNCTION_COMPILE_TESTS += genpd_xlate_t_has_const_of_phandle_args NV_CONFTEST_FUNCTION_COMPILE_TESTS += get_file_rcu_has_double_ptr_file_arg NV_CONFTEST_FUNCTION_COMPILE_TESTS += get_user_pages +NV_CONFTEST_FUNCTION_COMPILE_TESTS += hrtimer_setup NV_CONFTEST_FUNCTION_COMPILE_TESTS += icc_get NV_CONFTEST_FUNCTION_COMPILE_TESTS += icc_put NV_CONFTEST_FUNCTION_COMPILE_TESTS += icc_set_bw @@ -222,6 +223,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += tegra_ivc_use_ivc_ext_driver NV_CONFTEST_FUNCTION_COMPILE_TESTS += thermal_zone_device_priv NV_CONFTEST_FUNCTION_COMPILE_TESTS += thermal_zone_device_ops_struct_has_get_trip_type NV_CONFTEST_FUNCTION_COMPILE_TESTS += thermal_zone_for_each_trip +NV_CONFTEST_FUNCTION_COMPILE_TESTS += timer_delete NV_CONFTEST_FUNCTION_COMPILE_TESTS += tty_operations_struct_send_xchar_has_u8_arg NV_CONFTEST_FUNCTION_COMPILE_TESTS += tty_operations_struct_write_has_u8_ptr_arg NV_CONFTEST_FUNCTION_COMPILE_TESTS += tty_operations_struct_set_termios_has_const_ktermios_arg diff --git a/scripts/conftest/conftest.sh b/scripts/conftest/conftest.sh index 9c270027..39173c8c 100755 --- a/scripts/conftest/conftest.sh +++ b/scripts/conftest/conftest.sh @@ -7682,6 +7682,22 @@ compile_test() { compile_check_conftest "$CODE" "NV_GPIO_DEVICE_GET_CHIP_PRESENT" "" "functions" ;; + hrtimer_setup) + # + # Determine if the function hrtimer_setup() is present. + # + # This change was made in Linux v6.13 by commit 908a1d775422 + # ("hrtimers: Introduce hrtimer_setup() to replace hrtimer_init()"). + # + CODE=" + #include + bool conftest_hrtimer_setup(void) { + return hrtimer_setup(); + }" + + compile_check_conftest "$CODE" "NV_HRTIMER_SETUP_PRESENT" "" "functions" + ;; + netif_set_tso_max_size) # # Determine if netif_set_tso_max_size() function is present @@ -8680,6 +8696,22 @@ compile_test() { compile_check_conftest "$CODE" "NV_TEGRA_DEV_IOMMU_GET_STREAM_ID_PRESENT" "" "functions" ;; + timer_delete) + # + # Determine if the function timer_delete() is present. + # + # This change was made in Linux v6.15 by commit 8fa7292fee5c + # ("treewide: Switch/rename to timer_delete[_sync]()"). + # + CODE=" + #include + bool conftest_timer_delete(void) { + return timer_delete(); + }" + + compile_check_conftest "$CODE" "NV_TIMER_DELETE_PRESENT" "" "functions" + ;; + tty_operations_struct_send_xchar_has_u8_arg) # # Determine if the struct tty_operations::send_xchar argument is of type u8.