From 4beeeb807c32f82be0cbea3575a39a581c703b00 Mon Sep 17 00:00:00 2001 From: Miod Vallat Date: Sat, 21 Jan 2006 12:18:50 +0000 Subject: Invoke disk_detach() and related cleanup work in detach(), rather than zeroref() - just to be on the safe side, should we mess up our ref count. --- sys/dev/ata/wd.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'sys/dev/ata/wd.c') diff --git a/sys/dev/ata/wd.c b/sys/dev/ata/wd.c index 89fb2089b52..640cb8f727b 100644 --- a/sys/dev/ata/wd.c +++ b/sys/dev/ata/wd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wd.c,v 1.45 2005/11/09 19:05:48 uwe Exp $ */ +/* $OpenBSD: wd.c,v 1.46 2006/01/21 12:18:47 miod Exp $ */ /* $NetBSD: wd.c,v 1.193 1999/02/28 17:15:27 explorer Exp $ */ /* @@ -182,12 +182,11 @@ int wdprobe(struct device *, void *, void *); void wdattach(struct device *, struct device *, void *); int wddetach(struct device *, int); int wdactivate(struct device *, enum devact); -void wdzeroref(struct device *); int wdprint(void *, char *); struct cfattach wd_ca = { sizeof(struct wd_softc), wdprobe, wdattach, - wddetach, wdactivate, wdzeroref + wddetach, wdactivate }; #ifdef __OpenBSD__ @@ -445,6 +444,9 @@ wddetach(struct device *self, int flags) if (sc->sc_sdhook != NULL) shutdownhook_disestablish(sc->sc_sdhook); + /* Detach disk. */ + disk_detach(&sc->sc_dk); + #if NRND > 0 /* Unhook the entropy source. */ rnd_detach_source(&sc->rnd_source); @@ -453,15 +455,6 @@ wddetach(struct device *self, int flags) return (0); } -void -wdzeroref(struct device *self) -{ - struct wd_softc *sc = (struct wd_softc *)self; - - /* Detach disk. */ - disk_detach(&sc->sc_dk); -} - /* * Read/write routine for a buffer. Validates the arguments and schedules the * transfer. Does not wait for the transfer to complete. -- cgit v1.2.3