Replace shutdownhook_establish(9) with pmf_device_register1(9).

Compile test only.
This commit is contained in:
tsutsui 2009-09-27 10:00:11 +00:00
parent 7c94c6769f
commit 0719ca07be
2 changed files with 15 additions and 11 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: aic6915.c,v 1.24 2009/05/12 14:25:17 cegger Exp $ */
/* $NetBSD: aic6915.c,v 1.25 2009/09/27 10:00:11 tsutsui Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: aic6915.c,v 1.24 2009/05/12 14:25:17 cegger Exp $");
__KERNEL_RCSID(0, "$NetBSD: aic6915.c,v 1.25 2009/09/27 10:00:11 tsutsui Exp $");
#include "bpfilter.h"
@ -75,7 +75,7 @@ static int sf_ioctl(struct ifnet *, u_long, void *);
static int sf_init(struct ifnet *);
static void sf_stop(struct ifnet *, int);
static void sf_shutdown(void *);
static bool sf_shutdown(device_t, int);
static void sf_txintr(struct sf_softc *);
static void sf_rxintr(struct sf_softc *);
@ -291,9 +291,11 @@ sf_attach(struct sf_softc *sc)
/*
* Make sure the interface is shutdown during reboot.
*/
sc->sc_sdhook = shutdownhook_establish(sf_shutdown, sc);
if (sc->sc_sdhook == NULL)
aprint_error_dev(&sc->sc_dev, "WARNING: unable to establish shutdown hook\n");
if (pmf_device_register1(&sc->sc_dev, NULL, NULL, sf_shutdown))
pmf_class_network_register(&sc->sc_dev, ifp);
else
aprint_error_dev(&sc->sc_dev,
"couldn't establish power handler\n");
return;
/*
@ -329,12 +331,15 @@ sf_attach(struct sf_softc *sc)
*
* Shutdown hook -- make sure the interface is stopped at reboot.
*/
static void
sf_shutdown(void *arg)
static bool
sf_shutdown(device_t self, int howto)
{
struct sf_softc *sc = arg;
struct sf_softc *sc;
sc = device_private(self);
sf_stop(&sc->sc_ethercom.ec_if, 1);
return true;
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: aic6915var.h,v 1.2 2008/04/28 20:23:49 martin Exp $ */
/* $NetBSD: aic6915var.h,v 1.3 2009/09/27 10:00:11 tsutsui Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -118,7 +118,6 @@ struct sf_softc {
bus_space_handle_t sc_sh_func; /* sub-handle for func regs */
bus_dma_tag_t sc_dmat; /* bus DMA tag */
struct ethercom sc_ethercom; /* ethernet common data */
void *sc_sdhook; /* shutdown hook */
int sc_iomapped; /* are we I/O mapped? */
struct mii_data sc_mii; /* MII/media information */