Module Name: src
Committed By: jnemeth
Date: Fri May 15 20:52:23 UTC 2009
Modified Files:
src/sys/arch/sparc64/dev: fdc.c
Log Message:
Convert shutdownhook_establish() to pmf_device_register1().
XXX This should be done as part of an overall plan to support
power management and device detachment. However, in order to do
that, I would first have to invent sbus_intr_disestablish(). This
is being done at this time in order to aid in the effort to eliminate
shutdownhook_establish().
To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/sparc64/dev/fdc.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/arch/sparc64/dev/fdc.c
diff -u src/sys/arch/sparc64/dev/fdc.c:1.30 src/sys/arch/sparc64/dev/fdc.c:1.31
--- src/sys/arch/sparc64/dev/fdc.c:1.30 Wed Mar 18 16:00:15 2009
+++ src/sys/arch/sparc64/dev/fdc.c Fri May 15 20:52:22 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: fdc.c,v 1.30 2009/03/18 16:00:15 cegger Exp $ */
+/* $NetBSD: fdc.c,v 1.31 2009/05/15 20:52:22 jnemeth Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fdc.c,v 1.30 2009/03/18 16:00:15 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdc.c,v 1.31 2009/05/15 20:52:22 jnemeth Exp $");
#include "opt_ddb.h"
#include "opt_md.h"
@@ -314,8 +314,6 @@
int sc_cylin; /* where we think the head is */
int sc_opts; /* user-set options */
- void *sc_sdhook; /* shutdownhook cookie */
-
TAILQ_ENTRY(fd_softc) sc_drivechain;
int sc_ops; /* I/O ops since last switch */
struct bufq_state *sc_q;/* pending I/O requests */
@@ -325,6 +323,8 @@
/* floppy driver configuration */
int fdmatch(struct device *, struct cfdata *, void *);
void fdattach(struct device *, struct device *, void *);
+bool fdshutdown(device_t, int);
+bool fdsuspend(device_t PMF_FN_PROTO);
CFATTACH_DECL(fd, sizeof(struct fd_softc),
fdmatch, fdattach, NULL, NULL);
@@ -967,9 +967,25 @@
fd_set_properties(fd);
/* Make sure the drive motor gets turned off at shutdown time. */
- fd->sc_sdhook = shutdownhook_establish(fd_motor_off, fd);
+ if (!pmf_device_register1(self, fdsuspend, NULL, fdshutdown))
+ aprint_error_dev(self, "couldn't establish power handler\n");
+}
+
+bool fdshutdown(device_t self, int how)
+{
+ struct fd_softc *fd = device_private(self);
+
+ fd_motor_off(fd);
+ return true;
}
+bool fdsuspend(device_t self PMF_FN_ARGS)
+{
+
+ return fdshutdown(self, boothowto);
+}
+
+
inline struct fd_type *
fd_dev_to_type(struct fd_softc *fd, dev_t dev)
{