From d5faffc28715cb58c1183564e20cf31a728e5796 Mon Sep 17 00:00:00 2001 From: gene Date: Thu, 17 Apr 1997 17:46:39 +0000 Subject: [PATCH] Changes earmarked 'purely cosmetic' by Scott Reynolds: >- Remove unused `register' modifier on declarations >- Reverse the sense of some tests to make the code more clear >- Type casts per KNF >- Move a static variable into the only function that uses it > (perhaps we can eliminate it entirely, someday?) Also, I went through these files and XXX'ed some things that should be and fixed a few more formatting problems per KNF. --- sys/arch/mac68k/dev/grf_mv.c | 55 ++++++++++++++++++------------------ sys/arch/mac68k/dev/if_ae.c | 26 +++++++++-------- 2 files changed, 41 insertions(+), 40 deletions(-) diff --git a/sys/arch/mac68k/dev/grf_mv.c b/sys/arch/mac68k/dev/grf_mv.c index d99aec18910..3a758dc6d71 100644 --- a/sys/arch/mac68k/dev/grf_mv.c +++ b/sys/arch/mac68k/dev/grf_mv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: grf_mv.c,v 1.12 1997/04/10 20:34:33 briggs Exp $ */ +/* $OpenBSD: grf_mv.c,v 1.13 1997/04/17 17:46:39 gene Exp $ */ /* $NetBSD: grf_mv.c,v 1.17 1997/02/24 06:20:06 scottr Exp $ */ /* @@ -53,7 +53,6 @@ static void load_image_data __P((caddr_t data, struct image_data *image)); -static char zero = 0; static void grfmv_intr_generic __P((void *vsc, int slot)); static void grfmv_intr_cti __P((void *vsc, int slot)); static void grfmv_intr_cb264 __P((void *vsc, int slot)); @@ -101,7 +100,7 @@ grfmv_match(parent, vcf, aux) void *vcf; void *aux; { - struct nubus_attach_args *na = (struct nubus_attach_args *) aux; + struct nubus_attach_args *na = (struct nubus_attach_args *)aux; if (na->category != NUBUS_CATEGORY_DISPLAY) return 0; @@ -127,8 +126,8 @@ grfmv_attach(parent, self, aux) struct device *parent, *self; void *aux; { - struct grfbus_softc *sc = (struct grfbus_softc *) self; - struct nubus_attach_args *na = (struct nubus_attach_args *) aux; + struct grfbus_softc *sc = (struct grfbus_softc *)self; + struct nubus_attach_args *na = (struct nubus_attach_args *)aux; struct image_data image_store, image; struct grfmode *gm; char cardname[CARD_NAME_LEN]; @@ -169,7 +168,7 @@ grfmv_attach(parent, self, aux) return; } - if (nubus_get_ind_data(&sc->sc_slot, &dirent, (caddr_t) &image_store, + if (nubus_get_ind_data(&sc->sc_slot, &dirent, (caddr_t)&image_store, sizeof(struct image_data)) <= 0) { printf("\n%s: probe failed to get indirect mode data.\n", sc->sc_dev.dv_xname); @@ -178,11 +177,11 @@ grfmv_attach(parent, self, aux) /* Need to load display info (and driver?), etc... (?) */ - load_image_data((caddr_t) &image_store, &image); + load_image_data((caddr_t)&image_store, &image); gm = &sc->curr_mode; gm->mode_id = mode; - gm->fbbase = (caddr_t) (sc->sc_slot.virtual_base + + gm->fbbase = (caddr_t)(sc->sc_slot.virtual_base + mac68k_trunc_page(image.offset)); gm->fboff = image.offset & PGOFSET; gm->rowbytes = image.rowbytes; @@ -197,6 +196,7 @@ grfmv_attach(parent, self, aux) strncpy(cardname, nubus_get_card_name(&sc->sc_slot), CARD_NAME_LEN); cardname[CARD_NAME_LEN-1] = '\0'; + printf(": %s\n", cardname); if (sc->card_id == NUBUS_DRHW_TFB) { /* @@ -205,16 +205,13 @@ grfmv_attach(parent, self, aux) * value here, even though the cards are different, so we * so we try to differentiate here. */ - if (strncmp(cardname, "Samsung 768", 11) == 0) { + if (strncmp(cardname, "Samsung 768", 11) == 0) sc->card_id = NUBUS_DRHW_SAM768; - } else if (strncmp(cardname, "Toby frame", 10) == 0) { - } else { - printf(": (evil card pretending to be TFB)"); - } + else if (strncmp(cardname, "Toby frame", 10) != 0) + printf("%s: card masquaredes as Toby Framebuffer", + sc->sc_dev.dv_xname); } - printf(": %s\n", cardname); - switch (sc->card_id) { case NUBUS_DRHW_M2HRVC: case NUBUS_DRHW_TFB: @@ -237,7 +234,8 @@ grfmv_attach(parent, self, aux) case NUBUS_DRHW_MICRON: /* What do we know about this one? */ default: - printf(" Unknown video card 0x%x--", sc->card_id); + printf("%s: Unknown video card 0x%x--", + sc->sc_dev.dv_xname, sc->card_id); printf("Not installing interrupt routine.\n"); break; } @@ -271,7 +269,7 @@ grfmv_phys(gp, addr) struct grf_softc *gp; vm_offset_t addr; { - return (caddr_t) (NUBUS_SLOT2PA(gp->sc_slot->slot) + + return (caddr_t)(NUBUS_SLOT2PA(gp->sc_slot->slot) + (addr - gp->sc_slot->virtual_base)); } @@ -287,11 +285,12 @@ grfmv_intr_generic(vsc, slot) void *vsc; int slot; { - caddr_t slotbase; - struct grfbus_softc *sc; + static char zero = 0; + struct grfbus_softc *sc; + volatile char *slotbase; - sc = (struct grfbus_softc *) vsc; - slotbase = (caddr_t) sc->sc_slot.virtual_base; + sc = (struct grfbus_softc *)vsc; + slotbase = (volatile char *)sc->sc_slot.virtual_base; slotbase[sc->cli_offset] = zero; } @@ -310,11 +309,11 @@ grfmv_intr_cti(vsc, slot) void *vsc; int slot; { - volatile char *slotbase; - struct grfbus_softc *sc; + struct grfbus_softc *sc; + volatile char *slotbase; - sc = (struct grfbus_softc *) vsc; - slotbase = ((volatile char *) sc->sc_slot.virtual_base) + 0x00080000; + sc = (struct grfbus_softc *)vsc; + slotbase = ((volatile char *)sc->sc_slot.virtual_base) + 0x00080000; *slotbase = (*slotbase | 0x02); *slotbase = (*slotbase & 0xFD); } @@ -326,10 +325,10 @@ grfmv_intr_cb264(vsc, slot) int slot; { struct grfbus_softc *sc; - caddr_t slotbase; + volatile char *slotbase; - sc = (struct grfbus_softc *) vsc; - slotbase = (caddr_t) sc->sc_slot.virtual_base; + sc = (struct grfbus_softc *)vsc; + slotbase = (volatile char *)sc->sc_slot.virtual_base; asm volatile(" movl %0,a0 movl a0@(0xff6028),d0 andl #0x2,d0 diff --git a/sys/arch/mac68k/dev/if_ae.c b/sys/arch/mac68k/dev/if_ae.c index c465815e18b..e2a2dcb4fd5 100644 --- a/sys/arch/mac68k/dev/if_ae.c +++ b/sys/arch/mac68k/dev/if_ae.c @@ -1,5 +1,5 @@ -/* $OpenBSD: if_ae.c,v 1.11 1997/03/25 04:58:43 briggs Exp $ */ -/* $NetBSD: if_ae.c,v 1.60 1997/03/19 08:04:38 scottr Exp $ */ +/* $OpenBSD: if_ae.c,v 1.12 1997/04/17 17:46:41 gene Exp $ */ +/* $NetBSD: if_ae.c,v 1.61 1997/04/14 16:28:34 scottr Exp $ */ /* * Device driver for National Semiconductor DS8390/WD83C690 based ethernet @@ -239,8 +239,8 @@ aeinit(sc) struct ae_softc *sc; { struct ifnet *ifp = &sc->sc_arpcom.ac_if; - int i; - u_char mcaf[8]; + u_int8_t mcaf[8]; + int i; /* * Initialize the NIC in the exact order outlined in the NS manual. @@ -460,9 +460,9 @@ static inline void ae_rint(sc) struct ae_softc *sc; { - u_char boundary, current; + u_char boundary, current; u_short len; - u_char nlen; + u_char nlen; u_int8_t *lenp; struct ae_ring packet_hdr; int packet_ptr; @@ -740,16 +740,17 @@ aeintr(arg, slot) } /* - * Process an ioctl request. This code needs some work - it looks pretty ugly. + * Process an ioctl request. + * XXX - This code needs some work - it looks pretty ugly. */ int aeioctl(ifp, cmd, data) - register struct ifnet *ifp; + struct ifnet *ifp; u_long cmd; caddr_t data; { struct ae_softc *sc = ifp->if_softc; - register struct ifaddr *ifa = (struct ifaddr *) data; + struct ifaddr *ifa = (struct ifaddr *) data; struct ifreq *ifr = (struct ifreq *) data; int s, error = 0; @@ -889,6 +890,7 @@ aeread(sc, buf, len) /* * Supporting routines. */ + /* * Given a source and destination address, copy 'amount' of a packet from the * ring buffer into a linear destination buffer. Takes into account ring-wrap. @@ -982,9 +984,9 @@ ae_getmcaf(ac, af) { struct ifnet *ifp = &ac->ac_if; struct ether_multi *enm; - register u_char *cp, c; - register u_long crc; - register int i, len; + u_char *cp, c; + u_int32_t crc; + int i, len; struct ether_multistep step; /* -- 2.20.1