summaryrefslogtreecommitdiff
path: root/sys/dev/i2c
diff options
context:
space:
mode:
authorriastradh <riastradh@NetBSD.org>2022-10-24 10:17:40 +0000
committerriastradh <riastradh@NetBSD.org>2022-10-24 10:17:40 +0000
commit54f666f3becd497dad044f70ab01b30faa005dc1 (patch)
treedcc55f85cbe1fa3238cb81ada70600a1dd44d7a6 /sys/dev/i2c
parentaee28a410e57efd2308267b5ca955457cd321c5c (diff)
iic(4): Use config_detach_children to simplify.
Diffstat (limited to 'sys/dev/i2c')
-rw-r--r--sys/dev/i2c/i2c.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/sys/dev/i2c/i2c.c b/sys/dev/i2c/i2c.c
index ae8650a7dc7..3619fa46493 100644
--- a/sys/dev/i2c/i2c.c
+++ b/sys/dev/i2c/i2c.c
@@ -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 self, void *aux)
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);