Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a352def2 authored by Alan Cox's avatar Alan Cox Committed by Linus Torvalds
Browse files

tty: Ldisc revamp



Move the line disciplines towards a conventional ->ops arrangement.  For
the moment the actual 'tty_ldisc' struct in the tty is kept as part of
the tty struct but this can then be changed if it turns out that when it
all settles down we want to refcount ldiscs separately to the tty.

Pull the ldisc code out of /proc and put it with our ldisc code.

Signed-off-by: default avatarAlan Cox <alan@redhat.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent e1e5770b
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -282,8 +282,8 @@ static int hci_uart_tty_open(struct tty_struct *tty)
	/* FIXME: why is this needed. Note don't use ldisc_ref here as the
	   open path is before the ldisc is referencable */

	if (tty->ldisc.flush_buffer)
		tty->ldisc.flush_buffer(tty);
	if (tty->ldisc.ops->flush_buffer)
		tty->ldisc.ops->flush_buffer(tty);
	tty_driver_flush_buffer(tty);

	return 0;
@@ -514,7 +514,7 @@ static unsigned int hci_uart_tty_poll(struct tty_struct *tty,

static int __init hci_uart_init(void)
{
	static struct tty_ldisc hci_uart_ldisc;
	static struct tty_ldisc_ops hci_uart_ldisc;
	int err;

	BT_INFO("HCI UART driver ver %s", VERSION);
+2 −1
Original line number Diff line number Diff line
@@ -5246,7 +5246,8 @@ cyclades_get_proc_info(char *buf, char **start, off_t offset, int length,
					HZ, info->idle_stats.recv_bytes,
					(cur_jifs - info->idle_stats.recv_idle)/
					HZ, info->idle_stats.overruns,
					(long)info->tty->ldisc.num);
					/* FIXME: double check locking */
					(long)info->tty->ldisc.ops->num);
			else
				size = sprintf(buf + len, "%3d %8lu %10lu %8lu "
					"%10lu %8lu %9lu %6ld\n",
+2 −2
Original line number Diff line number Diff line
@@ -2262,8 +2262,8 @@ static int pc_ioctl(struct tty_struct *tty, struct file *file,
			tty_wait_until_sent(tty, 0);
		} else {
			/* ldisc lock already held in ioctl */
			if (tty->ldisc.flush_buffer)
				tty->ldisc.flush_buffer(tty);
			if (tty->ldisc.ops->flush_buffer)
				tty->ldisc.ops->flush_buffer(tty);
		}
		unlock_kernel();
		/* Fall Thru */
+2 −2
Original line number Diff line number Diff line
@@ -868,11 +868,11 @@ i2Input(i2ChanStrPtr pCh)
		amountToMove = count;
	}
	// Move the first block
	pCh->pTTY->ldisc.receive_buf( pCh->pTTY, 
	pCh->pTTY->ldisc.ops->receive_buf( pCh->pTTY,
		 &(pCh->Ibuf[stripIndex]), NULL, amountToMove );
	// If we needed to wrap, do the second data move
	if (count > amountToMove) {
		pCh->pTTY->ldisc.receive_buf( pCh->pTTY, 
		pCh->pTTY->ldisc.ops->receive_buf( pCh->pTTY,
		 pCh->Ibuf, NULL, count - amountToMove );
	}
	// Bump and wrap the stripIndex all at once by the amount of data read. This
+4 −3
Original line number Diff line number Diff line
@@ -1289,11 +1289,12 @@ static void do_input(struct work_struct *work)
// code duplicated from n_tty (ldisc)
static inline void  isig(int sig, struct tty_struct *tty, int flush)
{
	/* FIXME: This is completely bogus */
	if (tty->pgrp)
		kill_pgrp(tty->pgrp, sig, 1);
	if (flush || !L_NOFLSH(tty)) {
		if ( tty->ldisc.flush_buffer )  
			tty->ldisc.flush_buffer(tty);
		if ( tty->ldisc.ops->flush_buffer )  
			tty->ldisc.ops->flush_buffer(tty);
		i2InputFlush( tty->driver_data );
	}
}
@@ -1342,7 +1343,7 @@ static void do_status(struct work_struct *work)
		}
		tmp = pCh->pTTY->real_raw;
		pCh->pTTY->real_raw = 0;
		pCh->pTTY->ldisc.receive_buf( pCh->pTTY, &brkc, &brkf, 1 );
		pCh->pTTY->ldisc->ops.receive_buf( pCh->pTTY, &brkc, &brkf, 1 );
		pCh->pTTY->real_raw = tmp;
	}
#endif /* NEVER_HAPPENS_AS_SETUP_XXX */
Loading