Module Name: src
Committed By: riastradh
Date: Mon Oct 24 10:17:40 UTC 2022
Modified Files:
src/sys/dev/i2c: i2c.c
Log Message:
iic(4): Use config_detach_children to simplify.
To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 src/sys/dev/i2c/i2c.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/i2c/i2c.c
diff -u src/sys/dev/i2c/i2c.c:1.89 src/sys/dev/i2c/i2c.c:1.90
--- src/sys/dev/i2c/i2c.c:1.89 Mon Oct 24 10:17:27 2022
+++ src/sys/dev/i2c/i2c.c Mon Oct 24 10:17:40 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: i2c.c,v 1.89 2022/10/24 10:17:27 riastradh Exp $ */
+/* $NetBSD: i2c.c,v 1.90 2022/10/24 10:17:40 riastradh Exp $ */
/*
* Copyright (c) 2003 Wasabi Systems, Inc.
@@ -53,7 +53,7 @@
#endif /* _KERNEL_OPT */
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i2c.c,v 1.89 2022/10/24 10:17:27 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i2c.c,v 1.90 2022/10/24 10:17:40 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -543,16 +543,11 @@ iic_attach(device_t parent, device_t sel
static int
iic_detach(device_t self, int flags)
{
- struct iic_softc *sc = device_private(self);
- int i, error;
+ int error;
- for (i = 0; i <= I2C_MAX_ADDR; i++) {
- if (sc->sc_devices[i]) {
- error = config_detach(sc->sc_devices[i], flags);
- if (error)
- return error;
- }
- }
+ error = config_detach_children(self, flags);
+ if (error)
+ return error;
pmf_device_deregister(self);