Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/drm2/include/linux drm: Fix semantics of de...



details:   https://anonhg.NetBSD.org/src/rev/1877f9fd5b83
branches:  trunk
changeset: 1028950:1877f9fd5b83
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Dec 19 12:33:48 2021 +0000

description:
drm: Fix semantics of del_timer, del_timer_sync.

diffstat:

 sys/external/bsd/drm2/include/linux/timer.h |  14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diffs (35 lines):

diff -r dfec33202335 -r 1877f9fd5b83 sys/external/bsd/drm2/include/linux/timer.h
--- a/sys/external/bsd/drm2/include/linux/timer.h       Sun Dec 19 12:33:42 2021 +0000
+++ b/sys/external/bsd/drm2/include/linux/timer.h       Sun Dec 19 12:33:48 2021 +0000
@@ -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 @@
         * 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 @@
         * 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



Home | Main Index | Thread Index | Old Index