In iwm_init() save the generation counter once before looping over
authorstsp <stsp@openbsd.org>
Fri, 16 Jun 2017 08:45:34 +0000 (08:45 +0000)
committerstsp <stsp@openbsd.org>
Fri, 16 Jun 2017 08:45:34 +0000 (08:45 +0000)
tsleep(9), instead of saving it during every iteration.

sys/dev/pci/if_iwm.c

index cc4fcf4..d25dbc9 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: if_iwm.c,v 1.196 2017/06/14 16:58:28 stsp Exp $       */
+/*     $OpenBSD: if_iwm.c,v 1.197 2017/06/16 08:45:34 stsp Exp $       */
 
 /*
  * Copyright (c) 2014, 2016 genua gmbh <info@genua.de>
@@ -6126,8 +6126,8 @@ iwm_init(struct ifnet *ifp)
         * ieee80211_begin_scan() ends up scheduling iwm_newstate_task().
         * Wait until the transition to SCAN state has completed.
         */
+       generation = sc->sc_generation;
        do {
-               generation = sc->sc_generation;
                err = tsleep(&ic->ic_state, PCATCH, "iwminit", hz);
                if (generation != sc->sc_generation)
                        return ENXIO;