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

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

[PATCH] tty: switch to ktermios



This is the grungy swap all the occurrences in the right places patch that
goes with the updates.  At this point we have the same functionality as
before (except that sgttyb() returns speeds not zero) and are ready to
begin turning new stuff on providing nobody reports lots of bugs

If you are a tty driver author converting an out of tree driver the only
impact should be termios->ktermios name changes for the speed/property
setting functions from your upper layers.

If you are implementing your own TCGETS function before then your driver
was broken already and its about to get a whole lot more painful for you so
please fix it 8)

Also fill in c_ispeed/ospeed on init for most devices, although the current
code will do this for you anyway but I'd like eventually to lose that extra
paranoia

[akpm@osdl.org: bluetooth fix]
[mp3@de.ibm.com: sclp fix]
[mp3@de.ibm.com: warning fix for tty3270]
[hugh@veritas.com: fix tty_ioctl powerpc build]
[jdike@addtoit.com: uml: fix ->set_termios declaration]
Signed-off-by: default avatarAlan Cox <alan@redhat.com>
Signed-off-by: default avatarMartin Peschke <mp3@de.ibm.com>
Acked-by: default avatarPeter Oberparleiter <oberpar@de.ibm.com>
Cc: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: default avatarHugh Dickins <hugh@veritas.com>
Signed-off-by: default avatarJeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent edc6afc5
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -246,7 +246,7 @@ int line_write(struct tty_struct *tty, const unsigned char *buf, int len)
	return ret;
	return ret;
}
}


void line_set_termios(struct tty_struct *tty, struct termios * old)
void line_set_termios(struct tty_struct *tty, struct ktermios * old)
{
{
	/* nothing */
	/* nothing */
}
}
+1 −1
Original line number Original line Diff line number Diff line
@@ -76,7 +76,7 @@ extern int line_setup(struct line *lines, unsigned int sizeof_lines,
extern int line_write(struct tty_struct *tty, const unsigned char *buf,
extern int line_write(struct tty_struct *tty, const unsigned char *buf,
		      int len);
		      int len);
extern void line_put_char(struct tty_struct *tty, unsigned char ch);
extern void line_put_char(struct tty_struct *tty, unsigned char ch);
extern void line_set_termios(struct tty_struct *tty, struct termios * old);
extern void line_set_termios(struct tty_struct *tty, struct ktermios * old);
extern int line_chars_in_buffer(struct tty_struct *tty);
extern int line_chars_in_buffer(struct tty_struct *tty);
extern void line_flush_buffer(struct tty_struct *tty);
extern void line_flush_buffer(struct tty_struct *tty);
extern void line_flush_chars(struct tty_struct *tty);
extern void line_flush_chars(struct tty_struct *tty);
+3 −3
Original line number Original line Diff line number Diff line
@@ -104,7 +104,7 @@ static struct async_struct *IRQ_ports;


static unsigned char current_ctl_bits;
static unsigned char current_ctl_bits;


static void change_speed(struct async_struct *info, struct termios *old);
static void change_speed(struct async_struct *info, struct ktermios *old);
static void rs_wait_until_sent(struct tty_struct *tty, int timeout);
static void rs_wait_until_sent(struct tty_struct *tty, int timeout);




@@ -694,7 +694,7 @@ static void shutdown(struct async_struct * info)
 * the specified baud rate for a serial port.
 * the specified baud rate for a serial port.
 */
 */
static void change_speed(struct async_struct *info,
static void change_speed(struct async_struct *info,
			 struct termios *old_termios)
			 struct ktermios *old_termios)
{
{
	int	quot = 0, baud_base, baud;
	int	quot = 0, baud_base, baud;
	unsigned cflag, cval = 0;
	unsigned cflag, cval = 0;
@@ -1365,7 +1365,7 @@ static int rs_ioctl(struct tty_struct *tty, struct file * file,
	return 0;
	return 0;
}
}


static void rs_set_termios(struct tty_struct *tty, struct termios *old_termios)
static void rs_set_termios(struct tty_struct *tty, struct ktermios *old_termios)
{
{
	struct async_struct *info = (struct async_struct *)tty->driver_data;
	struct async_struct *info = (struct async_struct *)tty->driver_data;
	unsigned long flags;
	unsigned long flags;
+1 −1
Original line number Original line Diff line number Diff line
@@ -4101,7 +4101,7 @@ cy_ioctl(struct tty_struct *tty, struct file * file,
 * where old == NULL, and try to do something rational.
 * where old == NULL, and try to do something rational.
 */
 */
static void
static void
cy_set_termios(struct tty_struct *tty, struct termios * old_termios)
cy_set_termios(struct tty_struct *tty, struct ktermios * old_termios)
{
{
  struct cyclades_port *info = (struct cyclades_port *)tty->driver_data;
  struct cyclades_port *info = (struct cyclades_port *)tty->driver_data;


+11 −5
Original line number Original line Diff line number Diff line
@@ -199,7 +199,7 @@ static int pc_ioctl(struct tty_struct *, struct file *,
                    unsigned int, unsigned long);
                    unsigned int, unsigned long);
static int info_ioctl(struct tty_struct *, struct file *,
static int info_ioctl(struct tty_struct *, struct file *,
                    unsigned int, unsigned long);
                    unsigned int, unsigned long);
static void pc_set_termios(struct tty_struct *, struct termios *);
static void pc_set_termios(struct tty_struct *, struct ktermios *);
static void do_softint(struct work_struct *work);
static void do_softint(struct work_struct *work);
static void pc_stop(struct tty_struct *);
static void pc_stop(struct tty_struct *);
static void pc_start(struct tty_struct *);
static void pc_start(struct tty_struct *);
@@ -1236,6 +1236,8 @@ static int __init pc_init(void)
	pc_driver->init_termios.c_oflag = 0;
	pc_driver->init_termios.c_oflag = 0;
	pc_driver->init_termios.c_cflag = B9600 | CS8 | CREAD | CLOCAL | HUPCL;
	pc_driver->init_termios.c_cflag = B9600 | CS8 | CREAD | CLOCAL | HUPCL;
	pc_driver->init_termios.c_lflag = 0;
	pc_driver->init_termios.c_lflag = 0;
	pc_driver->init_termios.c_ispeed = 9600;
	pc_driver->init_termios.c_ospeed = 9600;
	pc_driver->flags = TTY_DRIVER_REAL_RAW;
	pc_driver->flags = TTY_DRIVER_REAL_RAW;
	tty_set_operations(pc_driver, &pc_ops);
	tty_set_operations(pc_driver, &pc_ops);


@@ -1250,6 +1252,8 @@ static int __init pc_init(void)
	pc_info->init_termios.c_oflag = 0;
	pc_info->init_termios.c_oflag = 0;
	pc_info->init_termios.c_lflag = 0;
	pc_info->init_termios.c_lflag = 0;
	pc_info->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL;
	pc_info->init_termios.c_cflag = B9600 | CS8 | CREAD | HUPCL;
	pc_info->init_termios.c_ispeed = 9600;
	pc_info->init_termios.c_ospeed = 9600;
	pc_info->flags = TTY_DRIVER_REAL_RAW;
	pc_info->flags = TTY_DRIVER_REAL_RAW;
	tty_set_operations(pc_info, &info_ops);
	tty_set_operations(pc_info, &info_ops);


@@ -1999,7 +2003,7 @@ static void epcaparam(struct tty_struct *tty, struct channel *ch)
{ /* Begin epcaparam */
{ /* Begin epcaparam */


	unsigned int cmdHead;
	unsigned int cmdHead;
	struct termios *ts;
	struct ktermios *ts;
	struct board_chan __iomem *bc;
	struct board_chan __iomem *bc;
	unsigned mval, hflow, cflag, iflag;
	unsigned mval, hflow, cflag, iflag;


@@ -2114,7 +2118,7 @@ static void receive_data(struct channel *ch)
{ /* Begin receive_data */
{ /* Begin receive_data */


	unchar *rptr;
	unchar *rptr;
	struct termios *ts = NULL;
	struct ktermios *ts = NULL;
	struct tty_struct *tty;
	struct tty_struct *tty;
	struct board_chan __iomem *bc;
	struct board_chan __iomem *bc;
	int dataToRead, wrapgap, bytesAvailable;
	int dataToRead, wrapgap, bytesAvailable;
@@ -2362,12 +2366,14 @@ static int pc_ioctl(struct tty_struct *tty, struct file * file,
	switch (cmd) 
	switch (cmd) 
	{ /* Begin switch cmd */
	{ /* Begin switch cmd */


#if 0	/* Handled by calling layer properly */
		case TCGETS:
		case TCGETS:
			if (copy_to_user(argp, tty->termios, sizeof(struct termios)))
			if (copy_to_user(argp, tty->termios, sizeof(struct ktermios)))
				return -EFAULT;
				return -EFAULT;
			return 0;
			return 0;
		case TCGETA:
		case TCGETA:
			return get_termio(tty, argp);
			return get_termio(tty, argp);
#endif
		case TCSBRK:	/* SVID version: non-zero arg --> no break */
		case TCSBRK:	/* SVID version: non-zero arg --> no break */
			retval = tty_check_change(tty);
			retval = tty_check_change(tty);
			if (retval)
			if (retval)
@@ -2536,7 +2542,7 @@ static int pc_ioctl(struct tty_struct *tty, struct file * file,


/* --------------------- Begin pc_set_termios  ----------------------- */
/* --------------------- Begin pc_set_termios  ----------------------- */


static void pc_set_termios(struct tty_struct *tty, struct termios *old_termios)
static void pc_set_termios(struct tty_struct *tty, struct ktermios *old_termios)
{ /* Begin pc_set_termios */
{ /* Begin pc_set_termios */


	struct channel *ch;
	struct channel *ch;
Loading