Source-Changes-HG archive

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

[src/pgoyette-localcount]: src/sys/dev When detaching, call device_release() ...



details:   https://anonhg.NetBSD.org/src/rev/764749ae912c
branches:  pgoyette-localcount
changeset: 852874:764749ae912c
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Wed Jul 27 11:51:57 2016 +0000

description:
When detaching, call device_release() to allow the detach to complete.

diffstat:

 sys/dev/vnd.c |  9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diffs (37 lines):

diff -r cab4ab0c4b5d -r 764749ae912c sys/dev/vnd.c
--- a/sys/dev/vnd.c     Wed Jul 27 11:23:32 2016 +0000
+++ b/sys/dev/vnd.c     Wed Jul 27 11:51:57 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vnd.c,v 1.256.2.8 2016/07/27 11:23:32 pgoyette Exp $   */
+/*     $NetBSD: vnd.c,v 1.256.2.9 2016/07/27 11:51:57 pgoyette Exp $   */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008 The NetBSD Foundation, Inc.
@@ -91,7 +91,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.256.2.8 2016/07/27 11:23:32 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.256.2.9 2016/07/27 11:51:57 pgoyette Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_vnd.h"
@@ -275,6 +275,10 @@
                aprint_error_dev(self, "couldn't establish power handler\n");
 }
 
+/*
+ * The caller must hold a reference to the device's localcount.  the
+ * reference is released if the device is available for detach.
+ */
 static int
 vnd_detach(device_t self, int flags)
 {
@@ -291,6 +295,7 @@
        bufq_free(sc->sc_tab);
        disk_destroy(&sc->sc_dkdev);
 
+       device_release(self);
        return 0;
 }
 



Home | Main Index | Thread Index | Old Index