Module Name:    src
Committed By:   msaitoh
Date:           Fri Mar 17 11:21:45 UTC 2017

Modified Files:
        src/sys/dev/pci: pci_map.c

Log Message:
Modify some variables to make code more understandable.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/pci/pci_map.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/pci_map.c
diff -u src/sys/dev/pci/pci_map.c:1.32 src/sys/dev/pci/pci_map.c:1.33
--- src/sys/dev/pci/pci_map.c:1.32	Fri Dec 26 05:09:03 2014
+++ src/sys/dev/pci/pci_map.c	Fri Mar 17 11:21:45 2017
@@ -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 @@ pci_mapreg_map(const struct pci_attach_a
 
 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_submap(const struct pci_attac
 	 * 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 @@ pci_mapreg_submap(const struct pci_attac
 	if (basep != NULL)
 		*basep = base;
 	if (sizep != NULL)
-		*sizep = maxsize;
+		*sizep = reqsize;
 
 	return 0;
 }

Reply via email to