Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/ic Add a self-suspensor. It's not used, yet.



details:   https://anonhg.NetBSD.org/src/rev/affe45ca3f0c
branches:  trunk
changeset: 753300:affe45ca3f0c
user:      dyoung <dyoung%NetBSD.org@localhost>
date:      Mon Mar 22 17:11:19 2010 +0000

description:
Add a self-suspensor.  It's not used, yet.

In ex_detach(), call ex_stop(), first.  ex_stop() stops the callout.
Destroy the callout in ex_detach().

diffstat:

 sys/dev/ic/elinkxl.c    |  17 ++++++++++++-----
 sys/dev/ic/elinkxlvar.h |   4 +++-
 2 files changed, 15 insertions(+), 6 deletions(-)

diffs (68 lines):

diff -r eb1de1ebe45d -r affe45ca3f0c sys/dev/ic/elinkxl.c
--- a/sys/dev/ic/elinkxl.c      Mon Mar 22 16:57:54 2010 +0000
+++ b/sys/dev/ic/elinkxl.c      Mon Mar 22 17:11:19 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: elinkxl.c,v 1.110 2010/01/19 22:06:24 pooka Exp $      */
+/*     $NetBSD: elinkxl.c,v 1.111 2010/03/22 17:11:19 dyoung Exp $     */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: elinkxl.c,v 1.110 2010/01/19 22:06:24 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: elinkxl.c,v 1.111 2010/03/22 17:11:19 dyoung Exp $");
 
 #include "rnd.h"
 
@@ -181,6 +181,8 @@
        bus_space_handle_t ioh = sc->sc_ioh;
        int i, error, attach_stage;
 
+       pmf_self_suspensor_init(sc->sc_dev, &sc->sc_suspensor, &sc->sc_qual);
+
        callout_init(&sc->ex_mii_callout, 0);
 
        ex_reset(sc);
@@ -1688,14 +1690,19 @@
 {
        struct ifnet *ifp = &sc->sc_ethercom.ec_if;
        struct ex_rxdesc *rxd;
-       int i;
+       int i, s;
 
        /* Succeed now if there's no work to do. */
        if ((sc->ex_flags & EX_FLAGS_ATTACHED) == 0)
                return (0);
 
-       /* Unhook our tick handler. */
-       callout_stop(&sc->ex_mii_callout);
+       s = splnet();
+       /* Stop the interface. Callouts are stopped in it. */
+       ex_stop(ifp, 1);
+       splx(s);
+
+       /* Destroy our callout. */
+       callout_destroy(&sc->ex_mii_callout);
 
        if (sc->ex_conf & EX_CONF_MII) {
                /* Detach all PHYs */
diff -r eb1de1ebe45d -r affe45ca3f0c sys/dev/ic/elinkxlvar.h
--- a/sys/dev/ic/elinkxlvar.h   Mon Mar 22 16:57:54 2010 +0000
+++ b/sys/dev/ic/elinkxlvar.h   Mon Mar 22 17:11:19 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: elinkxlvar.h,v 1.20 2008/04/28 20:23:49 martin Exp $   */
+/*     $NetBSD: elinkxlvar.h,v 1.21 2010/03/22 17:11:19 dyoung Exp $   */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -40,6 +40,8 @@
  */
 struct ex_softc {
        device_t sc_dev;
+       device_suspensor_t sc_suspensor;
+       pmf_qual_t sc_qual;
        void *sc_ih;
 
        struct ethercom sc_ethercom;    /* Ethernet common part         */



Home | Main Index | Thread Index | Old Index