Module Name:    src
Committed By:   tsutsui
Date:           Wed Sep  2 15:11:13 UTC 2009

Modified Files:
        src/sys/dev/cardbus: if_re_cardbus.c
        src/sys/dev/ic: rtl8169.c
        src/sys/dev/pci: if_re_pci.c

Log Message:
Move pmf(9) calls to MI re_attach() and re_detach() from each backend.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/cardbus/if_re_cardbus.c
cvs rdiff -u -r1.124 -r1.125 src/sys/dev/ic/rtl8169.c
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/pci/if_re_pci.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/cardbus/if_re_cardbus.c
diff -u src/sys/dev/cardbus/if_re_cardbus.c:1.19 src/sys/dev/cardbus/if_re_cardbus.c:1.20
--- src/sys/dev/cardbus/if_re_cardbus.c:1.19	Sat Aug 29 14:18:34 2009
+++ src/sys/dev/cardbus/if_re_cardbus.c	Wed Sep  2 15:11:13 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_re_cardbus.c,v 1.19 2009/08/29 14:18:34 tsutsui Exp $	*/
+/*	$NetBSD: if_re_cardbus.c,v 1.20 2009/09/02 15:11:13 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 2004 Jonathan Stone
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_re_cardbus.c,v 1.19 2009/08/29 14:18:34 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_re_cardbus.c,v 1.20 2009/09/02 15:11:13 tsutsui Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -207,11 +207,6 @@
 	sc->sc_dmat = ca->ca_dmat;
 	re_attach(sc);
 
-	if (!pmf_device_register(self, NULL, NULL))
-		aprint_error_dev(self, "couldn't establish power handler\n");
-	else
-		pmf_class_network_register(self, &sc->ethercom.ec_if);
-
 	/*
 	 * Power down the socket.
 	 */
@@ -236,8 +231,6 @@
 	if (rv)
 		return rv;
 
-	pmf_device_deregister(self);
-
 	/*
 	 * Unhook the interrupt handler.
 	 */

Index: src/sys/dev/ic/rtl8169.c
diff -u src/sys/dev/ic/rtl8169.c:1.124 src/sys/dev/ic/rtl8169.c:1.125
--- src/sys/dev/ic/rtl8169.c:1.124	Mon Aug 31 13:05:30 2009
+++ src/sys/dev/ic/rtl8169.c	Wed Sep  2 15:11:13 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtl8169.c,v 1.124 2009/08/31 13:05:30 tsutsui Exp $	*/
+/*	$NetBSD: rtl8169.c,v 1.125 2009/09/02 15:11:13 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1997, 1998-2003
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rtl8169.c,v 1.124 2009/08/31 13:05:30 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtl8169.c,v 1.125 2009/09/02 15:11:13 tsutsui Exp $");
 /* $FreeBSD: /repoman/r/ncvs/src/sys/dev/re/if_re.c,v 1.20 2004/04/11 20:34:08 ru Exp $ */
 
 /*
@@ -833,6 +833,12 @@
 	if_attach(ifp);
 	ether_ifattach(ifp, eaddr);
 
+	if (pmf_device_register(sc->sc_dev, NULL, NULL))
+		pmf_class_network_register(sc->sc_dev, ifp);
+	else
+		aprint_error_dev(sc->sc_dev,
+		    "couldn't establish power handler\n");
+
 	return;
 
  fail_8:
@@ -956,6 +962,8 @@
 	bus_dmamem_free(sc->sc_dmat,
 	    &sc->re_ldata.re_tx_listseg, sc->re_ldata.re_tx_listnseg);
 
+	pmf_device_deregister(sc->sc_dev);
+
 	return 0;
 }
 

Index: src/sys/dev/pci/if_re_pci.c
diff -u src/sys/dev/pci/if_re_pci.c:1.37 src/sys/dev/pci/if_re_pci.c:1.38
--- src/sys/dev/pci/if_re_pci.c:1.37	Sat Aug 29 14:18:34 2009
+++ src/sys/dev/pci/if_re_pci.c	Wed Sep  2 15:11:13 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_re_pci.c,v 1.37 2009/08/29 14:18:34 tsutsui Exp $	*/
+/*	$NetBSD: if_re_pci.c,v 1.38 2009/09/02 15:11:13 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1997, 1998-2003
@@ -46,7 +46,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_re_pci.c,v 1.37 2009/08/29 14:18:34 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_re_pci.c,v 1.38 2009/09/02 15:11:13 tsutsui Exp $");
 
 #include <sys/types.h>
 
@@ -286,9 +286,4 @@
 				bus_space_unmap(memt, memh, memsize);
 		}
 	}
-
-	if (!pmf_device_register(self, NULL, NULL))
-		aprint_error_dev(self, "couldn't establish power handler\n");
-	else
-		pmf_class_network_register(self, &sc->ethercom.ec_if);
 }

Reply via email to