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/23ec1ef0f4d6
branches:  trunk
changeset: 747125:23ec1ef0f4d6
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Thu Sep 03 14:13:16 2009 +0000

description:
Replace shutdownhook_establish(9) with pmf_device_register1().
Tested EtherPower II 10/100 (SMC9432TX) on macppc.

diffstat:

 sys/dev/ic/smc83c170.c    |  22 +++++++++++++---------
 sys/dev/ic/smc83c170var.h |   3 +--
 2 files changed, 14 insertions(+), 11 deletions(-)

diffs (78 lines):

diff -r dc57c1361177 -r 23ec1ef0f4d6 sys/dev/ic/smc83c170.c
--- a/sys/dev/ic/smc83c170.c    Thu Sep 03 12:55:10 2009 +0000
+++ b/sys/dev/ic/smc83c170.c    Thu Sep 03 14:13:16 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: smc83c170.c,v 1.76 2008/07/06 14:32:56 tsutsui Exp $   */
+/*     $NetBSD: smc83c170.c,v 1.77 2009/09/03 14:13:16 tsutsui Exp $   */
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: smc83c170.c,v 1.76 2008/07/06 14:32:56 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: smc83c170.c,v 1.77 2009/09/03 14:13:16 tsutsui Exp $");
 
 #include "bpfilter.h"
 
@@ -77,7 +77,7 @@
 int    epic_init(struct ifnet *);
 void   epic_stop(struct ifnet *, int);
 
-void   epic_shutdown(void *);
+bool   epic_shutdown(device_t, int);
 
 void   epic_reset(struct epic_softc *);
 void   epic_rxdrain(struct epic_softc *);
@@ -301,10 +301,12 @@
        /*
         * Make sure the interface is shutdown during reboot.
         */
-       sc->sc_sdhook = shutdownhook_establish(epic_shutdown, sc);
-       if (sc->sc_sdhook == NULL)
+       if (pmf_device_register1(sc->sc_dev, NULL, NULL, epic_shutdown))
+               pmf_class_network_register(sc->sc_dev, ifp);
+       else
                aprint_error_dev(sc->sc_dev,
-                   "WARNING: unable to establish shutdown hook\n");
+                   "couldn't establish power handler\n");
+
        return;
 
        /*
@@ -340,12 +342,14 @@
 /*
  * Shutdown hook.  Make sure the interface is stopped at reboot.
  */
-void
-epic_shutdown(void *arg)
+bool
+epic_shutdown(device_t self, int howto)
 {
-       struct epic_softc *sc = arg;
+       struct epic_softc *sc = device_private(self);
 
        epic_stop(&sc->sc_ethercom.ec_if, 1);
+
+       return true;
 }
 
 /*
diff -r dc57c1361177 -r 23ec1ef0f4d6 sys/dev/ic/smc83c170var.h
--- a/sys/dev/ic/smc83c170var.h Thu Sep 03 12:55:10 2009 +0000
+++ b/sys/dev/ic/smc83c170var.h Thu Sep 03 14:13:16 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: smc83c170var.h,v 1.13 2008/07/06 14:32:56 tsutsui Exp $        */
+/*     $NetBSD: smc83c170var.h,v 1.14 2009/09/03 14:13:16 tsutsui Exp $        */
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -98,7 +98,6 @@
        bus_space_handle_t sc_sh;       /* bus space handle */
        bus_dma_tag_t sc_dmat;          /* bus DMA tag */
        struct ethercom sc_ethercom;    /* ethernet common data */
-       void *sc_sdhook;                /* shutdown hook */
 
        int sc_hwflags;                 /* info about board */
 #define EPIC_HAS_BNC           0x01    /* BNC on serial interface */



Home | Main Index | Thread Index | Old Index