Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pci Add detachment support for sdhc_pci.
details: https://anonhg.NetBSD.org/src/rev/9a3f005eb163
branches: trunk
changeset: 783431:9a3f005eb163
user: jakllsch <jakllsch%NetBSD.org@localhost>
date: Thu Dec 20 14:41:35 2012 +0000
description:
Add detachment support for sdhc_pci.
Tested on an ExpressCard JMicron JMB38[89] with as-of-yet-uncommitted changes.
diffstat:
sys/dev/pci/sdhc_pci.c | 37 +++++++++++++++++++++++++++++++++----
1 files changed, 33 insertions(+), 4 deletions(-)
diffs (80 lines):
diff -r 055440f5eda4 -r 9a3f005eb163 sys/dev/pci/sdhc_pci.c
--- a/sys/dev/pci/sdhc_pci.c Thu Dec 20 14:37:00 2012 +0000
+++ b/sys/dev/pci/sdhc_pci.c Thu Dec 20 14:41:35 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sdhc_pci.c,v 1.9 2012/07/29 23:14:13 matt Exp $ */
+/* $NetBSD: sdhc_pci.c,v 1.10 2012/12/20 14:41:35 jakllsch Exp $ */
/* $OpenBSD: sdhc_pci.c,v 1.7 2007/10/30 18:13:45 chl Exp $ */
/*
@@ -18,7 +18,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sdhc_pci.c,v 1.9 2012/07/29 23:14:13 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdhc_pci.c,v 1.10 2012/12/20 14:41:35 jakllsch Exp $");
#ifdef _KERNEL_OPT
#include "opt_sdmmc.h"
@@ -56,14 +56,16 @@
struct sdhc_pci_softc {
struct sdhc_softc sc;
+ pci_chipset_tag_t sc_pc;
void *sc_ih;
};
static int sdhc_pci_match(device_t, cfdata_t, void *);
static void sdhc_pci_attach(device_t, device_t, void *);
+static int sdhc_pci_detach(device_t, int);
CFATTACH_DECL_NEW(sdhc_pci, sizeof(struct sdhc_pci_softc),
- sdhc_pci_match, sdhc_pci_attach, NULL, NULL);
+ sdhc_pci_match, sdhc_pci_attach, sdhc_pci_detach, NULL);
#ifdef SDHC_DEBUG
#define DPRINTF(s) printf s
@@ -224,6 +226,8 @@
sc->sc.sc_dmat = pa->pa_dmat;
sc->sc.sc_host = NULL;
+ sc->sc_pc = pc;
+
pci_aprint_devinfo(pa, NULL);
/* Some controllers needs special treatment. */
@@ -305,8 +309,33 @@
return;
err:
- if (sc->sc.sc_host != NULL)
+ if (sc->sc.sc_host != NULL) {
free(sc->sc.sc_host, M_DEVBUF);
+ sc->sc.sc_host = NULL;
+ }
+}
+
+static int
+sdhc_pci_detach(device_t self, int flags)
+{
+ struct sdhc_pci_softc * const sc = device_private(self);
+ int rv;
+
+ rv = sdhc_detach(&sc->sc, flags);
+ if (rv)
+ return rv;
+
+ if (sc->sc_ih != NULL) {
+ pci_intr_disestablish(sc->sc_pc, sc->sc_ih);
+ sc->sc_ih = NULL;
+ }
+
+ if (sc->sc.sc_host != NULL) {
+ free(sc->sc.sc_host, M_DEVBUF);
+ sc->sc.sc_host = NULL;
+ }
+
+ return rv;
}
static void
Home |
Main Index |
Thread Index |
Old Index