diff options
author | Alan Cox <alan@lxorguk.ukuu.org.uk> | 2008-04-30 03:54:13 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-30 11:29:47 -0400 |
commit | f34d7a5b7010b82fe97da95496b9971435530062 (patch) | |
tree | 87e2abec1e33ed4fe5e63ee2fd000bc2ad745e57 /drivers/net/ppp_async.c | |
parent | 251b8dd7eee30fda089a1dc088abf4fc9a0dee9c (diff) |
tty: The big operations rework
- Operations are now a shared const function block as with most other Linux
objects
- Introduce wrappers for some optional functions to get consistent behaviour
- Wrap put_char which used to be patched by the tty layer
- Document which functions are needed/optional
- Make put_char report success/fail
- Cache the driver->ops pointer in the tty as tty->ops
- Remove various surplus lock calls we no longer need
- Remove proc_write method as noted by Alexey Dobriyan
- Introduce some missing sanity checks where certain driver/ldisc
combinations would oops as they didn't check needed methods were present
[akpm@linux-foundation.org: fix fs/compat_ioctl.c build]
[akpm@linux-foundation.org: fix isicom]
[akpm@linux-foundation.org: fix arch/ia64/hp/sim/simserial.c build]
[akpm@linux-foundation.org: fix kgdb]
Signed-off-by: Alan Cox <alan@redhat.com>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Cc: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/net/ppp_async.c')
-rw-r--r-- | drivers/net/ppp_async.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/net/ppp_async.c b/drivers/net/ppp_async.c index f023d5b67e6e..1c4b7e37912c 100644 --- a/drivers/net/ppp_async.c +++ b/drivers/net/ppp_async.c | |||
@@ -158,6 +158,9 @@ ppp_asynctty_open(struct tty_struct *tty) | |||
158 | struct asyncppp *ap; | 158 | struct asyncppp *ap; |
159 | int err; | 159 | int err; |
160 | 160 | ||
161 | if (tty->ops->write == NULL) | ||
162 | return -EOPNOTSUPP; | ||
163 | |||
161 | err = -ENOMEM; | 164 | err = -ENOMEM; |
162 | ap = kzalloc(sizeof(*ap), GFP_KERNEL); | 165 | ap = kzalloc(sizeof(*ap), GFP_KERNEL); |
163 | if (!ap) | 166 | if (!ap) |
@@ -359,8 +362,8 @@ ppp_asynctty_receive(struct tty_struct *tty, const unsigned char *buf, | |||
359 | tasklet_schedule(&ap->tsk); | 362 | tasklet_schedule(&ap->tsk); |
360 | ap_put(ap); | 363 | ap_put(ap); |
361 | if (test_and_clear_bit(TTY_THROTTLED, &tty->flags) | 364 | if (test_and_clear_bit(TTY_THROTTLED, &tty->flags) |
362 | && tty->driver->unthrottle) | 365 | && tty->ops->unthrottle) |
363 | tty->driver->unthrottle(tty); | 366 | tty->ops->unthrottle(tty); |
364 | } | 367 | } |
365 | 368 | ||
366 | static void | 369 | static void |
@@ -676,7 +679,7 @@ ppp_async_push(struct asyncppp *ap) | |||
676 | if (!tty_stuffed && ap->optr < ap->olim) { | 679 | if (!tty_stuffed && ap->optr < ap->olim) { |
677 | avail = ap->olim - ap->optr; | 680 | avail = ap->olim - ap->optr; |
678 | set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); | 681 | set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); |
679 | sent = tty->driver->write(tty, ap->optr, avail); | 682 | sent = tty->ops->write(tty, ap->optr, avail); |
680 | if (sent < 0) | 683 | if (sent < 0) |
681 | goto flush; /* error, e.g. loss of CD */ | 684 | goto flush; /* error, e.g. loss of CD */ |
682 | ap->optr += sent; | 685 | ap->optr += sent; |