Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sgimips/hpc Replace shutdownhook_establish(9) (whic...



details:   https://anonhg.NetBSD.org/src/rev/f40f3adb9bc1
branches:  trunk
changeset: 747610:f40f3adb9bc1
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Thu Sep 24 14:09:18 2009 +0000

description:
Replace shutdownhook_establish(9) (which was added by me)
with pmf_device_register1(9).

diffstat:

 sys/arch/sgimips/hpc/haltwo.c    |  20 +++++++++++---------
 sys/arch/sgimips/hpc/haltwovar.h |   4 +---
 2 files changed, 12 insertions(+), 12 deletions(-)

diffs (77 lines):

diff -r 70d0ca95a110 -r f40f3adb9bc1 sys/arch/sgimips/hpc/haltwo.c
--- a/sys/arch/sgimips/hpc/haltwo.c     Thu Sep 24 11:13:38 2009 +0000
+++ b/sys/arch/sgimips/hpc/haltwo.c     Thu Sep 24 14:09:18 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: haltwo.c,v 1.16 2009/05/14 01:06:15 macallan Exp $ */
+/* $NetBSD: haltwo.c,v 1.17 2009/09/24 14:09:18 tsutsui Exp $ */
 
 /*
  * Copyright (c) 2003 Ilpo Ruotsalainen
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: haltwo.c,v 1.16 2009/05/14 01:06:15 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: haltwo.c,v 1.17 2009/09/24 14:09:18 tsutsui Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -75,7 +75,7 @@
        void *, const audio_params_t *);
 static int haltwo_trigger_input(void *, void *, void *, int, void (*)(void *),
        void *, const audio_params_t *);
-static void haltwo_shutdown(void *);
+static bool haltwo_shutdown(device_t, int);
 
 static const struct audio_hw_if haltwo_hw_if = {
        NULL, /* open */
@@ -358,10 +358,9 @@
 
        audio_attach_mi(&haltwo_hw_if, sc, &sc->sc_dev);
 
-       sc->sc_sdhook = shutdownhook_establish(haltwo_shutdown, sc);
-       if (sc->sc_sdhook == NULL)
+       if (!pmf_device_register1(self, NULL, NULL, haltwo_shutdown))
                aprint_error_dev(self,
-                   "WARNING: unable to establish shutdown hook\n");
+                   "couldn't establish power handler\n");
 }
 
 static int
@@ -815,12 +814,15 @@
        return ENXIO;
 }
 
-void
-haltwo_shutdown(void *arg)
+bool
+haltwo_shutdown(device_t self, int howto)
 {
-       struct haltwo_softc *sc = arg;
+       struct haltwo_softc *sc;
 
+       sc = device_private(self);
        haltwo_write(sc, ctl, HAL2_REG_CTL_ISR, 0);
        haltwo_write(sc, ctl, HAL2_REG_CTL_ISR,
            HAL2_ISR_GLOBAL_RESET_N | HAL2_ISR_CODEC_RESET_N);
+
+       return true;
 }
diff -r 70d0ca95a110 -r f40f3adb9bc1 sys/arch/sgimips/hpc/haltwovar.h
--- a/sys/arch/sgimips/hpc/haltwovar.h  Thu Sep 24 11:13:38 2009 +0000
+++ b/sys/arch/sgimips/hpc/haltwovar.h  Thu Sep 24 14:09:18 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: haltwovar.h,v 1.5 2008/08/24 13:03:39 tsutsui Exp $ */
+/* $NetBSD: haltwovar.h,v 1.6 2009/09/24 14:09:18 tsutsui Exp $ */
 
 /*
  * Copyright (c) 2003 Ilpo Ruotsalainen
@@ -81,8 +81,6 @@
        bus_space_handle_t sc_aes_sh;
        bus_space_handle_t sc_vol_sh;
        bus_space_handle_t sc_syn_sh;
-
-       void *sc_sdhook;
 };
 
 #endif



Home | Main Index | Thread Index | Old Index