Module Name: src Committed By: drochner Date: Wed Oct 30 15:41:14 UTC 2013
Modified Files: src/sys/dev/ata: wd.c Log Message: play the addref/delref game on suspend, prevents crash if the disk/CF Card is eg. in a PCMCIA adapter and not mounted To generate a diff of this commit: cvs rdiff -u -r1.405 -r1.406 src/sys/dev/ata/wd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/ata/wd.c diff -u src/sys/dev/ata/wd.c:1.405 src/sys/dev/ata/wd.c:1.406 --- src/sys/dev/ata/wd.c:1.405 Mon Aug 19 14:58:57 2013 +++ src/sys/dev/ata/wd.c Wed Oct 30 15:41:14 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: wd.c,v 1.405 2013/08/19 14:58:57 skrll Exp $ */ +/* $NetBSD: wd.c,v 1.406 2013/10/30 15:41:14 drochner Exp $ */ /* * Copyright (c) 1998, 2001 Manuel Bouyer. All rights reserved. @@ -54,7 +54,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.405 2013/08/19 14:58:57 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.406 2013/10/30 15:41:14 drochner Exp $"); #include "opt_ata.h" @@ -405,8 +405,14 @@ wd_suspend(device_t dv, const pmf_qual_t { struct wd_softc *sc = device_private(dv); + /* the adapter needs to be enabled */ + if (sc->atabus->ata_addref(sc->drvp)) + return true; /* no need to complain */ + wd_flushcache(sc, AT_WAIT); wd_standby(sc, AT_WAIT); + + sc->atabus->ata_delref(sc->drvp); return true; }