Detach atapibus(4), scsibus(4), cd(4), and sd(4) during shutdown.

Destroy sd->sc_callout in sddetach().  Delete some dead code in
cddetach().
This commit is contained in:
dyoung 2009-04-07 18:35:17 +00:00
parent 47c972421f
commit 3098a4fbed
4 changed files with 18 additions and 22 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: atapiconf.c,v 1.77 2008/03/24 14:44:26 cube Exp $ */
/* $NetBSD: atapiconf.c,v 1.78 2009/04/07 18:35:17 dyoung Exp $ */
/*
* Copyright (c) 1996, 2001 Manuel Bouyer. All rights reserved.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: atapiconf.c,v 1.77 2008/03/24 14:44:26 cube Exp $");
__KERNEL_RCSID(0, "$NetBSD: atapiconf.c,v 1.78 2009/04/07 18:35:17 dyoung Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -68,9 +68,9 @@ static int atapi_probe_bus(struct atapibus_softc *, int);
static int atapibusprint(void *, const char *);
CFATTACH_DECL2_NEW(atapibus, sizeof(struct atapibus_softc),
CFATTACH_DECL3_NEW(atapibus, sizeof(struct atapibus_softc),
atapibusmatch, atapibusattach, atapibusdetach, atapibusactivate, NULL,
atapibuschilddet);
atapibuschilddet, DVF_DETACH_SHUTDOWN);
extern struct cfdriver atapibus_cd;

View File

@ -1,4 +1,4 @@
/* $NetBSD: cd.c,v 1.291 2009/04/01 12:19:04 reinoud Exp $ */
/* $NetBSD: cd.c,v 1.292 2009/04/07 18:35:17 dyoung Exp $ */
/*-
* Copyright (c) 1998, 2001, 2003, 2004, 2005, 2008 The NetBSD Foundation,
@ -50,7 +50,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: cd.c,v 1.291 2009/04/01 12:19:04 reinoud Exp $");
__KERNEL_RCSID(0, "$NetBSD: cd.c,v 1.292 2009/04/07 18:35:17 dyoung Exp $");
#include "rnd.h"
@ -181,8 +181,8 @@ static int mmc_setup_writeparams(struct scsipi_periph *, struct mmc_writeparams
static void cd_set_properties(struct cd_softc *);
CFATTACH_DECL_NEW(cd, sizeof(struct cd_softc), cdmatch, cdattach, cddetach,
cdactivate);
CFATTACH_DECL3_NEW(cd, sizeof(struct cd_softc), cdmatch, cdattach, cddetach,
cdactivate, NULL, NULL, DVF_DETACH_SHUTDOWN);
extern struct cfdriver cd_cd;
@ -354,12 +354,6 @@ cddetach(device_t self, int flags)
disk_detach(&cd->sc_dk);
disk_destroy(&cd->sc_dk);
#if 0
/* Get rid of the shutdown hook. */
if (cd->sc_sdhook != NULL)
shutdownhook_disestablish(cd->sc_sdhook);
#endif
#if NRND > 0
/* Unhook the entropy source. */
rnd_detach_source(&cd->rnd_source);

View File

@ -1,4 +1,4 @@
/* $NetBSD: scsiconf.c,v 1.250 2008/07/16 18:50:58 drochner Exp $ */
/* $NetBSD: scsiconf.c,v 1.251 2009/04/07 18:35:17 dyoung Exp $ */
/*-
* Copyright (c) 1998, 1999, 2004 The NetBSD Foundation, Inc.
@ -48,7 +48,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: scsiconf.c,v 1.250 2008/07/16 18:50:58 drochner Exp $");
__KERNEL_RCSID(0, "$NetBSD: scsiconf.c,v 1.251 2009/04/07 18:35:17 dyoung Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -94,9 +94,9 @@ static int scsibusdetach(struct device *, int flags);
static int scsibusrescan(struct device *, const char *, const int *);
static void scsidevdetached(struct device *, struct device *);
CFATTACH_DECL2_NEW(scsibus, sizeof(struct scsibus_softc),
CFATTACH_DECL3_NEW(scsibus, sizeof(struct scsibus_softc),
scsibusmatch, scsibusattach, scsibusdetach, scsibusactivate,
scsibusrescan, scsidevdetached);
scsibusrescan, scsidevdetached, DVF_DETACH_SHUTDOWN);
extern struct cfdriver scsibus_cd;

View File

@ -1,4 +1,4 @@
/* $NetBSD: sd.c,v 1.277 2009/01/13 13:35:54 yamt Exp $ */
/* $NetBSD: sd.c,v 1.278 2009/04/07 18:35:17 dyoung Exp $ */
/*-
* Copyright (c) 1998, 2003, 2004 The NetBSD Foundation, Inc.
@ -47,7 +47,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sd.c,v 1.277 2009/01/13 13:35:54 yamt Exp $");
__KERNEL_RCSID(0, "$NetBSD: sd.c,v 1.278 2009/04/07 18:35:17 dyoung Exp $");
#include "opt_scsi.h"
#include "rnd.h"
@ -129,8 +129,8 @@ static int sdactivate(struct device *, enum devact);
static int sddetach(struct device *, int);
static void sd_set_properties(struct sd_softc *);
CFATTACH_DECL_NEW(sd, sizeof(struct sd_softc), sdmatch, sdattach, sddetach,
sdactivate);
CFATTACH_DECL3_NEW(sd, sizeof(struct sd_softc), sdmatch, sdattach, sddetach,
sdactivate, NULL, NULL, DVF_DETACH_SHUTDOWN);
extern struct cfdriver sd_cd;
@ -389,6 +389,8 @@ sddetach(struct device *self, int flags)
disk_detach(&sd->sc_dk);
disk_destroy(&sd->sc_dk);
callout_destroy(&sd->sc_callout);
pmf_device_deregister(self);
shutdownhook_disestablish(sd->sc_sdhook);