diff --git a/sys/net/if_ppp.c b/sys/net/if_ppp.c index c21b66351f2e..8a47125d5d0f 100644 --- a/sys/net/if_ppp.c +++ b/sys/net/if_ppp.c @@ -160,22 +160,6 @@ static void pppdumpm(struct mbuf *m0); static int ppp_clone_create(struct if_clone *, int); static void ppp_clone_destroy(struct ifnet *); -struct ppp_softc * -ppp_for_tty(struct tty *tp) -{ - struct ppp_softc *sc; - - PPP_LIST_LOCK(); - LIST_FOREACH(sc, &ppp_softc_list, sc_list) { - if (sc->sc_devp == (void*)tp) { - PPP_LIST_UNLOCK(); - return (sc); - } - } - PPP_LIST_UNLOCK(); - return (NULL); -} - IFC_SIMPLE_DECLARE(ppp, 0); /* diff --git a/sys/net/if_pppvar.h b/sys/net/if_pppvar.h index f103df5a5c86..12c308f175aa 100644 --- a/sys/net/if_pppvar.h +++ b/sys/net/if_pppvar.h @@ -110,4 +110,3 @@ int pppoutput(struct ifnet *ifp, struct mbuf *m0, struct sockaddr *dst, void ppp_restart(struct ppp_softc *sc); void ppppktin(struct ppp_softc *sc, struct mbuf *m, int lost); struct mbuf *ppp_dequeue(struct ppp_softc *sc); -struct ppp_softc *ppp_for_tty(struct tty *); diff --git a/sys/net/ppp_tty.c b/sys/net/ppp_tty.c index 51c11cf307ee..05ac9f1bf31f 100644 --- a/sys/net/ppp_tty.c +++ b/sys/net/ppp_tty.c @@ -212,6 +212,7 @@ pppopen(dev, tp) PPP2IFP(sc)->if_baudrate = tp->t_ospeed; tp->t_hotchar = PPP_FLAG; + tp->t_lsc = sc; ttyflush(tp, FREAD | FWRITE); /* @@ -240,14 +241,13 @@ pppclose(tp, flag) struct tty *tp; int flag; { - register struct ppp_softc *sc; + register struct ppp_softc *sc = (struct ppp_softc *)tp->t_lsc; int s; s = spltty(); ttyflush(tp, FREAD | FWRITE); clist_free_cblocks(&tp->t_canq); clist_free_cblocks(&tp->t_outq); - sc = ppp_for_tty(tp); if (sc != NULL) { pppasyncrelinq(sc); pppdealloc(sc); @@ -309,7 +309,7 @@ pppread(tp, uio, flag) struct uio *uio; int flag; { - register struct ppp_softc *sc = ppp_for_tty(tp); + register struct ppp_softc *sc = (struct ppp_softc *)tp->t_lsc; struct mbuf *m, *m0; register int s; int error = 0; @@ -368,7 +368,7 @@ pppwrite(tp, uio, flag) struct uio *uio; int flag; { - register struct ppp_softc *sc = ppp_for_tty(tp); + register struct ppp_softc *sc = (struct ppp_softc *)tp->t_lsc; struct mbuf *m; struct sockaddr dst; int error, s; @@ -414,7 +414,7 @@ ppptioctl(tp, cmd, data, flag, td) int flag; struct thread *td; { - struct ppp_softc *sc = ppp_for_tty(tp); + struct ppp_softc *sc = (struct ppp_softc *)tp->t_lsc; int error, s; if (sc == NULL || tp != (struct tty *) sc->sc_devp) @@ -729,7 +729,7 @@ static int pppstart(tp) register struct tty *tp; { - register struct ppp_softc *sc = ppp_for_tty(tp); + register struct ppp_softc *sc = (struct ppp_softc *)tp->t_lsc; /* * Call output process whether or not there is any output. @@ -815,7 +815,7 @@ pppinput(c, tp) struct mbuf *m; int ilen, s; - sc = ppp_for_tty(tp); + sc = (struct ppp_softc *)tp->t_lsc; if (sc == NULL) return 0;