Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci simplify



details:   https://anonhg.NetBSD.org/src/rev/082d1f3ba2a9
branches:  trunk
changeset: 811410:082d1f3ba2a9
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Oct 29 02:29:41 2015 +0000

description:
simplify

diffstat:

 sys/dev/pci/if_vioif.c |  18 ++++++------------
 1 files changed, 6 insertions(+), 12 deletions(-)

diffs (42 lines):

diff -r 39693f818e26 -r 082d1f3ba2a9 sys/dev/pci/if_vioif.c
--- a/sys/dev/pci/if_vioif.c    Thu Oct 29 02:09:02 2015 +0000
+++ b/sys/dev/pci/if_vioif.c    Thu Oct 29 02:29:41 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_vioif.c,v 1.19 2015/10/29 02:09:02 ozaki-r Exp $    */
+/*     $NetBSD: if_vioif.c,v 1.20 2015/10/29 02:29:41 christos Exp $   */
 
 /*
  * Copyright (c) 2010 Minoura Makoto.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_vioif.c,v 1.19 2015/10/29 02:09:02 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vioif.c,v 1.20 2015/10/29 02:29:41 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -681,19 +681,13 @@
                mutex_obj_free(sc->sc_rx_lock);
 
        if (vsc->sc_nvqs == 3) {
-               virtio_free_vq(vsc, &sc->sc_vq[VQ_CTRL]);
                cv_destroy(&sc->sc_ctrl_wait);
                mutex_destroy(&sc->sc_ctrl_wait_lock);
-               vsc->sc_nvqs = 2;
        }
-       if (vsc->sc_nvqs == 2) {
-               virtio_free_vq(vsc, &sc->sc_vq[VQ_TX]);
-               vsc->sc_nvqs = 1;
-       }
-       if (vsc->sc_nvqs == 1) {
-               virtio_free_vq(vsc, &sc->sc_vq[VQ_RX]);
-               vsc->sc_nvqs = 0;
-       }
+
+       while (vsc->sc_nvqs > 0)
+               virtio_free_vq(vsc, &sc->sc_vq[--vsc->sc_nvqs]);
+
        vsc->sc_child = (void*)1;
        return;
 }



Home | Main Index | Thread Index | Old Index