Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sun3/dev Replace shutdownhook_establish(9) with pmf...



details:   https://anonhg.NetBSD.org/src/rev/b4cd912dbca2
branches:  trunk
changeset: 747662:b4cd912dbca2
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Sat Sep 26 16:03:45 2009 +0000

description:
Replace shutdownhook_establish(9) with pmf_device_register1(9).
Tested on 3/80.

diffstat:

 sys/arch/sun3/dev/fd.c |  21 ++++++++++++++++-----
 1 files changed, 16 insertions(+), 5 deletions(-)

diffs (56 lines):

diff -r 32180203ffd2 -r b4cd912dbca2 sys/arch/sun3/dev/fd.c
--- a/sys/arch/sun3/dev/fd.c    Sat Sep 26 15:49:45 2009 +0000
+++ b/sys/arch/sun3/dev/fd.c    Sat Sep 26 16:03:45 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fd.c,v 1.69 2009/01/13 13:35:52 yamt Exp $     */
+/*     $NetBSD: fd.c,v 1.70 2009/09/26 16:03:45 tsutsui Exp $  */
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -72,7 +72,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.69 2009/01/13 13:35:52 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.70 2009/09/26 16:03:45 tsutsui Exp $");
 
 #include "opt_ddb.h"
 
@@ -258,8 +258,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 */
@@ -289,6 +287,7 @@
        nostop, notty, nopoll, nommap, nokqfilter, D_DISK
 };
 
+static bool fd_shutdown(device_t, int);
 void fdgetdisklabel(dev_t);
 int fd_get_parms(struct fd_softc *);
 void fdstart(struct fd_softc *);
@@ -613,7 +612,19 @@
        mountroothook_establish(fd_mountroot_hook, self);
 
        /* 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, NULL, NULL, fd_shutdown))
+               aprint_error_dev(self, "couldn't establish power handler\n");
+}
+
+bool
+fd_shutdown(device_t self, int howto)
+{
+       struct fd_softc *fd;
+
+       fd = device_private(self);
+       fd_motor_off(fd);
+
+       return true;
 }
 
 inline struct fd_type *



Home | Main Index | Thread Index | Old Index