Module Name:    src
Committed By:   tsutsui
Date:           Mon Sep 14 12:02:48 UTC 2009

Modified Files:
        src/sys/dev/pci: if_stge.c

Log Message:
Replace shutdownhook_establish(9) with pmf_device_register1(9).
Tested on D-Link DL-4000.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/dev/pci/if_stge.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/if_stge.c
diff -u src/sys/dev/pci/if_stge.c:1.47 src/sys/dev/pci/if_stge.c:1.48
--- src/sys/dev/pci/if_stge.c:1.47	Sun May 17 02:08:35 2009
+++ src/sys/dev/pci/if_stge.c	Mon Sep 14 12:02:48 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_stge.c,v 1.47 2009/05/17 02:08:35 tsutsui Exp $	*/
+/*	$NetBSD: if_stge.c,v 1.48 2009/09/14 12:02:48 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_stge.c,v 1.47 2009/05/17 02:08:35 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_stge.c,v 1.48 2009/09/14 12:02:48 tsutsui Exp $");
 
 #include "bpfilter.h"
 
@@ -137,7 +137,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_rev;			/* silicon revision */
 
 	void *sc_ih;			/* interrupt cookie */
@@ -266,7 +265,7 @@
 static int	stge_init(struct ifnet *);
 static void	stge_stop(struct ifnet *, int);
 
-static void	stge_shutdown(void *);
+static bool	stge_shutdown(device_t, int);
 
 static void	stge_reset(struct stge_softc *);
 static void	stge_rxdrain(struct stge_softc *);
@@ -696,10 +695,11 @@
 	/*
 	 * Make sure the interface is shutdown during reboot.
 	 */
-	sc->sc_sdhook = shutdownhook_establish(stge_shutdown, sc);
-	if (sc->sc_sdhook == NULL)
-		aprint_error_dev(self,
-		    "WARNING: unable to establish shutdown hook\n");
+	if (pmf_device_register1(self, NULL, NULL, stge_shutdown))
+		pmf_class_network_register(self, ifp);
+	else
+		aprint_error_dev(self, "couldn't establish power handler\n");
+
 	return;
 
 	/*
@@ -735,12 +735,15 @@
  *
  *	Make sure the interface is stopped at reboot time.
  */
-static void
-stge_shutdown(void *arg)
+static bool
+stge_shutdown(device_t self, int howto)
 {
-	struct stge_softc *sc = arg;
+	struct stge_softc *sc = device_private(self);
+	struct ifnet *ifp = &sc->sc_ethercom.ec_if;
+
+	stge_stop(ifp, 1);
 
-	stge_stop(&sc->sc_ethercom.ec_if, 1);
+	return true;
 }
 
 static void

Reply via email to