Module Name: src Committed By: tsutsui Date: Sun Sep 6 14:10:42 UTC 2009
Modified Files: src/sys/dev/pci: if_vr.c Log Message: Replace shutdownhook_establish(9) with pmf_device_register1(9). Tested VIA VT86C100A (which is probed as VT3043). To generate a diff of this commit: cvs rdiff -u -r1.97 -r1.98 src/sys/dev/pci/if_vr.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/pci/if_vr.c diff -u src/sys/dev/pci/if_vr.c:1.97 src/sys/dev/pci/if_vr.c:1.98 --- src/sys/dev/pci/if_vr.c:1.97 Sun Aug 23 16:11:48 2009 +++ src/sys/dev/pci/if_vr.c Sun Sep 6 14:10:42 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: if_vr.c,v 1.97 2009/08/23 16:11:48 jmcneill Exp $ */ +/* $NetBSD: if_vr.c,v 1.98 2009/09/06 14:10:42 tsutsui Exp $ */ /*- * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc. @@ -97,7 +97,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_vr.c,v 1.97 2009/08/23 16:11:48 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_vr.c,v 1.98 2009/09/06 14:10:42 tsutsui Exp $"); #include "rnd.h" @@ -200,7 +200,6 @@ struct vr_softc { device_t vr_dev; void *vr_ih; /* interrupt cookie */ - void *vr_ats; /* shutdown hook */ bus_space_tag_t vr_bst; /* bus space tag */ bus_space_handle_t vr_bsh; /* bus space handle */ bus_dma_tag_t vr_dmat; /* bus DMA tag */ @@ -1391,7 +1390,7 @@ static int vr_probe(device_t, cfdata_t, void *); static void vr_attach(device_t, device_t, void *); -static void vr_shutdown(void *); +static bool vr_shutdown(device_t, int); CFATTACH_DECL_NEW(vr, sizeof (struct vr_softc), vr_probe, vr_attach, NULL, NULL); @@ -1426,12 +1425,14 @@ * Stop all chip I/O so that the kernel's probe routines don't * get confused by errant DMAs when rebooting. */ -static void -vr_shutdown(void *arg) +static bool +vr_shutdown(device_t self, int howto) { - struct vr_softc *sc = (struct vr_softc *)arg; + struct vr_softc *sc = device_private(self); vr_stop(&sc->vr_ec.ec_if, 1); + + return true; } /* @@ -1704,9 +1705,11 @@ RND_TYPE_NET, 0); #endif - sc->vr_ats = shutdownhook_establish(vr_shutdown, sc); - if (sc->vr_ats == NULL) - aprint_error_dev(self, "warning: couldn't establish shutdown hook\n"); + if (pmf_device_register1(self, NULL, NULL, vr_shutdown)) + pmf_class_network_register(self, ifp); + else + aprint_error_dev(self, "couldn't establish power handler\n"); + return; fail_5: