2013-05-08 18:14:12

by Wang YanQing

[permalink] [raw]
Subject: [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.

Signed-off-by: Wang YanQing <[email protected]>
---
drivers/tty/vt/vt.c | 45 ---------------------------------------------
include/linux/console.h | 2 --
2 files changed, 47 deletions(-)

diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index fbd447b..852d470 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -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
diff --git a/include/linux/console.h b/include/linux/console.h
index 29680a8..c2b2d45 100644
--- a/include/linux/console.h
+++ b/include/linux/console.h
@@ -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
--
1.7.12.4.dirty


2013-05-08 19:56:54

by Peter Hurley

[permalink] [raw]
Subject: Re: [PATCH 3/9] vt: delete unneeded functions register_con_driver|take_over_console

On 05/08/2013 02:13 PM, Wang YanQing wrote:
> 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.
>
> Signed-off-by: Wang YanQing <[email protected]>
> ---
> drivers/tty/vt/vt.c | 45 ---------------------------------------------
> include/linux/console.h | 2 --
> 2 files changed, 47 deletions(-)
>
> diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
> index fbd447b..852d470 100644
> --- a/drivers/tty/vt/vt.c
> +++ b/drivers/tty/vt/vt.c
> @@ -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);

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

> /**
> * 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);

This effectively converts take_over_console() to require GPL now.

2013-05-08 20:14:15

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 3/9] vt: delete unneeded functions register_con_driver|take_over_console

On Wed, May 08, 2013 at 03:56:49PM -0400, Peter Hurley wrote:
> On 05/08/2013 02:13 PM, Wang YanQing wrote:
> >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.
> >
> >Signed-off-by: Wang YanQing <[email protected]>
> >---
> > drivers/tty/vt/vt.c | 45 ---------------------------------------------
> > include/linux/console.h | 2 --
> > 2 files changed, 47 deletions(-)
> >
> >diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
> >index fbd447b..852d470 100644
> >--- a/drivers/tty/vt/vt.c
> >+++ b/drivers/tty/vt/vt.c
> >@@ -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);
>
> 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

2013-05-08 20:37:19

by Peter Hurley

[permalink] [raw]
Subject: Re: [PATCH 3/9] vt: delete unneeded functions register_con_driver|take_over_console

On 05/08/2013 04:14 PM, Greg KH wrote:
> On Wed, May 08, 2013 at 03:56:49PM -0400, Peter Hurley wrote:
>> On 05/08/2013 02:13 PM, Wang YanQing wrote:
>>> 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.
>>>
>>> Signed-off-by: Wang YanQing <[email protected]>
>>> ---
>>> drivers/tty/vt/vt.c | 45 ---------------------------------------------
>>> include/linux/console.h | 2 --
>>> 2 files changed, 47 deletions(-)
>>>
>>> diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
>>> index fbd447b..852d470 100644
>>> --- a/drivers/tty/vt/vt.c
>>> +++ b/drivers/tty/vt/vt.c
>>> @@ -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);
>>
>> 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?

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

2013-05-08 20:45:03

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 3/9] vt: delete unneeded functions register_con_driver|take_over_console

On Wed, May 08, 2013 at 04:37:14PM -0400, Peter Hurley wrote:
> On 05/08/2013 04:14 PM, Greg KH wrote:
> >On Wed, May 08, 2013 at 03:56:49PM -0400, Peter Hurley wrote:
> >>On 05/08/2013 02:13 PM, Wang YanQing wrote:
> >>>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.
> >>>
> >>>Signed-off-by: Wang YanQing <[email protected]>
> >>>---
> >>> drivers/tty/vt/vt.c | 45 ---------------------------------------------
> >>> include/linux/console.h | 2 --
> >>> 2 files changed, 47 deletions(-)
> >>>
> >>>diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
> >>>index fbd447b..852d470 100644
> >>>--- a/drivers/tty/vt/vt.c
> >>>+++ b/drivers/tty/vt/vt.c
> >>>@@ -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);
> >>
> >>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?
>
> 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

2013-05-09 11:31:24

by Peter Hurley

[permalink] [raw]
Subject: Re: [PATCH 3/9] vt: delete unneeded functions register_con_driver|take_over_console

On 05/08/2013 04:45 PM, Greg KH wrote:
> On Wed, May 08, 2013 at 04:37:14PM -0400, Peter Hurley wrote:
>> On 05/08/2013 04:14 PM, Greg KH wrote:
>>> On Wed, May 08, 2013 at 03:56:49PM -0400, Peter Hurley wrote:
>>>> On 05/08/2013 02:13 PM, Wang YanQing wrote:
>>>>> 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.
>>>>>
>>>>> Signed-off-by: Wang YanQing <[email protected]>
>>>>> ---
>>>>> drivers/tty/vt/vt.c | 45 ---------------------------------------------
>>>>> include/linux/console.h | 2 --
>>>>> 2 files changed, 47 deletions(-)
>>>>>
>>>>> diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
>>>>> index fbd447b..852d470 100644
>>>>> --- a/drivers/tty/vt/vt.c
>>>>> +++ b/drivers/tty/vt/vt.c
>>>>> @@ -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);
>>>>
>>>> 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?
>>
>> 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.

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

2013-05-09 15:15:11

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 3/9] vt: delete unneeded functions register_con_driver|take_over_console

On Thu, May 09, 2013 at 07:31:18AM -0400, Peter Hurley wrote:
> On 05/08/2013 04:45 PM, Greg KH wrote:
> >On Wed, May 08, 2013 at 04:37:14PM -0400, Peter Hurley wrote:
> >>On 05/08/2013 04:14 PM, Greg KH wrote:
> >>>On Wed, May 08, 2013 at 03:56:49PM -0400, Peter Hurley wrote:
> >>>>On 05/08/2013 02:13 PM, Wang YanQing wrote:
> >>>>>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.
> >>>>>
> >>>>>Signed-off-by: Wang YanQing <[email protected]>
> >>>>>---
> >>>>> drivers/tty/vt/vt.c | 45 ---------------------------------------------
> >>>>> include/linux/console.h | 2 --
> >>>>> 2 files changed, 47 deletions(-)
> >>>>>
> >>>>>diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
> >>>>>index fbd447b..852d470 100644
> >>>>>--- a/drivers/tty/vt/vt.c
> >>>>>+++ b/drivers/tty/vt/vt.c
> >>>>>@@ -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);
> >>>>
> >>>>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?
> >>
> >>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.
>
> 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

2013-05-17 16:50:16

by Peter Hurley

[permalink] [raw]
Subject: [PATCH] tty: Remove TTY_HW_COOK_IN/OUT

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

Signed-off-by: Peter Hurley <[email protected]>
---
drivers/tty/n_tty.c | 12 +++---------
include/linux/tty.h | 2 --
2 files changed, 3 insertions(+), 11 deletions(-)

diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index 5d95873..f5b9211 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -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) {
diff --git a/include/linux/tty.h b/include/linux/tty.h
index e10846a..3efeb1b 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -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() */
--
1.8.1.2