Re: [PATCH] tty: serial_core: Clear TTY_IO_ERROR iftty_port_open()return 0

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I use a PLX9050 PCI-serial card (I think this problem isn't limited to this card).
I boot kernel-4.9.0-rc5 with "console=ttyS1,115200 console=tty".
My distribution is Fedora21 on Loongson (I think X86 have the same problem).
When I do "echo xxxyyy > /dev/ttyS1" or "stty -F /dev/ttyS1", I get "Input/Output Error".

Huacai
 
------------------ Original ------------------
From:  "Rob Herring"<robh@xxxxxxxxxx>;
Date:  Wed, Dec 7, 2016 11:38 AM
To:  "陈华才"<chenhc@xxxxxxxxxx>;
Cc:  "One Thousand Gnomes"<gnomes@xxxxxxxxxxxxxxxxxxx>; "Peter Hurley"<peter@xxxxxxxxxxxxxxxxxx>; "Greg Kroah-Hartman"<gregkh@xxxxxxxxxxxxxxxxxxx>; "linux-serial@xxxxxxxxxxxxxxx"<linux-serial@xxxxxxxxxxxxxxx>; "Ce Sun"<sunc@xxxxxxxxxx>;
Subject:  Re: [PATCH] tty: serial_core: Clear TTY_IO_ERROR iftty_port_open()return 0
 
On Tue, Dec 6, 2016 at 9:12 PM, 陈华才 <chenhc@xxxxxxxxxx> wrote:
> Ping?

Can you provide some more details on configuration and steps to reproduce this?

Rob

>
> ------------------ Original ------------------
> From:  "Rob Herring"<robh@xxxxxxxxxx>;
> Date:  Tue, Nov 22, 2016 08:15 AM
> To:  "Huacai Chen"<chenhc@xxxxxxxxxx>; "One Thousand Gnomes"<gnomes@xxxxxxxxxxxxxxxxxxx>; "Peter Hurley"<peter@xxxxxxxxxxxxxxxxxx>;
> Cc:  "Greg Kroah-Hartman"<gregkh@xxxxxxxxxxxxxxxxxxx>; "linux-serial@xxxxxxxxxxxxxxx"<linux-serial@xxxxxxxxxxxxxxx>; "Ce Sun"<sunc@xxxxxxxxxx>;
> Subject:  Re: [PATCH] tty: serial_core: Clear TTY_IO_ERROR if tty_port_open()return 0
>
> On Sun, Nov 20, 2016 at 9:31 PM, Huacai Chen <chenhc@xxxxxxxxxx> wrote:
>> After commit b3b57646186400d4f ("tty: serial_core: convert uart_open
>> to use tty_port_open") and 761ed4a94582ab291a ("tty: serial_core:
>> convert uart_close to use tty_port_close"), TTY_IO_ERROR is set by
>> tty_port_close() unconditionally, but cleared by tty_port_open() only
>> when tty_port_initialized() return 0.
>>
>> This is a bug: If we use "console=ttyS*" in kernel parameters, the
>> corresponding serial port's port->console will be true. When somebody
>> close the serial port, tty_port_close() will return without calling
>> tty_port_set_initialized(port, 0). Then, when it is opened again,
>> tty_port_open() will not clear TTY_IO_ERROR, and serial port becomes
>> unavailable at last.
>>
>> So, this patch clear TTY_IO_ERROR in uart_open() if tty_port_open()
>> return 0.
>
> This seems like a bug in tty_port code to me. I think TTY_IO_ERROR
> should not get set if the port is a console. Alan? Peter?
>
> Rob
>
>>
>> Signed-off-by: Ce Sun <sunc@xxxxxxxxxx>
>> Signed-off-by: Huacai Chen <chenhc@xxxxxxxxxx>
>> ---
>>  drivers/tty/serial/serial_core.c | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
>> index f2303f3..58be3ef 100644
>> --- a/drivers/tty/serial/serial_core.c
>> +++ b/drivers/tty/serial/serial_core.c
>> @@ -1690,6 +1690,8 @@ static int uart_open(struct tty_struct *tty, struct file *filp)
>>         tty->driver_data = state;
>>
>>         retval = tty_port_open(&state->port, tty, filp);
>> +       if (!retval)
>> +               clear_bit(TTY_IO_ERROR, &tty->flags);
>>         if (retval > 0)
>>                 retval = 0;
>>
>> --
>> 2.7.0
>>
>>
>>��.n��������+%������w��{.n�����{��ǫ����{ay�ʇڙ���f���h������_�(�階�ݢj"��������G����?���&��




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux