diff options
author | peter <peter@FreeBSD.org> | 1999-05-09 16:56:38 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1999-05-09 16:56:38 +0000 |
commit | 4889b510f02afdb3319fab2fee369ecc90c95ca2 (patch) | |
tree | d4fab0b789a7bbb3d4efe2d371e0a6d3bb33e93a /sys/dev/sio/sio.c | |
parent | 3e9a4fabc345d4d09660888dc13b2a5515b3b35b (diff) | |
download | FreeBSD-src-4889b510f02afdb3319fab2fee369ecc90c95ca2.zip FreeBSD-src-4889b510f02afdb3319fab2fee369ecc90c95ca2.tar.gz |
Optimize out a couple of places where com_addr() is used twice in a row,
although this is pretty trivial. devclass_get_softc() is a tad more
expensive than the old com_addr() implementation. If Bruce is really
worried about the cost of this, it could always be changed so that the
softc pointer is stored in a local array again.
Diffstat (limited to 'sys/dev/sio/sio.c')
-rw-r--r-- | sys/dev/sio/sio.c | 36 |
1 files changed, 9 insertions, 27 deletions
diff --git a/sys/dev/sio/sio.c b/sys/dev/sio/sio.c index baab269..2e921bc 100644 --- a/sys/dev/sio/sio.c +++ b/sys/dev/sio/sio.c @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: sio.c,v 1.237 1999/05/09 13:00:44 phk Exp $ + * $Id: sio.c,v 1.238 1999/05/09 13:10:46 peter Exp $ * from: @(#)com.c 7.5 (Berkeley) 5/16/91 * from: i386/isa sio.c,v 1.234 */ @@ -554,7 +554,6 @@ siounload(struct pccard_devinfo *devi) ttwakeup(com->tp); ttwwakeup(com->tp); } else { - com_addr(com->unit) = NULL; if (com->ibuf != NULL) free(com->ibuf, M_DEVBUF); free(com, M_DEVBUF); @@ -905,18 +904,12 @@ sioattach(dev) Port_t *espp; #endif Port_t iobase; -#if 0 - int s; -#endif int unit; void *ih; struct resource *res; int zero = 0; u_int flags = isa_get_flags(dev); -#if 0 - isdp->id_ri_flags |= RI_FAST; -#endif iobase = isa_get_port(dev); unit = device_get_unit(dev); com = device_get_softc(dev); @@ -1098,12 +1091,6 @@ determined_type: ; printf(" with a bogus IIR_TXRDY register"); printf("\n"); -#if 0 - s = spltty(); - com_addr(unit) = com; - splx(s); -#endif - if (!sio_registered) { register_swi(SWI_TTY, siopoll); sio_registered = TRUE; @@ -1355,9 +1342,6 @@ sioclose(dev, flag, mode, p) if (com->gone) { printf("sio%d: gone\n", com->unit); s = spltty(); -#if 0 - com_addr(com->unit) = NULL; -#endif if (com->ibuf != NULL) free(com->ibuf, M_DEVBUF); bzero(tp, sizeof *tp); @@ -1428,17 +1412,15 @@ sioread(dev, uio, flag) int flag; { int mynor; - int unit; - struct tty *tp; + struct com_s *com; mynor = minor(dev); if (mynor & CONTROL_MASK) return (ENODEV); - unit = MINOR_TO_UNIT(mynor); - if (com_addr(unit)->gone) + com = com_addr(MINOR_TO_UNIT(mynor)); + if (com->gone) return (ENODEV); - tp = com_addr(unit)->tp; - return ((*linesw[tp->t_line].l_read)(tp, uio, flag)); + return ((*linesw[com->tp->t_line].l_read)(com->tp, uio, flag)); } static int @@ -1448,7 +1430,7 @@ siowrite(dev, uio, flag) int flag; { int mynor; - struct tty *tp; + struct com_s *com; int unit; mynor = minor(dev); @@ -1456,9 +1438,9 @@ siowrite(dev, uio, flag) return (ENODEV); unit = MINOR_TO_UNIT(mynor); - if (com_addr(unit)->gone) + com = com_addr(unit); + if (com->gone) return (ENODEV); - tp = com_addr(unit)->tp; /* * (XXX) We disallow virtual consoles if the physical console is * a serial port. This is in case there is a display attached that @@ -1467,7 +1449,7 @@ siowrite(dev, uio, flag) */ if (constty != NULL && unit == comconsole) constty = NULL; - return ((*linesw[tp->t_line].l_write)(tp, uio, flag)); + return ((*linesw[com->tp->t_line].l_write)(com->tp, uio, flag)); } static void |