diff options
author | Ed Schouten <ed@FreeBSD.org> | 2009-08-23 08:04:40 +0000 |
---|---|---|
committer | Ed Schouten <ed@FreeBSD.org> | 2009-08-23 08:04:40 +0000 |
commit | 5c67885a2660e6403402851f912dd01331cb45d4 (patch) | |
tree | 832ce47945c34ffc3c6cc8881a39f32c034bfb8a /sys/dev/snp/snp.c | |
parent | 8f26c03fe64c21c8e35ebcb8eff474a0c4b29312 (diff) | |
download | src-5c67885a2660e6403402851f912dd01331cb45d4.tar.gz src-5c67885a2660e6403402851f912dd01331cb45d4.zip |
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.
Notes
Notes:
svn path=/head/; revision=196452
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 fcc70a5d84f3..37d996563f94 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); } |