From patchwork Wed Jan 4 15:15:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ilpo_J=C3=A4rvinen?= X-Patchwork-Id: 38971 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp5197086wrt; Wed, 4 Jan 2023 07:17:39 -0800 (PST) X-Google-Smtp-Source: AMrXdXtjSV5iDeBXQLi8HNP1ouf2xwWFlzfKTc0vZOZN/Xv4sb9pd1ndGG7Q8NiOGhlASEfJpIpe X-Received: by 2002:a05:6402:5296:b0:461:dd11:c688 with SMTP id en22-20020a056402529600b00461dd11c688mr44888598edb.9.1672845459071; Wed, 04 Jan 2023 07:17:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672845459; cv=none; d=google.com; s=arc-20160816; b=avPqVo54EkeMj3ijvsF/YcTvxKxmrAzoG1GNr6XZSkHgHMX63CcXssAVUcmy7+jOB6 7AB9lHwKkTHvuZPFUgrNWFLqns0DDgl3ZiSRA743R7gpMwK3iIBLzwuaGPsxU7oHPibm EJDmgvNrPyFlo5y9stVRvNvohqE04db3JGM2ebg4lQ94w9AJt/mXGltPsCy4Ghv6cLZg sx0VY8r7gQBwAJIJNqqiyD5fKc3tOQUNTePmiRTChLrv+HvbulJp7j/YSxfxXxrNIAmJ 0UjjtNPjXKdi8qFNqfPZU3hzHX8ZFf/OZE5Rc76eyvPzo2HxHnjsDby30FPTLcz6L9ST gK7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=AUtKQJ4veOaR3bDkZ4aV5qlxfc+bhDkqxsMQC+C+WV8=; b=BDKrwzGodvjhXLkeDcvqvHDIdhOXYoTp0kInX/CSDGhmIz4f6rGFon9Kh7S6J4eHgn vtjxCMYc5DQ/NZL0EQNnh59vGyXRFM94aSovaT9fABYaHKZnSjBCkfS5yk0FlngAisAs ZIGW/BH9zKm39n9Pva0OjN7VhGsjGsKwYUEScg0iiedi7ko7qxWj1W1y5+7CJdj3E3ev E5UfRi/LFHmn5nnbudV5C6pKujYLXSo+R464hvl0TkiILdBy3NmAz4nqtPh75a/yiv2l dleS6GQw04Zmn1bPu4WpqYqeYc2HgaBCMGRChe1Oij5jye5o/LrL+klXIKCLpXgZMWVc 7GLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=QBYZIFKC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v3-20020a056402348300b0048edf59946fsi3662374edc.19.2023.01.04.07.17.15; Wed, 04 Jan 2023 07:17:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=QBYZIFKC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239517AbjADPRC (ORCPT + 99 others); Wed, 4 Jan 2023 10:17:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239613AbjADPQx (ORCPT ); Wed, 4 Jan 2023 10:16:53 -0500 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F07E61A233; Wed, 4 Jan 2023 07:16:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1672845412; x=1704381412; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=JjjW6dFqxPvZpMJtTa0hvemI7uFSxCRu5bewJdPlkFg=; b=QBYZIFKCp4RDHI2A6skJ/DtzCZHQj9LMjTquXytZElrH7U+3pXATraT/ RHxXRv3sRv3stjRNhYcx+TIw3zbVgftn74S/vrYUx4mUgyX2FuNPmp63Y A4dBssryqVjvLwqVCzpqUxjaBf2GSLDk6Nk5wUgnynhpus4gGj4xsXqyf afLz4IywQvKoJJbmbPJvunaeRIYjnL9GfT71Mcyugx9eUgrp6dU9o171N q8wNALk5Qhgm2JZ9+MyYRHfH6KOtCwW06jct74FXZOA/NpriYnCoQxz1D 2x7Aar09FhptoTCUGRD5IiwlI22GJJxeViXy34c1Yzz29TZKLeS8+jmyb A==; X-IronPort-AV: E=McAfee;i="6500,9779,10580"; a="301644574" X-IronPort-AV: E=Sophos;i="5.96,300,1665471600"; d="scan'208";a="301644574" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jan 2023 07:16:31 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10580"; a="762700952" X-IronPort-AV: E=Sophos;i="5.96,300,1665471600"; d="scan'208";a="762700952" Received: from msvoboda-mobl.ger.corp.intel.com (HELO ijarvine-MOBL2.ger.corp.intel.com) ([10.252.48.119]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jan 2023 07:16:29 -0800 From: =?utf-8?q?Ilpo_J=C3=A4rvinen?= To: linux-serial@vger.kernel.org, Greg Kroah-Hartman , Jiri Slaby , linux-kernel@vger.kernel.org Cc: Johan Hovold , =?utf-8?q?Ilpo_J=C3=A4rvinen?= Subject: [PATCH 10/10] tty: Return bool from tty_termios_hw_change() Date: Wed, 4 Jan 2023 17:15:31 +0200 Message-Id: <20230104151531.73994-11-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230104151531.73994-1-ilpo.jarvinen@linux.intel.com> References: <20230104151531.73994-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_PASS, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754105600066658820?= X-GMAIL-MSGID: =?utf-8?q?1754105600066658820?= Change tty_termios_hw_change() return to bool and convert it to a or-chained return statement. Signed-off-by: Ilpo Järvinen Reviewed-by: Jiri Slaby --- 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); } EXPORT_SYMBOL(tty_termios_hw_change); diff --git a/include/linux/tty.h b/include/linux/tty.h index 730c3301d710..093935e97f42 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h @@ -453,7 +453,7 @@ unsigned char tty_get_char_size(unsigned int cflag); unsigned char tty_get_frame_size(unsigned int cflag); void tty_termios_copy_hw(struct ktermios *new, const struct ktermios *old); -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); int tty_set_termios(struct tty_struct *tty, struct ktermios *kt); void tty_wakeup(struct tty_struct *tty);