From 9a90188bf93f91b01724614dcff8d26bcc3f87b3 Mon Sep 17 00:00:00 2001 From: riastradh Date: Sun, 6 Jul 2014 15:43:55 +0000 Subject: [PATCH] Modify Linux timer API to add teardown_timer. del_timer_sync does not actually destroy the timer so it can't be reused again -- but Linux has no routine to do that. So we'll have to add that in where appropriate. --- sys/external/bsd/drm2/include/linux/timer.h | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/sys/external/bsd/drm2/include/linux/timer.h b/sys/external/bsd/drm2/include/linux/timer.h index 1a2637474e10..7234bbf88f1c 100644 --- a/sys/external/bsd/drm2/include/linux/timer.h +++ b/sys/external/bsd/drm2/include/linux/timer.h @@ -1,4 +1,4 @@ -/* $NetBSD: timer.h,v 1.2 2014/03/18 18:20:43 riastradh Exp $ */ +/* $NetBSD: timer.h,v 1.3 2014/07/06 15:43:55 riastradh Exp $ */ /*- * Copyright (c) 2013 The NetBSD Foundation, Inc. @@ -29,6 +29,13 @@ * POSSIBILITY OF SUCH DAMAGE. */ +/* + * Notes on porting: + * + * - Linux does not have teardown_timer. You must add it yourself in + * the appropriate place. + */ + #ifndef _LINUX_TIMER_H_ #define _LINUX_TIMER_H_ @@ -52,6 +59,13 @@ setup_timer(struct timer_list *timer, void (*fn)(unsigned long), (void *)(uintptr_t)arg); } +static inline void +teardown_timer(struct timer_list *timer) +{ + + callout_destroy(&timer->tl_callout); +} + static inline void mod_timer(struct timer_list *timer, unsigned long then) { @@ -63,8 +77,8 @@ mod_timer(struct timer_list *timer, unsigned long then) static inline void del_timer_sync(struct timer_list *timer) { + callout_halt(&timer->tl_callout, NULL); - callout_destroy(&timer->tl_callout); } /*