Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci More const. Remove strange ifp assignments in bg...



details:   https://anonhg.NetBSD.org/src/rev/c255f776165a
branches:  trunk
changeset: 368264:c255f776165a
user:      skrll <skrll%NetBSD.org@localhost>
date:      Sat Jul 02 07:07:07 2022 +0000

description:
More const. Remove strange ifp assignments in bge_init.

diffstat:

 sys/dev/pci/if_bge.c |  14 +++++---------
 1 files changed, 5 insertions(+), 9 deletions(-)

diffs (63 lines):

diff -r 923648d7aa91 -r c255f776165a sys/dev/pci/if_bge.c
--- a/sys/dev/pci/if_bge.c      Sat Jul 02 06:10:29 2022 +0000
+++ b/sys/dev/pci/if_bge.c      Sat Jul 02 07:07:07 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_bge.c,v 1.357 2022/06/30 19:06:35 skrll Exp $       */
+/*     $NetBSD: if_bge.c,v 1.358 2022/07/02 07:07:07 skrll Exp $       */
 
 /*
  * Copyright (c) 2001 Wind River Systems
@@ -79,7 +79,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.357 2022/06/30 19:06:35 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.358 2022/07/02 07:07:07 skrll Exp $");
 
 #include <sys/param.h>
 
@@ -4391,7 +4391,7 @@
 static void
 bge_rxeof(struct bge_softc *sc)
 {
-       struct ifnet *ifp;
+       struct ifnet * const ifp = &sc->ethercom.ec_if;
        uint16_t rx_prod, rx_cons;
        int stdcnt = 0, jumbocnt = 0;
        bus_dmamap_t dmamap;
@@ -4406,8 +4406,6 @@
        if (rx_cons == rx_prod)
                return;
 
-       ifp = &sc->ethercom.ec_if;
-
        bus_dmamap_sync(sc->bge_dmatag, sc->bge_ring_map,
            offsetof(struct bge_ring_data, bge_status_block),
            sizeof (struct bge_status_block),
@@ -4572,16 +4570,14 @@
 static void
 bge_txeof(struct bge_softc *sc)
 {
+       struct ifnet * const ifp = &sc->ethercom.ec_if;
        struct bge_tx_bd *cur_tx = NULL;
-       struct ifnet *ifp;
        struct txdmamap_pool_entry *dma;
        bus_addr_t offset, toff;
        bus_size_t tlen;
        int tosync;
        struct mbuf *m;
 
-       ifp = &sc->ethercom.ec_if;
-
        bus_dmamap_sync(sc->bge_dmatag, sc->bge_ring_map,
            offsetof(struct bge_ring_data, bge_status_block),
            sizeof (struct bge_status_block),
@@ -5514,7 +5510,7 @@
 
        s = splnet();
 
-       ifp = &sc->ethercom.ec_if;
+       KASSERT(ifp == &sc->ethercom.ec_if);
 
        /* Cancel pending I/O and flush buffers. */
        bge_stop(ifp, 0);



Home | Main Index | Thread Index | Old Index