Module Name:    src
Committed By:   tsutsui
Date:           Fri Sep  4 16:21:24 UTC 2009

Modified Files:
        src/sys/dev/ic: lance.c lancevar.h

Log Message:
Replace shutdownhook_establish(9) with pmf_device_register1(9).
Tested on sun3x.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/dev/ic/lance.c
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/ic/lancevar.h

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/ic/lance.c
diff -u src/sys/dev/ic/lance.c:1.42 src/sys/dev/ic/lance.c:1.43
--- src/sys/dev/ic/lance.c:1.42	Fri Nov  7 00:20:02 2008
+++ src/sys/dev/ic/lance.c	Fri Sep  4 16:21:24 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: lance.c,v 1.42 2008/11/07 00:20:02 dyoung Exp $	*/
+/*	$NetBSD: lance.c,v 1.43 2009/09/04 16:21:24 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lance.c,v 1.42 2008/11/07 00:20:02 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lance.c,v 1.43 2009/09/04 16:21:24 tsutsui Exp $");
 
 #include "bpfilter.h"
 #include "rnd.h"
@@ -111,7 +111,7 @@
 
 integrate struct mbuf *lance_get(struct lance_softc *, int, int);
 
-hide void lance_shutdown(void *);
+hide bool lance_shutdown(device_t, int);
 
 int lance_mediachange(struct ifnet *);
 void lance_mediastatus(struct ifnet *, struct ifmediareq *);
@@ -250,9 +250,12 @@
 	if_attach(ifp);
 	ether_ifattach(ifp, sc->sc_enaddr);
 
-	sc->sc_sh = shutdownhook_establish(lance_shutdown, ifp);
-	if (sc->sc_sh == NULL)
-		panic("lance_config: can't establish shutdownhook");
+	if (pmf_device_register1(sc->sc_dev, NULL, NULL, lance_shutdown))
+		pmf_class_network_register(sc->sc_dev, ifp);
+	else
+		aprint_error_dev(sc->sc_dev,
+		    "couldn't establish power handler\n");
+
 	sc->sc_rbufaddr = malloc(sc->sc_nrbuf * sizeof(int), M_DEVBUF,
 					M_WAITOK);
 	sc->sc_tbufaddr = malloc(sc->sc_ntbuf * sizeof(int), M_DEVBUF,
@@ -568,11 +571,15 @@
 	return (error);
 }
 
-hide void
-lance_shutdown(void *arg)
+hide bool
+lance_shutdown(device_t self, int howto)
 {
+	struct lance_softc *sc = device_private(self);
+	struct ifnet *ifp = &sc->sc_ethercom.ec_if;
+
+	lance_stop(ifp, 0);
 
-	lance_stop((struct ifnet *)arg, 0);
+	return true;
 }
 
 /*

Index: src/sys/dev/ic/lancevar.h
diff -u src/sys/dev/ic/lancevar.h:1.12 src/sys/dev/ic/lancevar.h:1.13
--- src/sys/dev/ic/lancevar.h:1.12	Mon Apr 28 20:23:50 2008
+++ src/sys/dev/ic/lancevar.h	Fri Sep  4 16:21:24 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: lancevar.h,v 1.12 2008/04/28 20:23:50 martin Exp $	*/
+/*	$NetBSD: lancevar.h,v 1.13 2009/09/04 16:21:24 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -91,8 +91,6 @@
 
 	int	sc_havecarrier;	/* carrier status */
 
-	void	*sc_sh;		/* shutdownhook cookie */
-
 	uint16_t sc_conf3;	/* CSR3 value */
 	uint16_t sc_saved_csr0;/* Value of csr0 at time of interrupt */
 

Reply via email to