drivers: Fix from_timer() for Linux v6.16

In Linux v6.16, commit 41cb08555c41 ("treewide, timers: Rename
from_timer() to timer_container_of()") renamed 'from_timer()' to
'timer_container_of()'. Given that this is a macro we can simplfy see if
the macro 'timer_container_of' is defined and if so use this otherwise
fall back to 'from_timer()'. Update the necessary drivers to fix the
build for Linux v6.16.

JIRA LINQPJ14-60

Change-Id: I7f622b5d046a92da2ade755e6a697c1810f61275
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3383387
(cherry picked from commit 320ec84efd492c0c2711c69104fabc30b4f15ecb)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3461850
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
This commit is contained in:
Jon Hunter
2025-06-09 12:04:03 +01:00
committed by mobile promotions
parent a3097907b3
commit 96cae7f9de
5 changed files with 32 additions and 6 deletions

View File

@@ -2369,7 +2369,11 @@ static irqreturn_t ivc_irq_handler(int irq, void *data)
*/ */
static void bio_request_timeout_callback(struct timer_list *timer) static void bio_request_timeout_callback(struct timer_list *timer)
{ {
#if defined(timer_container_of) /* Linux v6.16 */
struct vsc_request *req = timer_container_of(req, timer, timer);
#else
struct vsc_request *req = from_timer(req, timer, timer); struct vsc_request *req = from_timer(req, timer, timer);
#endif
dev_err(req->vblkdev->device, "Request id %d timed out. curr ctr: %llu sched ctr: %llu\n", dev_err(req->vblkdev->device, "Request id %d timed out. curr ctr: %llu sched ctr: %llu\n",
req->id, _arch_counter_get_cntvct(), req->time); req->id, _arch_counter_get_cntvct(), req->time);

View File

@@ -134,10 +134,13 @@ static void bluedroid_pm_gpio_set_value(struct gpio_desc *gpio, int value)
*/ */
static void bluedroid_pm_timer_expire(struct timer_list *timer) static void bluedroid_pm_timer_expire(struct timer_list *timer)
{ {
#if defined(timer_container_of) /* Linux v6.16 */
struct bluedroid_pm_data *bluedroid_pm = struct bluedroid_pm_data *bluedroid_pm = timer_container_of(bluedroid_pm,
from_timer(bluedroid_pm, timer, timer, bluedroid_pm_timer);
bluedroid_pm_timer); #else
struct bluedroid_pm_data *bluedroid_pm = from_timer(bluedroid_pm,
timer, bluedroid_pm_timer);
#endif
/* /*
* if bluedroid_pm data is NULL or timer is deleted with TX busy. * if bluedroid_pm data is NULL or timer is deleted with TX busy.

View File

@@ -287,7 +287,12 @@ static irqreturn_t nvpps_gpio_isr(int irq, void *data)
static void tsc_timer_callback(struct timer_list *t) static void tsc_timer_callback(struct timer_list *t)
{ {
struct nvpps_device_data *pdev_data = (struct nvpps_device_data *)from_timer(pdev_data, t, tsc_timer); struct nvpps_device_data *pdev_data =
#if defined(timer_container_of) /* Linux v6.16 */
timer_container_of(pdev_data, t, tsc_timer);
#else
from_timer(pdev_data, t, tsc_timer);
#endif
if (pdev_data->soc_data.ops->ptp_tsc_get_is_locked_fn) { if (pdev_data->soc_data.ops->ptp_tsc_get_is_locked_fn) {
/* check and trigger sync if PTP-TSC is unlocked */ /* check and trigger sync if PTP-TSC is unlocked */
@@ -305,7 +310,12 @@ static void tsc_timer_callback(struct timer_list *t)
static void nvpps_timer_callback(struct timer_list *t) static void nvpps_timer_callback(struct timer_list *t)
{ {
struct nvpps_device_data *pdev_data = (struct nvpps_device_data *)from_timer(pdev_data, t, timer); struct nvpps_device_data *pdev_data =
#if defined(timer_container_of) /* Linux v6.16 */
timer_container_of(pdev_data, t, timer);
#else
from_timer(pdev_data, t, timer);
#endif
/* get timestamps for this event */ /* get timestamps for this event */
nvpps_get_ts(pdev_data, 0); nvpps_get_ts(pdev_data, 0);

View File

@@ -2114,7 +2114,12 @@ static void wch_ser_set_termios(struct ser_port *port, struct WCHTERMIOS *termio
static void wch_ser_timeout(struct timer_list *t) static void wch_ser_timeout(struct timer_list *t)
{ {
#if defined(timer_container_of) /* Linux v6.16 */
struct wch_ser_port *sp = timer_container_of(sp, t, timer);
#else
struct wch_ser_port *sp = from_timer(sp, t, timer); struct wch_ser_port *sp = from_timer(sp, t, timer);
#endif
unsigned int timeout; unsigned int timeout;
unsigned int iir; unsigned int iir;
iir = READ_UART_IIR(sp); iir = READ_UART_IIR(sp);

View File

@@ -37,7 +37,11 @@ struct softdog_platform_wdt {
/* If the timer expires.. */ /* If the timer expires.. */
static void softdog_platform_watchdog_fire(struct timer_list *t) static void softdog_platform_watchdog_fire(struct timer_list *t)
{ {
#if defined(timer_container_of) /* Linux v6.16 */
struct softdog_platform_wdt *swdt = timer_container_of(swdt, t, watchdog_ticktock);
#else
struct softdog_platform_wdt *swdt = from_timer(swdt, t, watchdog_ticktock); struct softdog_platform_wdt *swdt = from_timer(swdt, t, watchdog_ticktock);
#endif
if (swdt->is_stopped) if (swdt->is_stopped)
return; return;