Module Name: src
Committed By: tsutsui
Date: Sat Sep 5 12:31:00 UTC 2009
Modified Files:
src/sys/dev/ic: elink3.c elink3var.h
src/sys/dev/pcmcia: if_ep_pcmcia.c
Log Message:
Replace shutdownhook_establish(9) with pmf_device_register1(9) in
MI epconfig() and ep_detach(), and remove pmf(9) calls in pcmcia attachment.
Tested on ep0 at pci, but pcmcia attachment is untested.
To generate a diff of this commit:
cvs rdiff -u -r1.127 -r1.128 src/sys/dev/ic/elink3.c
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/ic/elink3var.h
cvs rdiff -u -r1.62 -r1.63 src/sys/dev/pcmcia/if_ep_pcmcia.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/ic/elink3.c
diff -u src/sys/dev/ic/elink3.c:1.127 src/sys/dev/ic/elink3.c:1.128
--- src/sys/dev/ic/elink3.c:1.127 Wed Aug 27 05:33:47 2008
+++ src/sys/dev/ic/elink3.c Sat Sep 5 12:30:59 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: elink3.c,v 1.127 2008/08/27 05:33:47 christos Exp $ */
+/* $NetBSD: elink3.c,v 1.128 2009/09/05 12:30:59 tsutsui Exp $ */
/*-
* Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: elink3.c,v 1.127 2008/08/27 05:33:47 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: elink3.c,v 1.128 2009/09/05 12:30:59 tsutsui Exp $");
#include "opt_inet.h"
#include "bpfilter.h"
@@ -192,7 +192,7 @@
void epstart(struct ifnet *);
void epwatchdog(struct ifnet *);
void epreset(struct ep_softc *);
-static void epshutdown(void *);
+static bool epshutdown(device_t, int);
void epread(struct ep_softc *);
struct mbuf *epget(struct ep_softc *, int);
void epmbuffill(void *);
@@ -501,7 +501,11 @@
sc->tx_start_thresh = 20; /* probably a good starting point. */
/* Establish callback to reset card when we reboot. */
- sc->sd_hook = shutdownhook_establish(epshutdown, sc);
+ if (pmf_device_register1(sc->sc_dev, NULL, NULL, epshutdown))
+ pmf_class_network_register(sc->sc_dev, ifp);
+ else
+ aprint_error_dev(sc->sc_dev,
+ "couldn't establish power handler\n");
ep_reset_cmd(sc, ELINK_COMMAND, RX_RESET);
ep_reset_cmd(sc, ELINK_COMMAND, TX_RESET);
@@ -1798,10 +1802,10 @@
/*
* Before reboots, reset card completely.
*/
-static void
-epshutdown(void *arg)
+static bool
+epshutdown(device_t self, int howto)
{
- struct ep_softc *sc = arg;
+ struct ep_softc *sc = device_private(self);
int s = splnet();
if (sc->enabled) {
@@ -1811,6 +1815,8 @@
sc->enabled = 0;
}
splx(s);
+
+ return true;
}
/*
@@ -2050,7 +2056,7 @@
ether_ifdetach(ifp);
if_detach(ifp);
- shutdownhook_disestablish(sc->sd_hook);
+ pmf_device_deregister(sc->sc_dev);
return (0);
}
Index: src/sys/dev/ic/elink3var.h
diff -u src/sys/dev/ic/elink3var.h:1.35 src/sys/dev/ic/elink3var.h:1.36
--- src/sys/dev/ic/elink3var.h:1.35 Wed Aug 27 05:33:47 2008
+++ src/sys/dev/ic/elink3var.h Sat Sep 5 12:30:59 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: elink3var.h,v 1.35 2008/08/27 05:33:47 christos Exp $ */
+/* $NetBSD: elink3var.h,v 1.36 2009/09/05 12:30:59 tsutsui Exp $ */
/*
* Copyright (c) 1994 Herb Peyerl <[email protected]>
@@ -105,8 +105,6 @@
rndsource_element_t rnd_source;
#endif
- void *sd_hook;
-
/* power management hooks */
int (*enable)(struct ep_softc *);
void (*disable)(struct ep_softc *);
Index: src/sys/dev/pcmcia/if_ep_pcmcia.c
diff -u src/sys/dev/pcmcia/if_ep_pcmcia.c:1.62 src/sys/dev/pcmcia/if_ep_pcmcia.c:1.63
--- src/sys/dev/pcmcia/if_ep_pcmcia.c:1.62 Wed Aug 27 05:33:47 2008
+++ src/sys/dev/pcmcia/if_ep_pcmcia.c Sat Sep 5 12:31:00 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: if_ep_pcmcia.c,v 1.62 2008/08/27 05:33:47 christos Exp $ */
+/* $NetBSD: if_ep_pcmcia.c,v 1.63 2009/09/05 12:31:00 tsutsui Exp $ */
/*-
* Copyright (c) 1998, 2000, 2004 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ep_pcmcia.c,v 1.62 2008/08/27 05:33:47 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ep_pcmcia.c,v 1.63 2009/09/05 12:31:00 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -322,11 +322,6 @@
if (epconfig(sc, epp->epp_chipset, enaddr))
aprint_error_dev(self, "couldn't configure controller\n");
- if (!pmf_device_register(self, NULL, NULL))
- aprint_error_dev(self, "couldn't establish power handler\n");
- else
- pmf_class_network_register(self, &sc->sc_ethercom.ec_if);
-
sc->enabled = 0;
ep_pcmcia_disable(sc);
return;
@@ -349,8 +344,6 @@
/* Nothing to detach. */
return 0;
- pmf_device_deregister(self);
-
rv = ep_detach(self, flags);
if (rv != 0)
return rv;