Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/nand nandemulator(4): Use config_detach_children.



details:   https://anonhg.NetBSD.org/src/rev/cd88d4300005
branches:  trunk
changeset: 374698:cd88d4300005
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Wed May 10 00:11:16 2023 +0000

description:
nandemulator(4): Use config_detach_children.

diffstat:

 sys/dev/nand/nandemulator.c |  17 ++++++++---------
 1 files changed, 8 insertions(+), 9 deletions(-)

diffs (45 lines):

diff -r 9cc2f32d1e44 -r cd88d4300005 sys/dev/nand/nandemulator.c
--- a/sys/dev/nand/nandemulator.c       Wed May 10 00:11:08 2023 +0000
+++ b/sys/dev/nand/nandemulator.c       Wed May 10 00:11:16 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nandemulator.c,v 1.9 2019/10/01 18:00:08 chs Exp $     */
+/*     $NetBSD: nandemulator.c,v 1.10 2023/05/10 00:11:16 riastradh Exp $      */
 
 /*-
  * Copyright (c) 2011 Department of Software Engineering,
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nandemulator.c,v 1.9 2019/10/01 18:00:08 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nandemulator.c,v 1.10 2023/05/10 00:11:16 riastradh Exp $");
 
 /* XXX this code likely needs work */
 
@@ -281,20 +281,19 @@ static int
 nandemulator_detach(device_t self, int flags)
 {
        struct nandemulator_softc *sc = device_private(self);
-       int ret = 0;
+       int error;
 
        aprint_normal_dev(sc->sc_dev, "detaching emulator\n");
 
-       pmf_device_deregister(sc->sc_dev);
+       error = config_detach_children(self, flags);
+       if (error)
+               return error;
 
-       if (sc->sc_nanddev != NULL)
-               ret = config_detach(sc->sc_nanddev, flags);
-
+       pmf_device_deregister(sc->sc_dev);
        kmem_free(sc->sc_backend, sc->sc_backend_size);
        kmem_free(sc->sc_parameter_page,
            sizeof(struct onfi_parameter_page) * 4);
-
-       return ret;
+       return 0;
 }
 
 /**



Home | Main Index | Thread Index | Old Index