Source-Changes-HG archive

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

[src/thorpej-i2c-spi-conf2]: src/sys/dev/i2c Use designated initialiers in ii...



details:   https://anonhg.NetBSD.org/src/rev/7cd487dfbb09
branches:  thorpej-i2c-spi-conf2
changeset: 1024886:7cd487dfbb09
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sun Aug 22 18:40:11 2021 +0000

description:
Use designated initialiers in iic_attach().

diffstat:

 sys/dev/i2c/i2c.c |  20 +++++++++-----------
 1 files changed, 9 insertions(+), 11 deletions(-)

diffs (41 lines):

diff -r f1f87ca4da9b -r 7cd487dfbb09 sys/dev/i2c/i2c.c
--- a/sys/dev/i2c/i2c.c Mon Aug 09 12:36:14 2021 +0000
+++ b/sys/dev/i2c/i2c.c Sun Aug 22 18:40:11 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: i2c.c,v 1.80.2.2 2021/08/09 01:09:41 thorpej Exp $     */
+/*     $NetBSD: i2c.c,v 1.80.2.3 2021/08/22 18:40:11 thorpej Exp $     */
 
 /*-
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -69,7 +69,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i2c.c,v 1.80.2.2 2021/08/09 01:09:41 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i2c.c,v 1.80.2.3 2021/08/22 18:40:11 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -679,15 +679,13 @@
         * Attempt to enumerate the devices on the bus.  If there is no
         * enumeration method, then we will attempt indirect configuration.
         */
-       struct i2c_enumerate_devices_args enumargs;
-       struct i2c_attach_args ia;
-
-       memset(&ia, 0, sizeof(ia));
-       ia.ia_tag = ic;
-
-       memset(&enumargs, 0, sizeof(enumargs));
-       enumargs.ia = &ia;
-       enumargs.callback = iic_enumerate_devices_callback;
+       struct i2c_attach_args ia = {
+               .ia_tag = ic,
+       };
+       struct i2c_enumerate_devices_args enumargs = {
+               .ia = &ia,
+               .callback = iic_enumerate_devices_callback,
+       };
 
        rv = device_call(self, "i2c-enumerate-devices", &enumargs);
        if (rv == ENOTSUP) {



Home | Main Index | Thread Index | Old Index