Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/isa - Use the correct function name for the panic me...



details:   https://anonhg.NetBSD.org/src/rev/f79c76cea7f5
branches:  trunk
changeset: 998148:f79c76cea7f5
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Tue Apr 09 05:59:14 2019 +0000

description:
- Use the correct function name for the panic message.
- KNF.

diffstat:

 sys/dev/isa/if_ef.c |  177 ++++++++++++++++++++++++---------------------------
 1 files changed, 84 insertions(+), 93 deletions(-)

diffs (truncated from 505 to 300 lines):

diff -r ea336c334b85 -r f79c76cea7f5 sys/dev/isa/if_ef.c
--- a/sys/dev/isa/if_ef.c       Tue Apr 09 05:25:14 2019 +0000
+++ b/sys/dev/isa/if_ef.c       Tue Apr 09 05:59:14 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_ef.c,v 1.31 2011/06/03 16:28:40 tsutsui Exp $       */
+/*     $NetBSD: if_ef.c,v 1.32 2019/04/09 05:59:14 msaitoh Exp $       */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ef.c,v 1.31 2011/06/03 16:28:40 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ef.c,v 1.32 2019/04/09 05:59:14 msaitoh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -72,17 +72,17 @@
 
        void* sc_ih;                    /* interrupt handle */
 
-       u_int8_t card_rev;              /* hardware revision */
-       u_int8_t card_type;             /* card model -- AUI/BNC or TP */
+       uint8_t card_rev;               /* hardware revision */
+       uint8_t card_type;              /* card model -- AUI/BNC or TP */
 };
 
-int ef_media[] = {
+static int ef_media[] = {
        IFM_ETHER | IFM_10_5,
        IFM_ETHER | IFM_10_2,
 };
 #define NEF_MEDIA       (sizeof(ef_media) / sizeof(ef_media[0]))
 
-int eftp_media[] = {
+static int eftp_media[] = {
        IFM_ETHER | IFM_10_T,
 };
 #define NEFTP_MEDIA       (sizeof(eftp_media) / sizeof(eftp_media[0]))
@@ -96,8 +96,8 @@
 static void    ef_copyin(struct ie_softc *, void *, int, size_t);
 static void    ef_copyout(struct ie_softc *, const void *, int, size_t);
 
-static u_int16_t ef_read_16(struct ie_softc *, int);
-static void    ef_write_16(struct ie_softc *, int, u_int16_t);
+static uint16_t ef_read_16(struct ie_softc *, int);
+static void    ef_write_16(struct ie_softc *, int, uint16_t);
 static void    ef_write_24(struct ie_softc *, int, int);
 
 static void    ef_mediastatus(struct ie_softc *, struct ifmediareq *);
@@ -105,8 +105,8 @@
 /* Local routines */
 static int     ef_port_check(bus_space_tag_t, bus_space_handle_t);
 
-int ef_match(device_t, cfdata_t, void *);
-void ef_attach(device_t, device_t, void *);
+static int     ef_match(device_t, cfdata_t, void *);
+static void    ef_attach(device_t, device_t, void *);
 
 /*
  * This keeps track of which ISAs have been through an ie probe sequence.
@@ -117,7 +117,7 @@
  * which will unique per ISA bus.
  */
 
-#define MAXCARDS_PER_ISABUS     8       /* if you have more than 8, you lose */
+#define MAXCARDS_PER_ISABUS     8       /* If you have more than 8, you lose */
 
 struct ef_isabus {
        LIST_ENTRY(ef_isabus) isa_link;
@@ -138,12 +138,8 @@
 static int ef_isa_buses_inited;
 
 static void
-ef_card_add(
-    struct ef_isabus *bus,
-    bus_addr_t iobase,
-    bus_addr_t maddr,
-    bus_size_t msiz,
-    int irq)
+ef_card_add(struct ef_isabus *bus, bus_addr_t iobase, bus_addr_t maddr,
+    bus_size_t msiz, int irq)
 {
        int idx;
 
@@ -168,11 +164,11 @@
 static void
 ef_reset(struct ie_softc *sc, int why)
 {
-       struct ef_softc* esc = (struct ef_softc *) sc;
+       struct ef_softc *esc = (struct ef_softc *)sc;
 
        switch (why) {
        case CHIP_PROBE:
-               /* reset to chip to see if it responds */
+               /* Reset to chip to see if it responds */
                bus_space_write_1(esc->sc_regt, esc->sc_regh,
                                  EF_CTRL, EF_CTRL_RESET);
                DELAY(100);
@@ -183,7 +179,7 @@
 
        case CARD_RESET:
                /*
-                * this takes around 10sec, and we can get
+                * This takes around 10sec, and we can get
                 * by quite well w/out it...
                 */
                break;
@@ -193,14 +189,16 @@
 static void
 ef_atten(struct ie_softc *sc, int why)
 {
-       struct ef_softc* esc = (struct ef_softc *) sc;
+       struct ef_softc *esc = (struct ef_softc *)sc;
+
        bus_space_write_1(esc->sc_regt, esc->sc_regh, EF_ATTN, 1);
 }
 
 static void
 ef_hwinit(struct ie_softc *sc)
 {
-       struct ef_softc* esc = (struct ef_softc *) sc;
+       struct ef_softc *esc = (struct ef_softc *)sc;
+
        bus_space_write_1(esc->sc_regt, esc->sc_regh, EF_ICTRL, 1);
 }
 
@@ -208,26 +206,26 @@
 ef_intrhook(struct ie_softc *sc, int where)
 {
        unsigned char cr;
-       struct ef_softc* esc = (struct ef_softc *) sc;
+       struct ef_softc *esc = (struct ef_softc *)sc;
 
        switch (where) {
        case INTR_ENTER:
-               /* entering ISR: disable, ack card interrupts */
+               /* Entering ISR: disable, ack card interrupts */
                cr = bus_space_read_1(esc->sc_regt, esc->sc_regh, EF_CTRL);
                bus_space_write_1(esc->sc_regt, esc->sc_regh, EF_CTRL,
-                                 cr & ~EF_CTRL_IEN);
+                   cr & ~EF_CTRL_IEN);
                bus_space_write_1(esc->sc_regt, esc->sc_regh, EF_ICTRL, 1);
                break;
 
        case INTR_EXIT:
-               /* exiting ISR: re-enable card interrupts */
+               /* Exiting ISR: re-enable card interrupts */
                cr = bus_space_read_1(esc->sc_regt, esc->sc_regh, EF_CTRL);
                bus_space_write_1(esc->sc_regt, esc->sc_regh, EF_CTRL,
-                                 cr | EF_CTRL_IEN);
+                   cr | EF_CTRL_IEN);
                break;
 
        case INTR_LOOP:
-               /* looping in ISR: ack new interrupts */
+               /* Looping in ISR: ack new interrupts */
                bus_space_write_1(esc->sc_regt, esc->sc_regh, EF_ICTRL, 1);
                break;
     }
@@ -235,21 +233,22 @@
     return 1;
 }
 
-static u_int16_t
-ef_read_16 (struct ie_softc *sc, int offset)
+static uint16_t
+ef_read_16(struct ie_softc *sc, int offset)
 {
+
        bus_space_barrier(sc->bt, sc->bh, offset, 2, BUS_SPACE_BARRIER_READ);
        return bus_space_read_2(sc->bt, sc->bh, offset);
 }
 
 static void
-ef_copyin (struct ie_softc *sc, void *dst, int offset, size_t size)
+ef_copyin(struct ie_softc *sc, void *dst, int offset, size_t size)
 {
        int dribble;
-       u_int8_t* bptr = dst;
+       uint8_t *bptr = dst;
 
        bus_space_barrier(sc->bt, sc->bh, offset, size,
-                         BUS_SPACE_BARRIER_READ);
+           BUS_SPACE_BARRIER_READ);
 
        if (offset % 2) {
                *bptr = bus_space_read_1(sc->bt, sc->bh, offset);
@@ -257,8 +256,8 @@
        }
 
        dribble = size % 2;
-       bus_space_read_region_2(sc->bt, sc->bh, offset, (u_int16_t *) bptr,
-                               size >> 1);
+       bus_space_read_region_2(sc->bt, sc->bh, offset, (uint16_t *) bptr,
+           size >> 1);
 
        if (dribble) {
                bptr += size - 1;
@@ -268,12 +267,12 @@
 }
 
 static void
-ef_copyout (struct ie_softc *sc, const void *src, int offset, size_t size)
+ef_copyout(struct ie_softc *sc, const void *src, int offset, size_t size)
 {
        int dribble;
        int osize = size;
        int ooffset = offset;
-       const u_int8_t* bptr = src;
+       const uint8_t *bptr = src;
 
        if (offset % 2) {
                bus_space_write_1(sc->bt, sc->bh, offset, *bptr);
@@ -282,7 +281,7 @@
 
        dribble = size % 2;
        bus_space_write_region_2(sc->bt, sc->bh, offset,
-           (const u_int16_t *)bptr, size >> 1);
+           (const uint16_t *)bptr, size >> 1);
        if (dribble) {
                bptr += size - 1;
                offset += size - 1;
@@ -290,21 +289,23 @@
        }
 
        bus_space_barrier(sc->bt, sc->bh, ooffset, osize,
-                         BUS_SPACE_BARRIER_WRITE);
+           BUS_SPACE_BARRIER_WRITE);
 }
 
 static void
-ef_write_16 (struct ie_softc *sc, int offset, u_int16_t value)
+ef_write_16(struct ie_softc *sc, int offset, uint16_t value)
 {
+
        bus_space_write_2(sc->bt, sc->bh, offset, value);
        bus_space_barrier(sc->bt, sc->bh, offset, 2, BUS_SPACE_BARRIER_WRITE);
 }
 
 static void
-ef_write_24 (struct ie_softc *sc, int offset, int addr)
+ef_write_24(struct ie_softc *sc, int offset, int addr)
 {
-       bus_space_write_4(sc->bt, sc->bh, offset, addr +
-                         (u_long) sc->sc_maddr - (u_long) sc->sc_iobase);
+
+       bus_space_write_4(sc->bt, sc->bh, offset,
+           addr + (u_long)sc->sc_maddr - (u_long)sc->sc_iobase);
        bus_space_barrier(sc->bt, sc->bh, offset, 4, BUS_SPACE_BARRIER_WRITE);
 }
 
@@ -313,34 +314,28 @@
 {
         struct ifmedia *ifm = &sc->sc_media;
 
-        /*
-         * The currently selected media is always the active media.
-         */
+        /* The currently selected media is always the active media. */
         ifmr->ifm_active = ifm->ifm_cur->ifm_media;
 }
 
-int
+static int
 ef_match(device_t parent, cfdata_t cf, void *aux)
 {
        struct isa_attach_args * const ia = aux;
-
        int idx;
        struct ef_isabus *bus;
-
        bus_space_handle_t ioh;
        bus_space_tag_t iot = ia->ia_iot;
 
        if (ISA_DIRECT_CONFIG(ia))
-               return (0);
+               return 0;
 
        if (ef_isa_buses_inited == 0) {
                LIST_INIT(&ef_isa_buses);
                ef_isa_buses_inited = 1;
        }
 
-       /*
-        * Probe this bus if we haven't done so already.
-        */
+       /* Probe this bus if we haven't done so already. */
        for (bus = ef_isa_buses.lh_first; bus != NULL;
             bus = bus->isa_link.le_next) {
                if (bus->isa_bus == parent)
@@ -350,16 +345,14 @@
        if (bus == NULL) {
                bus_addr_t iobase;
 
-               /*
-                * Mark this bus so we don't probe it again.
-                */
+               /* Mark this bus so we don't probe it again. */



Home | Main Index | Thread Index | Old Index