From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756021AbdEKNdi (ORCPT ); Thu, 11 May 2017 09:33:38 -0400 Received: from www.llwyncelyn.cymru ([82.70.14.225]:38418 "EHLO fuzix.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751969AbdEKNdh (ORCPT ); Thu, 11 May 2017 09:33:37 -0400 Date: Thu, 11 May 2017 14:33:14 +0100 From: Alan Cox To: Okash Khawaja Cc: Greg Kroah-Hartman , Samuel Thibault , linux-kernel@vger.kernel.org, William Hubbs , Chris Brannon , Kirk Reiser , speakup@linux-speakup.org, devel@driverdev.osuosl.org, John Covici Subject: Re: [patch 1/1] staging: speakup: flush tty buffers and ensure hardware flow control Message-ID: <20170511143314.590cb399@alans-desktop> In-Reply-To: <20170511082914.GA599@sanghar> References: <20170509124040.816526511@gmail.com> <20170509124238.139472887@gmail.com> <20170510204151.43986689@alans-desktop> <20170511082914.GA599@sanghar> Organization: Intel Corporation X-Mailer: Claws Mail 3.14.1 (GTK+ 2.24.31; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 11 May 2017 09:29:14 +0100 Okash Khawaja wrote: > Hi Alan, > > On Wed, May 10, 2017 at 08:41:51PM +0100, Alan Cox wrote: > > > + if (!(tmp_termios.c_cflag & CRTSCTS)) { > > > + tmp_termios.c_cflag |= CRTSCTS; > > > + ret = tty_set_termios(tty, &tmp_termios); > > > + if (ret) > > > + pr_warn("speakup: Failed to set hardware flow control\n"); > > > > You should check the tty c_cflag after the call rather than rely on an > > error code. Strictly speaking tty_set_termios should error if no tty bits > > are changed by the request but it never has on Linux. Instead check the > > tty gave you the result you wanted. > Thanks. I will replace the check for return value with check for c_cflag. > > May be we should fix this in tty_set_termios? Possibly. It however changes the external kernel ABI. It's also not a simple memcmp because any undefined bits must be ignored. Make a patch, try it and see what breaks ? If nothing breaks then yes it makes sense IMHO too. Alan