Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/ata play the addref/delref game on suspend, prevents...



details:   https://anonhg.NetBSD.org/src/rev/58a71a40f535
branches:  trunk
changeset: 791010:58a71a40f535
user:      drochner <drochner%NetBSD.org@localhost>
date:      Wed Oct 30 15:41:14 2013 +0000

description:
play the addref/delref game on suspend, prevents crash if the disk/CF Card
is eg. in a PCMCIA adapter and not mounted

diffstat:

 sys/dev/ata/wd.c |  10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diffs (33 lines):

diff -r 68214a78da33 -r 58a71a40f535 sys/dev/ata/wd.c
--- a/sys/dev/ata/wd.c  Wed Oct 30 15:37:49 2013 +0000
+++ b/sys/dev/ata/wd.c  Wed Oct 30 15:41:14 2013 +0000
@@ -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 @@
 {
        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;
 }
 



Home | Main Index | Thread Index | Old Index