Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/imcsmb Detach our children before allowing ourselves...



details:   https://anonhg.NetBSD.org/src/rev/3f4a09dcafd1
branches:  trunk
changeset: 830163:3f4a09dcafd1
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Tue Feb 27 11:50:57 2018 +0000

description:
Detach our children before allowing ourselves to detach.

diffstat:

 sys/dev/imcsmb/imc.c    |  12 +++++++++++-
 sys/dev/imcsmb/imcsmb.c |   7 +++++++
 2 files changed, 18 insertions(+), 1 deletions(-)

diffs (45 lines):

diff -r 431bcdd6b48f -r 3f4a09dcafd1 sys/dev/imcsmb/imc.c
--- a/sys/dev/imcsmb/imc.c      Tue Feb 27 11:26:39 2018 +0000
+++ b/sys/dev/imcsmb/imc.c      Tue Feb 27 11:50:57 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: imc.c,v 1.4 2018/02/26 05:47:03 pgoyette Exp $ */
+/* $NetBSD: imc.c,v 1.5 2018/02/27 11:50:57 pgoyette Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -259,6 +259,16 @@
 static int
 imc_detach(device_t self, int flags)
 {
+       struct imc_softc *sc = device_private(self);
+       int i, error;
+
+       for (i = 0; i < 2; i++) {
+               if (sc->sc_smbchild[i] != NULL) {
+                       error = config_detach(sc->sc_smbchild[i], flags);     
+                       if (error)
+                               return error;
+               }
+       }
 
        pmf_device_deregister(self);
        return 0;
diff -r 431bcdd6b48f -r 3f4a09dcafd1 sys/dev/imcsmb/imcsmb.c
--- a/sys/dev/imcsmb/imcsmb.c   Tue Feb 27 11:26:39 2018 +0000
+++ b/sys/dev/imcsmb/imcsmb.c   Tue Feb 27 11:50:57 2018 +0000
@@ -179,8 +179,15 @@
 static int
 imcsmb_detach(device_t self, int flags)
 {
+       int error;
        struct imcsmb_softc *sc = device_private(self);
 
+       if (sc->sc_smbus != NULL) {
+               error = config_detach(sc->sc_smbus, flags);
+               if (error)
+                       return error;
+       }
+
        pmf_device_deregister(self);
        mutex_destroy(&sc->sc_i2c_mutex);
        return 0;



Home | Main Index | Thread Index | Old Index