Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci Replace shutdownhook_establish(9) with pmf_devic...



details:   https://anonhg.NetBSD.org/src/rev/685e4f90bac8
branches:  trunk
changeset: 747203:685e4f90bac8
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Sat Sep 05 13:50:15 2009 +0000

description:
Replace shutdownhook_establish(9) with pmf_device_register1(9).
Tested Compaq Netelligent 10/100 TX.

diffstat:

 sys/dev/pci/if_tl.c |  31 +++++++++++++++++++------------
 1 files changed, 19 insertions(+), 12 deletions(-)

diffs (75 lines):

diff -r 20c34dfa213d -r 685e4f90bac8 sys/dev/pci/if_tl.c
--- a/sys/dev/pci/if_tl.c       Sat Sep 05 12:59:24 2009 +0000
+++ b/sys/dev/pci/if_tl.c       Sat Sep 05 13:50:15 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_tl.c,v 1.91 2008/11/16 02:11:29 tsutsui Exp $       */
+/*     $NetBSD: if_tl.c,v 1.92 2009/09/05 13:50:15 tsutsui Exp $       */
 
 /*
  * Copyright (c) 1997 Manuel Bouyer.  All rights reserved.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_tl.c,v 1.91 2008/11/16 02:11:29 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_tl.c,v 1.92 2009/09/05 13:50:15 tsutsui Exp $");
 
 #undef TLDEBUG
 #define TL_PRIV_STATS
@@ -125,7 +125,7 @@
 static int tl_ifioctl(struct ifnet *, ioctl_cmd_t, void *);
 static int tl_mediachange(struct ifnet *);
 static void tl_ifwatchdog(struct ifnet *);
-static void tl_shutdown(void *);
+static bool tl_shutdown(device_t, int);
 
 static void tl_ifstart(struct ifnet *);
 static void tl_reset(tl_softc_t *);
@@ -429,12 +429,6 @@
                aprint_error_dev(self, "can't allocate DMA memory for lists\n");
                return;
        }
-       /*
-        * Add shutdown hook so that DMA is disabled prior to reboot. Not
-        * doing
-        * reboot before the driver initializes.
-        */
-       (void)shutdownhook_establish(tl_shutdown, ifp);
 
        /*
         * Initialize our media structures and probe the MII.
@@ -477,6 +471,15 @@
        if_attach(ifp);
        ether_ifattach(&(sc)->tl_if, (sc)->tl_enaddr);
 
+       /*
+        * Add shutdown hook so that DMA is disabled prior to reboot.
+        * Not doing reboot before the driver initializes.
+        */
+       if (pmf_device_register1(self, NULL, NULL, tl_shutdown))
+               pmf_class_network_register(self, ifp);
+       else
+               aprint_error_dev(self, "couldn't establish power handler\n");
+
 #if NRND > 0
        rnd_attach_source(&sc->rnd_source, device_xname(self),
            RND_TYPE_NET, 0);
@@ -523,11 +526,15 @@
        sc->tl_mii.mii_media_status &= ~IFM_ACTIVE;
 }
 
-static void
-tl_shutdown(void *v)
+static bool
+tl_shutdown(device_t self, int howto)
 {
+       tl_softc_t *sc = device_private(self);
+       struct ifnet *ifp = &sc->tl_if;
 
-       tl_stop(v, 1);
+       tl_stop(ifp, 1);
+
+       return true;
 }
 
 static void



Home | Main Index | Thread Index | Old Index