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_synctty.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_synctty.c')
-rw-r--r-- | drivers/net/ppp_synctty.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/net/ppp_synctty.c b/drivers/net/ppp_synctty.c index 0d80fa54671..48ed5fdbfe1 100644 --- a/drivers/net/ppp_synctty.c +++ b/drivers/net/ppp_synctty.c | |||
@@ -207,6 +207,9 @@ ppp_sync_open(struct tty_struct *tty) | |||
207 | struct syncppp *ap; | 207 | struct syncppp *ap; |
208 | int err; | 208 | int err; |
209 | 209 | ||
210 | if (tty->ops->write == NULL) | ||
211 | return -EOPNOTSUPP; | ||
212 | |||
210 | ap = kzalloc(sizeof(*ap), GFP_KERNEL); | 213 | ap = kzalloc(sizeof(*ap), GFP_KERNEL); |
211 | err = -ENOMEM; | 214 | err = -ENOMEM; |
212 | if (!ap) | 215 | if (!ap) |
@@ -399,8 +402,8 @@ ppp_sync_receive(struct tty_struct *tty, const unsigned char *buf, | |||
399 | tasklet_schedule(&ap->tsk); | 402 | tasklet_schedule(&ap->tsk); |
400 | sp_put(ap); | 403 | sp_put(ap); |
401 | if (test_and_clear_bit(TTY_THROTTLED, &tty->flags) | 404 | if (test_and_clear_bit(TTY_THROTTLED, &tty->flags) |
402 | && tty->driver->unthrottle) | 405 | && tty->ops->unthrottle) |
403 | tty->driver->unthrottle(tty); | 406 | tty->ops->unthrottle(tty); |
404 | } | 407 | } |
405 | 408 | ||
406 | static void | 409 | static void |
@@ -653,7 +656,7 @@ ppp_sync_push(struct syncppp *ap) | |||
653 | tty_stuffed = 0; | 656 | tty_stuffed = 0; |
654 | if (!tty_stuffed && ap->tpkt) { | 657 | if (!tty_stuffed && ap->tpkt) { |
655 | set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); | 658 | set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); |
656 | sent = tty->driver->write(tty, ap->tpkt->data, ap->tpkt->len); | 659 | sent = tty->ops->write(tty, ap->tpkt->data, ap->tpkt->len); |
657 | if (sent < 0) | 660 | if (sent < 0) |
658 | goto flush; /* error, e.g. loss of CD */ | 661 | goto flush; /* error, e.g. loss of CD */ |
659 | if (sent < ap->tpkt->len) { | 662 | if (sent < ap->tpkt->len) { |