Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic Replace shutdownhook_establish(9) with pmf_device...



details:   https://anonhg.NetBSD.org/src/rev/644734a4291f
branches:  trunk
changeset: 747675:644734a4291f
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Sun Sep 27 10:00:11 2009 +0000

description:
Replace shutdownhook_establish(9) with pmf_device_register1(9).
Compile test only.

diffstat:

 sys/dev/ic/aic6915.c    |  23 ++++++++++++++---------
 sys/dev/ic/aic6915var.h |   3 +--
 2 files changed, 15 insertions(+), 11 deletions(-)

diffs (78 lines):

diff -r 1c202e6c5b77 -r 644734a4291f sys/dev/ic/aic6915.c
--- a/sys/dev/ic/aic6915.c      Sun Sep 27 08:04:14 2009 +0000
+++ b/sys/dev/ic/aic6915.c      Sun Sep 27 10:00:11 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: aic6915.c,v 1.24 2009/05/12 14:25:17 cegger Exp $      */
+/*     $NetBSD: aic6915.c,v 1.25 2009/09/27 10:00:11 tsutsui Exp $     */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: aic6915.c,v 1.24 2009/05/12 14:25:17 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aic6915.c,v 1.25 2009/09/27 10:00:11 tsutsui Exp $");
 
 #include "bpfilter.h"
 
@@ -75,7 +75,7 @@
 static int     sf_init(struct ifnet *);
 static void    sf_stop(struct ifnet *, int);
 
-static void    sf_shutdown(void *);
+static bool    sf_shutdown(device_t, int);
 
 static void    sf_txintr(struct sf_softc *);
 static void    sf_rxintr(struct sf_softc *);
@@ -291,9 +291,11 @@
        /*
         * Make sure the interface is shutdown during reboot.
         */
-       sc->sc_sdhook = shutdownhook_establish(sf_shutdown, sc);
-       if (sc->sc_sdhook == NULL)
-               aprint_error_dev(&sc->sc_dev, "WARNING: unable to establish shutdown hook\n");
+       if (pmf_device_register1(&sc->sc_dev, NULL, NULL, sf_shutdown))
+               pmf_class_network_register(&sc->sc_dev, ifp);
+       else
+               aprint_error_dev(&sc->sc_dev,
+                   "couldn't establish power handler\n");
        return;
 
        /*
@@ -329,12 +331,15 @@
  *
  *     Shutdown hook -- make sure the interface is stopped at reboot.
  */
-static void
-sf_shutdown(void *arg)
+static bool
+sf_shutdown(device_t self, int howto)
 {
-       struct sf_softc *sc = arg;
+       struct sf_softc *sc;
 
+       sc = device_private(self);
        sf_stop(&sc->sc_ethercom.ec_if, 1);
+
+       return true;
 }
 
 /*
diff -r 1c202e6c5b77 -r 644734a4291f sys/dev/ic/aic6915var.h
--- a/sys/dev/ic/aic6915var.h   Sun Sep 27 08:04:14 2009 +0000
+++ b/sys/dev/ic/aic6915var.h   Sun Sep 27 10:00:11 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: aic6915var.h,v 1.2 2008/04/28 20:23:49 martin Exp $    */
+/*     $NetBSD: aic6915var.h,v 1.3 2009/09/27 10:00:11 tsutsui Exp $   */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -118,7 +118,6 @@
        bus_space_handle_t sc_sh_func;  /* sub-handle for func regs */
        bus_dma_tag_t sc_dmat;          /* bus DMA tag */
        struct ethercom sc_ethercom;    /* ethernet common data */
-       void *sc_sdhook;                /* shutdown hook */
        int sc_iomapped;                /* are we I/O mapped? */
 
        struct mii_data sc_mii;         /* MII/media information */



Home | Main Index | Thread Index | Old Index