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/c83822bcabae
branches:  trunk
changeset: 747253:c83822bcabae
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Mon Sep 07 12:44:29 2009 +0000

description:
Replace shutdownhook_establish(9) with pmf_device_register1(9).
Tested on VT6122.

diffstat:

 sys/dev/pci/if_vge.c |  22 ++++++++++++----------
 1 files changed, 12 insertions(+), 10 deletions(-)

diffs (59 lines):

diff -r 60bfe61dfe85 -r c83822bcabae sys/dev/pci/if_vge.c
--- a/sys/dev/pci/if_vge.c      Mon Sep 07 11:59:53 2009 +0000
+++ b/sys/dev/pci/if_vge.c      Mon Sep 07 12:44:29 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_vge.c,v 1.48 2009/05/16 07:34:05 tsutsui Exp $ */
+/* $NetBSD: if_vge.c,v 1.49 2009/09/07 12:44:29 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2004
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_vge.c,v 1.48 2009/05/16 07:34:05 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vge.c,v 1.49 2009/09/07 12:44:29 tsutsui Exp $");
 
 /*
  * VIA Networking Technologies VT612x PCI gigabit ethernet NIC driver.
@@ -318,7 +318,7 @@
 static int vge_suspend(device_t);
 static int vge_resume(device_t);
 #endif
-static void vge_shutdown(void *);
+static bool vge_shutdown(device_t, int);
 
 static uint16_t vge_read_eeprom(struct vge_softc *, int);
 
@@ -1077,10 +1077,10 @@
        /*
         * Make sure the interface is shutdown during reboot.
         */
-       if (shutdownhook_establish(vge_shutdown, sc) == NULL) {
-               aprint_error_dev(self,
-                   "WARNING: unable to establish shutdown hook\n");
-       }
+       if (pmf_device_register1(self, NULL, NULL, vge_shutdown))
+               pmf_class_network_register(self, ifp);
+       else
+               aprint_error_dev(self, "couldn't establish power handler\n");
 }
 
 static int
@@ -2212,11 +2212,13 @@
  * Stop all chip I/O so that the kernel's probe routines don't
  * get confused by errant DMAs when rebooting.
  */
-static void
-vge_shutdown(void *arg)
+static bool
+vge_shutdown(device_t self, int howto)
 {
        struct vge_softc *sc;
 
-       sc = arg;
+       sc = device_private(self);
        vge_stop(&sc->sc_ethercom.ec_if, 1);
+
+       return true;
 }



Home | Main Index | Thread Index | Old Index