diff options
author | ed <ed@FreeBSD.org> | 2009-08-23 08:04:40 +0000 |
---|---|---|
committer | ed <ed@FreeBSD.org> | 2009-08-23 08:04:40 +0000 |
commit | 503bd5d6c51e4b39865925d17eb7f6d7708b93c6 (patch) | |
tree | 832ce47945c34ffc3c6cc8881a39f32c034bfb8a /sys/dev/snp/snp.c | |
parent | 659df31c6cd55ed551bd24d090e55b1df6e9f152 (diff) | |
download | FreeBSD-src-503bd5d6c51e4b39865925d17eb7f6d7708b93c6.zip FreeBSD-src-503bd5d6c51e4b39865925d17eb7f6d7708b93c6.tar.gz |
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.
Diffstat (limited to 'sys/dev/snp/snp.c')
-rw-r--r-- | sys/dev/snp/snp.c | 11 |
1 files changed, 3 insertions, 8 deletions
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); } |