Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/i2c Use values from "locators.h" when constructing l...



details:   https://anonhg.NetBSD.org/src/rev/a431ad5f0370
branches:  trunk
changeset: 816772:a431ad5f0370
user:      jakllsch <jakllsch%NetBSD.org@localhost>
date:      Sat Jul 23 17:42:37 2016 +0000

description:
Use values from "locators.h" when constructing locators array to be sure
of correct index;

diffstat:

 sys/dev/i2c/i2c.c |  12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diffs (42 lines):

diff -r 48749443dd19 -r a431ad5f0370 sys/dev/i2c/i2c.c
--- a/sys/dev/i2c/i2c.c Sat Jul 23 13:37:10 2016 +0000
+++ b/sys/dev/i2c/i2c.c Sat Jul 23 17:42:37 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: i2c.c,v 1.52 2016/06/07 01:06:27 pgoyette Exp $        */
+/*     $NetBSD: i2c.c,v 1.53 2016/07/23 17:42:37 jakllsch Exp $        */
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i2c.c,v 1.52 2016/06/07 01:06:27 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i2c.c,v 1.53 2016/07/23 17:42:37 jakllsch Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -236,7 +236,7 @@
                uint64_t cookie;
                const char *name;
                struct i2c_attach_args ia;
-               int loc[2];
+               int loc[IICCF_NLOCS];
 
                memset(loc, 0, sizeof loc);
                count = prop_array_count(child_devices);
@@ -250,11 +250,11 @@
                                continue;
                        if (!prop_dictionary_get_uint64(dev, "cookie", &cookie))
                                cookie = 0;
-                       loc[0] = addr;
+                       loc[IICCF_ADDR] = addr;
                        if (prop_dictionary_get_uint32(dev, "size", &size))
-                               loc[1] = size;
+                               loc[IICCF_SIZE] = size;
                        else
-                               loc[1] = -1;
+                               loc[IICCF_SIZE] = -1;
 
                        memset(&ia, 0, sizeof ia);
                        ia.ia_addr = addr;



Home | Main Index | Thread Index | Old Index