aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn
diff options
context:
space:
mode:
authorAlan Cox <alan@lxorguk.ukuu.org.uk>2008-04-30 03:54:13 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-30 11:29:47 -0400
commitf34d7a5b7010b82fe97da95496b9971435530062 (patch)
tree87e2abec1e33ed4fe5e63ee2fd000bc2ad745e57 /drivers/isdn
parent251b8dd7eee30fda089a1dc088abf4fc9a0dee9c (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/isdn')
-rw-r--r--drivers/isdn/gigaset/ser-gigaset.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/isdn/gigaset/ser-gigaset.c b/drivers/isdn/gigaset/ser-gigaset.c
index fceeb1d57682..45d1ee93cd39 100644
--- a/drivers/isdn/gigaset/ser-gigaset.c
+++ b/drivers/isdn/gigaset/ser-gigaset.c
@@ -68,10 +68,10 @@ static int write_modem(struct cardstate *cs)
68 struct tty_struct *tty = cs->hw.ser->tty; 68 struct tty_struct *tty = cs->hw.ser->tty;
69 struct bc_state *bcs = &cs->bcs[0]; /* only one channel */ 69 struct bc_state *bcs = &cs->bcs[0]; /* only one channel */
70 struct sk_buff *skb = bcs->tx_skb; 70 struct sk_buff *skb = bcs->tx_skb;
71 int sent; 71 int sent = -EOPNOTSUPP;
72 72
73 if (!tty || !tty->driver || !skb) 73 if (!tty || !tty->driver || !skb)
74 return -EFAULT; 74 return -EINVAL;
75 75
76 if (!skb->len) { 76 if (!skb->len) {
77 dev_kfree_skb_any(skb); 77 dev_kfree_skb_any(skb);
@@ -80,7 +80,8 @@ static int write_modem(struct cardstate *cs)
80 } 80 }
81 81
82 set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); 82 set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags);
83 sent = tty->driver->write(tty, skb->data, skb->len); 83 if (tty->ops->write)
84 sent = tty->ops->write(tty, skb->data, skb->len);
84 gig_dbg(DEBUG_OUTPUT, "write_modem: sent %d", sent); 85 gig_dbg(DEBUG_OUTPUT, "write_modem: sent %d", sent);
85 if (sent < 0) { 86 if (sent < 0) {
86 /* error */ 87 /* error */
@@ -120,7 +121,7 @@ static int send_cb(struct cardstate *cs)
120 121
121 if (cb->len) { 122 if (cb->len) {
122 set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); 123 set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags);
123 sent = tty->driver->write(tty, cb->buf + cb->offset, cb->len); 124 sent = tty->ops->write(tty, cb->buf + cb->offset, cb->len);
124 if (sent < 0) { 125 if (sent < 0) {
125 /* error */ 126 /* error */
126 gig_dbg(DEBUG_OUTPUT, "send_cb: write error %d", sent); 127 gig_dbg(DEBUG_OUTPUT, "send_cb: write error %d", sent);
@@ -440,14 +441,14 @@ static int gigaset_set_modem_ctrl(struct cardstate *cs, unsigned old_state, unsi
440 struct tty_struct *tty = cs->hw.ser->tty; 441 struct tty_struct *tty = cs->hw.ser->tty;
441 unsigned int set, clear; 442 unsigned int set, clear;
442 443
443 if (!tty || !tty->driver || !tty->driver->tiocmset) 444 if (!tty || !tty->driver || !tty->ops->tiocmset)
444 return -EFAULT; 445 return -EINVAL;
445 set = new_state & ~old_state; 446 set = new_state & ~old_state;
446 clear = old_state & ~new_state; 447 clear = old_state & ~new_state;
447 if (!set && !clear) 448 if (!set && !clear)
448 return 0; 449 return 0;
449 gig_dbg(DEBUG_IF, "tiocmset set %x clear %x", set, clear); 450 gig_dbg(DEBUG_IF, "tiocmset set %x clear %x", set, clear);
450 return tty->driver->tiocmset(tty, NULL, set, clear); 451 return tty->ops->tiocmset(tty, NULL, set, clear);
451} 452}
452 453
453static int gigaset_baud_rate(struct cardstate *cs, unsigned cflag) 454static int gigaset_baud_rate(struct cardstate *cs, unsigned cflag)