tty: fixes on top of summer cleanup
Subsystems (2)
Jiri Slaby (SUSE)
maintainerv2 cover tty: fixes on top of summer cleanup
These are fixes which were suggested or popped out of the summer cleanup series.
For v1..v2 diff, see the comments in respective patches.
Jiri Slaby (SUSE) (5):
serial: 8250: extract serial8250_init_mctrl()
serial: 8250: extract serial8250_iir_txen_test()
serial: 8250: rename lsr_TEMT, iir_NOINT to lowercase
serial: 8250: document doubled "type == PORT_8250_CIR" check
tty: fix tty_port_tty_*hangup() kernel-doc
Documentation/driver-api/tty/tty_port.rst | 5 +- drivers/tty/serial/8250/8250_core.c | 2 + drivers/tty/serial/8250/8250_port.c | 60 ++++++++++++++--------- drivers/tty/tty_port.c | 5 -- include/linux/tty_port.h | 9 ++++ 5 files changed, 50 insertions(+), 31 deletions(-)
Signature · 1 line
2.50.0
Jiri Slaby (SUSE)
maintainerPATCH v2 1/5 serial: 8250: extract serial8250_init_mctrl()
After commit 795158691cc0 ("serial: 8250: extract serial8250_initialize()"), split serial8250_initialize() even more -- the mctrl part of this code can be separated into serial8250_init_mctrl() -- done now.
---
[v2]
* use port-> directly.
* do not remove curly braces.
Both rebase errors -- noticed by Andy.
--- drivers/tty/serial/8250/8250_port.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-)
drivers/tty/serial/8250/8250_port.c +13 -8
@@ -2216,15 +2216,8 @@ static void serial8250_THRE_test(struct uart_port *port) up->bugs |=UART_BUG_THRE ; } -static void serial8250_initialize (struct uart_port *port) +static void serial8250_init_mctrl (struct uart_port *port) { -struct uart_8250_port *up =up_to_u8250p (port); -unsigned long flags; -bool lsr_TEMT, iir_NOINT; - -serial_port_out (port,UART_LCR ,UART_LCR_WLEN8 ); - -uart_port_lock_irqsave (port, &flags);if (port->flags &UPF_FOURPORT ) {if (!port->irq) port->mctrl |=TIOCM_OUT1 ;
@@ -2235,6 +2228,18 @@ static void serial8250_initialize(struct uart_port *port) }serial8250_set_mctrl (port, port->mctrl); +} + +static void serial8250_initialize (struct uart_port *port) +{ +struct uart_8250_port *up =up_to_u8250p (port); +unsigned long flags; +bool lsr_TEMT, iir_NOINT; + +serial_port_out (port,UART_LCR ,UART_LCR_WLEN8 ); + +uart_port_lock_irqsave (port, &flags); +serial8250_init_mctrl (port);/* * Serial over Lan (SoL) hack:
Signature · 1 line
2.50.0
Re: [PATCH v2 1/5] serial: 8250: extract serial8250_init_mctrl()
Quoted 7 lines · Jiri Slaby (SUSE)
After commit
795158691cc0("serial: 8250: extractserial8250_initialize()"), splitserial8250_initialize()even more -- the mctrl part of this code can be separated intoserial8250_init_mctrl()-- done now.Signed-off-by Jiri Slaby (SUSE) <[email protected]>Suggested-by Ilpo Järvinen <[email protected]>
Heh, I didn't even realize I was suggesting this :-D but it's good nonetheless.
Quoted 51 lines
Cc Andy Shevchenko <[email protected]>---
[v2]
* use port-> directly.
* do not remove curly braces.
Both rebase errors -- noticed by Andy.--- drivers/tty/serial/8250/8250_port.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-)drivers/tty/serial/8250/8250_port.c +13
-8@@ -2216,15 +2216,8 @@ static void serial8250_THRE_test(struct uart_port *port) up->bugs |=UART_BUG_THRE ; } -static void serial8250_initialize (struct uart_port *port) +static void serial8250_init_mctrl (struct uart_port *port) { -struct uart_8250_port *up =up_to_u8250p (port); -unsigned long flags; -bool lsr_TEMT, iir_NOINT; - -serial_port_out (port,UART_LCR ,UART_LCR_WLEN8 ); - -uart_port_lock_irqsave (port, &flags);if (port->flags &UPF_FOURPORT ) {if (!port->irq) port->mctrl |=TIOCM_OUT1 ;@@ -2235,6 +2228,18 @@ static void serial8250_initialize(struct uart_port *port) }serial8250_set_mctrl (port, port->mctrl); +} + +static void serial8250_initialize (struct uart_port *port) +{ +struct uart_8250_port *up =up_to_u8250p (port); +unsigned long flags; +bool lsr_TEMT, iir_NOINT; + +serial_port_out (port,UART_LCR ,UART_LCR_WLEN8 ); + +uart_port_lock_irqsave (port, &flags); +serial8250_init_mctrl (port);/* * Serial over Lan (SoL) hack:
Signature · 1 line
i.
Re: [PATCH v2 1/5] serial: 8250: extract serial8250_init_mctrl()
Quoted 33 lines · Ilpo Järvinen
Quoted 7 lines · Jiri Slaby (SUSE)
After commit
795158691cc0("serial: 8250: extractserial8250_initialize()"), splitserial8250_initialize()even more -- the mctrl part of this code can be separated intoserial8250_init_mctrl()-- done now.Signed-off-by Jiri Slaby (SUSE) <[email protected]>Suggested-by Ilpo Järvinen <[email protected]>Heh, I didn't even realize I was suggesting this :-D but it's good nonetheless.
Reviewed-by Ilpo Järvinen <[email protected]>Quoted 18 lines
Cc Andy Shevchenko <[email protected]>---
[v2]
* use port-> directly.
* do not remove curly braces.
Both rebase errors -- noticed by Andy.--- drivers/tty/serial/8250/8250_port.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-)drivers/tty/serial/8250/8250_port.c +0
-0@@ -2216,15 +2216,8 @@ static void serial8250_THRE_test(struct uart_port *port) up->bugs |=UART_BUG_THRE ; }
Quoted 11 lines
drivers/tty/serial/8250/8250_port.c static void serial8250_THRE_test(struct uart_port *port) · line 2221
Quoted 11 lines
drivers/tty/serial/8250/8250_port.c +1
-8-static void serial8250_initialize (struct uart_port *port) +static void serial8250_init_mctrl (struct uart_port *port) { -struct uart_8250_port *up =up_to_u8250p (port); -unsigned long flags; -bool lsr_TEMT, iir_NOINT; - -serial_port_out (port,UART_LCR ,UART_LCR_WLEN8 ); - -uart_port_lock_irqsave (port, &flags);if (port->flags &UPF_FOURPORT ) {
I should have also added what I meant with my earlier suggestion. AFAICT, this UPF_FOURPORT thing can only occur if SERIAL_8250_FOURPORT is enabled.
The challenge obviously are the if/else constructs but there are a few places that do port->flags & UPF_FOURPORT specific thing and something else otherwise. That hw-specific code could be placed into the hw-specific 8250_fourport.c file if the hw-specific function is made to return true if it did match, and the generic code runs otherwise.
I also have no idea why serial/sunsu.c checks UPF_FOURPORT, perhaps that's copy-paste in action. :-)
Quoted 24 lines
Quoted 22 lines
drivers/tty/serial/8250/8250_port.c +12
-0if (!port->irq) port->mctrl |=TIOCM_OUT1 ;@@ -2235,6 +2228,18 @@ static void serial8250_initialize(struct uart_port *port) }serial8250_set_mctrl (port, port->mctrl); +} + +static void serial8250_initialize (struct uart_port *port) +{ +struct uart_8250_port *up =up_to_u8250p (port); +unsigned long flags; +bool lsr_TEMT, iir_NOINT; + +serial_port_out (port,UART_LCR ,UART_LCR_WLEN8 ); + +uart_port_lock_irqsave (port, &flags); +serial8250_init_mctrl (port);/* * Serial over Lan (SoL) hack:
Signature · 1 line
i.
Jiri Slaby
maintainerRe: [PATCH v2 1/5] serial: 8250: extract serial8250_init_mctrl()
Quoted 50 lines · Ilpo Järvinen
Quoted 33 lines · Ilpo Järvinen
Quoted 7 lines · Jiri Slaby (SUSE)
After commit
795158691cc0("serial: 8250: extractserial8250_initialize()"), splitserial8250_initialize()even more -- the mctrl part of this code can be separated intoserial8250_init_mctrl()-- done now.Signed-off-by Jiri Slaby (SUSE) <[email protected]>Suggested-by Ilpo Järvinen <[email protected]>Heh, I didn't even realize I was suggesting this :-D but it's good nonetheless.
Reviewed-by Ilpo Järvinen <[email protected]>Quoted 18 lines
Cc Andy Shevchenko <[email protected]>---
[v2]
* use port-> directly.
* do not remove curly braces.
Both rebase errors -- noticed by Andy.--- drivers/tty/serial/8250/8250_port.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-)drivers/tty/serial/8250/8250_port.c +0
-0@@ -2216,15 +2216,8 @@ static void serial8250_THRE_test(struct uart_port *port) up->bugs |=UART_BUG_THRE ; }Quoted 11 lines
drivers/tty/serial/8250/8250_port.c static void serial8250_THRE_test(struct uart_port *port) · line 2221
Quoted 11 lines
drivers/tty/serial/8250/8250_port.c +1
-8-static void serial8250_initialize (struct uart_port *port) +static void serial8250_init_mctrl (struct uart_port *port) { -struct uart_8250_port *up =up_to_u8250p (port); -unsigned long flags; -bool lsr_TEMT, iir_NOINT; - -serial_port_out (port,UART_LCR ,UART_LCR_WLEN8 ); - -uart_port_lock_irqsave (port, &flags);if (port->flags &UPF_FOURPORT ) {I should have also added what I meant with my earlier suggestion. AFAICT, this
UPF_FOURPORTthing can only occur ifSERIAL_8250_FOURPORTis enabled.
Quoted 5 lines
The challenge obviously are the if/else constructs but there are a few places that do
port->flags&UPF_FOURPORTspecific thing and something else otherwise. That hw-specific code could be placed into the hw-specific8250_fourport.cfile if the hw-specific function is made to return true if it did match, and the generic code runs otherwise.
So you can brew a patch for this, right :)? Every time I read some code the same you describe, I end up with 10+ patches. I don't want for now :P.
Quoted 2 lines
I also have no idea why
serial/sunsu.cchecksUPF_FOURPORT, perhaps that's copy-paste in action. :-)
Yes, AFAI looked, it was during the switch of sunsu to serial driver. If you feel confident (it really appears apparent), drop that too ;).
thanks,
Signature · 2 lines
js suse labs
Re: [PATCH v2 1/5] serial: 8250: extract serial8250_init_mctrl()
In reply to Jiri Slaby (SUSE)Quoted 4 lines · Jiri Slaby (SUSE)
After commit
795158691cc0("serial: 8250: extractserial8250_initialize()"), splitserial8250_initialize()even more -- the mctrl part of this code can be separated intoserial8250_init_mctrl()-- done now.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Jiri Slaby (SUSE)
maintainerPATCH v2 2/5 serial: 8250: extract serial8250_iir_txen_test()
In reply to Jiri Slaby (SUSE)After commit 795158691cc0 ("serial: 8250: extract serial8250_initialize()"), split serial8250_initialize() even more -- the TX enable test part of this code can be separated into serial8250_iir_txen_test().
--- drivers/tty/serial/8250/8250_port.c | 49 ++++++++++++++++------------- 1 file changed, 28 insertions(+), 21 deletions(-)
drivers/tty/serial/8250/8250_port.c +28 -21
@@ -2230,16 +2230,19 @@ static void serial8250_init_mctrl(struct uart_port *port)serial8250_set_mctrl (port, port->mctrl); } -static void serial8250_initialize (struct uart_port *port) +static void serial8250_iir_txen_test (struct uart_port *port) {struct uart_8250_port *up =up_to_u8250p (port); -unsigned long flags;bool lsr_TEMT, iir_NOINT; -serial_port_out (port,UART_LCR ,UART_LCR_WLEN8 ); +if (port->quirks &UPQ_NO_TXEN_TEST ) +return ; -uart_port_lock_irqsave (port, &flags); -serial8250_init_mctrl (port); +/* Do a quick test to see if we receive an interrupt when we enable the TX irq. */ +serial_port_out (port,UART_IER ,UART_IER_THRI ); + lsr_TEMT =serial_port_in (port,UART_LSR ) &UART_LSR_TEMT ; + iir_NOINT =serial_port_in (port,UART_IIR ) &UART_IIR_NO_INT ; +serial_port_out (port,UART_IER ,0 );/* * Serial over Lan (SoL) hack:
@@ -2247,26 +2250,30 @@ static void serial8250_initialize(struct uart_port *port)* Lan. Those chips take a longer time than a normal serial device to signalize that a * transmission data was queued. Due to that, the above test generally fails. One solution * would be to delay the reading of iir. However, this is not reliable, since the timeout is -* variable. So, let's just don't test if we receive TX irq. This way, we'll never enable -* UART_BUG_TXEN. +* variable. So, in case of UPQ_NO_TXEN_TEST, let's just don't test if we receive TX irq. +* This way, we'll never enable UART_BUG_TXEN. */ -if (!(port->quirks &UPQ_NO_TXEN_TEST )) { -/* Do a quick test to see if we receive an interrupt when we enable the TX irq. */ -serial_port_out (port,UART_IER ,UART_IER_THRI ); - lsr_TEMT =serial_port_in (port,UART_LSR ) &UART_LSR_TEMT ; - iir_NOINT =serial_port_in (port,UART_IIR ) &UART_IIR_NO_INT ; -serial_port_out (port,UART_IER ,0 ); - -if (lsr_TEMT && iir_NOINT) { -if (!(up->bugs &UART_BUG_TXEN )) { - up->bugs |=UART_BUG_TXEN ; -dev_dbg (port->dev,"enabling bad tx status workarounds\n" ); - } - }else { - up->bugs &= ~UART_BUG_TXEN ; +if (lsr_TEMT && iir_NOINT) { +if (!(up->bugs &UART_BUG_TXEN )) { + up->bugs |=UART_BUG_TXEN ; +dev_dbg (port->dev,"enabling bad tx status workarounds\n" ); } +return ; } +/* FIXME: why is this needed? */ + up->bugs &= ~UART_BUG_TXEN ; +} + +static void serial8250_initialize (struct uart_port *port) +{ +unsigned long flags; + +serial_port_out (port,UART_LCR ,UART_LCR_WLEN8 ); + +uart_port_lock_irqsave (port, &flags); +serial8250_init_mctrl (port); +serial8250_iir_txen_test (port);uart_port_unlock_irqrestore (port, flags); }
Signature · 1 line
2.50.0
Re: [PATCH v2 2/5] serial: 8250: extract serial8250_iir_txen_test()
Quoted 78 lines · Jiri Slaby (SUSE)
After commit
795158691cc0("serial: 8250: extractserial8250_initialize()"), splitserial8250_initialize()even more -- the TX enable test part of this code can be separated intoserial8250_iir_txen_test().Signed-off-by Jiri Slaby (SUSE) <[email protected]>Suggested-by Ilpo Järvinen <[email protected]>--- drivers/tty/serial/8250/8250_port.c | 49 ++++++++++++++++------------- 1 file changed, 28 insertions(+), 21 deletions(-)drivers/tty/serial/8250/8250_port.c +21
-21@@ -2230,16 +2230,19 @@ static void serial8250_init_mctrl(struct uart_port *port)serial8250_set_mctrl (port, port->mctrl); } -static void serial8250_initialize (struct uart_port *port) +static void serial8250_iir_txen_test (struct uart_port *port) {struct uart_8250_port *up =up_to_u8250p (port); -unsigned long flags;bool lsr_TEMT, iir_NOINT; -serial_port_out (port,UART_LCR ,UART_LCR_WLEN8 ); +if (port->quirks &UPQ_NO_TXEN_TEST ) +return ; -uart_port_lock_irqsave (port, &flags); -serial8250_init_mctrl (port); +/* Do a quick test to see if we receive an interrupt when we enable the TX irq. */ +serial_port_out (port,UART_IER ,UART_IER_THRI ); + lsr_TEMT =serial_port_in (port,UART_LSR ) &UART_LSR_TEMT ; + iir_NOINT =serial_port_in (port,UART_IIR ) &UART_IIR_NO_INT ; +serial_port_out (port,UART_IER ,0 );/* * Serial over Lan (SoL) hack: @@ -2247,26 +2250,30 @@ static void serial8250_initialize(struct uart_port *port)* Lan. Those chips take a longer time than a normal serial device to signalize that a * transmission data was queued. Due to that, the above test generally fails. One solution * would be to delay the reading of iir. However, this is not reliable, since the timeout is -* variable. So, let's just don't test if we receive TX irq. This way, we'll never enable -* UART_BUG_TXEN. +* variable. So, in case of UPQ_NO_TXEN_TEST, let's just don't test if we receive TX irq. +* This way, we'll never enable UART_BUG_TXEN. */ -if (!(port->quirks &UPQ_NO_TXEN_TEST )) { -/* Do a quick test to see if we receive an interrupt when we enable the TX irq. */ -serial_port_out (port,UART_IER ,UART_IER_THRI ); - lsr_TEMT =serial_port_in (port,UART_LSR ) &UART_LSR_TEMT ; - iir_NOINT =serial_port_in (port,UART_IIR ) &UART_IIR_NO_INT ; -serial_port_out (port,UART_IER ,0 ); - -if (lsr_TEMT && iir_NOINT) { -if (!(up->bugs &UART_BUG_TXEN )) { - up->bugs |=UART_BUG_TXEN ; -dev_dbg (port->dev,"enabling bad tx status workarounds\n" ); - } - }else { - up->bugs &= ~UART_BUG_TXEN ; +if (lsr_TEMT && iir_NOINT) { +if (!(up->bugs &UART_BUG_TXEN )) { + up->bugs |=UART_BUG_TXEN ; +dev_dbg (port->dev,"enabling bad tx status workarounds\n" ); } +return ; } +/* FIXME: why is this needed? */ + up->bugs &= ~UART_BUG_TXEN ; +} + +static void serial8250_initialize (struct uart_port *port) +{
drivers/tty/serial/8250/8250_port.c static void serial8250_initialize(struct uart_port *port) · line 2279
Quoted 10 lines
drivers/tty/serial/8250/8250_port.c +7
-0+unsigned long flags; + +serial_port_out (port,UART_LCR ,UART_LCR_WLEN8 ); + +uart_port_lock_irqsave (port, &flags); +serial8250_init_mctrl (port); +serial8250_iir_txen_test (port);uart_port_unlock_irqrestore (port, flags); }
Signature · 1 line
i.
Re: [PATCH v2 2/5] serial: 8250: extract serial8250_iir_txen_test()
In reply to Jiri Slaby (SUSE)Quoted 4 lines · Jiri Slaby (SUSE)
After commit
795158691cc0("serial: 8250: extractserial8250_initialize()"), splitserial8250_initialize()even more -- the TX enable test part of this code can be separated intoserial8250_iir_txen_test().
Signature · 2 lines
With Best Regards, Andy Shevchenko
Jiri Slaby (SUSE)
maintainerPATCH v2 3/5 serial: 8250: rename lsr_TEMT, iir_NOINT to lowercase
In reply to Jiri Slaby (SUSE)There are already variables like 'iir_noint1' and 'iir_noint2'. Follow the preexisting lowercase naming of variables. So s/lsr_TEMT/lsr_temt/ and 'iir_NOINT' likewise.
--- drivers/tty/serial/8250/8250_port.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/tty/serial/8250/8250_port.c +4 -4
@@ -2233,15 +2233,15 @@ static void serial8250_init_mctrl(struct uart_port *port)static void serial8250_iir_txen_test (struct uart_port *port) {struct uart_8250_port *up =up_to_u8250p (port); -bool lsr_TEMT, iir_NOINT; +bool lsr_temt, iir_noint;if (port->quirks &UPQ_NO_TXEN_TEST )return ;/* Do a quick test to see if we receive an interrupt when we enable the TX irq. */ serial_port_out (port,UART_IER ,UART_IER_THRI ); - lsr_TEMT =serial_port_in (port,UART_LSR ) &UART_LSR_TEMT ; - iir_NOINT =serial_port_in (port,UART_IIR ) &UART_IIR_NO_INT ; + lsr_temt =serial_port_in (port,UART_LSR ) &UART_LSR_TEMT ; + iir_noint =serial_port_in (port,UART_IIR ) &UART_IIR_NO_INT ;serial_port_out (port,UART_IER ,0 );/*
@@ -2253,7 +2253,7 @@ static void serial8250_iir_txen_test(struct uart_port *port)* variable. So, in case of UPQ_NO_TXEN_TEST, let's just don't test if we receive TX irq. * This way, we'll never enable UART_BUG_TXEN. */ -if (lsr_TEMT && iir_NOINT) { +if (lsr_temt && iir_noint) {if (!(up->bugs &UART_BUG_TXEN )) { up->bugs |=UART_BUG_TXEN ;dev_dbg (port->dev,"enabling bad tx status workarounds\n" );
Signature · 1 line
2.50.0
Re: [PATCH v2 3/5] serial: 8250: rename lsr_TEMT, iir_NOINT to lowercase
Quoted 35 lines · Jiri Slaby (SUSE)
There are already variables like '
iir_noint1' and 'iir_noint2'. Follow the preexisting lowercase naming of variables. So s/lsr_TEMT/lsr_temt/ and 'iir_NOINT' likewise.Signed-off-by Jiri Slaby (SUSE) <[email protected]>Suggested-by Ilpo Järvinen <[email protected]>--- drivers/tty/serial/8250/8250_port.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/tty/serial/8250/8250_port.c +3
-3@@ -2233,15 +2233,15 @@ static void serial8250_init_mctrl(struct uart_port *port)static void serial8250_iir_txen_test (struct uart_port *port) {struct uart_8250_port *up =up_to_u8250p (port); -bool lsr_TEMT, iir_NOINT; +bool lsr_temt, iir_noint;if (port->quirks &UPQ_NO_TXEN_TEST )return ;/* Do a quick test to see if we receive an interrupt when we enable the TX irq. */ serial_port_out (port,UART_IER ,UART_IER_THRI ); - lsr_TEMT =serial_port_in (port,UART_LSR ) &UART_LSR_TEMT ; - iir_NOINT =serial_port_in (port,UART_IIR ) &UART_IIR_NO_INT ; + lsr_temt =serial_port_in (port,UART_LSR ) &UART_LSR_TEMT ; + iir_noint =serial_port_in (port,UART_IIR ) &UART_IIR_NO_INT ;serial_port_out (port,UART_IER ,0 );/*
drivers/tty/serial/8250/8250_port.c static void serial8250_iir_txen_test(struct uart_port *port) · line 2259
Quoted 8 lines
drivers/tty/serial/8250/8250_port.c +1
-1@@ -2253,7 +2253,7 @@ static void serial8250_iir_txen_test(struct uart_port *port)* variable. So, in case of UPQ_NO_TXEN_TEST, let's just don't test if we receive TX irq. * This way, we'll never enable UART_BUG_TXEN. */ -if (lsr_TEMT && iir_NOINT) { +if (lsr_temt && iir_noint) {if (!(up->bugs &UART_BUG_TXEN )) { up->bugs |=UART_BUG_TXEN ;dev_dbg (port->dev,"enabling bad tx status workarounds\n" );
Signature · 1 line
i.
Re: [PATCH v2 3/5] serial: 8250: rename lsr_TEMT, iir_NOINT to lowercase
In reply to Jiri Slaby (SUSE)Quoted 3 lines · Jiri Slaby (SUSE)
There are already variables like '
iir_noint1' and 'iir_noint2'. Follow the preexisting lowercase naming of variables. So s/lsr_TEMT/lsr_temt/ and 'iir_NOINT' likewise.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Jiri Slaby (SUSE)
maintainerPATCH v2 4/5 serial: 8250: document doubled "type == PORT_8250_CIR" check
In reply to Jiri Slaby (SUSE)The check for "port.type == PORT_8250_CIR" is present twice in serial8250_register_8250_port(). The latter was already tried to be dropped by 1104321a7b3b ("serial: Delete dead code for CIR serial ports") and then reverted by 9527b82ae3af ("Revert "serial: Delete dead code for CIR serial ports"").
Document this weirdness with a reason.
--- drivers/tty/serial/8250/8250_core.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/tty/serial/8250/8250_core.c +2 -0
@@ -717,6 +717,7 @@ int serial8250_register_8250_port(const struct uart_8250_port *up) nr_uarts++; } +/* Check if it is CIR already. We check this below again, see there why. */ if (uart->port.type ==PORT_8250_CIR ) { ret = -ENODEV ; goto unlock;
@@ -815,6 +816,7 @@ int serial8250_register_8250_port(const struct uart_8250_port *up)if (up->dl_write) uart->dl_write = up->dl_write; +/* Check the type (again)! It might have changed by the port.type assignment above. */ if (uart->port.type !=PORT_8250_CIR ) {if (uart_console_registered (&uart->port))pm_runtime_get_sync (uart->port.dev);
Signature · 1 line
2.50.0
Re: [PATCH v2 4/5] serial: 8250: document doubled "type == PORT_8250_CIR" check
Quoted 31 lines · Jiri Slaby (SUSE)
The check for "port.type ==
PORT_8250_CIR" is present twice inserial8250_register_8250_port(). The latter was already tried to be dropped by1104321a7b3b("serial: Delete dead code for CIR serial ports") and then reverted by9527b82ae3af("Revert "serial: Delete dead code for CIR serial ports"").Document this weirdness with a reason.
Signed-off-by Jiri Slaby (SUSE) <[email protected]>Suggested-by Andy Shevchenko <[email protected]>Acked-by Andy Shevchenko <[email protected]>Cc Maciej S. Szmigiero <[email protected]>--- drivers/tty/serial/8250/8250_core.c | 2 ++ 1 file changed, 2 insertions(+)drivers/tty/serial/8250/8250_core.c +1
-0@@ -717,6 +717,7 @@ int serial8250_register_8250_port(const struct uart_8250_port *up) nr_uarts++; } +/* Check if it is CIR already. We check this below again, see there why. */ if (uart->port.type ==PORT_8250_CIR ) { ret = -ENODEV ; goto unlock;
drivers/tty/serial/8250/8250_core.c int serial8250_register_8250_port(const struct uart_8250_port *up) · line 822
Quoted 7 lines
drivers/tty/serial/8250/8250_core.c +1
-0@@ -815,6 +816,7 @@ int serial8250_register_8250_port(const struct uart_8250_port *up)if (up->dl_write) uart->dl_write = up->dl_write; +/* Check the type (again)! It might have changed by the port.type assignment above. */ if (uart->port.type !=PORT_8250_CIR ) {if (uart_console_registered (&uart->port))pm_runtime_get_sync (uart->port.dev);
Signature · 1 line
i.
Jiri Slaby (SUSE)
maintainerPATCH v2 5/5 tty: fix tty_port_tty_*hangup() kernel-doc
In reply to Jiri Slaby (SUSE)The commit below added a new helper, but omitted to move (and add) the corressponding kernel-doc. Do it now.
--- Documentation/driver-api/tty/tty_port.rst | 5 +++-- drivers/tty/tty_port.c | 5 ----- include/linux/tty_port.h | 9 +++++++++ 3 files changed, 12 insertions(+), 7 deletions(-)
Documentation/driver-api/tty/tty_port.rst +3 -2
@@ -42,9 +42,10 @@ TTY Refcounting TTY Helpers ----------- +.. kernel-doc:: include/linux/tty_port.h + :identifiers: tty_port_tty_hangup tty_port_tty_vhangup .. kernel-doc:: drivers/tty/tty_port.c - :identifiers: tty_port_tty_hangup tty_port_tty_wakeup - + :identifiers: tty_port_tty_wakeup Modem Signals -------------
drivers/tty/tty_port.c +0 -5
@@ -391,11 +391,6 @@ void tty_port_hangup(struct tty_port *port) }EXPORT_SYMBOL (tty_port_hangup); -/** -* tty_port_tty_hangup - helper to hang up a tty -* @port: tty port -* @check_clocal: hang only ttys with %CLOCAL unset? -*/ void __tty_port_tty_hangup (struct tty_port *port,bool check_clocal,bool async) {struct tty_struct *tty =tty_port_tty_get (port);
include/linux/tty_port.h +9 -0
@@ -251,11 +251,20 @@ static inline int tty_port_users(struct tty_port *port)return port->count + port->blocked_open; } +/** +* tty_port_tty_hangup - helper to hang up a tty asynchronously +* @port: tty port +* @check_clocal: hang only ttys with %CLOCAL unset? +*/ static inline void tty_port_tty_hangup (struct tty_port *port,bool check_clocal) {__tty_port_tty_hangup (port, check_clocal, true); } +/** +* tty_port_tty_vhangup - helper to hang up a tty synchronously +* @port: tty port +*/ static inline void tty_port_tty_vhangup (struct tty_port *port) {__tty_port_tty_hangup (port, false, false);
Signature · 1 line
2.50.0
Re: [PATCH v2 5/5] tty: fix tty_port_tty_*hangup() kernel-doc
Quoted 2 lines · Jiri Slaby (SUSE)
The commit below added a new helper, but omitted to move (and add) the corressponding kernel-doc. Do it now.
corresponding
With that fixed, Reviewed-by: Ilpo Järvinen <[email protected]>
Signature · 1 line
i.
Quoted 71 lines
Signed-off-by Jiri Slaby (SUSE) <[email protected]>Fixes 2b5eac0f8c6e ("tty: introduce and use tty_port_tty_vhangup() helper")Reported-by Ilpo Järvinen <[email protected]>Cc Jonathan Corbet <[email protected]>--- Documentation/driver-api/tty/tty_port.rst | 5 +++-- drivers/tty/tty_port.c | 5 ----- include/linux/tty_port.h | 9 +++++++++ 3 files changed, 12 insertions(+), 7 deletions(-)Documentation/driver-api/tty/tty_port.rst +3
-2@@ -42,9 +42,10 @@ TTY Refcounting TTY Helpers ----------- +.. kernel-doc:: include/linux/tty_port.h + :identifiers: tty_port_tty_hangup tty_port_tty_vhangup .. kernel-doc:: drivers/tty/tty_port.c - :identifiers: tty_port_tty_hangup tty_port_tty_wakeup - + :identifiers: tty_port_tty_wakeup Modem Signals -------------drivers/tty/tty_port.c +0
-5@@ -391,11 +391,6 @@ void tty_port_hangup(struct tty_port *port) }EXPORT_SYMBOL (tty_port_hangup); -/** -* tty_port_tty_hangup - helper to hang up a tty -* @port: tty port -* @check_clocal: hang only ttys with %CLOCAL unset? -*/ void __tty_port_tty_hangup (struct tty_port *port,bool check_clocal,bool async) {struct tty_struct *tty =tty_port_tty_get (port);include/linux/tty_port.h +9
-0@@ -251,11 +251,20 @@ static inline int tty_port_users(struct tty_port *port)return port->count + port->blocked_open; } +/** +* tty_port_tty_hangup - helper to hang up a tty asynchronously +* @port: tty port +* @check_clocal: hang only ttys with %CLOCAL unset? +*/ static inline void tty_port_tty_hangup (struct tty_port *port,bool check_clocal) {__tty_port_tty_hangup (port, check_clocal, true); } +/** +* tty_port_tty_vhangup - helper to hang up a tty synchronously +* @port: tty port +*/ static inline void tty_port_tty_vhangup (struct tty_port *port) {__tty_port_tty_hangup (port, false, false);