aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/n_hdlc.c
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/char/n_hdlc.c
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/char/n_hdlc.c')
-rw-r--r--drivers/char/n_hdlc.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/char/n_hdlc.c b/drivers/char/n_hdlc.c
index a07c0af4819..a35bfd7ee80 100644
--- a/drivers/char/n_hdlc.c
+++ b/drivers/char/n_hdlc.c
@@ -342,12 +342,10 @@ static int n_hdlc_tty_open (struct tty_struct *tty)
342#endif 342#endif
343 343
344 /* Flush any pending characters in the driver and discipline. */ 344 /* Flush any pending characters in the driver and discipline. */
345
346 if (tty->ldisc.flush_buffer) 345 if (tty->ldisc.flush_buffer)
347 tty->ldisc.flush_buffer (tty); 346 tty->ldisc.flush_buffer(tty);
348 347
349 if (tty->driver->flush_buffer) 348 tty_driver_flush_buffer(tty);
350 tty->driver->flush_buffer (tty);
351 349
352 if (debuglevel >= DEBUG_LEVEL_INFO) 350 if (debuglevel >= DEBUG_LEVEL_INFO)
353 printk("%s(%d)n_hdlc_tty_open() success\n",__FILE__,__LINE__); 351 printk("%s(%d)n_hdlc_tty_open() success\n",__FILE__,__LINE__);
@@ -399,7 +397,7 @@ static void n_hdlc_send_frames(struct n_hdlc *n_hdlc, struct tty_struct *tty)
399 397
400 /* Send the next block of data to device */ 398 /* Send the next block of data to device */
401 tty->flags |= (1 << TTY_DO_WRITE_WAKEUP); 399 tty->flags |= (1 << TTY_DO_WRITE_WAKEUP);
402 actual = tty->driver->write(tty, tbuf->buf, tbuf->count); 400 actual = tty->ops->write(tty, tbuf->buf, tbuf->count);
403 401
404 /* rollback was possible and has been done */ 402 /* rollback was possible and has been done */
405 if (actual == -ERESTARTSYS) { 403 if (actual == -ERESTARTSYS) {
@@ -752,8 +750,7 @@ static int n_hdlc_tty_ioctl(struct tty_struct *tty, struct file *file,
752 750
753 case TIOCOUTQ: 751 case TIOCOUTQ:
754 /* get the pending tx byte count in the driver */ 752 /* get the pending tx byte count in the driver */
755 count = tty->driver->chars_in_buffer ? 753 count = tty_chars_in_buffer(tty);
756 tty->driver->chars_in_buffer(tty) : 0;
757 /* add size of next output frame in queue */ 754 /* add size of next output frame in queue */
758 spin_lock_irqsave(&n_hdlc->tx_buf_list.spinlock,flags); 755 spin_lock_irqsave(&n_hdlc->tx_buf_list.spinlock,flags);
759 if (n_hdlc->tx_buf_list.head) 756 if (n_hdlc->tx_buf_list.head)