Module Name: src Committed By: rin Date: Sat Oct 1 12:35:25 UTC 2022
Modified Files: src/sys/dev/pci: genfb_pci.c Log Message: Use appropriate macros. No binary changes for GCC/amd64. To generate a diff of this commit: cvs rdiff -u -r1.43 -r1.44 src/sys/dev/pci/genfb_pci.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/pci/genfb_pci.c diff -u src/sys/dev/pci/genfb_pci.c:1.43 src/sys/dev/pci/genfb_pci.c:1.44 --- src/sys/dev/pci/genfb_pci.c:1.43 Sat Oct 1 12:27:29 2022 +++ src/sys/dev/pci/genfb_pci.c Sat Oct 1 12:35:25 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: genfb_pci.c,v 1.43 2022/10/01 12:27:29 rin Exp $ */ +/* $NetBSD: genfb_pci.c,v 1.44 2022/10/01 12:35:25 rin Exp $ */ /*- * Copyright (c) 2007 Michael Lorenz @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: genfb_pci.c,v 1.43 2022/10/01 12:27:29 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: genfb_pci.c,v 1.44 2022/10/01 12:35:25 rin Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -212,7 +212,8 @@ pci_genfb_ioctl(void *v, void *vs, u_lon struct lwp *l) { struct pci_genfb_softc *sc = v; - int new_mode, i; + size_t i; + int new_mode; switch (cmd) { case WSDISPLAYIO_GTYPE: @@ -232,11 +233,9 @@ pci_genfb_ioctl(void *v, void *vs, u_lon case WSDISPLAYIO_SMODE: new_mode = *(int *)data; if (new_mode == WSDISPLAYIO_MODE_EMUL) { - for (i = 0; i < 9; i++) - pci_conf_write(sc->sc_pc, - sc->sc_pcitag, - 0x10 + (i << 2), - sc->sc_bars[i]); + for (i = 0; i < __arraycount(sc->sc_bars); i++) + pci_conf_write(sc->sc_pc, sc->sc_pcitag, + PCI_BAR(i), sc->sc_bars[i]); } return 0; }