Hi, Rob In my case, "Input/Output Error" only apears when both ModemManager.service and serial-getty@ttyS0.service co-exsist. Your patch can solve my problem. But I don't know whether it will break other things, because the old code never cause problems (except my case) without your patch. Huacai ------------------ Original ------------------ From: "Rob Herring"<robh@xxxxxxxxxx>; Date: Thu, Jan 26, 2017 03:47 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()return0 On Tue, Dec 6, 2016 at 9:45 PM, 陈华才 <chenhc@xxxxxxxxxx> wrote: > 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". I've played with a variety of setups, wrestled with systemd creating gettys, and still can't reproduce this. I only see "Input/Output Error" if the port doesn't exist (and needs configuration by setserial). Can you try something like this: diff --git a/drivers/tty/tty_port.c b/drivers/tty/tty_port.c index 5cd3cd932293..0be8ad1824ed 100644 --- a/drivers/tty/tty_port.c +++ b/drivers/tty/tty_port.c @@ -265,6 +265,8 @@ static void tty_port_shutdown(struct tty_port *port, struct tty_struct *tty) if (port->ops->shutdown) port->ops->shutdown(port); + + set_bit(TTY_IO_ERROR, &tty->flags); } out: mutex_unlock(&port->mutex); @@ -576,7 +578,6 @@ void tty_port_close(struct tty_port *port, struct tty_struct *tty, if (tty_port_close_start(port, tty, filp) == 0) return; tty_port_shutdown(port, tty); - set_bit(TTY_IO_ERROR, &tty->flags); tty_port_close_end(port, tty); tty_port_tty_set(port, NULL); } Rob��.n��������+%������w��{.n�����{��ǫ����{ay�ʇڙ���f���h������_�(�階�ݢj"��������G����?���&��