Skip to contentSkip to conversation

vt: delete unneeded functions register_con_driver|take_over_console

PATCH In review Wang YanQing 3 participants 8 messages May 8, 2013 – May 17, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 3/9 vt: delete unneeded functions register_con_driver|take_over_console

Now there is no place use register_con_driver|take_over_console, and we can achieve their function with do_register_con_driver| do_take_over_console easily, so just delete them to reduce code duplication.

---
 drivers/tty/vt/vt.c     | 45 ---------------------------------------------
 include/linux/console.h |  2 --
 2 files changed, 47 deletions(-)
drivers/tty/vt/vt.c +0 -45
index fbd447b..852d470 100644
@@ -3576,26 +3576,6 @@ err:
 	return retval;
 }
 
-/**
- * register_con_driver - register console driver to console layer
- * @csw: console driver
- * @first: the first console to take over, minimum value is 0
- * @last: the last console to take over, maximum value is MAX_NR_CONSOLES -1
- *
- * DESCRIPTION: This function registers a console driver which can later
- * bind to a range of consoles specified by @first and @last. It will
- * also initialize the console driver by calling con_startup().
- */
-int register_con_driver(const struct consw *csw, int first, int last)
-{
-	int retval;
-
-	console_lock();
-	retval = do_register_con_driver(csw, first, last);
-	console_unlock();
-	return retval;
-}
-EXPORT_SYMBOL(register_con_driver);
 
 /**
  * unregister_con_driver - unregister console driver from console layer
@@ -3677,30 +3657,6 @@ int do_take_over_console(const struct consw *csw, int first, int last, int deflt
 }
 EXPORT_SYMBOL_GPL(do_take_over_console);
 
-/*
- *	If we support more console drivers, this function is used
- *	when a driver wants to take over some existing consoles
- *	and become default driver for newly opened ones.
- *
- *	take_over_console is basically a register followed by unbind
- */
-int take_over_console(const struct consw *csw, int first, int last, int deflt)
-{
-	int err;
-
-	err = register_con_driver(csw, first, last);
-	/*
-	 * If we get an busy error we still want to bind the console driver
-	 * and return success, as we may have unbound the console driver
-	 * but not unregistered it.
-	 */
-	if (err == -EBUSY)
-		err = 0;
-	if (!err)
-		bind_con_driver(csw, first, last, deflt);
-
-	return err;
-}
 
 /*
  * give_up_console is a wrapper to unregister_con_driver. It will only
@@ -4264,6 +4220,5 @@ EXPORT_SYMBOL(console_blanked);
 EXPORT_SYMBOL(vc_cons);
 EXPORT_SYMBOL(global_cursor_default);
 #ifndef VT_SINGLE_DRIVER
-EXPORT_SYMBOL(take_over_console);
 EXPORT_SYMBOL(give_up_console);
 #endif
include/linux/console.h +0 -2
index 29680a8..c2b2d45 100644
@@ -75,10 +75,8 @@ extern const struct consw newport_con;	/* SGI Newport console  */
 extern const struct consw prom_con;	/* SPARC PROM console */
 
 int con_is_bound(const struct consw *csw);
-int register_con_driver(const struct consw *csw, int first, int last);
 int unregister_con_driver(const struct consw *csw);
 int do_unregister_con_driver(const struct consw *csw);
-int take_over_console(const struct consw *sw, int first, int last, int deflt);
 int do_take_over_console(const struct consw *sw, int first, int last, int deflt);
 void give_up_console(const struct consw *sw);
 #ifdef CONFIG_HW_CONSOLE
Signature · 1 line
1.7.12.4.dirty
#1 lore raw
Quoted 28 lines · Wang YanQing

Now there is no place use register_con_driver|take_over_console, and we can achieve their function with do_register_con_driver| do_take_over_console easily, so just delete them to reduce code duplication.

---
  drivers/tty/vt/vt.c     | 45 ---------------------------------------------
  include/linux/console.h |  2 --
  2 files changed, 47 deletions(-)
drivers/tty/vt/vt.c +0 -10
index fbd447b..852d470 100644
@@ -3576,26 +3576,6 @@ err:
  	return retval;
  }
 
-/**
- * register_con_driver - register console driver to console layer
- * @csw: console driver
- * @first: the first console to take over, minimum value is 0
- * @last: the last console to take over, maximum value is MAX_NR_CONSOLES -1
- *
- * DESCRIPTION: This function registers a console driver which can later
- * bind to a range of consoles specified by @first and @last. It will
- * also initialize the console driver by calling con_startup().
- */

drivers/tty/vt/vt.c err: · line 3598

Quoted 10 lines
drivers/tty/vt/vt.c +0 -10
-int register_con_driver(const struct consw *csw, int first, int last)
-{
-	int retval;
-
-	console_lock();
-	retval = do_register_con_driver(csw, first, last);
-	console_unlock();
-	return retval;
-}
-EXPORT_SYMBOL(register_con_driver);

Maybe register_con_driver() should print a deprecated warning for a release or two before we remove it.

Quoted 34 lines
drivers/tty/vt/vt.c +0 -24
  /**
   * unregister_con_driver - unregister console driver from console layer
@@ -3677,30 +3657,6 @@ int do_take_over_console(const struct consw *csw, int first, int last, int deflt
  }
  EXPORT_SYMBOL_GPL(do_take_over_console);
 
-/*
- *	If we support more console drivers, this function is used
- *	when a driver wants to take over some existing consoles
- *	and become default driver for newly opened ones.
- *
- *	take_over_console is basically a register followed by unbind
- */
-int take_over_console(const struct consw *csw, int first, int last, int deflt)
-{
-	int err;
-
-	err = register_con_driver(csw, first, last);
-	/*
-	 * If we get an busy error we still want to bind the console driver
-	 * and return success, as we may have unbound the console driver
-	 * but not unregistered it.
-	 */
-	if (err == -EBUSY)
-		err = 0;
-	if (!err)
-		bind_con_driver(csw, first, last, deflt);
-
-	return err;
-}
 
  /*
   * give_up_console is a wrapper to unregister_con_driver. It will only

drivers/tty/vt/vt.c EXPORT_SYMBOL(console_blanked); · line 4267

Quoted 4 lines
drivers/tty/vt/vt.c +0 -1
@@ -4264,6 +4220,5 @@ EXPORT_SYMBOL(console_blanked);
  EXPORT_SYMBOL(vc_cons);
  EXPORT_SYMBOL(global_cursor_default);
  #ifndef VT_SINGLE_DRIVER
-EXPORT_SYMBOL(take_over_console);

This effectively converts take_over_console() to require GPL now.

maintainer
#2 lore raw
Quoted 34 lines · Peter Hurley
Quoted 33 lines · Wang YanQing

Now there is no place use register_con_driver|take_over_console, and we can achieve their function with do_register_con_driver| do_take_over_console easily, so just delete them to reduce code duplication.

---
 drivers/tty/vt/vt.c     | 45 ---------------------------------------------
 include/linux/console.h |  2 --
 2 files changed, 47 deletions(-)
drivers/tty/vt/vt.c +0 -15
index fbd447b..852d470 100644
@@ -3576,26 +3576,6 @@ err:
 	return retval;
 }
 
-/**
- * register_con_driver - register console driver to console layer
- * @csw: console driver
- * @first: the first console to take over, minimum value is 0
- * @last: the last console to take over, maximum value is MAX_NR_CONSOLES -1
- *
- * DESCRIPTION: This function registers a console driver which can later
- * bind to a range of consoles specified by @first and @last. It will
- * also initialize the console driver by calling con_startup().
- */
-int register_con_driver(const struct consw *csw, int first, int last)
-{
-	int retval;
-
-	console_lock();
Quoted 8 lines

drivers/tty/vt/vt.c err: · line 3598

Quoted 5 lines
drivers/tty/vt/vt.c +0 -5
-	retval = do_register_con_driver(csw, first, last);
-	console_unlock();
-	return retval;
-}
-EXPORT_SYMBOL(register_con_driver);

Maybe register_con_driver() should print a deprecated warning for a release or two before we remove it.

If there are no in-kernel users, why do we need to keep it around?

thanks,

greg k-h

#3 lore raw
Quoted 44 lines · Greg KH
Quoted 34 lines · Peter Hurley
Quoted 33 lines · Wang YanQing

Now there is no place use register_con_driver|take_over_console, and we can achieve their function with do_register_con_driver| do_take_over_console easily, so just delete them to reduce code duplication.

---
  drivers/tty/vt/vt.c     | 45 ---------------------------------------------
  include/linux/console.h |  2 --
  2 files changed, 47 deletions(-)
drivers/tty/vt/vt.c +0 -15
index fbd447b..852d470 100644
@@ -3576,26 +3576,6 @@ err:
  	return retval;
  }
 
-/**
- * register_con_driver - register console driver to console layer
- * @csw: console driver
- * @first: the first console to take over, minimum value is 0
- * @last: the last console to take over, maximum value is MAX_NR_CONSOLES -1
- *
- * DESCRIPTION: This function registers a console driver which can later
- * bind to a range of consoles specified by @first and @last. It will
- * also initialize the console driver by calling con_startup().
- */
-int register_con_driver(const struct consw *csw, int first, int last)
-{
-	int retval;
-
-	console_lock();
Quoted 8 lines

drivers/tty/vt/vt.c err: · line 3598

Quoted 5 lines
drivers/tty/vt/vt.c +0 -5
-	retval = do_register_con_driver(csw, first, last);
-	console_unlock();
-	return retval;
-}
-EXPORT_SYMBOL(register_con_driver);

Maybe register_con_driver() should print a deprecated warning for a release or two before we remove it.

Quoted 1 line

If there are no in-kernel users, why do we need to keep it around?

Well, it's not my position that we *need* to keep previously exported symbols around, but I do think a release or two is enough of a heads-up for out-of-tree drivers to transition.

That said, you're the maintainer, so I'll defer to your requirements here.

Regards,
Peter Hurley

maintainer
#4 lore raw
Quoted 45 lines · Peter Hurley
Quoted 44 lines · Greg KH
Quoted 42 lines · Peter Hurley
Quoted 28 lines · Wang YanQing

Now there is no place use register_con_driver|take_over_console, and we can achieve their function with do_register_con_driver| do_take_over_console easily, so just delete them to reduce code duplication.

---
 drivers/tty/vt/vt.c     | 45 ---------------------------------------------
 include/linux/console.h |  2 --
 2 files changed, 47 deletions(-)
drivers/tty/vt/vt.c +0 -10
index fbd447b..852d470 100644
@@ -3576,26 +3576,6 @@ err:
 	return retval;
 }
 
-/**
- * register_con_driver - register console driver to console layer
- * @csw: console driver
- * @first: the first console to take over, minimum value is 0
- * @last: the last console to take over, maximum value is MAX_NR_CONSOLES -1
- *
- * DESCRIPTION: This function registers a console driver which can later
- * bind to a range of consoles specified by @first and @last. It will
- * also initialize the console driver by calling con_startup().
- */

drivers/tty/vt/vt.c err: · line 3598

Quoted 10 lines
drivers/tty/vt/vt.c +0 -10
-int register_con_driver(const struct consw *csw, int first, int last)
-{
-	int retval;
-
-	console_lock();
-	retval = do_register_con_driver(csw, first, last);
-	console_unlock();
-	return retval;
-}
-EXPORT_SYMBOL(register_con_driver);

Maybe register_con_driver() should print a deprecated warning for a release or two before we remove it.

Quoted 5 lines
Quoted 1 line

If there are no in-kernel users, why do we need to keep it around?

Well, it's not my position that we *need* to keep previously exported symbols around, but I do think a release or two is enough of a heads-up for out-of-tree drivers to transition.

I don't care about out-of-tree drivers, as we have no insight into what they do, but they can see everything we can do, it's up to them to keep up with us.

Or even better yet, get merged into the tree, and then these types of things aren't even an issue.

thanks,

greg k-h

#5 lore raw
Quoted 52 lines · Greg KH
Quoted 45 lines · Peter Hurley
Quoted 44 lines · Greg KH
Quoted 42 lines · Peter Hurley
Quoted 28 lines · Wang YanQing

Now there is no place use register_con_driver|take_over_console, and we can achieve their function with do_register_con_driver| do_take_over_console easily, so just delete them to reduce code duplication.

---
  drivers/tty/vt/vt.c     | 45 ---------------------------------------------
  include/linux/console.h |  2 --
  2 files changed, 47 deletions(-)
drivers/tty/vt/vt.c +0 -10
index fbd447b..852d470 100644
@@ -3576,26 +3576,6 @@ err:
  	return retval;
  }
 
-/**
- * register_con_driver - register console driver to console layer
- * @csw: console driver
- * @first: the first console to take over, minimum value is 0
- * @last: the last console to take over, maximum value is MAX_NR_CONSOLES -1
- *
- * DESCRIPTION: This function registers a console driver which can later
- * bind to a range of consoles specified by @first and @last. It will
- * also initialize the console driver by calling con_startup().
- */

drivers/tty/vt/vt.c err: · line 3598

Quoted 10 lines
drivers/tty/vt/vt.c +0 -10
-int register_con_driver(const struct consw *csw, int first, int last)
-{
-	int retval;
-
-	console_lock();
-	retval = do_register_con_driver(csw, first, last);
-	console_unlock();
-	return retval;
-}
-EXPORT_SYMBOL(register_con_driver);

Maybe register_con_driver() should print a deprecated warning for a release or two before we remove it.

Quoted 5 lines
Quoted 1 line

If there are no in-kernel users, why do we need to keep it around?

Well, it's not my position that we *need* to keep previously exported symbols around, but I do think a release or two is enough of a heads-up for out-of-tree drivers to transition.

Quoted 6 lines

I don't care about out-of-tree drivers, as we have no insight into what they do, but they can see everything we can do, it's up to them to keep up with us.

Or even better yet, get merged into the tree, and then these types of things aren't even an issue.

So now that no in-tree driver declares TTY_HW_COOK_IN/OUT, you're ok with patches for their removal?

maintainer
#6 lore raw
Quoted 57 lines · Peter Hurley
Quoted 56 lines · Greg KH
Quoted 45 lines · Peter Hurley
Quoted 44 lines · Greg KH
Quoted 42 lines · Peter Hurley
Quoted 28 lines · Wang YanQing

Now there is no place use register_con_driver|take_over_console, and we can achieve their function with do_register_con_driver| do_take_over_console easily, so just delete them to reduce code duplication.

---
 drivers/tty/vt/vt.c     | 45 ---------------------------------------------
 include/linux/console.h |  2 --
 2 files changed, 47 deletions(-)
drivers/tty/vt/vt.c +0 -10
index fbd447b..852d470 100644
@@ -3576,26 +3576,6 @@ err:
 	return retval;
 }
 
-/**
- * register_con_driver - register console driver to console layer
- * @csw: console driver
- * @first: the first console to take over, minimum value is 0
- * @last: the last console to take over, maximum value is MAX_NR_CONSOLES -1
- *
- * DESCRIPTION: This function registers a console driver which can later
- * bind to a range of consoles specified by @first and @last. It will
- * also initialize the console driver by calling con_startup().
- */

drivers/tty/vt/vt.c err: · line 3598

Quoted 10 lines
drivers/tty/vt/vt.c +0 -10
-int register_con_driver(const struct consw *csw, int first, int last)
-{
-	int retval;
-
-	console_lock();
-	retval = do_register_con_driver(csw, first, last);
-	console_unlock();
-	return retval;
-}
-EXPORT_SYMBOL(register_con_driver);

Maybe register_con_driver() should print a deprecated warning for a release or two before we remove it.

Quoted 5 lines
Quoted 1 line

If there are no in-kernel users, why do we need to keep it around?

Well, it's not my position that we *need* to keep previously exported symbols around, but I do think a release or two is enough of a heads-up for out-of-tree drivers to transition.

I don't care about out-of-tree drivers, as we have no insight into what they do, but they can see everything we can do, it's up to them to keep up with us.

Quoted 5 lines
Quoted 2 lines

Or even better yet, get merged into the tree, and then these types of things aren't even an issue.

So now that no in-tree driver declares TTY_HW_COOK_IN/OUT, you're ok with patches for their removal?

Sure, send them on.

thanks,

greg k-h

#7 lore raw

PATCH 1/1 tty: Remove TTY_HW_COOK_IN/OUT

No in-tree tty driver supports cooked mode in hardware; remove.

---
 drivers/tty/n_tty.c | 12 +++---------
 include/linux/tty.h |  2 --
 2 files changed, 3 insertions(+), 11 deletions(-)
drivers/tty/n_tty.c +3 -9
index 5d95873..f5b9211 100644
@@ -746,8 +746,7 @@ static size_t __process_echoes(struct tty_struct *tty)
 			if (no_space_left)
 				break;
 		} else {
-			if (O_OPOST(tty) &&
-			    !(test_bit(TTY_HW_COOK_OUT, &tty->flags))) {
+			if (O_OPOST(tty)) {
 				int retval = do_output_char(c, tty, space);
 				if (retval < 0)
 					break;
@@ -1767,12 +1766,7 @@ static void n_tty_set_termios(struct tty_struct *tty, struct ktermios *old)
 		wake_up_interruptible(&tty->read_wait);
 
 	ldata->icanon = (L_ICANON(tty) != 0);
-	if (test_bit(TTY_HW_COOK_IN, &tty->flags)) {
-		ldata->raw = 1;
-		ldata->real_raw = 1;
-		n_tty_set_room(tty);
-		return;
-	}
+
 	if (I_ISTRIP(tty) || I_IUCLC(tty) || I_IGNCR(tty) ||
 	    I_ICRNL(tty) || I_INLCR(tty) || L_ICANON(tty) ||
 	    I_IXON(tty) || L_ISIG(tty) || L_ECHO(tty) ||
@@ -2312,7 +2306,7 @@ static ssize_t n_tty_write(struct tty_struct *tty, struct file *file,
 			retval = -EIO;
 			break;
 		}
-		if (O_OPOST(tty) && !(test_bit(TTY_HW_COOK_OUT, &tty->flags))) {
+		if (O_OPOST(tty)) {
 			while (nr > 0) {
 				ssize_t num = process_output_block(tty, b, nr);
 				if (num < 0) {
include/linux/tty.h +0 -2
index e10846a..3efeb1b 100644
@@ -307,8 +307,6 @@ struct tty_file_private {
 #define TTY_DO_WRITE_WAKEUP 	5	/* Call write_wakeup after queuing new */
 #define TTY_CLOSING 		7	/* ->close() in progress */
 #define TTY_LDISC_OPEN	 	11	/* Line discipline is open */
-#define TTY_HW_COOK_OUT 	14	/* Hardware can do output cooking */
-#define TTY_HW_COOK_IN 		15	/* Hardware can do input cooking */
 #define TTY_PTY_LOCK 		16	/* pty private */
 #define TTY_NO_WRITE_SPLIT 	17	/* Preserve write boundaries to driver */
 #define TTY_HUPPED 		18	/* Post driver->hangup() */
Signature · 1 line
1.8.1.2