Re: [PATCH 2/2] serial: 8250: Check UART_SCR is writable

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

 



Peter Hurley <peter@xxxxxxxxxxxxxxxxxx> writes:

> Au1x00/RT2800+ doesn't implement the 8250 scratch register (and
> this may be true of other h/w currently supported by the 8250 driver);
> read back the canary value written to the scratch register to enable
> the console h/w restart after resume from system suspend.
>
> Fixes: 4516d50aabedb ("serial: 8250: Use canary to restart console ...")
> Reported-by: Mason <slash.tmp@xxxxxxx>
> Signed-off-by: Peter Hurley <peter@xxxxxxxxxxxxxxxxxx>
> ---
>  drivers/tty/serial/8250/8250_core.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c
> index 87df908..50c80b1 100644
> --- a/drivers/tty/serial/8250/8250_core.c
> +++ b/drivers/tty/serial/8250/8250_core.c
> @@ -3486,7 +3486,8 @@ void serial8250_suspend_port(int line)
>  	    port->type != PORT_8250) {
>  		unsigned char canary = 0xa5;
>  		serial_out(up, UART_SCR, canary);
> -		up->canary = canary;
> +		if (serial_in(up, UART_SCR) == canary)
> +			up->canary = canary;
>  	}

I think this has the opposite of the intended effect.  If there is no
scratch register, up->canary will remain zero, and the reset code in
serial8250_console_write() won't execute even if it is needed.

As it is currently (without this patch), a missing scratch register will
only result in the port possibly being re-initialised unnecessarily,
which should be quite harmless.

-- 
Måns Rullgård
mans@xxxxxxxxx
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[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