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: 13088692 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EAAF2C4332F for ; Wed, 4 Jan 2023 15:25:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=hOpXwYhlPLN+W4wR86JMuprT3uwrLX0C370sD6YOW8w=; b=QuPQ9c+ekQztYM u1wBXJqBGZqv4Jr1rNHc3IMXKuxrKSF9BwYo3XxTfm4kQVOUd9Rq5VnNk1efpZqtY6NPw/s2fDTt3 xMPnOiHhaXbz7slQb/b9Lsild++pmGpvHbuXZxjRxflNxLBGCepO49+wO3iNq+j+7VWGJYZ1kTYh1 v/ouSbIrLDhgVhXEqy1u2yuEWaluLJuRGuLxBI29eDBjrOdjalbafFHI6ar3x6W1XqmHNwUES5vnN mGr25SzcBY0IeZObybJ5HxaLggwAQy88fnBebOBhbwPjsfPIpoUpVNazidz56S7kma+ijGhXxdEUl g8qQmj2++OHCosvDPYHQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pD5dS-00A5ct-Fj; Wed, 04 Jan 2023 15:24:59 +0000 Received: from mga12.intel.com ([192.55.52.136]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pD5Vb-00A1ng-MW for linux-arm-kernel@lists.infradead.org; Wed, 04 Jan 2023 15:16:55 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1672845411; x=1704381411; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=FoqobpN/XyZOt6RH0jMAVUy4b82570kSmzhqiLl+O90=; b=OS5ZM+6mJOa8wYYW2oQO/+KGY7UmXKiomzQtJ3V4/S7CNAgudR4B2kvw 4plOJakHT21Clx3Zo7UbgRjk8fQXy3rLsBOlu0szD+/C6S3AyG6JPRx7g s7xmFe4p6AG82LZjGENWWwPa1GWqSp+C68zvWq3oFPQlS0wM8tfcVbzUc 3HtfIYuCnKa16ag6en34iTl/p+3MQsN4ayyDjosZ5RNppV6ijA2p/PGrf qXK5SsSNTtymRUgtwFiGk1MJczQ99f9hDwqgmQ+r8SNjyXrB1sS2Bpy3f X+twjaAW1K9QJ5WZMhhTbKnHyDeIO8tImxgwDHs/ouISB/zvglmTAduB2 Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10580"; a="301644561" X-IronPort-AV: E=Sophos;i="5.96,300,1665471600"; d="scan'208";a="301644561" 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230104_071651_826469_E25DE2C3 X-CRM114-Status: GOOD ( 14.28 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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);