Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci Use appropriate macros. No binary changes for GC...



details:   https://anonhg.NetBSD.org/src/rev/7e70fce28287
branches:  trunk
changeset: 371250:7e70fce28287
user:      rin <rin%NetBSD.org@localhost>
date:      Sat Oct 01 12:35:25 2022 +0000

description:
Use appropriate macros. No binary changes for GCC/amd64.

diffstat:

 sys/dev/pci/genfb_pci.c |  15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)

diffs (43 lines):

diff -r 5224a1ad6696 -r 7e70fce28287 sys/dev/pci/genfb_pci.c
--- a/sys/dev/pci/genfb_pci.c   Sat Oct 01 12:27:29 2022 +0000
+++ b/sys/dev/pci/genfb_pci.c   Sat Oct 01 12:35:25 2022 +0000
@@ -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 @@
     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 @@
        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;
        }



Home | Main Index | Thread Index | Old Index