lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 11 Apr 2019 14:13:24 -0700 (PDT)
From:   Paul Walmsley <paul.walmsley@...ive.com>
To:     Andreas Schwab <schwab@...e.de>
cc:     Paul Walmsley <paul.walmsley@...ive.com>,
        linux-kernel@...r.kernel.org, linux-riscv@...ts.infradead.org,
        linux-serial@...r.kernel.org, gregkh@...uxfoundation.org,
        Paul Walmsley <paul@...an.com>, Jiri Slaby <jslaby@...e.com>,
        Palmer Dabbelt <palmer@...ive.com>,
        Wesley Terpstra <wesley@...ive.com>,
        Julia Lawall <julia.lawall@...6.fr>
Subject: Re: [PATCH v4 2/2] tty: serial: add driver for the SiFive UART

On Thu, 11 Apr 2019, Andreas Schwab wrote:

> On Apr 11 2019, Paul Walmsley <paul.walmsley@...ive.com> wrote:
> 
> > +static void sifive_serial_set_termios(struct uart_port *port,
> > +				      struct ktermios *termios,
> > +				      struct ktermios *old)
> > +{
> > +	struct sifive_serial_port *ssp = port_to_sifive_serial_port(port);
> > +	unsigned long flags;
> > +	u32 v, old_v;
> > +	int rate;
> > +	char nstop;
> > +
> > +	if ((termios->c_cflag & CSIZE) != CS8) {
> > +		dev_err(ssp->port.dev, "only 8-bit words supported\n");
> > +		return;
> > +	}
> > +
> > +	/* Set number of stop bits */
> > +	nstop = (termios->c_cflag & CSTOPB) ? 2 : 1;
> > +	__ssp_set_stop_bits(ssp, nstop);
> > +
> > +	/* Set line rate */
> > +	rate = uart_get_baud_rate(port, termios, old, 0, ssp->clkin_rate / 16);
> > +	__ssp_update_baud_rate(ssp, rate);
> > +
> > +	spin_lock_irqsave(&ssp->port.lock, flags);
> > +
> > +	/*
> > +	 * Update the per-port timeout.
> > +	 */
> > +	uart_update_timeout(port, termios->c_cflag, rate);
> > +
> > +	ssp->port.read_status_mask = 0;
> > +	if (termios->c_iflag & INPCK) {
> > +		dev_err(ssp->port.dev, "INPCK flag not supported\n");
> > +		goto ssst_out;
> > +	}
> > +	if (termios->c_iflag & (BRKINT | PARMRK)) {
> > +		dev_err(ssp->port.dev, "BRKINT/PARMRK flag not supported\n");
> > +		goto ssst_out;
> > +	}
> 
> I don't think it is a good idea to print something while the port is
> locked.
> 
> And I think set_termios is supposed to apply all applicable settings,
> even if some of them are not supported.

Agreed.  Thank you for your help debugging (some of which was off-list).
Clearly there should have been a build-test with lockdep enabled. 

I will send a v5.


- Paul

Powered by blists - more mailing lists