Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci Support detach by drvctl(8).



details:   https://anonhg.NetBSD.org/src/rev/5e5df8be0c47
branches:  trunk
changeset: 754237:5e5df8be0c47
user:      kiyohara <kiyohara%NetBSD.org@localhost>
date:      Sat Apr 24 11:26:15 2010 +0000

description:
Support detach by drvctl(8).

diffstat:

 sys/dev/pci/fwohci_pci.c |  30 +++++++++++++++++++++++++++---
 1 files changed, 27 insertions(+), 3 deletions(-)

diffs (63 lines):

diff -r f576769e5bec -r 5e5df8be0c47 sys/dev/pci/fwohci_pci.c
--- a/sys/dev/pci/fwohci_pci.c  Sat Apr 24 10:41:21 2010 +0000
+++ b/sys/dev/pci/fwohci_pci.c  Sat Apr 24 11:26:15 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fwohci_pci.c,v 1.37 2010/03/29 03:05:27 kiyohara Exp $ */
+/*     $NetBSD: fwohci_pci.c,v 1.38 2010/04/24 11:26:15 kiyohara Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fwohci_pci.c,v 1.37 2010/03/29 03:05:27 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fwohci_pci.c,v 1.38 2010/04/24 11:26:15 kiyohara Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -60,12 +60,13 @@
 
 static int fwohci_pci_match(device_t, cfdata_t, void *);
 static void fwohci_pci_attach(device_t, device_t, void *);
+static int fwohci_pci_detach(device_t, int);
 
 static bool fwohci_pci_suspend(device_t, const pmf_qual_t *);
 static bool fwohci_pci_resume(device_t, const pmf_qual_t *);
 
 CFATTACH_DECL_NEW(fwohci_pci, sizeof(struct fwohci_pci_softc),
-    fwohci_pci_match, fwohci_pci_attach, NULL, NULL);
+    fwohci_pci_match, fwohci_pci_attach, fwohci_pci_detach, NULL);
 
 static int
 fwohci_pci_match(device_t parent, cfdata_t match,
@@ -163,6 +164,29 @@
        return;
 }
 
+static int
+fwohci_pci_detach(device_t self, int flags)
+{
+       struct fwohci_pci_softc *psc = device_private(self);
+       int rv;
+
+       pmf_device_deregister(self);
+       rv = fwohci_detach(&psc->psc_sc, flags);
+       if (rv)
+               return rv;
+
+       if (psc->psc_ih != NULL) {
+               pci_intr_disestablish(psc->psc_pc, psc->psc_ih);
+               psc->psc_ih = NULL;
+       }
+       if (psc->psc_sc.bssize) {
+               bus_space_unmap(psc->psc_sc.bst, psc->psc_sc.bsh,
+                   psc->psc_sc.bssize);
+               psc->psc_sc.bssize = 0;
+       }
+       return 0;
+}
+
 static bool
 fwohci_pci_suspend(device_t dv, const pmf_qual_t *qual)
 {



Home | Main Index | Thread Index | Old Index