Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp6195958yba; Thu, 11 Apr 2019 14:14:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqw9BFAv/a1NXpmU1VAtGITxWOWr5Gm7mlTBdacjfodJB1hRU+oUAfF+UmUSz90PaOCydHFC X-Received: by 2002:a17:902:2ec1:: with SMTP id r59mr53174651plb.171.1555017261173; Thu, 11 Apr 2019 14:14:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555017261; cv=none; d=google.com; s=arc-20160816; b=lv1gTEYE9tP4hYy+WidmfEEZcM+KTY2XBRNUfxFGzmyMxwYKD7taZYtdLuoMAJ6rUN 0jr2FisD9Ix3jlMk0QVlGjbx6jMV1//o8N8kqYGYkKemmTqR9HeK2IUmB9DoGvkEY8Zv NT5aDuv3tMBc4bOZie6ID76dJuAMK2MiunAxLjEk9+ZZ4CAqwzEImmqt9+CIoED7qNfi zq0dzCiwCnYumu3WwWNcmzVcGELBWrDrP55AaiR8osPHvkg8/Kry4GCOPZ2ZOuw9+TY7 IrfOhqwed6X0Sn/9XJaOsVtsmFvSEkPg+O2U6qVg9DraqZgF2fkVfHkwcnb7PYUFiKEA pXTw== 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:references :message-id:in-reply-to:subject:cc:to:from:date:dkim-signature; bh=6qx4oaDnhlAJm0gPbdRpHZo/sIlRW/ZqdOGZf+3EXyw=; b=aay5AL0OGLduq8tiHHuLgiuDfYe6zBvEWcyrUbbxrmMsbAQFtXKKO0KtOh11KOQp0A AmR+iGZUYdMrxYBq9YW4B9vtyGLzi86KoPOLUN853PZSWDMG8uA8hALYVDPfwT5iOwrs rhnTQprcvnJkQcpoinaQhJbv2zb22mVaN7VZJRsJkO4mzPa8Freeq9PEVTKLP+lbqaeR alCSyiJe+/0jycLe6zmFEH527GniCTFbkiLskQJuNmqnZFuu0QGie1sTY9q8Ys9kjFat 4GV0Zs1zfkySjobDM8IIrBDzMqHEEwVUqrfAU0P7lGrx1f+FFLKJ3HMuvuwPQC2MC4zL IkuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b="gHdiPvs/"; 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 p88si35392684pfi.142.2019.04.11.14.14.05; Thu, 11 Apr 2019 14:14:21 -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; dkim=pass header.i=@sifive.com header.s=google header.b="gHdiPvs/"; 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 S1726983AbfDKVN1 (ORCPT + 99 others); Thu, 11 Apr 2019 17:13:27 -0400 Received: from mail-it1-f194.google.com ([209.85.166.194]:35649 "EHLO mail-it1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726664AbfDKVN0 (ORCPT ); Thu, 11 Apr 2019 17:13:26 -0400 Received: by mail-it1-f194.google.com with SMTP id w15so12050242itc.0 for ; Thu, 11 Apr 2019 14:13:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=6qx4oaDnhlAJm0gPbdRpHZo/sIlRW/ZqdOGZf+3EXyw=; b=gHdiPvs/z5uVjxn93EE9Y7hMgiKe3l23ssSQ5QcR2pSngVy9C6JkSBacoWdbgR+1DZ FLZd9pBlNLZsy5GlUNWYo00QOyHiG7MlTeqxuJ3Z3VPhUKpQhWDB3TaRdFIOoAA4f9Y2 KMm4cTGFo7cg1du/FwVDao1EMuZIB4ssOezbqks5pbb+fEPzKN4PylwxLXlBYoz802V/ PYLaQLVpmkz5YkSpjdYbcIEi2MPTHo8m39jVin+Oj1qYu8huzF6D1MswlxuqVurUUpDk 4hLwCN0VVPl1NW5xVWbg6+ZgvCpRZPLlF/VWLKx9aDzIqSMHpmdgV+cbr0ddF/7ZutPr X5JA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=6qx4oaDnhlAJm0gPbdRpHZo/sIlRW/ZqdOGZf+3EXyw=; b=oHYbcPz1AUAecR5pq6YBepV1QZ9Jcp/owccVj9lmdsgar9FaJGhR5AFuiiM4yZ4ysf GkYqDQieKrRPhEcCYHaq3moFv8ZukwaB2DAeyZfoRwLMEbKNM4r9wtJou+GpMjGUPeEc SDPamIkAfev9/39/qZ0Q0dn0J5AEj/KXq1CLdcu+YTiZi6mAya1h+vLO3OjNq/uGCib7 QyVdadQ3oxIXtY8p8veRIJRnF46tc6vGKgMC7DvynKQINdo7QbdOguXYdSiS7MhTVbi0 4zqeU/Y/vTuOwivfslXsO61dx+ADlb1cAbhockT9aVjSMgjpVYLw0/hUPGNAEn/R8Gip uMlw== X-Gm-Message-State: APjAAAWMTzD/OgS82//ZdO8M2zNB12iydxL+E1Qeaeu88TN5/Y9tKpOa M8FIb0wUurgFcd+A3MmqjGe/Ng== X-Received: by 2002:a05:660c:78e:: with SMTP id h14mr10028752itk.49.1555017205762; Thu, 11 Apr 2019 14:13:25 -0700 (PDT) Received: from localhost (63-238-229-145.dia.static.qwest.net. [63.238.229.145]) by smtp.gmail.com with ESMTPSA id 67sm3261210itz.37.2019.04.11.14.13.25 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 11 Apr 2019 14:13:25 -0700 (PDT) Date: Thu, 11 Apr 2019 14:13:24 -0700 (PDT) From: Paul Walmsley X-X-Sender: paulw@viisi.sifive.com To: Andreas Schwab cc: Paul Walmsley , 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 In-Reply-To: Message-ID: References: <20190411090027.8670-1-paul.walmsley@sifive.com> <20190411090027.8670-3-paul.walmsley@sifive.com> User-Agent: Alpine 2.21.9999 (DEB 301 2018-08-15) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 11 Apr 2019, Andreas Schwab wrote: > 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. 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