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

This commit is contained in:
tsutsui 2009-09-02 15:11:13 +00:00
parent 0968013cc2
commit 1de7f11179
3 changed files with 14 additions and 18 deletions

View File

@ -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 * Copyright (c) 2004 Jonathan Stone
@ -36,7 +36,7 @@
*/ */
#include <sys/cdefs.h> #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/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -207,11 +207,6 @@ re_cardbus_attach(device_t parent, device_t self, void *aux)
sc->sc_dmat = ca->ca_dmat; sc->sc_dmat = ca->ca_dmat;
re_attach(sc); 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. * Power down the socket.
*/ */
@ -236,8 +231,6 @@ re_cardbus_detach(device_t self, int flags)
if (rv) if (rv)
return rv; return rv;
pmf_device_deregister(self);
/* /*
* Unhook the interrupt handler. * Unhook the interrupt handler.
*/ */

View File

@ -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 * Copyright (c) 1997, 1998-2003
@ -33,7 +33,7 @@
*/ */
#include <sys/cdefs.h> #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 $ */ /* $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 @@ re_attach(struct rtk_softc *sc)
if_attach(ifp); if_attach(ifp);
ether_ifattach(ifp, eaddr); 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; return;
fail_8: fail_8:
@ -956,6 +962,8 @@ re_detach(struct rtk_softc *sc)
bus_dmamem_free(sc->sc_dmat, bus_dmamem_free(sc->sc_dmat,
&sc->re_ldata.re_tx_listseg, sc->re_ldata.re_tx_listnseg); &sc->re_ldata.re_tx_listseg, sc->re_ldata.re_tx_listnseg);
pmf_device_deregister(sc->sc_dev);
return 0; return 0;
} }

View File

@ -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 * Copyright (c) 1997, 1998-2003
@ -46,7 +46,7 @@
*/ */
#include <sys/cdefs.h> #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> #include <sys/types.h>
@ -286,9 +286,4 @@ re_pci_attach(device_t parent, device_t self, void *aux)
bus_space_unmap(memt, memh, memsize); 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);
} }