Replace shutdownhook_establish(9) with pmf_device_register1(9).
This commit is contained in:
parent
3a1b983101
commit
a2ff563552
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_mec.c,v 1.35 2009/05/09 18:31:46 tsutsui Exp $ */
|
||||
/* $NetBSD: if_mec.c,v 1.36 2009/09/01 15:19:20 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2004, 2008 Izumi Tsutsui. All rights reserved.
|
||||
|
@ -61,7 +61,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_mec.c,v 1.35 2009/05/09 18:31:46 tsutsui Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_mec.c,v 1.36 2009/09/01 15:19:20 tsutsui Exp $");
|
||||
|
||||
#include "opt_ddb.h"
|
||||
#include "bpfilter.h"
|
||||
|
@ -293,7 +293,6 @@ struct mec_softc {
|
|||
bus_space_tag_t sc_st; /* bus_space tag */
|
||||
bus_space_handle_t sc_sh; /* bus_space handle */
|
||||
bus_dma_tag_t sc_dmat; /* bus_dma tag */
|
||||
void *sc_sdhook; /* shutdown hook */
|
||||
|
||||
struct ethercom sc_ethercom; /* Ethernet common part */
|
||||
|
||||
|
@ -416,7 +415,7 @@ static void mec_rxintr(struct mec_softc *);
|
|||
static void mec_rxcsum(struct mec_softc *, struct mbuf *, uint16_t,
|
||||
uint32_t);
|
||||
static void mec_txintr(struct mec_softc *, uint32_t);
|
||||
static void mec_shutdown(void *);
|
||||
static bool mec_shutdown(device_t, int);
|
||||
|
||||
CFATTACH_DECL_NEW(mec, sizeof(struct mec_softc),
|
||||
mec_match, mec_attach, NULL, NULL);
|
||||
|
@ -727,7 +726,7 @@ mec_attach(device_t parent, device_t self, void *aux)
|
|||
#endif
|
||||
|
||||
/* set shutdown hook to reset interface on powerdown */
|
||||
sc->sc_sdhook = shutdownhook_establish(mec_shutdown, sc);
|
||||
pmf_device_register1(self, NULL, NULL, mec_shutdown);
|
||||
|
||||
return;
|
||||
|
||||
|
@ -1952,12 +1951,14 @@ mec_txintr(struct mec_softc *sc, uint32_t txptr)
|
|||
ifp->if_flags &= ~IFF_OACTIVE;
|
||||
}
|
||||
|
||||
static void
|
||||
mec_shutdown(void *arg)
|
||||
static bool
|
||||
mec_shutdown(device_t self, int howto)
|
||||
{
|
||||
struct mec_softc *sc = arg;
|
||||
struct mec_softc *sc = device_private(self);
|
||||
|
||||
mec_stop(&sc->sc_ethercom.ec_if, 1);
|
||||
/* make sure to stop DMA etc. */
|
||||
mec_reset(sc);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: dp83932.c,v 1.27 2008/08/23 15:46:47 tsutsui Exp $ */
|
||||
/* $NetBSD: dp83932.c,v 1.28 2009/09/01 15:20:53 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
|
@ -35,7 +35,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: dp83932.c,v 1.27 2008/08/23 15:46:47 tsutsui Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: dp83932.c,v 1.28 2009/09/01 15:20:53 tsutsui Exp $");
|
||||
|
||||
#include "bpfilter.h"
|
||||
|
||||
|
@ -71,7 +71,7 @@ int sonic_ioctl(struct ifnet *, u_long, void *);
|
|||
int sonic_init(struct ifnet *);
|
||||
void sonic_stop(struct ifnet *, int);
|
||||
|
||||
void sonic_shutdown(void *);
|
||||
bool sonic_shutdown(device_t, int);
|
||||
|
||||
void sonic_reset(struct sonic_softc *);
|
||||
void sonic_rxdrain(struct sonic_softc *);
|
||||
|
@ -222,8 +222,7 @@ sonic_attach(struct sonic_softc *sc, const uint8_t *enaddr)
|
|||
/*
|
||||
* Make sure the interface is shutdown during reboot.
|
||||
*/
|
||||
sc->sc_sdhook = shutdownhook_establish(sonic_shutdown, sc);
|
||||
if (sc->sc_sdhook == NULL)
|
||||
if (!pmf_device_register1(sc->sc_dev, NULL, NULL, sonic_shutdown))
|
||||
aprint_error_dev(sc->sc_dev,
|
||||
"WARNING: unable to establish shutdown hook\n");
|
||||
return;
|
||||
|
@ -262,12 +261,14 @@ sonic_attach(struct sonic_softc *sc, const uint8_t *enaddr)
|
|||
*
|
||||
* Make sure the interface is stopped at reboot.
|
||||
*/
|
||||
void
|
||||
sonic_shutdown(void *arg)
|
||||
bool
|
||||
sonic_shutdown(device_t self, int howto)
|
||||
{
|
||||
struct sonic_softc *sc = arg;
|
||||
struct sonic_softc *sc = device_private(self);
|
||||
|
||||
sonic_stop(&sc->sc_ethercom.ec_if, 1);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: dp83932var.h,v 1.11 2008/04/28 20:23:49 martin Exp $ */
|
||||
/* $NetBSD: dp83932var.h,v 1.12 2009/09/01 15:20:53 tsutsui Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
|
@ -151,7 +151,6 @@ struct sonic_softc {
|
|||
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_32bit; /* use 32-bit mode */
|
||||
int sc_bigendian; /* BMODE -> Vcc */
|
||||
|
|
Loading…
Reference in New Issue