Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci Modify some variables to make code more understa...



details:   https://anonhg.NetBSD.org/src/rev/0810ede493c2
branches:  trunk
changeset: 352124:0810ede493c2
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Fri Mar 17 11:21:45 2017 +0000

description:
Modify some variables to make code more understandable.

diffstat:

 sys/dev/pci/pci_map.c |  20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diffs (76 lines):

diff -r 3bf8380bf194 -r 0810ede493c2 sys/dev/pci/pci_map.c
--- a/sys/dev/pci/pci_map.c     Fri Mar 17 11:20:16 2017 +0000
+++ b/sys/dev/pci/pci_map.c     Fri Mar 17 11:21:45 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pci_map.c,v 1.32 2014/12/26 05:09:03 msaitoh Exp $     */
+/*     $NetBSD: pci_map.c,v 1.33 2017/03/17 11:21:45 msaitoh Exp $     */
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pci_map.c,v 1.32 2014/12/26 05:09:03 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_map.c,v 1.33 2017/03/17 11:21:45 msaitoh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -280,27 +280,27 @@
 
 int
 pci_mapreg_submap(const struct pci_attach_args *pa, int reg, pcireg_t type,
-    int busflags, bus_size_t maxsize, bus_size_t offset, bus_space_tag_t *tagp,
+    int busflags, bus_size_t reqsize, bus_size_t offset, bus_space_tag_t *tagp,
        bus_space_handle_t *handlep, bus_addr_t *basep, bus_size_t *sizep)
 {
        bus_space_tag_t tag;
        bus_space_handle_t handle;
        bus_addr_t base;
-       bus_size_t size;
+       bus_size_t realmaxsize;
        int flags;
 
        if (PCI_MAPREG_TYPE(type) == PCI_MAPREG_TYPE_IO) {
                if ((pa->pa_flags & PCI_FLAGS_IO_OKAY) == 0)
                        return 1;
                if (pci_io_find(pa->pa_pc, pa->pa_tag, reg, type, &base,
-                   &size, &flags))
+                   &realmaxsize, &flags))
                        return 1;
                tag = pa->pa_iot;
        } else {
                if ((pa->pa_flags & PCI_FLAGS_MEM_OKAY) == 0)
                        return 1;
                if (pci_mem_find(pa->pa_pc, pa->pa_tag, reg, type, &base,
-                   &size, &flags))
+                   &realmaxsize, &flags))
                        return 1;
                tag = pa->pa_memt;
        }
@@ -320,13 +320,13 @@
         * pci_mapreg_map.
         */
 
-       maxsize = (maxsize != 0) ? maxsize : size;
+       reqsize = (reqsize != 0) ? reqsize : realmaxsize;
        base += offset;
 
-       if ((size < maxsize) || (size < (offset + maxsize)))
+       if (realmaxsize < (offset + reqsize))
                return 1;
 
-       if (bus_space_map(tag, base, maxsize, busflags | flags, &handle))
+       if (bus_space_map(tag, base, reqsize, busflags | flags, &handle))
                return 1;
 
        if (tagp != NULL)
@@ -336,7 +336,7 @@
        if (basep != NULL)
                *basep = base;
        if (sizep != NULL)
-               *sizep = maxsize;
+               *sizep = reqsize;
 
        return 0;
 }



Home | Main Index | Thread Index | Old Index