From 503bd5d6c51e4b39865925d17eb7f6d7708b93c6 Mon Sep 17 00:00:00 2001 From: ed Date: Sun, 23 Aug 2009 08:04:40 +0000 Subject: Add ttydisc_rint_simple(). I noticed several drivers in our tree don't actually care about parity and framing, such as pts(4), snp(4) (and my partially finished console driver). Instead of duplicating a lot of code, I think we'd better add a utility function for those drivers to quickly process a buffer of input. Also change pts(4) and snp(4) to use this function. --- sys/dev/snp/snp.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'sys/dev/snp') diff --git a/sys/dev/snp/snp.c b/sys/dev/snp/snp.c index fcc70a5..37d9965 100644 --- a/sys/dev/snp/snp.c +++ b/sys/dev/snp/snp.c @@ -192,7 +192,7 @@ snp_write(struct cdev *dev, struct uio *uio, int flag) { struct snp_softc *ss; struct tty *tp; - int error, len, i; + int error, len; char in[SNP_INPUT_BUFSIZE]; error = devfs_get_cdevpriv((void **)&ss); @@ -223,14 +223,9 @@ snp_write(struct cdev *dev, struct uio *uio, int flag) * because we shouldn't bail out when we're running * close to the watermarks. */ - if (ttydisc_can_bypass(tp)) { - ttydisc_rint_bypass(tp, in, len); - } else { - for (i = 0; i < len; i++) - ttydisc_rint(tp, in[i], 0); - } - + ttydisc_rint_simple(tp, in, len); ttydisc_rint_done(tp); + tty_unlock(tp); } -- cgit v1.1