Module Name:    src
Committed By:   riastradh
Date:           Sun Dec 19 12:33:49 UTC 2021

Modified Files:
        src/sys/external/bsd/drm2/include/linux: timer.h

Log Message:
drm: Fix semantics of del_timer, del_timer_sync.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/external/bsd/drm2/include/linux/timer.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/drm2/include/linux/timer.h
diff -u src/sys/external/bsd/drm2/include/linux/timer.h:1.16 src/sys/external/bsd/drm2/include/linux/timer.h:1.17
--- src/sys/external/bsd/drm2/include/linux/timer.h:1.16	Sun Dec 19 12:02:05 2021
+++ src/sys/external/bsd/drm2/include/linux/timer.h	Sun Dec 19 12:33:48 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: timer.h,v 1.16 2021/12/19 12:02:05 riastradh Exp $	*/
+/*	$NetBSD: timer.h,v 1.17 2021/12/19 12:33:48 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -87,7 +87,11 @@ del_timer(struct timer_list *timer)
 	 * NetBSD: `callout_stop will return a non-zero value if the
 	 * callout was EXPIRED.', meaning it is no longer pending.
 	 */
-	return !callout_stop(&timer->tl_callout);
+	if (!callout_pending(&timer->tl_callout))
+		return 0;	/* not active */
+	if (callout_stop(&timer->tl_callout))
+		return 0;	/* too late, already expired */
+	return 1;		/* we stopped it while active */
 }
 
 static inline int
@@ -101,7 +105,11 @@ del_timer_sync(struct timer_list *timer)
 	 * NetBSD: `[callout_halt] will return a non-zero value if the
 	 * callout was EXPIRED.', meaning it is no longer pending.
 	 */
-	return !callout_halt(&timer->tl_callout, NULL);
+	if (!callout_pending(&timer->tl_callout))
+		return 0;	/* not active */
+	if (callout_halt(&timer->tl_callout, NULL))
+		return 0;	/* too late, already expired */
+	return 1;		/* we stopped it while active */
 }
 
 static inline bool

Reply via email to