From 2957bfb58603bb146553503e67d2866ebbe58d6e Mon Sep 17 00:00:00 2001 From: dyoung Date: Thu, 12 Nov 2009 20:14:04 +0000 Subject: [PATCH] Remove superfluous activation hook. Add a child-detachment hook. --- sys/dev/ic/mb89352.c | 25 ++++++------------------- sys/dev/ic/mb89352var.h | 3 ++- sys/dev/pcmcia/spc_pcmcia.c | 9 +++++---- 3 files changed, 13 insertions(+), 24 deletions(-) diff --git a/sys/dev/ic/mb89352.c b/sys/dev/ic/mb89352.c index d42d32f6662c..a72d2c4b4516 100644 --- a/sys/dev/ic/mb89352.c +++ b/sys/dev/ic/mb89352.c @@ -1,4 +1,4 @@ -/* $NetBSD: mb89352.c,v 1.49 2008/06/12 22:30:30 cegger Exp $ */ +/* $NetBSD: mb89352.c,v 1.50 2009/11/12 20:14:04 dyoung Exp $ */ /* NecBSD: mb89352.c,v 1.4 1998/03/14 07:31:20 kmatsuda Exp */ /*- @@ -77,7 +77,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mb89352.c,v 1.49 2008/06/12 22:30:30 cegger Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mb89352.c,v 1.50 2009/11/12 20:14:04 dyoung Exp $"); #ifdef DDB #define integrate @@ -307,26 +307,13 @@ spc_attach(struct spc_softc *sc) scsipi_adapter_delref(adapt); } -int -spc_activate(device_t self, enum devact act) +void +spc_childdet(device_t self, device_t child) { struct spc_softc *sc = device_private(self); - int s, rv = 0; - s = splhigh(); - switch (act) { - case DVACT_ACTIVATE: - rv = EOPNOTSUPP; - break; - - case DVACT_DEACTIVATE: - if (sc->sc_child != NULL) - rv = config_deactivate(sc->sc_child); - break; - } - splx(s); - - return (rv); + if (sc->sc_child == child) + sc->sc_child = NULL; } int diff --git a/sys/dev/ic/mb89352var.h b/sys/dev/ic/mb89352var.h index b6bb8cb5530e..3771af2083e5 100644 --- a/sys/dev/ic/mb89352var.h +++ b/sys/dev/ic/mb89352var.h @@ -1,4 +1,4 @@ -/* $NetBSD: mb89352var.h,v 1.13 2009/05/12 14:25:17 cegger Exp $ */ +/* $NetBSD: mb89352var.h,v 1.14 2009/11/12 20:14:04 dyoung Exp $ */ /* NecBSD: mb89352var.h,v 1.4 1998/03/14 07:31:22 kmatsuda Exp */ /*- @@ -230,6 +230,7 @@ extern int spc_debug; /* SPC_SHOWSTART|SPC_SHOWMISC|SPC_SHOWTRACE; */ void spc_attach(struct spc_softc *); int spc_activate(device_t, enum devact); +void spc_childdet(device_t, device_t); int spc_detach(device_t, int); int spc_intr(void *); int spc_find(bus_space_tag_t, bus_space_handle_t, int); diff --git a/sys/dev/pcmcia/spc_pcmcia.c b/sys/dev/pcmcia/spc_pcmcia.c index d4f2c1ce6c8a..ac08239d6397 100644 --- a/sys/dev/pcmcia/spc_pcmcia.c +++ b/sys/dev/pcmcia/spc_pcmcia.c @@ -1,4 +1,4 @@ -/* $NetBSD: spc_pcmcia.c,v 1.20 2008/04/28 20:23:56 martin Exp $ */ +/* $NetBSD: spc_pcmcia.c,v 1.21 2009/11/12 20:14:04 dyoung Exp $ */ /*- * Copyright (c) 2000, 2004 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: spc_pcmcia.c,v 1.20 2008/04/28 20:23:56 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: spc_pcmcia.c,v 1.21 2009/11/12 20:14:04 dyoung Exp $"); #include #include @@ -67,8 +67,9 @@ static void spc_pcmcia_attach(device_t, device_t, void *); static int spc_pcmcia_detach(device_t, int); static int spc_pcmcia_enable(device_t, int); -CFATTACH_DECL_NEW(spc_pcmcia, sizeof(struct spc_pcmcia_softc), - spc_pcmcia_match, spc_pcmcia_attach, spc_pcmcia_detach, spc_activate); +CFATTACH_DECL2_NEW(spc_pcmcia, sizeof(struct spc_pcmcia_softc), + spc_pcmcia_match, spc_pcmcia_attach, spc_pcmcia_detach, NULL, NULL, + spc_childdet); static const struct pcmcia_product spc_pcmcia_products[] = { { PCMCIA_VENDOR_FUJITSU, PCMCIA_PRODUCT_FUJITSU_SCSI600,