Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pci Replace shutdownhook_establish(9) with pmf_devic...
details: https://anonhg.NetBSD.org/src/rev/699307795752
branches: trunk
changeset: 747219:699307795752
user: tsutsui <tsutsui%NetBSD.org@localhost>
date: Sun Sep 06 13:39:56 2009 +0000
description:
Replace shutdownhook_establish(9) with pmf_device_register1(9).
Tested Am79c973 PCnet-FAST III.
diffstat:
sys/dev/pci/if_pcn.c | 29 +++++++++++++++++------------
1 files changed, 17 insertions(+), 12 deletions(-)
diffs (76 lines):
diff -r 133805d7d2a4 -r 699307795752 sys/dev/pci/if_pcn.c
--- a/sys/dev/pci/if_pcn.c Sun Sep 06 13:38:50 2009 +0000
+++ b/sys/dev/pci/if_pcn.c Sun Sep 06 13:39:56 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_pcn.c,v 1.47 2009/05/06 10:34:32 cegger Exp $ */
+/* $NetBSD: if_pcn.c,v 1.48 2009/09/06 13:39:56 tsutsui Exp $ */
/*
* Copyright (c) 2001 Wasabi Systems, Inc.
@@ -65,7 +65,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_pcn.c,v 1.47 2009/05/06 10:34:32 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_pcn.c,v 1.48 2009/09/06 13:39:56 tsutsui Exp $");
#include "bpfilter.h"
#include "rnd.h"
@@ -251,7 +251,6 @@
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 */
/* Points to our media routines, etc. */
const struct pcn_variant *sc_variant;
@@ -398,7 +397,7 @@
static int pcn_init(struct ifnet *);
static void pcn_stop(struct ifnet *, int);
-static void pcn_shutdown(void *);
+static bool pcn_shutdown(device_t, int);
static void pcn_reset(struct pcn_softc *);
static void pcn_rxdrain(struct pcn_softc *);
@@ -862,11 +861,15 @@
NULL, device_xname(self), "txcopy");
#endif /* PCN_EVENT_COUNTERS */
- /* Make sure the interface is shutdown during reboot. */
- sc->sc_sdhook = shutdownhook_establish(pcn_shutdown, sc);
- if (sc->sc_sdhook == NULL)
- aprint_error_dev(self,
- "WARNING: unable to establish shutdown hook\n");
+ /*
+ * Establish power handler with shutdown hook, to make sure
+ * the interface is shutdown during reboot.
+ */
+ if (pmf_device_register1(self, NULL, NULL, pcn_shutdown))
+ pmf_class_network_register(self, ifp);
+ else
+ aprint_error_dev(self, "couldn't establish power handler\n");
+
return;
/*
@@ -902,14 +905,16 @@
*
* Make sure the interface is stopped at reboot time.
*/
-static void
-pcn_shutdown(void *arg)
+static bool
+pcn_shutdown(device_t self, int howto)
{
- struct pcn_softc *sc = arg;
+ struct pcn_softc *sc = device_private(self);
pcn_stop(&sc->sc_ethercom.ec_if, 1);
/* explicitly reset the chip for some onboard one with lazy firmware */
pcn_reset(sc);
+
+ return true;
}
/*
Home |
Main Index |
Thread Index |
Old Index