summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorjmcneill <jmcneill@NetBSD.org>2010-08-19 17:59:10 +0000
committerjmcneill <jmcneill@NetBSD.org>2010-08-19 17:59:10 +0000
commitb4ea2443163a622d56161e45139c7a4d2f7cfdfa (patch)
tree0baf7170e51174c2d4bda424e386323d9061110a /sys/dev
parent961a253c71f32ddb628a44e653f753d56bdb66a4 (diff)
flush cache on suspend
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ld.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/sys/dev/ld.c b/sys/dev/ld.c
index e626b6b0cce..0ffd2d3e4b4 100644
--- a/sys/dev/ld.c
+++ b/sys/dev/ld.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ld.c,v 1.66 2009/07/23 21:38:33 dyoung Exp $ */
+/* $NetBSD: ld.c,v 1.67 2010/08/19 17:59:10 jmcneill Exp $ */
/*-
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ld.c,v 1.66 2009/07/23 21:38:33 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ld.c,v 1.67 2010/08/19 17:59:10 jmcneill Exp $");
#include "rnd.h"
@@ -67,6 +67,7 @@ __KERNEL_RCSID(0, "$NetBSD: ld.c,v 1.66 2009/07/23 21:38:33 dyoung Exp $");
static void ldgetdefaultlabel(struct ld_softc *, struct disklabel *);
static void ldgetdisklabel(struct ld_softc *);
static void ldminphys(struct buf *bp);
+static bool ld_suspend(device_t, const pmf_qual_t *);
static bool ld_shutdown(device_t, int);
static void ldstart(struct ld_softc *, struct buf *);
static void ld_set_properties(struct ld_softc *);
@@ -154,7 +155,7 @@ ldattach(struct ld_softc *sc)
#endif
/* Register with PMF */
- if (!pmf_device_register1(sc->sc_dv, NULL, NULL, ld_shutdown))
+ if (!pmf_device_register1(sc->sc_dv, ld_suspend, NULL, ld_shutdown))
aprint_error_dev(sc->sc_dv,
"couldn't establish power handler\n");
@@ -265,6 +266,13 @@ ldenddetach(struct ld_softc *sc)
/* ARGSUSED */
static bool
+ld_suspend(device_t dev, const pmf_qual_t *qual)
+{
+ return ld_shutdown(dev, 0);
+}
+
+/* ARGSUSED */
+static bool
ld_shutdown(device_t dev, int flags)
{
struct ld_softc *sc = device_private(dev);