From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2F2DDC3DA7A for ; Thu, 5 Jan 2023 09:27:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231192AbjAEJ1A (ORCPT ); Thu, 5 Jan 2023 04:27:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230010AbjAEJ05 (ORCPT ); Thu, 5 Jan 2023 04:26:57 -0500 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 534DE551D9; Thu, 5 Jan 2023 01:26:56 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 9D324CE1A94; Thu, 5 Jan 2023 09:26:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CB41DC433D2; Thu, 5 Jan 2023 09:26:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672910812; bh=+9ZE907Vc15LG3lF8cRKY8fbnn1srd+G9nbjuyEJj7c=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=SzxWY8o/Ow6igtlBqtBVZ48LGX3SCWt2nFL8BiNecCEbEj1E2FO7HX4CkuVKPDeSF cKsOn1EtL/07os90O5ghwk5omq3ZKp8Pdt+3eD6JOeNCUV8IWOvYnMnKCDw6XFUClD Zeo1eCKqGXQWssc//BnXkHrFymrbblbqDDXN13Xi359H2z60RpaDV2em4lndI+Hddm FwttT6P71u8Cf8rkggtod1givStsMcVKvx3dXdpXYDneZdzglnNXkVxvw6IS+CDjkK ebXaUPEwCkA4i6OKstfsEFYZmuRiZlh9Aa8mc6J7rcOV+KDV7ZfvhE0itqzLhk3l4M 59Wvzq6O/OmCg== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1pDMWr-00053M-Ts; Thu, 05 Jan 2023 10:27:17 +0100 Date: Thu, 5 Jan 2023 10:27:17 +0100 From: Johan Hovold To: Ilpo =?utf-8?B?SsOkcnZpbmVu?= Cc: linux-serial@vger.kernel.org, Greg Kroah-Hartman , Jiri Slaby , linux-kernel@vger.kernel.org Subject: Re: [PATCH 10/10] tty: Return bool from tty_termios_hw_change() Message-ID: References: <20230104151531.73994-1-ilpo.jarvinen@linux.intel.com> <20230104151531.73994-11-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230104151531.73994-11-ilpo.jarvinen@linux.intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org On Wed, Jan 04, 2023 at 05:15:31PM +0200, Ilpo Järvinen wrote: > Change tty_termios_hw_change() return to bool and convert it to > a or-chained return statement. > > Signed-off-by: Ilpo Järvinen > --- > drivers/tty/tty_ioctl.c | 10 ++++------ > include/linux/tty.h | 2 +- > 2 files changed, 5 insertions(+), 7 deletions(-) > > diff --git a/drivers/tty/tty_ioctl.c b/drivers/tty/tty_ioctl.c > index ce511557b98b..4a80fabf6d5e 100644 > --- a/drivers/tty/tty_ioctl.c > +++ b/drivers/tty/tty_ioctl.c > @@ -270,13 +270,11 @@ EXPORT_SYMBOL(tty_termios_copy_hw); > * between the two termios structures, or a speed change is needed. > */ > > -int tty_termios_hw_change(const struct ktermios *a, const struct ktermios *b) > +bool tty_termios_hw_change(const struct ktermios *a, const struct ktermios *b) > { > - if (a->c_ispeed != b->c_ispeed || a->c_ospeed != b->c_ospeed) > - return 1; > - if ((a->c_cflag ^ b->c_cflag) & ~(HUPCL | CREAD | CLOCAL)) > - return 1; > - return 0; > + return a->c_ispeed != b->c_ispeed || > + a->c_ospeed != b->c_ospeed || > + (a->c_cflag ^ b->c_cflag) & ~(HUPCL | CREAD | CLOCAL); Please keep the current structure which is more readable rather than merge everything into one long expression. Johan