From patchwork Wed Jan 4 15:15:30 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: 38973 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp5197185wrt; Wed, 4 Jan 2023 07:17:50 -0800 (PST) X-Google-Smtp-Source: AMrXdXstjfXNXdqn82T2CtH0wIQDOyGoeHcS4lD/pByFw0WY6SXfMqEKHZMqwHYsA+OMEMIFJZfF X-Received: by 2002:a17:907:b686:b0:7c1:7c3a:ffba with SMTP id vm6-20020a170907b68600b007c17c3affbamr46585456ejc.35.1672845470322; Wed, 04 Jan 2023 07:17:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672845470; cv=none; d=google.com; s=arc-20160816; b=KHFSRu/KB68MzxIXQPe2ZbywR8oL1yEPyyqxfV37MOogbl92j1v7yXengKwhGxBvYX itPoh9m7FJJ69J0iQrnbe9NF8+9AU9SbjW5DNACIaC69PhIlIcnZ4RO+i+6pK9BeTHVS ndkIaB9LrSGd/KvOOm5agGnAIgbc0BIW0mzbhyKBc6WAQOAFXSsdxmvMuPGZ2J6C8xvk xsFc5DYIfMQKO/hdKcwaswKJ/BSdZMG77PkStrXn/zDWGyBzdE0xnX/GlZGsn2uDKKyG 7ivojYAyYdHP8NktIrFNS2cUSxMg8Qxfn2GG7d0HMvOPACF3bQY5peGwKXqYqcqLEU3+ 2Jag== 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=Wb0ZEzUBNrMfBxRsRWmacNWEVceEQIdKSake9E/7rmY=; b=wHFGx6EJospNqtUQoVodA4S0bCw7jATgXiaCIVNSvQRZSXJsdGIaeVHROLXbtrNJV8 ovil0ocRIkW1NJc8vLhGC8zqNdJ0QcQHaeB+4cA/J1AjwO0YRyCAm/D9LYaG3d2WvNZb bGS2htjVtURn5+ydhxH0IIMYAndi78zd2DdZC7EgkCo6N7b+PC9AgVTEvatH8vjJuojp Ra+SQDG1cBglIk7tEBQn4zyed8fjoNHtdmhp581vcj0XqRFrsuP0eFdJop+5zRdvXawK zCdGE1K3PHD0DSyMDoKK3F0X6guzh28KXtUFAHI0JpwdkGe4snjWjWq0uUE6tSIQwsXH 340Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=LdG3Qsly; 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 hr25-20020a1709073f9900b0083fc624aedesi480407ejc.231.2023.01.04.07.17.25; Wed, 04 Jan 2023 07:17:50 -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=LdG3Qsly; 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 S239642AbjADPRG (ORCPT + 99 others); Wed, 4 Jan 2023 10:17:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239606AbjADPQv (ORCPT ); Wed, 4 Jan 2023 10:16:51 -0500 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E88252AF4; Wed, 4 Jan 2023 07:16:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1672845410; x=1704381410; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=FoqobpN/XyZOt6RH0jMAVUy4b82570kSmzhqiLl+O90=; b=LdG3QslyK49dN4+AMcSrL1lMlTmtijWgK2QFnYx4gKQBVr4psy4Z0lAE c1Zt5Dde2AJlslNpOj1nHrDX1yUlXGrQ6yj1NoUdoxnyeMp5fFTbLJ8NS NwPQiVB+/A/7PLuVWsmx3jcluHsdii2qN18ND+pc9RZ9TN9VxGPagHZQR RVSMkmMwxRuuReNRaoS4w4KOF/5Gm1mzo6LmUGHHnhmqq+BNRMiBSWUPR GqH9mxEArzESz2YrP2AAY/aNt7fHdz3gWc+sr1txZlKH6HYnilcscLaVz xRBgmOPa5PE1FJE6eeGCGEX96C+u1as6S5dnZNWGU2AeY/H0gtB13F7zr g==; X-IronPort-AV: E=McAfee;i="6500,9779,10580"; a="301644557" X-IronPort-AV: E=Sophos;i="5.96,300,1665471600"; d="scan'208";a="301644557" 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:28 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10580"; a="762700930" X-IronPort-AV: E=Sophos;i="5.96,300,1665471600"; d="scan'208";a="762700930" 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:25 -0800 From: =?utf-8?q?Ilpo_J=C3=A4rvinen?= To: linux-serial@vger.kernel.org, Greg Kroah-Hartman , Jiri Slaby , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Johan Hovold , =?utf-8?q?Ilpo_J=C3=A4rvinen?= Subject: [PATCH 09/10] serial: Make uart_handle_cts_change() status param bool Date: Wed, 4 Jan 2023 17:15:30 +0200 Message-Id: <20230104151531.73994-10-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?1754105611771736888?= X-GMAIL-MSGID: =?utf-8?q?1754105611771736888?= Convert uart_handle_cts_change() to bool which is more appropriate than unsigned int. Cleanup callsites from operations that are not necessary with bool. Signed-off-by: Ilpo Järvinen --- drivers/tty/serial/imx.c | 2 +- drivers/tty/serial/max3100.c | 2 +- drivers/tty/serial/max310x.c | 3 +-- drivers/tty/serial/serial_core.c | 4 ++-- include/linux/serial_core.h | 3 +-- 5 files changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index 757825edb0cd..07850a9cde61 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -771,7 +771,7 @@ static irqreturn_t __imx_uart_rtsint(int irq, void *dev_id) imx_uart_writel(sport, USR1_RTSD, USR1); usr1 = imx_uart_readl(sport, USR1) & USR1_RTSS; - uart_handle_cts_change(&sport->port, !!usr1); + uart_handle_cts_change(&sport->port, usr1); wake_up_interruptible(&sport->port.state->port.delta_msr_wait); return IRQ_HANDLED; diff --git a/drivers/tty/serial/max3100.c b/drivers/tty/serial/max3100.c index bb74f23251fe..86dcbff8faa3 100644 --- a/drivers/tty/serial/max3100.c +++ b/drivers/tty/serial/max3100.c @@ -247,7 +247,7 @@ static int max3100_handlerx(struct max3100_port *s, u16 rx) cts = (rx & MAX3100_CTS) > 0; if (s->cts != cts) { s->cts = cts; - uart_handle_cts_change(&s->port, cts ? TIOCM_CTS : 0); + uart_handle_cts_change(&s->port, cts); } return ret; diff --git a/drivers/tty/serial/max310x.c b/drivers/tty/serial/max310x.c index 4eb24e3407f8..e9cacfe7e032 100644 --- a/drivers/tty/serial/max310x.c +++ b/drivers/tty/serial/max310x.c @@ -819,8 +819,7 @@ static irqreturn_t max310x_port_irq(struct max310x_port *s, int portno) if (ists & MAX310X_IRQ_CTS_BIT) { lsr = max310x_port_read(port, MAX310X_LSR_IRQSTS_REG); - uart_handle_cts_change(port, - !!(lsr & MAX310X_LSR_CTS_BIT)); + uart_handle_cts_change(port, lsr & MAX310X_LSR_CTS_BIT); } if (rxlen) max310x_handle_rx(port, rxlen); diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index 76536c74e907..35fff37e42bb 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -3285,11 +3285,11 @@ EXPORT_SYMBOL_GPL(uart_handle_dcd_change); /** * uart_handle_cts_change - handle a change of clear-to-send state * @uport: uart_port structure for the open port - * @status: new clear to send status, nonzero if active + * @status: new clear to send status, true if active * * Caller must hold uport->lock. */ -void uart_handle_cts_change(struct uart_port *uport, unsigned int status) +void uart_handle_cts_change(struct uart_port *uport, bool status) { lockdep_assert_held_once(&uport->lock); diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index f1b69a36bb2b..591224505cb4 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -897,8 +897,7 @@ static inline bool uart_softcts_mode(struct uart_port *uport) */ extern void uart_handle_dcd_change(struct uart_port *uport, bool status); -extern void uart_handle_cts_change(struct uart_port *uport, - unsigned int status); +extern void uart_handle_cts_change(struct uart_port *uport, bool status); extern void uart_insert_char(struct uart_port *port, unsigned int status, unsigned int overrun, unsigned int ch, unsigned int flag);