Source-Changes-HG archive

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

[src/trunk]: src/sys/external/bsd/common/linux Reverse the sense of some bran...



details:   https://anonhg.NetBSD.org/src/rev/cb4bfe03ea48
branches:  trunk
changeset: 835438:cb4bfe03ea48
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon Aug 27 15:03:07 2018 +0000

description:
Reverse the sense of some branches for simplicity.

diffstat:

 sys/external/bsd/common/linux/linux_work.c |  28 +++++++++++++---------------
 1 files changed, 13 insertions(+), 15 deletions(-)

diffs (70 lines):

diff -r 15e77736c0b8 -r cb4bfe03ea48 sys/external/bsd/common/linux/linux_work.c
--- a/sys/external/bsd/common/linux/linux_work.c        Mon Aug 27 15:02:52 2018 +0000
+++ b/sys/external/bsd/common/linux/linux_work.c        Mon Aug 27 15:03:07 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_work.c,v 1.26 2018/08/27 15:02:52 riastradh Exp $        */
+/*     $NetBSD: linux_work.c,v 1.27 2018/08/27 15:03:07 riastradh Exp $        */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_work.c,v 1.26 2018/08/27 15:02:52 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_work.c,v 1.27 2018/08/27 15:03:07 riastradh Exp $");
 
 #include <sys/types.h>
 #include <sys/atomic.h>
@@ -570,13 +570,7 @@
                KASSERT(wq0 == wq);
                switch (dw->dw_state) {
                case DELAYED_WORK_IDLE:
-                       if (wq->wq_current_work != &dw->work) {
-                               /* Work is queued, but hasn't started yet.  */
-                               TAILQ_REMOVE(&wq->wq_queue, &dw->work,
-                                   work_entry);
-                               queue_delayed_work_anew(wq, dw, ticks);
-                               timer_modified = true;
-                       } else {
+                       if (wq->wq_current_work == &dw->work) {
                                /*
                                 * Too late.  Queue it anew.  If that
                                 * would skip the callout because it's
@@ -585,6 +579,12 @@
                                wq->wq_requeued = ticks == 0;
                                queue_delayed_work_anew(wq, dw, ticks);
                                timer_modified = false;
+                       } else {
+                               /* Work is queued, but hasn't started yet.  */
+                               TAILQ_REMOVE(&wq->wq_queue, &dw->work,
+                                   work_entry);
+                               queue_delayed_work_anew(wq, dw, ticks);
+                               timer_modified = true;
                        }
                        break;
                case DELAYED_WORK_SCHEDULED:
@@ -669,9 +669,8 @@
                         */
                        dw->dw_state = DELAYED_WORK_CANCELLED;
                        cancelled_p = true;
-                       if (callout_stop(&dw->dw_callout))
-                               break;
-                       cancel_delayed_work_done(wq, dw);
+                       if (!callout_stop(&dw->dw_callout))
+                               cancel_delayed_work_done(wq, dw);
                        break;
                default:
                        panic("invalid delayed work state: %d",
@@ -731,9 +730,8 @@
                         */
                        dw->dw_state = DELAYED_WORK_CANCELLED;
                        cancelled_p = true;
-                       if (callout_halt(&dw->dw_callout, &wq->wq_lock))
-                               break;
-                       cancel_delayed_work_done(wq, dw);
+                       if (!callout_halt(&dw->dw_callout, &wq->wq_lock))
+                               cancel_delayed_work_done(wq, dw);
                        break;
                default:
                        panic("invalid delayed work state: %d",



Home | Main Index | Thread Index | Old Index