Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5966992yba; Thu, 11 Apr 2019 09:17:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqxxW/RPM1lw2VFQrIqs3EkL9IcYNmP8C4x8LWkKa9Vw4VOTIwqOgkARSKMKLzpZ/wOyI0hv X-Received: by 2002:a05:6a00:11:: with SMTP id h17mr3772658pfk.232.1554999434526; Thu, 11 Apr 2019 09:17:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554999434; cv=none; d=google.com; s=arc-20160816; b=r0FcX5WDrTCiZ/LsN6c0kpIiSgsJe0DQ97rM2lXPTBFGOkg9jfc/4gOsMq+NU4bYID vX02DD3AzFwbzYo19558P1nSKv6xMRC5lmdDtEcjp/fHjBoAwmSu4g3zcmRwn6D+G7dG 87TdYp9lR66iS3e16GZUik2VObsdXBfo8J9mxeIJYk9BwgG/YagVSUefish9u4lOxjBI ezkpD37xa0yqOxs3alW97CNxZRjscSdpaEfiSAGxtdJ5NcszJZmes0qHq7DTyKUYXOMY fljWaBpYw6qGbhl24uykzeFCGW4NLOLAYABesWrsoppY2lCzHmwH6CRR0bp7vT6y/Bgm oQoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from; bh=LgEXeAWn1Al86SJPjamF96GK9I6snzxMnCAQthYv8yw=; b=P42b7o4MLh69SgtY9atg0Pkh/QEHjCvNRrxAGqPZFgPy/XyaQzYzr8nz4J441kChD0 a3E1M+iFVTq6bFW6ZqWH7avCaa9xEVNKeW7f5QwsPOSRVCq4qOh20HBsPCLWdih/0JRz Syo8yBgnkKrxJCBU20spfN8r+JoxOekEmAU4t7MKRLAoiCzh8FeB0ApnkyjsIooZhDto VIPaQXaxZpuSS1A6uuhp0vKJGlirAs1ck4h5vsJdOBS0lz0ya8KZ66XSD6VB7hGUcqhu f7lGrASr6p66TuOIKPAHTlXp8W9v4lr1zCbXT10OHc2yj7D1kFTKNXyBc5GMOwURyuLn mtPw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b40si35244631pla.277.2019.04.11.09.16.58; Thu, 11 Apr 2019 09:17:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726765AbfDKQQM (ORCPT + 99 others); Thu, 11 Apr 2019 12:16:12 -0400 Received: from mx2.suse.de ([195.135.220.15]:52912 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726603AbfDKQQM (ORCPT ); Thu, 11 Apr 2019 12:16:12 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id A5ED6AC3D; Thu, 11 Apr 2019 16:16:10 +0000 (UTC) From: Andreas Schwab To: Paul Walmsley Cc: linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, linux-serial@vger.kernel.org, gregkh@linuxfoundation.org, Paul Walmsley , Jiri Slaby , Palmer Dabbelt , Wesley Terpstra , Julia Lawall Subject: Re: [PATCH v4 2/2] tty: serial: add driver for the SiFive UART References: <20190411090027.8670-1-paul.walmsley@sifive.com> <20190411090027.8670-3-paul.walmsley@sifive.com> X-Yow: Four thousand different MAGNATES, MOGULS & NABOBS are romping in my gothic solarium!! Date: Thu, 11 Apr 2019 18:16:09 +0200 In-Reply-To: <20190411090027.8670-3-paul.walmsley@sifive.com> (Paul Walmsley's message of "Thu, 11 Apr 2019 02:00:30 -0700") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Apr 11 2019, Paul Walmsley 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. Andreas. -- Andreas Schwab, SUSE Labs, schwab@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."