From 50a354a808ae2914100ce4d2c25c9722a1bdd7b1 Mon Sep 17 00:00:00 2001 From: gene Date: Thu, 17 Apr 1997 17:46:42 +0000 Subject: 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 ++++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 28 deletions(-) (limited to 'sys/arch/mac68k/dev/grf_mv.c') 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 -- cgit v1.2.3