Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp4510900rwb; Tue, 17 Jan 2023 01:39:19 -0800 (PST) X-Google-Smtp-Source: AMrXdXtWRn8z7k3I/8jwxPgVKUnNKtiNn60SM8yyBkRxo5tDpDoDi7z1b4Z9Du0yDFkOIHypjkVD X-Received: by 2002:a17:902:ea0a:b0:191:24a:63e3 with SMTP id s10-20020a170902ea0a00b00191024a63e3mr3711119plg.50.1673948359206; Tue, 17 Jan 2023 01:39:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673948359; cv=none; d=google.com; s=arc-20160816; b=l22RLC6thl7Xk0EJ0+xnO5I4/UrfLBkUiZTBK76t+f4AXQg+WKqzMhU3hAAiUml9wZ mn5seEIejXxzVBTiXIfTmIxoYRJExS43QIruOEtRarxNXLc+Rbc3cFagc83H0PxWs2qt WjBEzTfZNu1BR/ONZt+m5Ihcu0abT0o1vrC6VYPFKQnoLCU/w4JgPacC0tvVGToal2z5 9Jww3xEtV4HCIXp6hf1TqsytNhUzBptF34PRkQfM5zkuKiohRF3DSzGhMS1a8pXnW/9Y fBZ5iAe9bk3q0Zst5EP0doQ8shd1NDbssLhfEhVeUALMVUz80FjaoxUISG7xdnqvi3t3 QISw== 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=W+79fkbsEtqMhrw/EF9jteEKD5n6DAoi1fDXrZRxjlU=; b=jhf56eNL0VIpbv+bbxVL/zMYNuJZtstpjiOKnBAW58SFyjovekNFQst/6ogciEt+J2 qNrT6Lt+S+BDUWBX4YlK3B8wkfqGUCNIRtkaXCpFg9YEjtZ+eTxcmRFyybLBTgzi+EIo wTKLVlOSLcuK75YtT8cLxR9ZqYuSF+6SoIiMHgrBxwAYrLWQwQLnvCN6fmtCJXHUtFVY /+Whu76PCG7mDVGA4Xoeuz/OeEDcFoFC2USWOuSYal0Nsyp9Iw48Gct7X3i9s1/cCPC3 p9NVEs6BNlHf1xJfzJMFjo9WbCW/77DE8M5A5eO3uytrIJNC3VAMAQdDdBk0aAznhhEU idXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=edceQ7P5; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e7-20020a170902ef4700b0018905bd4a58si31405269plx.169.2023.01.17.01.39.13; Tue, 17 Jan 2023 01:39:19 -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=edceQ7P5; 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 S236459AbjAQJOb (ORCPT + 49 others); Tue, 17 Jan 2023 04:14:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236402AbjAQJN2 (ORCPT ); Tue, 17 Jan 2023 04:13:28 -0500 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E71F73B672; Tue, 17 Jan 2023 01:06:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1673946393; x=1705482393; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=H7gcjHlQ0XUrWXxfntmwgVaPZ/M9meupAYikxPatJgg=; b=edceQ7P5eo/j9grw1A59pv6iIiEDc2j7KuIKtQncnJBK785owW9YJ7TH vgrITFfJ7vzQSyFMGQ4hcOwLhi7WMgNv58auu9J0jXt/by6aZta/gAwnu CqXDnKAxqkAWFWXaotyAbga872d/3Cm1Sp+vi0JC26QvUgOekpNm8DCAl oH4Y4bZNrVj8m461DCuFAPMa6nrmSUW5U3OFuWWNmSoprJs343Up9ViuD uYASAI3aYsM/b4ocE2bWA0c+a5tlUwoyslP5dBuuY/GL+cHqvSnzyfRsc 1b2EDfnYExDI9n8GJhS89JbjQWyPpM/JaGqQF+eM5na7m3uhN7yR8CZ2+ g==; X-IronPort-AV: E=McAfee;i="6500,9779,10592"; a="324701123" X-IronPort-AV: E=Sophos;i="5.97,222,1669104000"; d="scan'208";a="324701123" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Jan 2023 01:05:25 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10592"; a="783174265" X-IronPort-AV: E=Sophos;i="5.97,222,1669104000"; d="scan'208";a="783174265" Received: from tronach-mobl1.ger.corp.intel.com (HELO ijarvine-MOBL2.ger.corp.intel.com) ([10.252.40.3]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Jan 2023 01:05:19 -0800 From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= To: linux-serial@vger.kernel.org, Greg Kroah-Hartman , Jiri Slaby , Rodolfo Giometti , Ulf Hansson , Johan Hovold , Samuel Iglesias Gonsalvez , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Subject: [PATCH v4 09/12] serial: Make uart_handle_cts_change() status param bool active Date: Tue, 17 Jan 2023 11:03:55 +0200 Message-Id: <20230117090358.4796-10-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230117090358.4796-1-ilpo.jarvinen@linux.intel.com> References: <20230117090358.4796-1-ilpo.jarvinen@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,SPF_HELO_NONE, 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 Convert uart_handle_cts_change() to bool which is more appropriate than unsigned int. Rename status to active to better describe what the parameter means. While at it, make the comment about the active parameter easier to parse. Cleanup callsites from operations that are not necessary with bool. Reviewed-by: Jiri Slaby 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 | 8 ++++---- include/linux/serial_core.h | 3 +-- 5 files changed, 8 insertions(+), 10 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 f8a9386db482..b8fff667d4f0 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -3287,11 +3287,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 + * @active: new clear-to-send status * * 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 active) { lockdep_assert_held_once(&uport->lock); @@ -3299,13 +3299,13 @@ void uart_handle_cts_change(struct uart_port *uport, unsigned int status) if (uart_softcts_mode(uport)) { if (uport->hw_stopped) { - if (status) { + if (active) { uport->hw_stopped = 0; uport->ops->start_tx(uport); uart_write_wakeup(uport); } } else { - if (!status) { + if (!active) { uport->hw_stopped = 1; uport->ops->stop_tx(uport); } diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index 760c96ffb5bd..ddd7c9425938 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 active); -extern void uart_handle_cts_change(struct uart_port *uport, - unsigned int status); +extern void uart_handle_cts_change(struct uart_port *uport, bool active); extern void uart_insert_char(struct uart_port *port, unsigned int status, unsigned int overrun, unsigned int ch, unsigned int flag); -- 2.30.2