From patchwork Tue Dec 19 17:18:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugo Villeneuve X-Patchwork-Id: 181134 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp2094855dyi; Tue, 19 Dec 2023 09:23:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IHmkRPFv6BowgdT3av99dOWB5PMMvzcm6z94pXFa8DBLRnThc2JmqycVr2pba3maQnLTQTY X-Received: by 2002:a17:906:5306:b0:a23:75e2:76b with SMTP id h6-20020a170906530600b00a2375e2076bmr700466ejo.118.1703006596681; Tue, 19 Dec 2023 09:23:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703006596; cv=none; d=google.com; s=arc-20160816; b=bWJJWmKK1IUu/6ojDSeKeit1SZwiTMCtBx7khJaoECXBWoAqMjfQATeJbwqq75hF4e czCZpnZbTVQknzJEmjmPc6Imgs5L5q/DXZftnolvX0XPvnS3UHzy23iuG3vW5bgK2Wb4 TmTTWEzhckYrjGa14umkEUPulWUlmlmaOIil3ckrAbayV9zzIMmSCk0wyGtfrYcttori 6ZuAl5h1boOxoMUDlgs1vaW1C19cij6rE7iu6xNBgVc025uPty8CE+NxqSOgHe3X9zQg TiI2OkIFjx9tW87IsTMhwgCZeYprr1sxKJQAL6KJQNKBRjeQMblgSPFM7copUp0KQMvD vEpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=subject:content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:cc:to:from:dkim-signature; bh=dhOqiUDo6hWsxc+Eqa46nTmCA1Ktb3a/vQZ2WSiGGX4=; fh=ZhVoJUXUplWtbBNTeiJkgl42QzUYK2Vp2MLuE9KlSEQ=; b=DmfX1d09/QctdxOHEdaSFzshCk9yqFHOdHIFn/tkpfE7SQIGu2/3X4KWg0xmx65vGC fY49OYyg6+XgclpFQbMI/yi/UgnLAJJfFH39B9IK4kI1sfmCq30dlj1WUtcN/qYuOgUH /Uk/Kle8ZqUIrIZq4p6GhTE+6kxwiy3Vy3KsrVaLap+SkzxzI1dgzxcz43hceBDCKV0C 5ste+scudNybPk7KU6+XdQDEgX/BvQ1d1LkKpOWX4eA62ynVJ7YslNYmstAtCv40/sed gVgeJHcFvExNu3utGPP7jOfa2ITtwKKhQDRP6BRFvLC6Mk4qo26LLpLYlZ5zTLq6OnmF N6Yg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=M23ZXpdK; spf=pass (google.com: domain of linux-kernel+bounces-5669-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5669-ouuuleilei=gmail.com@vger.kernel.org" Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id lf17-20020a170906ae5100b00a236475a606si1376714ejb.441.2023.12.19.09.23.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 09:23:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-5669-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=M23ZXpdK; spf=pass (google.com: domain of linux-kernel+bounces-5669-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5669-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 32F8A1F23371 for ; Tue, 19 Dec 2023 17:22:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C1CC73BB36; Tue, 19 Dec 2023 17:19:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="M23ZXpdK" X-Original-To: linux-kernel@vger.kernel.org Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2A5B63714B; Tue, 19 Dec 2023 17:19:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hugovil.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hugovil.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=x; h=Subject:Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Cc:To :From:subject:date:message-id:reply-to; bh=dhOqiUDo6hWsxc+Eqa46nTmCA1Ktb3a/vQZ2WSiGGX4=; b=M23ZXpdKMsedpAYQeE1rlM1NqN eNC/VKIIK9P391JSVFHBlDFSDlvRY8Iyaw/hiGb2GJT8n6ROJIyv15xlet510U4EKkq/hKvLuIpx7 0yzhvZ4aLmxNQ5YoprkkXtMfX/j7LNJN8Kf1Bwl9C4+jWRrS/un1Wfen9CbIqyF6MMWk=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168]:40128 helo=pettiford.lan) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1rFdkJ-0007Ao-AQ; Tue, 19 Dec 2023 12:19:07 -0500 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, jirislaby@kernel.org, jringle@gridpoint.com, kubakici@wp.pl, phil@raspberrypi.org, bo.svangard@embeddedart.se Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, hugo@hugovil.com, Hugo Villeneuve , stable@vger.kernel.org Date: Tue, 19 Dec 2023 12:18:45 -0500 Message-Id: <20231219171903.3530985-2-hugo@hugovil.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231219171903.3530985-1-hugo@hugovil.com> References: <20231219171903.3530985-1-hugo@hugovil.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SA-Exim-Connect-IP: 70.80.174.168 X-SA-Exim-Mail-From: hugo@hugovil.com X-Spam-Level: X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * -0.0 T_SCC_BODY_TEXT_LINE No description available. Subject: [PATCH 01/18] serial: sc16is7xx: fix segfault when removing driver X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.hugovil.com) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785731845506120174 X-GMAIL-MSGID: 1785731845506120174 From: Hugo Villeneuve If a problem with a device occurs during probing, and we subsequently try to remove the driver, we get the following error: $ rmmod sc16is7xx [ 62.783166] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000040 [ 62.994226] Call trace: [ 62.996672] serial_core_unregister_port+0x58/0x2b0 [ 63.001558] serial_ctrl_unregister_port+0x18/0x30 [ 63.006354] uart_remove_one_port+0x18/0x30 [ 63.010542] sc16is7xx_spi_remove+0xc0/0x190 [sc16is7xx] Segmentation fault Tested on a custom board with two SC16IS742 ICs, and by simulating a fault when probing channel (port) B of the second device. The reason is that uart_remove_one_port() has already been called during probe in the out_ports: error path, and is called again in sc16is7xx_remove(). Fix the problem by clearing the device drvdata in probe error path to indicate that all resources have been deallocated. And only deallocate resources in sc16is7xx_remove() if device drvdata is non-null. Fixes: dfeae619d781 ("serial: sc16is7xx") Cc: stable@vger.kernel.org Signed-off-by: Hugo Villeneuve --- drivers/tty/serial/sc16is7xx.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index e40e4a99277e..b585663c1e6e 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -1663,6 +1663,8 @@ static int sc16is7xx_probe(struct device *dev, out_clk: clk_disable_unprepare(s->clk); + dev_set_drvdata(dev, NULL); + return ret; } @@ -1671,6 +1673,9 @@ static void sc16is7xx_remove(struct device *dev) struct sc16is7xx_port *s = dev_get_drvdata(dev); int i; + if (!s) + return; + #ifdef CONFIG_GPIOLIB if (s->gpio_valid_mask) gpiochip_remove(&s->gpio); From patchwork Tue Dec 19 17:18:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugo Villeneuve X-Patchwork-Id: 181129 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp2094308dyi; Tue, 19 Dec 2023 09:22:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IGydEQGRl6EIv+YJf6oemKrE6rT6TiPlOvgWUxyvau+Ly+GcAAA0Fj32sv7D/tSmOHio/5h X-Received: by 2002:a17:90b:1103:b0:28a:b563:502f with SMTP id gi3-20020a17090b110300b0028ab563502fmr9500026pjb.6.1703006539770; Tue, 19 Dec 2023 09:22:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703006539; cv=none; d=google.com; s=arc-20160816; b=GGcUYVSObYb57MWelNnXaYz2ZG3d4IG/i4fGgESlgJClQ9wUMi5NLSWiEI2rxqD9Fa PZfOKtREoFetJnqJlYLAnSHztKqDCQs9yMGLzrP3/A2OqG2UkgANi6HOzUXMLekAhAxW 4YSEULnEp/bW/gnFY3quJCJ6vDjPW8Y5oKwkzBeaIO/ImFR/0QxLAzMlY4LnQObtuny8 eu+GA+Hb8qIF7Iv/Dq8CCis9A7lpYL/HuGs5TKIWtO0KFMyidWxTOmHQ/ixAzkdIF3IY x1zZ71qlKbtq9C4XjuqVsZAcxw8BGcgadC2Dc2piSU2m4Zyc192YW8nr6fWFNvukX19n P0Gg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=subject:content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:cc:to:from:dkim-signature; bh=rcIhJ0kSFRXFUqlpgMlBLBoMnyaUvKyVyUcSYmShbS8=; fh=bDIuGkKlCsFf4mUxjX0p++qc4lMCVZKi7DkmSADYk8I=; b=FQzEg1lFBv9KsMeJTq11I45F34DO3iI2GK/xdsO7xRGARUF7oBoo0tEP9FLJuTkMlW ASa3IrDZnAKJ32pULpNbqIOx4rLzhMaMEzl7tZbfmhOYUylcZFnf1sVr92xQoplOV8XV KUlObqOi6ydFcpnAwtgWPqBhAyUu8GbWRzoxYm4W0I4kp+Z86RzWdSU25+LjeOzSWFI+ 92C323NKU+R8o6C7tg0rTFIfh4jXJRtamrSFlvqKkdyrphRCRTxhqzPOYRL9f/Kc5Z2f f63JxH5oMASVmVsF+c3KQKOlr6JZqi5DzWd4Gnq6ffQk74ZbN+PD4s1ycpraX2Biv6iK j8qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=ANj4Jjg4; spf=pass (google.com: domain of linux-kernel+bounces-5667-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5667-ouuuleilei=gmail.com@vger.kernel.org" Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id a3-20020a17090a854300b0028b4c107f20si1505000pjw.7.2023.12.19.09.22.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 09:22:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-5667-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=ANj4Jjg4; spf=pass (google.com: domain of linux-kernel+bounces-5667-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5667-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 88AD328740A for ; Tue, 19 Dec 2023 17:22:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E222939AF7; Tue, 19 Dec 2023 17:19:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="ANj4Jjg4" X-Original-To: linux-kernel@vger.kernel.org Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 150FB37142; Tue, 19 Dec 2023 17:19:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hugovil.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hugovil.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=x; h=Subject:Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Cc:To :From:subject:date:message-id:reply-to; bh=rcIhJ0kSFRXFUqlpgMlBLBoMnyaUvKyVyUcSYmShbS8=; b=ANj4Jjg44+HlSkwnUCOx+b+JKG F8EE2tsJBGCsaIQTuYxz54VRJD7ZRrf+RyiXgaA0pPhuZBBXMbPXmpg7EjvwrhQ6A/A3Mj9l78gVz P6Os8z9R8BmkvQ9zH3AoZgXb2sO9Jcc6KHF2kNGVQlMa8YX050iB9355q6dFMGsm6cVY=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168]:40128 helo=pettiford.lan) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1rFdkK-0007Ao-Bn; Tue, 19 Dec 2023 12:19:08 -0500 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, jirislaby@kernel.org, jringle@gridpoint.com, kubakici@wp.pl, phil@raspberrypi.org, bo.svangard@embeddedart.se Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, hugo@hugovil.com, Hugo Villeneuve , stable@vger.kernel.org, Yury Norov Date: Tue, 19 Dec 2023 12:18:46 -0500 Message-Id: <20231219171903.3530985-3-hugo@hugovil.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231219171903.3530985-1-hugo@hugovil.com> References: <20231219171903.3530985-1-hugo@hugovil.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SA-Exim-Connect-IP: 70.80.174.168 X-SA-Exim-Mail-From: hugo@hugovil.com X-Spam-Level: X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * -0.0 T_SCC_BODY_TEXT_LINE No description available. Subject: [PATCH 02/18] serial: sc16is7xx: fix invalid sc16is7xx_lines bitfield in case of probe error X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.hugovil.com) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785731785157811746 X-GMAIL-MSGID: 1785731785157811746 From: Hugo Villeneuve If an error occurs during probing, the sc16is7xx_lines bitfield may be left in a state that doesn't represent the correct state of lines allocation. For example, in a system with two SC16 devices, if an error occurs only during probing of channel (port) B of the second device, sc16is7xx_lines final state will be 00001011b instead of the expected 00000011b. This is caused in part because of the "i--" in the for/loop located in the out_ports: error path. Fix this by checking the return value of uart_add_one_port() and set line allocation bit only if this was successful. This allows the refactor of the obfuscated for(i--...) loop in the error path, and properly call uart_remove_one_port() only when needed, and properly unset line allocation bits. Also use same mechanism in remove() when calling uart_remove_one_port(). Fixes: c64349722d14 ("sc16is7xx: support multiple devices") Cc: stable@vger.kernel.org Cc: Yury Norov Signed-off-by: Hugo Villeneuve --- There is already a patch by Yury Norov to simplify sc16is7xx_alloc_line(): https://lore.kernel.org/all/20231212022749.625238-30-yury.norov@gmail.com/ Since my patch gets rid of sc16is7xx_alloc_line() entirely, it would make Yury's patch unnecessary. --- drivers/tty/serial/sc16is7xx.c | 44 ++++++++++++++-------------------- 1 file changed, 18 insertions(+), 26 deletions(-) diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index b585663c1e6e..b92fd01cfeec 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -407,19 +407,6 @@ static void sc16is7xx_port_update(struct uart_port *port, u8 reg, regmap_update_bits(one->regmap, reg, mask, val); } -static int sc16is7xx_alloc_line(void) -{ - int i; - - BUILD_BUG_ON(SC16IS7XX_MAX_DEVS > BITS_PER_LONG); - - for (i = 0; i < SC16IS7XX_MAX_DEVS; i++) - if (!test_and_set_bit(i, &sc16is7xx_lines)) - break; - - return i; -} - static void sc16is7xx_power(struct uart_port *port, int on) { sc16is7xx_port_update(port, SC16IS7XX_IER_REG, @@ -1550,6 +1537,13 @@ static int sc16is7xx_probe(struct device *dev, SC16IS7XX_IOCONTROL_SRESET_BIT); for (i = 0; i < devtype->nr_uart; ++i) { + s->p[i].port.line = find_first_zero_bit(&sc16is7xx_lines, + SC16IS7XX_MAX_DEVS); + if (s->p[i].port.line >= SC16IS7XX_MAX_DEVS) { + ret = -ERANGE; + goto out_ports; + } + /* Initialize port data */ s->p[i].port.dev = dev; s->p[i].port.irq = irq; @@ -1569,14 +1563,8 @@ static int sc16is7xx_probe(struct device *dev, s->p[i].port.rs485_supported = sc16is7xx_rs485_supported; s->p[i].port.ops = &sc16is7xx_ops; s->p[i].old_mctrl = 0; - s->p[i].port.line = sc16is7xx_alloc_line(); s->p[i].regmap = regmaps[i]; - if (s->p[i].port.line >= SC16IS7XX_MAX_DEVS) { - ret = -ENOMEM; - goto out_ports; - } - mutex_init(&s->p[i].efr_lock); ret = uart_get_rs485_mode(&s->p[i].port); @@ -1594,8 +1582,13 @@ static int sc16is7xx_probe(struct device *dev, kthread_init_work(&s->p[i].tx_work, sc16is7xx_tx_proc); kthread_init_work(&s->p[i].reg_work, sc16is7xx_reg_proc); kthread_init_delayed_work(&s->p[i].ms_work, sc16is7xx_ms_proc); + /* Register port */ - uart_add_one_port(&sc16is7xx_uart, &s->p[i].port); + ret = uart_add_one_port(&sc16is7xx_uart, &s->p[i].port); + if (ret) + goto out_ports; + + set_bit(s->p[i].port.line, &sc16is7xx_lines); /* Enable EFR */ sc16is7xx_port_write(&s->p[i].port, SC16IS7XX_LCR_REG, @@ -1653,10 +1646,9 @@ static int sc16is7xx_probe(struct device *dev, #endif out_ports: - for (i--; i >= 0; i--) { - uart_remove_one_port(&sc16is7xx_uart, &s->p[i].port); - clear_bit(s->p[i].port.line, &sc16is7xx_lines); - } + for (i = 0; i < devtype->nr_uart; i++) + if (test_and_clear_bit(s->p[i].port.line, &sc16is7xx_lines)) + uart_remove_one_port(&sc16is7xx_uart, &s->p[i].port); kthread_stop(s->kworker_task); @@ -1683,8 +1675,8 @@ static void sc16is7xx_remove(struct device *dev) for (i = 0; i < s->devtype->nr_uart; i++) { kthread_cancel_delayed_work_sync(&s->p[i].ms_work); - uart_remove_one_port(&sc16is7xx_uart, &s->p[i].port); - clear_bit(s->p[i].port.line, &sc16is7xx_lines); + if (test_and_clear_bit(s->p[i].port.line, &sc16is7xx_lines)) + uart_remove_one_port(&sc16is7xx_uart, &s->p[i].port); sc16is7xx_power(&s->p[i].port, 0); } From patchwork Tue Dec 19 17:18:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugo Villeneuve X-Patchwork-Id: 181144 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp2095748dyi; Tue, 19 Dec 2023 09:24:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IFopSQPXBYDEHsFiekvmj5lEKpLwMnAXt0jWgKx0i6DsWuXZhrNXkEjgN8s89i2X0Sa8eiX X-Received: by 2002:a17:902:780e:b0:1d0:5ed4:4bf with SMTP id p14-20020a170902780e00b001d05ed404bfmr18495204pll.54.1703006690778; Tue, 19 Dec 2023 09:24:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703006690; cv=none; d=google.com; s=arc-20160816; b=nrqeapVih8JFe7IkTLZdmVCznF1Ii0PegYFK/l7mjF7pPkn0EfGvdooVNryfLPHBOh nskBfhd9A+3iM8+sNMMPTCAjbpnVtkTe5HKkhSZfTA5mBYPFXrQgAkLZuA1Z6IBnpHEl uO9e2CrpnSZUzPWtiuK16ZddZ6vbPRw5cWFb86j56PYqyUCCPh/PbKYvE6OAPBzeiAph qSfrOlkjXAHMkv9RhJeZsqoKE658dic3v52bzrwNx5YV5qB4d3BIkWLiisBi6Ndn1o/Z /q7pBgwutlTsYvntqdfH0xSxvyiO7pCGQbEnLsO9Rm+aMXAqLJFjpru3Crtloj75EC4+ RpeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=subject:content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:cc:to:from:dkim-signature; bh=CVt1Ut4/5of52yoyDCsnAtN3bYTRSEdMAPxWPWpZRoY=; fh=a4WmmkWtrWkl6GT2O1otVp3028EnXdnaDQnaGXCvODo=; b=vpaSdI0XlfxSi1v6KhfUrW38sW/Fr15axt2+xSICMyVqmkyQuuB/DUIt6VzKK9opT4 7f96xZo7WTuoTKfj7WOXrXp0nc/Ywlh9t5wMi8/IRkhhtA2VxL+L9BDjV1qfgC+wK+k2 M7N345T3pvLZmuAtpYWeNWdTdlU+iUQTVwDQVRDu/u2nrMaV9uHMdeoUHxjVsOK+4rfv 9AT2k8eakA8ByAAOjuytiHTRZx3uWYQlDf7kMHjJoT+JJ1R+XszN74Iz6X4VgDmmx9ZI 9Vzhuzz+c9HntcO1J9FezatH2I9YB7+lFd1yTYOiy4vFXDKsHbEOL29FEqXK5gjJnlnT abNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=H5FEowUH; spf=pass (google.com: domain of linux-kernel+bounces-5681-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5681-ouuuleilei=gmail.com@vger.kernel.org" Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id x24-20020a170902821800b001d34d365654si11439791pln.464.2023.12.19.09.24.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 09:24:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-5681-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=H5FEowUH; spf=pass (google.com: domain of linux-kernel+bounces-5681-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5681-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id B529CB211D5 for ; Tue, 19 Dec 2023 17:24:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F061740BEE; Tue, 19 Dec 2023 17:19:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="H5FEowUH" X-Original-To: linux-kernel@vger.kernel.org Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 38C103714D; Tue, 19 Dec 2023 17:19:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hugovil.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hugovil.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=x; h=Subject:Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Cc:To :From:subject:date:message-id:reply-to; bh=CVt1Ut4/5of52yoyDCsnAtN3bYTRSEdMAPxWPWpZRoY=; b=H5FEowUHBNadact6idiPj8pFZH 4O8pOwFwj0Y4XYHrk2I+zqgrFv4FwyLBj3I2bh/WRRP9CDjHI2EfDFiXu3yxTq+eRTXnH4PbqznhT R0CkUbHI4t0VfutRTdldTl7EchSjLzUhr/JXS9S4PbaHoSxYL9LTAML+Qnmxq4QKeokE=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168]:40128 helo=pettiford.lan) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1rFdkL-0007Ao-IY; Tue, 19 Dec 2023 12:19:10 -0500 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, jirislaby@kernel.org, jringle@gridpoint.com, kubakici@wp.pl, phil@raspberrypi.org, bo.svangard@embeddedart.se Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, hugo@hugovil.com, Hugo Villeneuve , stable@vger.kernel.org, Andy Shevchenko Date: Tue, 19 Dec 2023 12:18:47 -0500 Message-Id: <20231219171903.3530985-4-hugo@hugovil.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231219171903.3530985-1-hugo@hugovil.com> References: <20231219171903.3530985-1-hugo@hugovil.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SA-Exim-Connect-IP: 70.80.174.168 X-SA-Exim-Mail-From: hugo@hugovil.com X-Spam-Level: X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * -0.0 T_SCC_BODY_TEXT_LINE No description available. Subject: [PATCH 03/18] serial: sc16is7xx: remove obsolete loop in sc16is7xx_port_irq() X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.hugovil.com) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785731943807081667 X-GMAIL-MSGID: 1785731943807081667 From: Hugo Villeneuve Commit 834449872105 ("sc16is7xx: Fix for multi-channel stall") changed sc16is7xx_port_irq() from looping multiple times when there was still interrupts to serve. It simply changed the do {} while(1) loop to a do {} while(0) loop, which makes the loop itself now obsolete. Clean the code by removing this obsolete do {} while(0) loop. Fixes: 834449872105 ("sc16is7xx: Fix for multi-channel stall") Cc: stable@vger.kernel.org Suggested-by: Andy Shevchenko Signed-off-by: Hugo Villeneuve --- drivers/tty/serial/sc16is7xx.c | 85 ++++++++++++++++------------------ 1 file changed, 41 insertions(+), 44 deletions(-) diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index b92fd01cfeec..b2d0f6d307bd 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -724,58 +724,55 @@ static void sc16is7xx_update_mlines(struct sc16is7xx_one *one) static bool sc16is7xx_port_irq(struct sc16is7xx_port *s, int portno) { bool rc = true; + unsigned int iir, rxlen; struct uart_port *port = &s->p[portno].port; struct sc16is7xx_one *one = to_sc16is7xx_one(port, port); mutex_lock(&one->efr_lock); - do { - unsigned int iir, rxlen; + iir = sc16is7xx_port_read(port, SC16IS7XX_IIR_REG); + if (iir & SC16IS7XX_IIR_NO_INT_BIT) { + rc = false; + goto out_port_irq; + } - iir = sc16is7xx_port_read(port, SC16IS7XX_IIR_REG); - if (iir & SC16IS7XX_IIR_NO_INT_BIT) { - rc = false; - goto out_port_irq; - } + iir &= SC16IS7XX_IIR_ID_MASK; - iir &= SC16IS7XX_IIR_ID_MASK; - - switch (iir) { - case SC16IS7XX_IIR_RDI_SRC: - case SC16IS7XX_IIR_RLSE_SRC: - case SC16IS7XX_IIR_RTOI_SRC: - case SC16IS7XX_IIR_XOFFI_SRC: - rxlen = sc16is7xx_port_read(port, SC16IS7XX_RXLVL_REG); - - /* - * There is a silicon bug that makes the chip report a - * time-out interrupt but no data in the FIFO. This is - * described in errata section 18.1.4. - * - * When this happens, read one byte from the FIFO to - * clear the interrupt. - */ - if (iir == SC16IS7XX_IIR_RTOI_SRC && !rxlen) - rxlen = 1; - - if (rxlen) - sc16is7xx_handle_rx(port, rxlen, iir); - break; + switch (iir) { + case SC16IS7XX_IIR_RDI_SRC: + case SC16IS7XX_IIR_RLSE_SRC: + case SC16IS7XX_IIR_RTOI_SRC: + case SC16IS7XX_IIR_XOFFI_SRC: + rxlen = sc16is7xx_port_read(port, SC16IS7XX_RXLVL_REG); + + /* + * There is a silicon bug that makes the chip report a + * time-out interrupt but no data in the FIFO. This is + * described in errata section 18.1.4. + * + * When this happens, read one byte from the FIFO to + * clear the interrupt. + */ + if (iir == SC16IS7XX_IIR_RTOI_SRC && !rxlen) + rxlen = 1; + + if (rxlen) + sc16is7xx_handle_rx(port, rxlen, iir); + break; /* CTSRTS interrupt comes only when CTS goes inactive */ - case SC16IS7XX_IIR_CTSRTS_SRC: - case SC16IS7XX_IIR_MSI_SRC: - sc16is7xx_update_mlines(one); - break; - case SC16IS7XX_IIR_THRI_SRC: - sc16is7xx_handle_tx(port); - break; - default: - dev_err_ratelimited(port->dev, - "ttySC%i: Unexpected interrupt: %x", - port->line, iir); - break; - } - } while (0); + case SC16IS7XX_IIR_CTSRTS_SRC: + case SC16IS7XX_IIR_MSI_SRC: + sc16is7xx_update_mlines(one); + break; + case SC16IS7XX_IIR_THRI_SRC: + sc16is7xx_handle_tx(port); + break; + default: + dev_err_ratelimited(port->dev, + "ttySC%i: Unexpected interrupt: %x", + port->line, iir); + break; + } out_port_irq: mutex_unlock(&one->efr_lock); From patchwork Tue Dec 19 17:18:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugo Villeneuve X-Patchwork-Id: 181138 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp2095053dyi; Tue, 19 Dec 2023 09:23:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IF0Ltl4mSR2sNlXIsqY9jCJ2lEei0XZyDGQr4bT4z+wbVs8cr+dgRny/4IG+A90hmQLx3zT X-Received: by 2002:a17:906:3606:b0:a23:4da5:d610 with SMTP id q6-20020a170906360600b00a234da5d610mr2188945ejb.100.1703006618477; Tue, 19 Dec 2023 09:23:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703006618; cv=none; d=google.com; s=arc-20160816; b=jv7Bq7dACA/1Lc2Huf5Ah+7jecN4vIh5OtSxrhPXA3eTiv/Yk9GwiX5Ep7SpxGsdWz tPRpD8I3HAz0WMnJMWyLJesO6wDPHHE3Lhlo3J9Y8r96aJipm7t+wyIDf+T6WQuL9L67 /QJUFhryYmx9iy2PGM1KGio/gNKMAEsWZOvmvHX0g0HE9/LAi6YdwxQk+cLuvizA3laq zBj6obV+wX0c/LPZCeZ6Q0oDS27fRhAXkLCpmjX9nnNQgo6ZSpnBo2QxyXq8NljoMNl5 BzcCgFhFfXkAT5gdTVTvgXao1dcf8wA+iB4m/ai4YUJr5zS8mee1U2OdBRh2IC5aGKVz 2jYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=subject:content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:cc:to:from:dkim-signature; bh=wIhfJw84538n4x2qE0zhacVXgJE56py7Ypbq2I5JZ+8=; fh=a4WmmkWtrWkl6GT2O1otVp3028EnXdnaDQnaGXCvODo=; b=pwYdKZDnCG1YZxlPJWGZm22k6vGYHq+zsRY1CW0NqAvK9GR8jzOpP9GSdlEdWXF2NH lBYbPO/8SPPZhKuE3FRvhn/ETR5L5auUSs1m+XEhElTBx3Pq6Qsm6n7oH4AxsX542Rwn ceQvK4AoCckW2MqA9UPKG6LSJoNgrcWrFsTZ/nWNMohA96mrgwkjPHcrllw3gJu/4Pj5 5jeqG1exnaEA1ZvcDG1SQCZY3cmbqEgKTNUB1TPOBYIDyo/JJ4qJoFPM28ZEPGpN9F3n Tw9kOy9osKYRm3qGpgubO2NQp8ExW3ud03l+LfQxsuohVnO7J4wXlIGK8FxSPC+wX2wr RrSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=KVIIQGPA; spf=pass (google.com: domain of linux-kernel+bounces-5674-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5674-ouuuleilei=gmail.com@vger.kernel.org" Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id z9-20020a170906714900b00a235dfc2621si1630208ejj.258.2023.12.19.09.23.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 09:23:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-5674-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=KVIIQGPA; spf=pass (google.com: domain of linux-kernel+bounces-5674-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5674-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id C447C1F213E9 for ; Tue, 19 Dec 2023 17:23:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 88AB93D0CB; Tue, 19 Dec 2023 17:19:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="KVIIQGPA" X-Original-To: linux-kernel@vger.kernel.org Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1D94237146; Tue, 19 Dec 2023 17:19:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hugovil.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hugovil.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=x; h=Subject:Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Cc:To :From:subject:date:message-id:reply-to; bh=wIhfJw84538n4x2qE0zhacVXgJE56py7Ypbq2I5JZ+8=; b=KVIIQGPATtH3Pn7WYoG+KvGah1 r/Y7s9pDUYBP5gslMkJ4ByM1gjt4VOusKN7uVyelPl4vn7fZOCX42OUqa38RwQsxwEZReKq7fYICS aTX7k2GsdZSsOoYQWAX6xVQ3oBLRu/IjvB0O8aSemohXPODPOzb6r/4fkBuBR33KGF/M=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168]:40128 helo=pettiford.lan) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1rFdkM-0007Ao-OM; Tue, 19 Dec 2023 12:19:11 -0500 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, jirislaby@kernel.org, jringle@gridpoint.com, kubakici@wp.pl, phil@raspberrypi.org, bo.svangard@embeddedart.se Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, hugo@hugovil.com, Hugo Villeneuve , stable@vger.kernel.org, Andy Shevchenko Date: Tue, 19 Dec 2023 12:18:48 -0500 Message-Id: <20231219171903.3530985-5-hugo@hugovil.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231219171903.3530985-1-hugo@hugovil.com> References: <20231219171903.3530985-1-hugo@hugovil.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SA-Exim-Connect-IP: 70.80.174.168 X-SA-Exim-Mail-From: hugo@hugovil.com X-Spam-Level: X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * -0.0 T_SCC_BODY_TEXT_LINE No description available. Subject: [PATCH 04/18] serial: sc16is7xx: improve do/while loop in sc16is7xx_irq() X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.hugovil.com) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785731867968739013 X-GMAIL-MSGID: 1785731867968739013 From: Hugo Villeneuve Simplify and improve readability by replacing while(1) loop with do {} while, and by using the keep_polling variable as the exit condition, making it more explicit. Fixes: 834449872105 ("sc16is7xx: Fix for multi-channel stall") Cc: stable@vger.kernel.org Suggested-by: Andy Shevchenko Signed-off-by: Hugo Villeneuve --- drivers/tty/serial/sc16is7xx.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index b2d0f6d307bd..8a038a9be09e 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -782,17 +782,17 @@ static bool sc16is7xx_port_irq(struct sc16is7xx_port *s, int portno) static irqreturn_t sc16is7xx_irq(int irq, void *dev_id) { + bool keep_polling; + struct sc16is7xx_port *s = (struct sc16is7xx_port *)dev_id; - while (1) { - bool keep_polling = false; + do { + keep_polling = false; int i; for (i = 0; i < s->devtype->nr_uart; ++i) keep_polling |= sc16is7xx_port_irq(s, i); - if (!keep_polling) - break; - } + } while (keep_polling); return IRQ_HANDLED; } From patchwork Tue Dec 19 17:18:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugo Villeneuve X-Patchwork-Id: 181132 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp2094557dyi; Tue, 19 Dec 2023 09:22:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IHQlIJuJwGxzGJl10Kc58cKPPQlgProFnZ+O22g17P/ZiefWneZuOXvGWincOmADHVSSl8W X-Received: by 2002:a05:622a:45:b0:425:4043:8d3d with SMTP id y5-20020a05622a004500b0042540438d3dmr16809098qtw.88.1703006567227; Tue, 19 Dec 2023 09:22:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703006567; cv=none; d=google.com; s=arc-20160816; b=kBNq8V/Lci20047zKng2VvlqudHDPABFpddMNxLy2NVrjU9P4vk2slZNzTcUYndgzp 2s8kzaslwAEIlUdNikZBpILHV6/0cJxbqQ9GrN5jwpgonP6YXkPpyCENLqfa2WkmiYtt LgGhJvR8/5yrHz9fBslx8vmfWu+qZjB8VARwZurhX151cHNxwQ254em4oP/DvmVke35a yT+eDY0CSrgsvL8Rh4iF1DKTe3hKDaKzMY2Y8vAX0M73m/kZi161Y9AMVkcVWV8GRlX8 QQWQvrnmoFASjj+Qn3ZPqJyXghL+xGRBFmh8yqCR5AXbfYmK4A3LLsOWCwJHvDcetEdL cc3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=subject:content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:cc:to:from:dkim-signature; bh=vtaUMnMT8EggKRdVVV4aSCElIVRE59twHxnKq4mL2OA=; fh=cU7nueyVLD6PCX143V/gcz7kaNKnsE7kxUBegEucbAs=; b=eGd37FivFuZoQCFL84N7BxoLzPCa4z61TnsI3S4vdvzI0COY6BnpNFrQOwCVtBsqI2 CaE5W9MnP1DAh7qiC16an3D/y7hEtXkUBkKijno2qUzo7cfM0Zz6V69rgDQCp1JgWvrE s9uSlDfnBIIs9hjFr7FsFxk0m0paxQT9lQ9ZTZy3seWitQfVJ/XVoin4qcP+qhmywATY 3Q27sxbV6WPgicGOQHZj9XCNl+QW+869A1xB0lMCAEchJPZbNOf5vbhmlxVVxe/VYTS4 ckTtIeD2687z6qsOfRvU6L7ZJ+do0/3iGTEngpDOi7p8ZIUrwl21lvuBZuWkJA4cznM3 bbwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=BRM1bdus; spf=pass (google.com: domain of linux-kernel+bounces-5670-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5670-ouuuleilei=gmail.com@vger.kernel.org" Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id j15-20020ac84c8f000000b00423ed2c8509si24462347qtv.308.2023.12.19.09.22.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 09:22:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-5670-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=BRM1bdus; spf=pass (google.com: domain of linux-kernel+bounces-5670-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5670-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id E673A1C24FC9 for ; Tue, 19 Dec 2023 17:22:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7B7493B29D; Tue, 19 Dec 2023 17:19:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="BRM1bdus" X-Original-To: linux-kernel@vger.kernel.org Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DE6D136AEA; Tue, 19 Dec 2023 17:19:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hugovil.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hugovil.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=x; h=Subject:Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Cc:To :From:subject:date:message-id:reply-to; bh=vtaUMnMT8EggKRdVVV4aSCElIVRE59twHxnKq4mL2OA=; b=BRM1bdusNTuln/ySzvTXmFKOSo 9z6XZgBwU9Xf0XVHKmHLt720y0NWn6X8yAPxzEmcMw3iA5cXwcZFsUEas5Anu7T0375scNgSSDLxS bzn6zxZiv4FSQ0md7r9VsTGrk2NXQasVTPfejHhytnSOi/FEh6MCtjUGnqRxgtIgWTwM=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168]:40128 helo=pettiford.lan) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1rFdkN-0007Ao-Pj; Tue, 19 Dec 2023 12:19:12 -0500 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, jirislaby@kernel.org, jringle@gridpoint.com, kubakici@wp.pl, phil@raspberrypi.org, bo.svangard@embeddedart.se Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, hugo@hugovil.com, Hugo Villeneuve Date: Tue, 19 Dec 2023 12:18:49 -0500 Message-Id: <20231219171903.3530985-6-hugo@hugovil.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231219171903.3530985-1-hugo@hugovil.com> References: <20231219171903.3530985-1-hugo@hugovil.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SA-Exim-Connect-IP: 70.80.174.168 X-SA-Exim-Mail-From: hugo@hugovil.com X-Spam-Level: X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * -0.0 T_SCC_BODY_TEXT_LINE No description available. Subject: [PATCH 05/18] serial: sc16is7xx: use DECLARE_BITMAP for sc16is7xx_lines bitfield X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.hugovil.com) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785731814049577948 X-GMAIL-MSGID: 1785731814049577948 From: Hugo Villeneuve Replace the explicit sc16is7xx_lines bitfield declaration with the generic macro DECLARE_BITMAP() to reserve just enough memory to contain all required bits. This also improves code self-documentation by showing the maximum number of bits required. This conversion now makes sc16is7xx_lines an array, so drop the "&" before sc16is7xx_lines in all bit access functions. Signed-off-by: Hugo Villeneuve Reviewed-by: Andy Shevchenko --- drivers/tty/serial/sc16is7xx.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index 8a038a9be09e..597280a5d0f3 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -346,7 +346,7 @@ struct sc16is7xx_port { struct sc16is7xx_one p[]; }; -static unsigned long sc16is7xx_lines; +static DECLARE_BITMAP(sc16is7xx_lines, SC16IS7XX_MAX_DEVS); static struct uart_driver sc16is7xx_uart = { .owner = THIS_MODULE, @@ -1534,7 +1534,7 @@ static int sc16is7xx_probe(struct device *dev, SC16IS7XX_IOCONTROL_SRESET_BIT); for (i = 0; i < devtype->nr_uart; ++i) { - s->p[i].port.line = find_first_zero_bit(&sc16is7xx_lines, + s->p[i].port.line = find_first_zero_bit(sc16is7xx_lines, SC16IS7XX_MAX_DEVS); if (s->p[i].port.line >= SC16IS7XX_MAX_DEVS) { ret = -ERANGE; @@ -1585,7 +1585,7 @@ static int sc16is7xx_probe(struct device *dev, if (ret) goto out_ports; - set_bit(s->p[i].port.line, &sc16is7xx_lines); + set_bit(s->p[i].port.line, sc16is7xx_lines); /* Enable EFR */ sc16is7xx_port_write(&s->p[i].port, SC16IS7XX_LCR_REG, @@ -1644,7 +1644,7 @@ static int sc16is7xx_probe(struct device *dev, out_ports: for (i = 0; i < devtype->nr_uart; i++) - if (test_and_clear_bit(s->p[i].port.line, &sc16is7xx_lines)) + if (test_and_clear_bit(s->p[i].port.line, sc16is7xx_lines)) uart_remove_one_port(&sc16is7xx_uart, &s->p[i].port); kthread_stop(s->kworker_task); @@ -1672,7 +1672,7 @@ static void sc16is7xx_remove(struct device *dev) for (i = 0; i < s->devtype->nr_uart; i++) { kthread_cancel_delayed_work_sync(&s->p[i].ms_work); - if (test_and_clear_bit(s->p[i].port.line, &sc16is7xx_lines)) + if (test_and_clear_bit(s->p[i].port.line, sc16is7xx_lines)) uart_remove_one_port(&sc16is7xx_uart, &s->p[i].port); sc16is7xx_power(&s->p[i].port, 0); } From patchwork Tue Dec 19 17:18:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugo Villeneuve X-Patchwork-Id: 181131 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp2094543dyi; Tue, 19 Dec 2023 09:22:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IG9XhjfsvC30X/Hs7cQf6f1fT9iEj4cGXIJHi3fLa6BtgFEu1uM0tc1TcbVW+2SAL4u2bSF X-Received: by 2002:a05:600c:2259:b0:40c:1e66:4dd5 with SMTP id a25-20020a05600c225900b0040c1e664dd5mr9051253wmm.216.1703006565566; Tue, 19 Dec 2023 09:22:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703006565; cv=none; d=google.com; s=arc-20160816; b=lRpmgJBIv93v1Ugyuo0IIMTMmlAxkmJGYfazcIu6EK/wJ88zbIJG6hOMoNFzEYAR34 EfANH0PLZBjIrDYp9JdjWw1yfln4weaVItZ3Y8y4r2qOqEqsk39hejRuGIekE4lVwKRk /KzjPnJrVq7JRnb5aOHUQ9dM9w+zWE5Itu3ZgVay0pk3XgJzpwce7m6iIYrD0rX6mJpV fQ0dAxxlDfU/PN+e7cgkKYp+bZN1PJN0bZ4aS56lpQHe6KmfXdv7Mip54JIinkdJwfpz 2C/T51tpKHcXjAEukEwjAVtQj6Pe3Xc6BUQK3oOnsVUQutg19FeVyscJ6xOICVSQLCV2 DVQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=subject:content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:cc:to:from:dkim-signature; bh=xfb6kuDgKADdMzZzBWchLLnlFd6E5qjoWxtuwWK9Sxk=; fh=XmY8az1z5a+LjrZQ1DQahIeB3Uro2SuOHb+6mIYcxXo=; b=FKYQhN1TgbrZViWv9SKuNQA2BsPD37GeUIVMbJCYTHA9h1xHSzt80uGW/5OinsjRcX 8zb0OvhDh6G4WbbmhzmeUnnPZRBBjsSfic+wJalHrIqP+0fayOFVg0Ei6WtI/tl16Cxw wMXvfU2ZScRQ5lJors7KL0Ej0gHouQSygJdZU04HGkU0GJBWe5VWB+taLwuKLdAzHtUa faNPryS+P53yNH8RTxEKyiZTttp8u8lU7lWHT2WYFdpc3Dyf1a6iBm8rj8hIXCs6UZZN WpH2x6UkRrS+YYtbuN2gUraji+IHSgLw0cgXeXfrYS3U9WQZmjmizIokb+3DNu6xpfXo dMCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=bfismZTE; spf=pass (google.com: domain of linux-kernel+bounces-5665-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5665-ouuuleilei=gmail.com@vger.kernel.org" Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id k7-20020a170906054700b00a23674648d6si1278014eja.815.2023.12.19.09.22.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 09:22:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-5665-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=bfismZTE; spf=pass (google.com: domain of linux-kernel+bounces-5665-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5665-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 5F96C1F2631C for ; Tue, 19 Dec 2023 17:22:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8A41639ACD; Tue, 19 Dec 2023 17:19:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="bfismZTE" X-Original-To: linux-kernel@vger.kernel.org Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E278436AF7; Tue, 19 Dec 2023 17:19:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hugovil.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hugovil.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=x; h=Subject:Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Cc:To :From:subject:date:message-id:reply-to; bh=xfb6kuDgKADdMzZzBWchLLnlFd6E5qjoWxtuwWK9Sxk=; b=bfismZTEkWG4Ih0UN0v1U5iSdR I6D5TQ4LYGpXeirp/GWIg4PAY9wNRxLtQFySR17aQnh5kq0s3PEU6SPugupj1/OOWiIxK6vc9jL6x N7J+/+kIKSEiaAfzEU0YeWn/wnoW9Tkl+ByzXzZ4ly0YLpiZTH93ol6SPz4yhi34Zuoo=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168]:40128 helo=pettiford.lan) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1rFdkO-0007Ao-PK; Tue, 19 Dec 2023 12:19:13 -0500 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, jirislaby@kernel.org, jringle@gridpoint.com, kubakici@wp.pl, phil@raspberrypi.org, bo.svangard@embeddedart.se Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, hugo@hugovil.com, Hugo Villeneuve , Andy Shevchenko Date: Tue, 19 Dec 2023 12:18:50 -0500 Message-Id: <20231219171903.3530985-7-hugo@hugovil.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231219171903.3530985-1-hugo@hugovil.com> References: <20231219171903.3530985-1-hugo@hugovil.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SA-Exim-Connect-IP: 70.80.174.168 X-SA-Exim-Mail-From: hugo@hugovil.com X-Spam-Level: X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * -0.0 T_SCC_BODY_TEXT_LINE No description available. Subject: [PATCH 06/18] serial: sc16is7xx: use spi_get_device_match_data() X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.hugovil.com) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785731812572102810 X-GMAIL-MSGID: 1785731812572102810 From: Hugo Villeneuve Use preferred spi_get_device_match_data() instead of device_get_match_data() and spi_get_device_id() to get the driver match data. Suggested-by: Andy Shevchenko Signed-off-by: Hugo Villeneuve --- drivers/tty/serial/sc16is7xx.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index 597280a5d0f3..8cbf54d0a16c 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -1742,14 +1742,10 @@ static int sc16is7xx_spi_probe(struct spi_device *spi) if (ret) return ret; - if (spi->dev.of_node) { - devtype = device_get_match_data(&spi->dev); - if (!devtype) - return -ENODEV; - } else { - const struct spi_device_id *id_entry = spi_get_device_id(spi); - - devtype = (struct sc16is7xx_devtype *)id_entry->driver_data; + devtype = (struct sc16is7xx_devtype *)spi_get_device_match_data(spi); + if (!devtype) { + dev_err(&spi->dev, "Failed to match device\n"); + return -ENODEV; } for (i = 0; i < devtype->nr_uart; i++) { From patchwork Tue Dec 19 17:18:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugo Villeneuve X-Patchwork-Id: 181137 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp2094971dyi; Tue, 19 Dec 2023 09:23:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IFxPHpoSV38CuFZcmfQm8QbbXvid3nVmTre56oYMdt8hEgfo4QrmEj9Xn0R3GRWPb6KkoIW X-Received: by 2002:a50:8a83:0:b0:553:456e:b609 with SMTP id j3-20020a508a83000000b00553456eb609mr2654277edj.13.1703006609701; Tue, 19 Dec 2023 09:23:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703006609; cv=none; d=google.com; s=arc-20160816; b=hi537e7pCK/OAsH+EnwUWbxLTJzLNGD9HwNb7ztpeUMGWvJ76huTgVJqci8TiHKfV4 AwslI6MR3Rg6L8cOPK0XMTzIV3WPuDeFtXl7Vw7uSs3riJpqNdTJTOtnDHy4YYLUyZjK M4yRXYZUr5wwECOCMkJOUI8RFXy4AvsIAcVliQgzDS6eoufn7vJAvsqbGkL3daruWqbs iDyWgnK4g2CHWItDiQb8NnGUVQ/iyiYaI2lEc9793+93r4KouODRqY00yWC6B5w8q00S nrx39iTAjll4GFTlWTOfDBz/SLlfyIeer1hoWA3Q6RHgM/jYWSabqtMJ5O1L+AFYUFF7 qnfw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=subject:content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:cc:to:from:dkim-signature; bh=wpxONzVdPDOBmeZf3AvhDTOhsPLl8o7m9pBKKhTUjcU=; fh=XmY8az1z5a+LjrZQ1DQahIeB3Uro2SuOHb+6mIYcxXo=; b=b2dqq1q6EXWmoLCohz8//oeJwJ62sY07FCDR/4gUpj/JUCbEYC0oWubkuEubHA4ziI scY2B8TeNCyWaOUAfRzLZOumn/KjxA6x54nXaH6GXW3Z0/UH/np3FbNXMoI0O/Zq83gf i2phqSHkQqGRsMPohzKsP+bA5Re1fi9MDavIn6oETr7aMYJEzn5Cv2AME7U+MMMJ2xgk Gm1BeQJfx7CpRSiHpZ/SA1Km6o9L2h+V/svr8MLDw9mBffm72VrMMsJleLcL3cVRn+HC wXDJ6kW9O3ZLqwysKJVUo3N9pO8KAUohZfG84tlOq3Cm26c7K6dX5WGFmL5y0fOR1lWD puzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b="So/GFKJp"; spf=pass (google.com: domain of linux-kernel+bounces-5675-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5675-ouuuleilei=gmail.com@vger.kernel.org" Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id r19-20020a05640251d300b005523ad0a3c6si5695655edd.468.2023.12.19.09.23.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 09:23:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-5675-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b="So/GFKJp"; spf=pass (google.com: domain of linux-kernel+bounces-5675-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5675-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 3CC4B1F23119 for ; Tue, 19 Dec 2023 17:23:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4960C35282; Tue, 19 Dec 2023 17:19:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="So/GFKJp" X-Original-To: linux-kernel@vger.kernel.org Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D1CE337178; Tue, 19 Dec 2023 17:19:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hugovil.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hugovil.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=x; h=Subject:Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Cc:To :From:subject:date:message-id:reply-to; bh=wpxONzVdPDOBmeZf3AvhDTOhsPLl8o7m9pBKKhTUjcU=; b=So/GFKJprQ3l/iO+UzDe0ddOtI DlyMEhRL+z38g6fjAfX+No4dwSQ6iPQTBJydcy8Co3pBx5BxpU/iK86h6SKDrdTUnBKfjuV3cPss1 UbZQErZihBwTW6m69yTCXpQ7Z9QVkC/S6d9EE6ZgAySbKcGk2BgcWCT1+IegB79AmseY=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168]:40128 helo=pettiford.lan) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1rFdkP-0007Ao-P9; Tue, 19 Dec 2023 12:19:14 -0500 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, jirislaby@kernel.org, jringle@gridpoint.com, kubakici@wp.pl, phil@raspberrypi.org, bo.svangard@embeddedart.se Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, hugo@hugovil.com, Hugo Villeneuve , Andy Shevchenko Date: Tue, 19 Dec 2023 12:18:51 -0500 Message-Id: <20231219171903.3530985-8-hugo@hugovil.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231219171903.3530985-1-hugo@hugovil.com> References: <20231219171903.3530985-1-hugo@hugovil.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SA-Exim-Connect-IP: 70.80.174.168 X-SA-Exim-Mail-From: hugo@hugovil.com X-Spam-Level: X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * -0.0 T_SCC_BODY_TEXT_LINE No description available. Subject: [PATCH 07/18] serial: sc16is7xx: use i2c_get_match_data() X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.hugovil.com) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785731858818105547 X-GMAIL-MSGID: 1785731858818105547 From: Hugo Villeneuve Use preferred i2c_get_match_data() instead of device_get_match_data() and i2c_client_get_device_id() to get the driver match data. Suggested-by: Andy Shevchenko Signed-off-by: Hugo Villeneuve --- drivers/tty/serial/sc16is7xx.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index 8cbf54d0a16c..97a97a4bd71a 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -1798,17 +1798,14 @@ MODULE_ALIAS("spi:sc16is7xx"); #ifdef CONFIG_SERIAL_SC16IS7XX_I2C static int sc16is7xx_i2c_probe(struct i2c_client *i2c) { - const struct i2c_device_id *id = i2c_client_get_device_id(i2c); const struct sc16is7xx_devtype *devtype; struct regmap *regmaps[2]; unsigned int i; - if (i2c->dev.of_node) { - devtype = device_get_match_data(&i2c->dev); - if (!devtype) - return -ENODEV; - } else { - devtype = (struct sc16is7xx_devtype *)id->driver_data; + devtype = (struct sc16is7xx_devtype *)i2c_get_match_data(i2c); + if (!devtype) { + dev_err(&i2c->dev, "Failed to match device\n"); + return -ENODEV; } for (i = 0; i < devtype->nr_uart; i++) { From patchwork Tue Dec 19 17:18:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugo Villeneuve X-Patchwork-Id: 181128 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp2094199dyi; Tue, 19 Dec 2023 09:22:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IFGP1Upgdhl4raUWW7+YiABbpOZu/zye+12tuq0iKK2f9xtkzdVT53tKKhjYVc+qAEJ6LfJ X-Received: by 2002:a17:902:ced2:b0:1d3:e8a5:7562 with SMTP id d18-20020a170902ced200b001d3e8a57562mr529123plg.96.1703006529561; Tue, 19 Dec 2023 09:22:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703006529; cv=none; d=google.com; s=arc-20160816; b=jw+BFwYVb8vUNMYvgxXYwnhmm0ThX8cvNtwbJgvFxymwiJlVVPlm9dXNR4ECDDFWQa xE7xDeOjRrLyRisPP6Z1ufWT0fgv4KoaFUJotECZ8OZktMcy17K11kY1c0M7qyJnfbG1 rkLupS+vVRV0EowWWSzYjAm0ctmEvIYvrzYLkHP81+1xHqAgbYQMC/kXuZUrYFGSzb8p RiqTfgocXvlJshL00mmYtVQlTQHDyl+NFWMSVe/ad8HyunLuqdfnKravoFDk9Axat5wc 6N6OMDYKb+alpFfPTFS6Z07HJ7HQFF0pbVkY5TcIaOr+U4/iiHiPPG7ereHGBh2uzMu0 OJIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=subject:content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:cc:to:from:dkim-signature; bh=ZsiNmlD3MHHl+wojDLWkdnOLAS+GCC2vUU+7h86+VQw=; fh=cU7nueyVLD6PCX143V/gcz7kaNKnsE7kxUBegEucbAs=; b=IXow0BzJoFWY1q/ml9sSG5xnc3+v338BsoaOoNgKiInC1Wu34866VliCTOZX6gSzlv L4AvhaHjRcysJ3Kj4yRKC/UNa0g9Y5SLfmg+1D7V5dpq5UhrGlDwqplqVOA4DaQOT/My bf5ZzdbeM7SRvhQCbClGPKQhz5VT8sIQoxO4XbQsQrX3QPyJ0TOmXN0WszewF0EG5mUj OJZMJYOX03dBTp6E5ZmlvLMcF+EQjA+2setjiaDQbVwS7laOTn7T2UaI7eaOHHOCJ0Z/ oyavIT+n5MuE36JDFQyHnzvO1sdYsr0QHt/v9rQdYpm7qOBwtjdmFJO7fkeFhXEfAEyH 3DTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=p0TX8kFA; spf=pass (google.com: domain of linux-kernel+bounces-5668-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5668-ouuuleilei=gmail.com@vger.kernel.org" Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id q6-20020a17090311c600b001bdd0d0530dsi20184593plh.129.2023.12.19.09.22.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 09:22:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-5668-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=p0TX8kFA; spf=pass (google.com: domain of linux-kernel+bounces-5668-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5668-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id B16A228748B for ; Tue, 19 Dec 2023 17:22:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9986439AD7; Tue, 19 Dec 2023 17:19:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="p0TX8kFA" X-Original-To: linux-kernel@vger.kernel.org Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1F4C037148; Tue, 19 Dec 2023 17:19:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hugovil.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hugovil.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=x; h=Subject:Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Cc:To :From:subject:date:message-id:reply-to; bh=ZsiNmlD3MHHl+wojDLWkdnOLAS+GCC2vUU+7h86+VQw=; b=p0TX8kFAxruNP3Fxt7QzvLJggc Lv5YSnGE42ufgm/ALsF5KQyLjJPa1YXhC+ChSNueIcxL8U0Gdw868Z7FZXWMXcPvAIDMSPy//vRGK T4ejEPFbKwevFPxeHaRPsW7Hh/QCbns6muG5tI+LV3DU9PYPIcwMRt+qeSgmZiH6d8Uk=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168]:40128 helo=pettiford.lan) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1rFdkQ-0007Ao-O6; Tue, 19 Dec 2023 12:19:15 -0500 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, jirislaby@kernel.org, jringle@gridpoint.com, kubakici@wp.pl, phil@raspberrypi.org, bo.svangard@embeddedart.se Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, hugo@hugovil.com, Hugo Villeneuve Date: Tue, 19 Dec 2023 12:18:52 -0500 Message-Id: <20231219171903.3530985-9-hugo@hugovil.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231219171903.3530985-1-hugo@hugovil.com> References: <20231219171903.3530985-1-hugo@hugovil.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SA-Exim-Connect-IP: 70.80.174.168 X-SA-Exim-Mail-From: hugo@hugovil.com X-Spam-Level: X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * -0.0 T_SCC_BODY_TEXT_LINE No description available. Subject: [PATCH 08/18] serial: sc16is7xx: add driver name to struct uart_driver X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.hugovil.com) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785731774777651978 X-GMAIL-MSGID: 1785731774777651978 From: Hugo Villeneuve Make sure that the driver name is displayed instead of "unknown" when displaying the driver infos: Before: cat /proc/tty/drivers | grep ttySC unknown /dev/ttySC 243 0-7 serial After: cat /proc/tty/drivers | grep ttySC sc16is7xx /dev/ttySC 243 0-7 serial Signed-off-by: Hugo Villeneuve --- drivers/tty/serial/sc16is7xx.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index 97a97a4bd71a..3fb99b6929f3 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -350,6 +350,7 @@ static DECLARE_BITMAP(sc16is7xx_lines, SC16IS7XX_MAX_DEVS); static struct uart_driver sc16is7xx_uart = { .owner = THIS_MODULE, + .driver_name = SC16IS7XX_NAME, .dev_name = "ttySC", .nr = SC16IS7XX_MAX_DEVS, }; From patchwork Tue Dec 19 17:18:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugo Villeneuve X-Patchwork-Id: 181133 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp2094598dyi; Tue, 19 Dec 2023 09:22:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IFmtaqbtnkIxpCKibT7u1qa08JDA14jl4asYo3v8lDzx+42g1yY+LztLgUse7rWhzv1h6aQ X-Received: by 2002:a17:906:1812:b0:a0c:46b4:a705 with SMTP id v18-20020a170906181200b00a0c46b4a705mr9849988eje.56.1703006572174; Tue, 19 Dec 2023 09:22:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703006572; cv=none; d=google.com; s=arc-20160816; b=TwfoeBN8vR5HW2vZ/GslKMUktWW1mtlXWJZvaHW9EFd4BmbDTRnCRsXF6rfmhuWMWX uTLTPJTEV/26bVsbmtfYT2Ep9zcuHHYOJTjKk6/b4rFScO5Nh8rUzp+llv0/Qik6YGBY EfWYGxhxNS2Noy4ZcmG1LlRxvm4cCUzN56WoYIcEaaIytFXKN3Y74UPMhaLMbX8cPKfD CLVNFWJEq/PmdsIu/L9jEsD/IYgYxzDoQNbcCy6tywz+nTiuzUdFpWeVOfNnnCmj++VM g75JEkqo7PK+GS/ORCI9SEqVULJZZy8Vy+o8VBRFIRAUmlwoV3shdhN+u2vTzEaUM5ZI KBBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=subject:content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:cc:to:from:dkim-signature; bh=HhHbtgJLUFnfTgDCXdi3cYtYacZcjPvaik0ZgmPx/5k=; fh=cU7nueyVLD6PCX143V/gcz7kaNKnsE7kxUBegEucbAs=; b=ftwkAxBQS7GS18aQM3ZEG8Jy4sLCYKlQWfjzj3CD1GUaA39EhoAb9l3ee/jSHTKC+d TI4FxwEyOHWJ9d3eURj22MrVf5tOu9z82UAK/n4jVW1MAmAFwHl9Mx48DAfMjfkLxuFk ceMMonK6EvnnldJk7aLPcUJdYSFYl+bYZxKKNx8AmNGxB9PjtVW6A2N8366Msn3rfl9m dY7LmcvhjORLU6iYYGsXkKoOQH3qs1v/ztnd8FVZI91983v33b2TJry6rs8qHtgqd5gd GFztc248iSwPhpQ0Hph54TKxL0wroQkZDK2C+vsT9H7cyESPzQBWstEmIBZXPRd0db1/ r5ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=eg5+ieEI; spf=pass (google.com: domain of linux-kernel+bounces-5666-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5666-ouuuleilei=gmail.com@vger.kernel.org" Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id cw10-20020a170906c78a00b00a234e172a3fsi2124971ejb.583.2023.12.19.09.22.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 09:22:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-5666-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=eg5+ieEI; spf=pass (google.com: domain of linux-kernel+bounces-5666-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5666-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id ECAF31F236D4 for ; Tue, 19 Dec 2023 17:22:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BBA9A39AE2; Tue, 19 Dec 2023 17:19:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="eg5+ieEI" X-Original-To: linux-kernel@vger.kernel.org Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1513337145; Tue, 19 Dec 2023 17:19:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hugovil.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hugovil.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=x; h=Subject:Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Cc:To :From:subject:date:message-id:reply-to; bh=HhHbtgJLUFnfTgDCXdi3cYtYacZcjPvaik0ZgmPx/5k=; b=eg5+ieEIjziTn7rV3RSBdTZFQc ENwvgwAHp3L/GkvwUsDJAHJ1V1WwnWz0QaFfCccwuCsOGEhE6WLro8PONzp6NvGnFXR/7i/wVOk2Y 4AGjYFJhCKJFuT4LmeX632Bst13yFAzsBlcTmJXDhZWCGkDCnpI+luF7Hon9a2oo9wJk=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168]:40128 helo=pettiford.lan) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1rFdkR-0007Ao-Mo; Tue, 19 Dec 2023 12:19:16 -0500 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, jirislaby@kernel.org, jringle@gridpoint.com, kubakici@wp.pl, phil@raspberrypi.org, bo.svangard@embeddedart.se Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, hugo@hugovil.com, Hugo Villeneuve Date: Tue, 19 Dec 2023 12:18:53 -0500 Message-Id: <20231219171903.3530985-10-hugo@hugovil.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231219171903.3530985-1-hugo@hugovil.com> References: <20231219171903.3530985-1-hugo@hugovil.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SA-Exim-Connect-IP: 70.80.174.168 X-SA-Exim-Mail-From: hugo@hugovil.com X-Spam-Level: X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * -0.0 T_SCC_BODY_TEXT_LINE No description available. Subject: [PATCH 09/18] serial: sc16is7xx: add macro for max number of UART ports X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.hugovil.com) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785731819468372091 X-GMAIL-MSGID: 1785731819468372091 From: Hugo Villeneuve Add macro to hold the maximum number of UART ports per IC/device. Signed-off-by: Hugo Villeneuve --- drivers/tty/serial/sc16is7xx.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index 3fb99b6929f3..29844e2eefc5 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -28,6 +28,7 @@ #define SC16IS7XX_NAME "sc16is7xx" #define SC16IS7XX_MAX_DEVS 8 +#define SC16IS7XX_MAX_PORTS 2 /* Maximum number of UART ports per IC. */ /* SC16IS7XX register definitions */ #define SC16IS7XX_RHR_REG (0x00) /* RX FIFO */ @@ -1396,11 +1397,11 @@ static void sc16is7xx_setup_irda_ports(struct sc16is7xx_port *s) int i; int ret; int count; - u32 irda_port[2]; + u32 irda_port[SC16IS7XX_MAX_PORTS]; struct device *dev = s->p[0].port.dev; count = device_property_count_u32(dev, "irda-mode-ports"); - if (count < 0 || count > ARRAY_SIZE(irda_port)) + if (count < 0 || count > SC16IS7XX_MAX_PORTS) return; ret = device_property_read_u32_array(dev, "irda-mode-ports", @@ -1423,11 +1424,11 @@ static int sc16is7xx_setup_mctrl_ports(struct sc16is7xx_port *s, int i; int ret; int count; - u32 mctrl_port[2]; + u32 mctrl_port[SC16IS7XX_MAX_PORTS]; struct device *dev = s->p[0].port.dev; count = device_property_count_u32(dev, "nxp,modem-control-line-ports"); - if (count < 0 || count > ARRAY_SIZE(mctrl_port)) + if (count < 0 || count > SC16IS7XX_MAX_PORTS) return 0; ret = device_property_read_u32_array(dev, "nxp,modem-control-line-ports", @@ -1471,6 +1472,8 @@ static int sc16is7xx_probe(struct device *dev, int i, ret; struct sc16is7xx_port *s; + WARN_ON(devtype->nr_uart > SC16IS7XX_MAX_PORTS); + for (i = 0; i < devtype->nr_uart; i++) if (IS_ERR(regmaps[i])) return PTR_ERR(regmaps[i]); @@ -1730,7 +1733,7 @@ static unsigned int sc16is7xx_regmap_port_mask(unsigned int port_id) static int sc16is7xx_spi_probe(struct spi_device *spi) { const struct sc16is7xx_devtype *devtype; - struct regmap *regmaps[2]; + struct regmap *regmaps[SC16IS7XX_MAX_PORTS]; unsigned int i; int ret; @@ -1800,7 +1803,7 @@ MODULE_ALIAS("spi:sc16is7xx"); static int sc16is7xx_i2c_probe(struct i2c_client *i2c) { const struct sc16is7xx_devtype *devtype; - struct regmap *regmaps[2]; + struct regmap *regmaps[SC16IS7XX_MAX_PORTS]; unsigned int i; devtype = (struct sc16is7xx_devtype *)i2c_get_match_data(i2c); From patchwork Tue Dec 19 17:18:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugo Villeneuve X-Patchwork-Id: 181145 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp2099487dyi; Tue, 19 Dec 2023 09:30:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IEL84be18/Vj40mIi09w7K7ksKrXbzJFccx47AiYw1IwXj403DcuGhLT6C3V41vAOiahw3U X-Received: by 2002:a17:906:140f:b0:a23:6d5a:7dcb with SMTP id p15-20020a170906140f00b00a236d5a7dcbmr1251051ejc.75.1703007057427; Tue, 19 Dec 2023 09:30:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703007057; cv=none; d=google.com; s=arc-20160816; b=wJwvnvoIskt7oW3+PqE9uA9pQTNROLALspx/pZIv1ixMXhAAkI5Bj1EogeFTMMOP0k qmc5n2ByERGRgUWmj6k0uGN+kQ0uGuPLNnwnvuZ1SRrMTB+aOqOww6N9jSH1Ywjg3S+t QUt0wTJ521MOoEXKaOjOM9kwwsD64+sADTsWLonxoYvG0RdHOtPke3wNmI04OYTiDRYq 8oj7gq3uCU+obLGTSf1/2z6Fs1hL3rkqGOFPkC4UoeJHn0/aLj3R4ymHNSaQF7mhzT9l UwmfMpWaOnLxumJDcrs2B1pqgwWuPjycY8cJ2omRYikdLD2ueMblSLTH7z4/8uu1hrjS zZSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=subject:content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:cc:to:from:dkim-signature; bh=teRiT/PcWy7VJ9V99NNQOeeSZvzVxy17hbE3C1wRPvE=; fh=XmY8az1z5a+LjrZQ1DQahIeB3Uro2SuOHb+6mIYcxXo=; b=J2mgBOH+lrKmDdyGf+fEtVlGZw9ZSUqIZwvYB8LSn20lAJPUBlxkGMo4WwKSVqswDK L4WVivE08uDsXFEu/BLYULiRMjbGlCmD1Ax67JAug+0bXRWzis1XOl0TNWmGCPOnAzOO aPpjEL0Y61IYNVGuqBuSP8Fh06q0iGKfag7FTL5Za/A5dyESYV4lshJNXIvXs8rvi9CA 7Dt7WvDjoumnthA7Pby7caAiiToIvuoaqYYH2lGDbq+UiIIGw7e7c2WjUNPLnuE7hCjF WSgxaxohBK1fi6NFOZwHQbT4YC5XppjJxXjT/NnsejVSpSaDyWyTzIMOmQWyX1qqp5vU BMFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=ci4Gmm1s; spf=pass (google.com: domain of linux-kernel+bounces-5680-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5680-ouuuleilei=gmail.com@vger.kernel.org" Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id p14-20020a1709061b4e00b00a2353a3f72csi2172876ejg.1009.2023.12.19.09.30.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 09:30:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-5680-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=ci4Gmm1s; spf=pass (google.com: domain of linux-kernel+bounces-5680-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5680-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id A45C21F2524F for ; Tue, 19 Dec 2023 17:24:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 69A083FE3D; Tue, 19 Dec 2023 17:19:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="ci4Gmm1s" X-Original-To: linux-kernel@vger.kernel.org Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 495363715D; Tue, 19 Dec 2023 17:19:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hugovil.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hugovil.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=x; h=Subject:Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Cc:To :From:subject:date:message-id:reply-to; bh=teRiT/PcWy7VJ9V99NNQOeeSZvzVxy17hbE3C1wRPvE=; b=ci4Gmm1sWAzaQsm3++CMVL9fPO qVSxhUubXDTMj40TZTnvWxCo1AQ+a8BENEENLsZwFioUVOjjpnFCbM2ARQ2XxRuBzw4d+wYzsHbVY KQylOUUYeM5GO/sBX33tzfHkNFwoypobk+AEUvTtq2gtU4wMpuSnJybSLWjMQPPQjU0w=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168]:40128 helo=pettiford.lan) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1rFdkS-0007Ao-Pm; Tue, 19 Dec 2023 12:19:17 -0500 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, jirislaby@kernel.org, jringle@gridpoint.com, kubakici@wp.pl, phil@raspberrypi.org, bo.svangard@embeddedart.se Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, hugo@hugovil.com, Hugo Villeneuve , Andy Shevchenko Date: Tue, 19 Dec 2023 12:18:54 -0500 Message-Id: <20231219171903.3530985-11-hugo@hugovil.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231219171903.3530985-1-hugo@hugovil.com> References: <20231219171903.3530985-1-hugo@hugovil.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SA-Exim-Connect-IP: 70.80.174.168 X-SA-Exim-Mail-From: hugo@hugovil.com X-Spam-Level: X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * -0.0 T_SCC_BODY_TEXT_LINE No description available. Subject: [PATCH 10/18] serial: sc16is7xx: use HZ_PER_MHZ macro to improve readability X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.hugovil.com) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785732328697946410 X-GMAIL-MSGID: 1785732328697946410 From: Hugo Villeneuve Improves code readability by making it more obvious that it is a MHz value. Suggested-by: Andy Shevchenko Signed-off-by: Hugo Villeneuve --- drivers/tty/serial/sc16is7xx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index 29844e2eefc5..7d5eec2d0e94 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #define SC16IS7XX_NAME "sc16is7xx" @@ -1741,7 +1742,7 @@ static int sc16is7xx_spi_probe(struct spi_device *spi) spi->bits_per_word = 8; /* only supports mode 0 on SC16IS762 */ spi->mode = spi->mode ? : SPI_MODE_0; - spi->max_speed_hz = spi->max_speed_hz ? : 15000000; + spi->max_speed_hz = spi->max_speed_hz ? : 15 * HZ_PER_MHZ; ret = spi_setup(spi); if (ret) return ret; From patchwork Tue Dec 19 17:18:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugo Villeneuve X-Patchwork-Id: 181140 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp2095194dyi; Tue, 19 Dec 2023 09:23:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IGZrHvgMcm3JvWYzaOD8WwLB4ABEhPcyXKayPsbm7GQGbtxRdRK2lvUR6wKvRokyiIeYSYx X-Received: by 2002:a17:902:bc8c:b0:1d0:6ffd:9e2b with SMTP id bb12-20020a170902bc8c00b001d06ffd9e2bmr15688281plb.125.1703006632927; Tue, 19 Dec 2023 09:23:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703006632; cv=none; d=google.com; s=arc-20160816; b=t/fMYWmnHUrXQO6jLbvGQK+peIlSxb8DT8/igbesGkuYawF7msTl1wFhxRczLQunie 6Zl5lBDxDUk0tXj0+EWOljthgpZhDdKdW0fFsglooTvBN+/w7z+lLwyxrxdvPeYx09bX qJmVbPVZ/bZPuda0TuHsO8zXRSSHQpQNAd2WMyRwHmPsJHdX6gvbqimBj0gKMTTliA3O 0n50QgZRg0dvNXZCRYUucc00FxCrhXm2zfNlxNRGep0JCknXX8gRsOzSmR/sCAuMGLfD aUbt7wh/5yZbQLpzCnVls7miXyV2msVmMJJU4tO73abedQ4Ho6l7uVpe5qoj1x5EzAZG x43w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=subject:content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:cc:to:from:dkim-signature; bh=s/yWW4Vy76vXSiHl0gv7O0Csm0Ex/rL0yRa8UtQ/IPg=; fh=XmY8az1z5a+LjrZQ1DQahIeB3Uro2SuOHb+6mIYcxXo=; b=IzYkiZFB0iyCBBiStYf0GLEi18iY/VsSDoqbJKUD34BjakdSsiuyCVM8rsjOsQLqln KmBioHtTH25afZMWy0pNMsfBzHKFaFjG2JY1M7W04kLVaXfqwVWuSFnGMBgNxeRZ9c9I 9GOsLlml0ebQj8CykbmfCCkCRvDWA5HpB29BFCTSXPUeWyOsrcj9zS+Lul9262IAg+ih kZ54bFlcyPgP0XpgzjpuP7GjD925XY6gByuOhDGVRhFzr5Dofw5Msrj619q/o/PLL0oc 0ft/B1km1XpjIgRCrxukfczNBpfkeRwC9bCxbgwk2WNzmipNAD5qoX1hjLWeBp2GK5uV /VsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=Es1tOgue; spf=pass (google.com: domain of linux-kernel+bounces-5678-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5678-ouuuleilei=gmail.com@vger.kernel.org" Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id i7-20020a63e907000000b005897813624fsi19449833pgh.476.2023.12.19.09.23.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 09:23:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-5678-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=Es1tOgue; spf=pass (google.com: domain of linux-kernel+bounces-5678-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5678-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 6378C287590 for ; Tue, 19 Dec 2023 17:23:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F32693E49B; Tue, 19 Dec 2023 17:19:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="Es1tOgue" X-Original-To: linux-kernel@vger.kernel.org Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 02D3B3717E; Tue, 19 Dec 2023 17:19:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hugovil.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hugovil.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=x; h=Subject:Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Cc:To :From:subject:date:message-id:reply-to; bh=s/yWW4Vy76vXSiHl0gv7O0Csm0Ex/rL0yRa8UtQ/IPg=; b=Es1tOgueRS7EWff0ucpzQMT/2F ynxAniJZI5jETkempKC8oIKdGZVd/qzbspc6QMaPmxCkvgFG8AZX2Dw/IIwHtzAuVxeij9tTtZPtZ fZVDY8dgmNcTWMRIt4XoNNJ0Zugu7rudi5acE9ot7GdWzJaoT2nMqoOmfYX3ZHq7OAt0=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168]:40128 helo=pettiford.lan) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1rFdkT-0007Ao-PK; Tue, 19 Dec 2023 12:19:18 -0500 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, jirislaby@kernel.org, jringle@gridpoint.com, kubakici@wp.pl, phil@raspberrypi.org, bo.svangard@embeddedart.se Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, hugo@hugovil.com, Hugo Villeneuve , Andy Shevchenko Date: Tue, 19 Dec 2023 12:18:55 -0500 Message-Id: <20231219171903.3530985-12-hugo@hugovil.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231219171903.3530985-1-hugo@hugovil.com> References: <20231219171903.3530985-1-hugo@hugovil.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SA-Exim-Connect-IP: 70.80.174.168 X-SA-Exim-Mail-From: hugo@hugovil.com X-Spam-Level: X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * -0.0 T_SCC_BODY_TEXT_LINE No description available. Subject: [PATCH 11/18] serial: sc16is7xx: add explicit return for some switch default cases X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.hugovil.com) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785731882687268051 X-GMAIL-MSGID: 1785731882687268051 From: Hugo Villeneuve Allows to simplify code by removing the break statement in the default switch/case in some functions. Suggested-by: Andy Shevchenko Signed-off-by: Hugo Villeneuve --- drivers/tty/serial/sc16is7xx.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index 7d5eec2d0e94..feb50d9271ac 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -460,10 +460,8 @@ static bool sc16is7xx_regmap_volatile(struct device *dev, unsigned int reg) case SC16IS7XX_IOCONTROL_REG: return true; default: - break; + return false; } - - return false; } static bool sc16is7xx_regmap_precious(struct device *dev, unsigned int reg) @@ -472,10 +470,8 @@ static bool sc16is7xx_regmap_precious(struct device *dev, unsigned int reg) case SC16IS7XX_RHR_REG: return true; default: - break; + return false; } - - return false; } static bool sc16is7xx_regmap_noinc(struct device *dev, unsigned int reg) From patchwork Tue Dec 19 17:18:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugo Villeneuve X-Patchwork-Id: 181143 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp2095729dyi; Tue, 19 Dec 2023 09:24:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IHRFJkyICTTucPHdPgDYe7Lx4nO/Pr0nefcfTJRePAOSBViw+WvtVwyN7zQqtelD9x+Om5K X-Received: by 2002:a05:6358:3106:b0:170:6675:a50a with SMTP id c6-20020a056358310600b001706675a50amr19497223rwe.36.1703006688657; Tue, 19 Dec 2023 09:24:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703006688; cv=none; d=google.com; s=arc-20160816; b=go9g2qQ+MMAlKCiPkG6S8neRiwaYhtsPN213llb3nbrIprachZ6Rc1+A0trimylN9c UKX732f3YVV8X8MUdyi0MSgBFzh3+rCpVLiewFQdXbVEPlx+r/gyAtC/3Vy3UjKWPSwG jFei6WgzXPCLRqgPBCujNeg++8dLSZw9umisbphMxqobDJM2WgDchYlGJiAqcxHG2sQ5 KPbsNbQI8ApRZz4RvGNKgKOtalWXccjBa27xBl18vOkFKRS3hv0A0nW81FeaqA/Csi/N qK0FrWtqdnLTuDYDWE2HN0qP1D/FFGE7uyFurL8XP5MBDF3asxEKi65ck1WQDq0b/Npz 62hg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=subject:content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:cc:to:from:dkim-signature; bh=gUAAQFKZm/4AQCPRUH7PAQYTLzlSP8EudxDx5BySHoI=; fh=XmY8az1z5a+LjrZQ1DQahIeB3Uro2SuOHb+6mIYcxXo=; b=OLnmIsdE6MExfdUlNzlMUvgv0DKnyq+VHez8ZinX/xlbhxCRxgt5Q/KqRqk8a52wM7 EehHMGXBQET0nJ2NtepRujz5q8D7fzSoC7f0MKZP6ve8jXMueiM9Ds0rHtkWgyR7GXvN RYTUPoFAPMSk9NGR2zRNV3Z7Jm6bY91zwN/op5JhpGOlhrljohRTTr6Qxlo/igd+D8OZ Nx/QcMtb6q2iGLCNPgKDkfMCxnQWfE+FCEIUS5xAHj7ZvM7wEGgjfwaE+/6nALrQejwu nUCnLlBPWAL/gwRG2ZtKswlXo5QbbQRXt1pHA9SRUKZk5iGFh6G/+Xv7cPpZl3hWFK8t 809A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=O5luuWiZ; spf=pass (google.com: domain of linux-kernel+bounces-5683-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5683-ouuuleilei=gmail.com@vger.kernel.org" Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id o188-20020a62cdc5000000b006d9415b7697si390612pfg.339.2023.12.19.09.24.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 09:24:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-5683-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=O5luuWiZ; spf=pass (google.com: domain of linux-kernel+bounces-5683-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5683-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 2E98F2818EF for ; Tue, 19 Dec 2023 17:24:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 56EA440BFF; Tue, 19 Dec 2023 17:19:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="O5luuWiZ" X-Original-To: linux-kernel@vger.kernel.org Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D1F4D374CE; Tue, 19 Dec 2023 17:19:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hugovil.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hugovil.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=x; h=Subject:Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Cc:To :From:subject:date:message-id:reply-to; bh=gUAAQFKZm/4AQCPRUH7PAQYTLzlSP8EudxDx5BySHoI=; b=O5luuWiZQkMMPrB0k4ShlsWyRX NFLKiiP6zWS1mVso7TGCKyZohscLty08HiRki2VHTr9psFhaexicFs+dD4pck+bPe0XtSUK53kHpk 1SrmcdE/7cMWxi7zdh43H5MUKu1H+llWLf6MCSpWgz7KRNjJAvXs6vi3BEZ22mcDsBuk=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168]:40128 helo=pettiford.lan) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1rFdkU-0007Ao-PP; Tue, 19 Dec 2023 12:19:19 -0500 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, jirislaby@kernel.org, jringle@gridpoint.com, kubakici@wp.pl, phil@raspberrypi.org, bo.svangard@embeddedart.se Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, hugo@hugovil.com, Hugo Villeneuve , Andy Shevchenko Date: Tue, 19 Dec 2023 12:18:56 -0500 Message-Id: <20231219171903.3530985-13-hugo@hugovil.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231219171903.3530985-1-hugo@hugovil.com> References: <20231219171903.3530985-1-hugo@hugovil.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SA-Exim-Connect-IP: 70.80.174.168 X-SA-Exim-Mail-From: hugo@hugovil.com X-Spam-Level: X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * -0.0 T_SCC_BODY_TEXT_LINE No description available. Subject: [PATCH 12/18] serial: sc16is7xx: replace hardcoded divisor value with BIT() macro X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.hugovil.com) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785731941276218954 X-GMAIL-MSGID: 1785731941276218954 From: Hugo Villeneuve To better show why the limit is what it is, since we have only 16 bits for the divisor. Suggested-by: Andy Shevchenko Signed-off-by: Hugo Villeneuve --- drivers/tty/serial/sc16is7xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index feb50d9271ac..133538f91390 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -486,7 +486,7 @@ static int sc16is7xx_set_baud(struct uart_port *port, int baud) u8 prescaler = 0; unsigned long clk = port->uartclk, div = clk / 16 / baud; - if (div > 0xffff) { + if (div >= BIT(16)) { prescaler = SC16IS7XX_MCR_CLKSEL_BIT; div /= 4; } From patchwork Tue Dec 19 17:18:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugo Villeneuve X-Patchwork-Id: 181142 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp2095482dyi; Tue, 19 Dec 2023 09:24:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IEfag97B8aQvUGdXrKQiyLxiOXtki4UWooh9zaw47oauNmuuHf0Ba4N1dl+4+qHQgXkm0HW X-Received: by 2002:a05:620a:14a7:b0:77d:a04d:24ef with SMTP id x7-20020a05620a14a700b0077da04d24efmr14521516qkj.74.1703006664377; Tue, 19 Dec 2023 09:24:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703006664; cv=none; d=google.com; s=arc-20160816; b=On68Dv6pVUJzz5ZdvS3GyJCoYqEOP7gIdkGkMaqQRWyUmY7sC99jTqibo9DNEsNfer YxvWOgkj/Gt4w0lVypWCR70kIc0w7jEMboylKQwNKL87DiDw5biDD5W2GtbwSFzAjdir bzHuwgKtq1lUoeyPvk1QRj0mJxE1Nr6Qz6QMvx33n32AfwouKyMRr1b9iYwrrtDKW72e hjrDTq4WUfDOTOT8hW1HC57vs7P0iFQlBZA1SWA+W2jD33soGl83CqhoboikCtshqpZw oh/fvMeMRAAxK7N2wVOjIrzdJTlLkUyZCooDkuEkJau+DXcG5DiGu0oMS3SLQSMO0qxW aHfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=subject:content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:cc:to:from:dkim-signature; bh=eAovb+UcCr8c4+yXpiGUDUECK8pQrI3Ofw2ziL8xaHg=; fh=XmY8az1z5a+LjrZQ1DQahIeB3Uro2SuOHb+6mIYcxXo=; b=Yq1f+vQPPTTB94m7QumijkDrQaqQ7tQEPJ/a1QpYPybwCHdrUlQJojplh5FgPlob1E CBqS7rVD6iPrV6Rv+nr9GOw++REYaXHG3SoX0JD/yxntSdREAdo66D6NjnGhbxI5yxuI MX3Q7B4bQdjEwq48S6A5yp1R2s27kVgGTO4yjf1zQh+ea+bNhUbQaqpFIIvobScjbJeD kClEXTAA1R6nEic80AS72QGatdmXmzmutKF5j/1jrmIuOzWpX3n/qvmuYNQfMZXQqsmW Ry14IzSaoce6ump4WIAx5xlK4lTgycwlguZGeSp3Y+GawW2TjBgkPWyPIiAHnS2AuLak yS6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=xb4NbYgN; spf=pass (google.com: domain of linux-kernel+bounces-5682-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5682-ouuuleilei=gmail.com@vger.kernel.org" Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id a20-20020a05620a439400b0077f75b710ccsi14294239qkp.399.2023.12.19.09.24.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 09:24:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-5682-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=xb4NbYgN; spf=pass (google.com: domain of linux-kernel+bounces-5682-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5682-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 2C91D1C24F5C for ; Tue, 19 Dec 2023 17:24:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CA97240BE6; Tue, 19 Dec 2023 17:19:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="xb4NbYgN" X-Original-To: linux-kernel@vger.kernel.org Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E97B71CA89; Tue, 19 Dec 2023 17:19:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hugovil.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hugovil.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=x; h=Subject:Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Cc:To :From:subject:date:message-id:reply-to; bh=eAovb+UcCr8c4+yXpiGUDUECK8pQrI3Ofw2ziL8xaHg=; b=xb4NbYgNCU3y5gAWSAmZIKnYEA mxGt9n6Mq740/FU1jviVnXzo7T+ziUKk9/z07smCh+nR9TaaLoZGGv3UE5jHqPpkhBhQk7K8Gc3Zj 2+IGINBIdLTNN0FmjmOnbkUZfHVO207RCm3g7ws2TgkSFNqB3wPLcdDZTStMp/uGcw0s=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168]:40128 helo=pettiford.lan) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1rFdkV-0007Ao-SB; Tue, 19 Dec 2023 12:19:20 -0500 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, jirislaby@kernel.org, jringle@gridpoint.com, kubakici@wp.pl, phil@raspberrypi.org, bo.svangard@embeddedart.se Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, hugo@hugovil.com, Hugo Villeneuve , Andy Shevchenko Date: Tue, 19 Dec 2023 12:18:57 -0500 Message-Id: <20231219171903.3530985-14-hugo@hugovil.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231219171903.3530985-1-hugo@hugovil.com> References: <20231219171903.3530985-1-hugo@hugovil.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SA-Exim-Connect-IP: 70.80.174.168 X-SA-Exim-Mail-From: hugo@hugovil.com X-Spam-Level: X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * -0.0 T_SCC_BODY_TEXT_LINE No description available. Subject: [PATCH 13/18] serial: sc16is7xx: use in_range() for DT properties bound checks X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.hugovil.com) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785731916224676761 X-GMAIL-MSGID: 1785731916224676761 From: Hugo Villeneuve Improve code readability and efficiency by using in_range() when checking device tree properties bound. Suggested-by: Andy Shevchenko Signed-off-by: Hugo Villeneuve --- drivers/tty/serial/sc16is7xx.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index 133538f91390..29089b11f6f1 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -1398,7 +1399,7 @@ static void sc16is7xx_setup_irda_ports(struct sc16is7xx_port *s) struct device *dev = s->p[0].port.dev; count = device_property_count_u32(dev, "irda-mode-ports"); - if (count < 0 || count > SC16IS7XX_MAX_PORTS) + if (!in_range(count, 0, SC16IS7XX_MAX_PORTS + 1)) return; ret = device_property_read_u32_array(dev, "irda-mode-ports", @@ -1425,7 +1426,7 @@ static int sc16is7xx_setup_mctrl_ports(struct sc16is7xx_port *s, struct device *dev = s->p[0].port.dev; count = device_property_count_u32(dev, "nxp,modem-control-line-ports"); - if (count < 0 || count > SC16IS7XX_MAX_PORTS) + if (!in_range(count, 0, SC16IS7XX_MAX_PORTS + 1)) return 0; ret = device_property_read_u32_array(dev, "nxp,modem-control-line-ports", From patchwork Tue Dec 19 17:18:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugo Villeneuve X-Patchwork-Id: 181136 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp2094945dyi; Tue, 19 Dec 2023 09:23:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IFxLGPmO41QrxFDxFjWa6phTSHdHm75MI06TzDHEeZiAxrE9RfBCWFGpOaTF9LoCoGTh4Y5 X-Received: by 2002:a17:902:d14a:b0:1d3:e36d:365c with SMTP id t10-20020a170902d14a00b001d3e36d365cmr984902plt.37.1703006606359; Tue, 19 Dec 2023 09:23:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703006606; cv=none; d=google.com; s=arc-20160816; b=lcuRO7Ef2gcgm/mu+CxejbKZ+qmXqh7bx914dYbh7ZgcT5/DG9tqMMHyuMba7loogV H4e3DJisiKs2H1OWMne5Hq9Eh781s3ufL0AnenkjSCK1fbBzstl2PzLvmhbqPURU3iF2 WTJ1US96k/RkUrur0O7fH9OUq1WtZT6KgjYwTY1Cx9bJ8nhytZxWdzTiv7PJUHxEFSNi mVMrNOgMezFXdbQ3s3mxg8qaA3qovd5xs/HvrOFB5XB9BOscmgu4YksaZMpqp8961nWi t5CyLGZhOgkpa8jm/D4hIIjqIIkiVz08Xz+hYHzUbjCyCO3QESwxFW5YVxNJYR7qwbss ouKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=subject:content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:cc:to:from:dkim-signature; bh=pCFiEl099gN+IaylTnT0hoDSq03Y5bym/mkoj8GjOYI=; fh=XmY8az1z5a+LjrZQ1DQahIeB3Uro2SuOHb+6mIYcxXo=; b=tbQbABGZky6QZd16KEkJRSkTpZYaaxgqHSBeKczdCiAML+RBFwosXJ5LtYT9oLs/zb C4iFdZl2eADXhx/SwYO675bfu+VcbWI85It6jx5e/KZdBQob96yA7s1BeZ3cJWjnqgie XsVZkiGAsAMMsDWc+35v7+GR+bk5Fc9o/yiF9jPP47UaE6GyNQd64IJvLmcyLwc89ks4 7vzcdp0nV8huq0Y1O8ErmNb2I6iJ0LbwcD4ZNnhQFzvqun97CxsI10HBE7bjfpW/TR8J DzkMfatRC3uYRcqvboC+DNeKoX1YbohsdaUgEthi1NOHba0H63fQ3MG8mkH1VfKOswNs YyeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=TP8HLyeo; spf=pass (google.com: domain of linux-kernel+bounces-5671-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5671-ouuuleilei=gmail.com@vger.kernel.org" Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id d6-20020a630e06000000b005cdb499ac85si1567126pgl.164.2023.12.19.09.23.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 09:23:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-5671-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=TP8HLyeo; spf=pass (google.com: domain of linux-kernel+bounces-5671-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5671-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 24661B207C4 for ; Tue, 19 Dec 2023 17:22:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 993ED3B786; Tue, 19 Dec 2023 17:19:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="TP8HLyeo" X-Original-To: linux-kernel@vger.kernel.org Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0154436B05; Tue, 19 Dec 2023 17:19:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hugovil.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hugovil.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=x; h=Subject:Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Cc:To :From:subject:date:message-id:reply-to; bh=pCFiEl099gN+IaylTnT0hoDSq03Y5bym/mkoj8GjOYI=; b=TP8HLyeol5TfMC88pf3h1hOSLC yEkaZd4yEfGOhmzwIyuRi+z0hb5vv7YXuVdrc6AhmLa2X+GOHEZEE1iB0v7FBP0PxUVq/VDnsvGPQ L8ja3zYXACIDVEhUy7YN5fT2JWrr042x+f3ELPiva32fXV8TxZaQ29dkVXpLijHFpGpM=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168]:40128 helo=pettiford.lan) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1rFdkX-0007Ao-3F; Tue, 19 Dec 2023 12:19:21 -0500 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, jirislaby@kernel.org, jringle@gridpoint.com, kubakici@wp.pl, phil@raspberrypi.org, bo.svangard@embeddedart.se Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, hugo@hugovil.com, Hugo Villeneuve , Andy Shevchenko Date: Tue, 19 Dec 2023 12:18:58 -0500 Message-Id: <20231219171903.3530985-15-hugo@hugovil.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231219171903.3530985-1-hugo@hugovil.com> References: <20231219171903.3530985-1-hugo@hugovil.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SA-Exim-Connect-IP: 70.80.174.168 X-SA-Exim-Mail-From: hugo@hugovil.com X-Spam-Level: X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * -0.0 T_SCC_BODY_TEXT_LINE No description available. Subject: [PATCH 14/18] serial: sc16is7xx: drop unneeded MODULE_ALIAS X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.hugovil.com) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785731855651695858 X-GMAIL-MSGID: 1785731855651695858 From: Hugo Villeneuve The MODULE_DEVICE_TABLE already creates the proper aliases for the SPI driver. Suggested-by: Andy Shevchenko Signed-off-by: Hugo Villeneuve --- drivers/tty/serial/sc16is7xx.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index 29089b11f6f1..a9e44e5ef713 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -1793,8 +1793,6 @@ static struct spi_driver sc16is7xx_spi_uart_driver = { .remove = sc16is7xx_spi_remove, .id_table = sc16is7xx_spi_id_table, }; - -MODULE_ALIAS("spi:sc16is7xx"); #endif #ifdef CONFIG_SERIAL_SC16IS7XX_I2C From patchwork Tue Dec 19 17:18:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugo Villeneuve X-Patchwork-Id: 181135 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp2094868dyi; Tue, 19 Dec 2023 09:23:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IHDvqW/DILnPuu9yr9l8matloiiMmppEgs2zWWQvTdH2Q5bR0qOMs7NBtWvIMMlE6As2SyF X-Received: by 2002:a17:906:5352:b0:a23:8929:97c7 with SMTP id j18-20020a170906535200b00a23892997c7mr731529ejo.24.1703006597910; Tue, 19 Dec 2023 09:23:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703006597; cv=none; d=google.com; s=arc-20160816; b=nBIUyS8ribZGr2UhaTdAbudCoBt+QHjAPcmWkoycfvEHTK5yRovDHvZdi7hCiVVldz l+ZZ1+JvNRiP+wCVwygN3Mpeb9UvoGuLusKmd2cd9cyq0aq510gAyi/h0ARfUbXhDzMP XANaf/58qYOlDKmrgUpwrdxSkr5VV3HySYNJGLPQL3qJvZamicbO0tazZIfMOu33fb2p iInyd/y3Pd5Q3Drcb6UjIxSEkmUREnAHk7fi/99UDKWNXL3CBTk9RLvNk/Jd4cM5AeaR jlxy1tje6M8sRCfA/AobG9SiguWqa2Q19R2cSBHL5Fh6Qujqu0dpslVC/6Y1dRV4ULLA v4nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=subject:content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:cc:to:from:dkim-signature; bh=cw/24HY4C5acblk8eliNCiZBV+lvTJ+0DUIF2TU1lJQ=; fh=ZhVoJUXUplWtbBNTeiJkgl42QzUYK2Vp2MLuE9KlSEQ=; b=c4B7mb8PxpzGiHQD70xX4Kv2K5imK9R/OQv4ob6B2YYw3SxWYN+lSPpi2eO5jlrDxd jD/s8zowlvAQ1ofuEChEavuLtGNrpQ39Uo/LgyAjLqduVAXdFDX2d3n/6sjVJtfkSIeK EdzlQtzQ1NpXzMvd14pOJacqPgebuZtrz62z7LGqyIIsU3Hx1ZtGnb+Ij1OruzhkcScQ zZFTytr2Lnw+IeT6mKXXM+mT0LlXtvkgpybWeVehr/Gkbf/gHGJA2p1Uth9nr/G/Cbkt Y7BTykLPb8lbXBlv0Q12dpZrXLOX6d6ewK+khZu26XjAQ/Bv738ppV8YbcJJ0ijn1LQK 2Hcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=EYi+AuJ7; spf=pass (google.com: domain of linux-kernel+bounces-5673-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5673-ouuuleilei=gmail.com@vger.kernel.org" Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id cw10-20020a170906c78a00b00a234e172a3fsi2124971ejb.583.2023.12.19.09.23.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 09:23:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-5673-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=EYi+AuJ7; spf=pass (google.com: domain of linux-kernel+bounces-5673-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5673-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 52D511F23B61 for ; Tue, 19 Dec 2023 17:23:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CAFC63BB55; Tue, 19 Dec 2023 17:19:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="EYi+AuJ7" X-Original-To: linux-kernel@vger.kernel.org Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B7DD237173; Tue, 19 Dec 2023 17:19:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hugovil.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hugovil.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=x; h=Subject:Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Cc:To :From:subject:date:message-id:reply-to; bh=cw/24HY4C5acblk8eliNCiZBV+lvTJ+0DUIF2TU1lJQ=; b=EYi+AuJ7sy0TuMj/AGsWiYqOKy pJeatye9iSP5hmCO7cWlO0Zi+0JIxROIkdm6Y1tfrfjLeQH8p2NXvLet1bJ1/3Bub478g9JLiBMe+ 6R24eaeBzY5FQh/rnhm5RYvTFWLMtHgirIuvpSPBt3v+OnPgWlPJReQeExq34jL2bAeo=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168]:40128 helo=pettiford.lan) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1rFdkY-0007Ao-56; Tue, 19 Dec 2023 12:19:22 -0500 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, jirislaby@kernel.org, jringle@gridpoint.com, kubakici@wp.pl, phil@raspberrypi.org, bo.svangard@embeddedart.se Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, hugo@hugovil.com, Hugo Villeneuve , stable@vger.kernel.org Date: Tue, 19 Dec 2023 12:18:59 -0500 Message-Id: <20231219171903.3530985-16-hugo@hugovil.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231219171903.3530985-1-hugo@hugovil.com> References: <20231219171903.3530985-1-hugo@hugovil.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SA-Exim-Connect-IP: 70.80.174.168 X-SA-Exim-Mail-From: hugo@hugovil.com X-Spam-Level: X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * -0.0 T_SCC_BODY_TEXT_LINE No description available. Subject: [PATCH 15/18] serial: sc16is7xx: pass R/W buffer in FIFO functions X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.hugovil.com) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785731846133115119 X-GMAIL-MSGID: 1785731846133115119 From: Hugo Villeneuve To simplify function by avoiding cast. This is similar to what is done in max310x driver. Signed-off-by: Hugo Villeneuve --- If deemed appropriate for stable kernel backporting: Fixes: dec273ecc116 ("sc16is7xx: fix FIFO address of secondary UART") Cc: stable@vger.kernel.org --- drivers/tty/serial/sc16is7xx.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index a9e44e5ef713..3322507ab18e 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -380,17 +380,15 @@ static void sc16is7xx_port_write(struct uart_port *port, u8 reg, u8 val) regmap_write(one->regmap, reg, val); } -static void sc16is7xx_fifo_read(struct uart_port *port, unsigned int rxlen) +static void sc16is7xx_fifo_read(struct uart_port *port, u8 *rxbuf, unsigned int rxlen) { - struct sc16is7xx_port *s = dev_get_drvdata(port->dev); struct sc16is7xx_one *one = to_sc16is7xx_one(port, port); - regmap_noinc_read(one->regmap, SC16IS7XX_RHR_REG, s->buf, rxlen); + regmap_noinc_read(one->regmap, SC16IS7XX_RHR_REG, rxbuf, rxlen); } -static void sc16is7xx_fifo_write(struct uart_port *port, u8 to_send) +static void sc16is7xx_fifo_write(struct uart_port *port, u8 *txbuf, u8 to_send) { - struct sc16is7xx_port *s = dev_get_drvdata(port->dev); struct sc16is7xx_one *one = to_sc16is7xx_one(port, port); /* @@ -400,7 +398,7 @@ static void sc16is7xx_fifo_write(struct uart_port *port, u8 to_send) if (unlikely(!to_send)) return; - regmap_noinc_write(one->regmap, SC16IS7XX_THR_REG, s->buf, to_send); + regmap_noinc_write(one->regmap, SC16IS7XX_THR_REG, txbuf, to_send); } static void sc16is7xx_port_update(struct uart_port *port, u8 reg, @@ -576,7 +574,7 @@ static void sc16is7xx_handle_rx(struct uart_port *port, unsigned int rxlen, s->buf[0] = sc16is7xx_port_read(port, SC16IS7XX_RHR_REG); bytes_read = 1; } else { - sc16is7xx_fifo_read(port, rxlen); + sc16is7xx_fifo_read(port, s->buf, rxlen); bytes_read = rxlen; } @@ -665,7 +663,7 @@ static void sc16is7xx_handle_tx(struct uart_port *port) uart_xmit_advance(port, 1); } - sc16is7xx_fifo_write(port, to_send); + sc16is7xx_fifo_write(port, s->buf, to_send); } uart_port_lock_irqsave(port, &flags); From patchwork Tue Dec 19 17:19:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugo Villeneuve X-Patchwork-Id: 181139 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp2095099dyi; Tue, 19 Dec 2023 09:23:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IEzT51UwHwfhHIPaEihSKW6VuMOmXoyTzh9ROARG9YYAhoVfQzY6PkWWC4MSxpF0WnISqsQ X-Received: by 2002:a05:6808:8c9:b0:3b8:b21d:206c with SMTP id k9-20020a05680808c900b003b8b21d206cmr18200020oij.119.1703006622689; Tue, 19 Dec 2023 09:23:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703006622; cv=none; d=google.com; s=arc-20160816; b=wZPwMEnyQdCsezHG+97SuL3HTWO0SAHgtkLIQRT3TKs97p6nehYzS4m9PYED7KAvKl 34lqnYIKRZsknb5rgKe38rxdFxUG+rEH2puPjxQZxpg7drYPWhqoHyVSYQSdQCGYBlsm F8VqcJuSyL9d0ctrsUDvRLEetSUxTY+af3z5l1yB7XOyE6di48fx3YV1lrzf4l16x2Wj medhZ3Xqqbz7Gwy1YibC1fpG5UxZA6JXxlMUeR/fFDhNNnx0URphW1CxyTy5+ZfuCHb8 OBz7anY4P8b8NS2ZNxub8RdvY3+3poDDD48K/orDhdX6Pip+mtC9dH90EN2ncv8zlc2s 2Qdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=subject:content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:cc:to:from:dkim-signature; bh=nLa/JOHCB+NVf/gTGPWED+N7sittkLrVaca+Po1a3K0=; fh=cU7nueyVLD6PCX143V/gcz7kaNKnsE7kxUBegEucbAs=; b=fqMxYG5KHBS5BkczKhe50QMzSRJO4m3aFzwHT3HGM1nrrJLR1IHh4bg5hv/QD0i4TJ QMEuVttEc6yptw5u5qf+EGYSHnzgTDnY4whBY9OnHeu/3C6tU4fSjo+RRokeLD8M4jSy J87p3bjeMWPr8bFvI0Q12FoEL16buPkXsR8OXVE1g68jLhrn6+h5gMccP7eap5t8a8fg ug5ZGtM0dPHyVMmq2fcpbYBWgFYBi0WPdpatSVUyQNjos86Wf+bfpKFBooXq2rBNV5UI 5K50mLqZRvpBy5+dDtu286UXotFz9Qd2kN8rTV7fbZPrur4Lim8lQkFlaiu6lEPBSANv fn8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=m1RSSwty; spf=pass (google.com: domain of linux-kernel+bounces-5676-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5676-ouuuleilei=gmail.com@vger.kernel.org" Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id f6-20020a0ccc86000000b0067f19825ac9si10024390qvl.234.2023.12.19.09.23.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 09:23:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-5676-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=m1RSSwty; spf=pass (google.com: domain of linux-kernel+bounces-5676-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5676-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 752241C20DD0 for ; Tue, 19 Dec 2023 17:23:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9E3233D0D4; Tue, 19 Dec 2023 17:19:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="m1RSSwty" X-Original-To: linux-kernel@vger.kernel.org Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0AE98374C8; Tue, 19 Dec 2023 17:19:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hugovil.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hugovil.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=x; h=Subject:Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Cc:To :From:subject:date:message-id:reply-to; bh=nLa/JOHCB+NVf/gTGPWED+N7sittkLrVaca+Po1a3K0=; b=m1RSSwtyeAOGky3TxFfrc8rLA+ K5+uM+NJIpBbnGXzBzZj4mCBq399To/bKfEmq+fsRq9TlOOUlfs55JhZp3OBkCiAFyrWEYw5/ex7O Stubz5czDs9H+wtPhaMONys+sZtN1LhhEo+kUNg6okf8enQiLuznpul5GFgEDkWFX0W4=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168]:40128 helo=pettiford.lan) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1rFdkZ-0007Ao-8V; Tue, 19 Dec 2023 12:19:23 -0500 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, jirislaby@kernel.org, jringle@gridpoint.com, kubakici@wp.pl, phil@raspberrypi.org, bo.svangard@embeddedart.se Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, hugo@hugovil.com, Hugo Villeneuve Date: Tue, 19 Dec 2023 12:19:00 -0500 Message-Id: <20231219171903.3530985-17-hugo@hugovil.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231219171903.3530985-1-hugo@hugovil.com> References: <20231219171903.3530985-1-hugo@hugovil.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SA-Exim-Connect-IP: 70.80.174.168 X-SA-Exim-Mail-From: hugo@hugovil.com X-Spam-Level: X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * -0.0 T_SCC_BODY_TEXT_LINE No description available. Subject: [PATCH 16/18] serial: sc16is7xx: reorder code to remove prototype declarations X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.hugovil.com) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785731872251511128 X-GMAIL-MSGID: 1785731872251511128 From: Hugo Villeneuve Move/reorder some functions to remove sc16is7xx_ier_set() and sc16is7xx_stop_tx() prototypes declarations. No functional change. sc16is7xx_ier_set() was introduced in commit cc4c1d05eb10 ("sc16is7xx: Properly resume TX after stop") Signed-off-by: Hugo Villeneuve Reviewed-by: Andy Shevchenko --- drivers/tty/serial/sc16is7xx.c | 75 ++++++++++++++++------------------ 1 file changed, 36 insertions(+), 39 deletions(-) diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index 3322507ab18e..9154fd75134a 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -358,9 +358,6 @@ static struct uart_driver sc16is7xx_uart = { .nr = SC16IS7XX_MAX_DEVS, }; -static void sc16is7xx_ier_set(struct uart_port *port, u8 bit); -static void sc16is7xx_stop_tx(struct uart_port *port); - #define to_sc16is7xx_one(p,e) ((container_of((p), struct sc16is7xx_one, e))) static u8 sc16is7xx_port_read(struct uart_port *port, u8 reg) @@ -416,6 +413,42 @@ static void sc16is7xx_power(struct uart_port *port, int on) on ? 0 : SC16IS7XX_IER_SLEEP_BIT); } +static void sc16is7xx_ier_clear(struct uart_port *port, u8 bit) +{ + struct sc16is7xx_port *s = dev_get_drvdata(port->dev); + struct sc16is7xx_one *one = to_sc16is7xx_one(port, port); + + lockdep_assert_held_once(&port->lock); + + one->config.flags |= SC16IS7XX_RECONF_IER; + one->config.ier_mask |= bit; + one->config.ier_val &= ~bit; + kthread_queue_work(&s->kworker, &one->reg_work); +} + +static void sc16is7xx_ier_set(struct uart_port *port, u8 bit) +{ + struct sc16is7xx_port *s = dev_get_drvdata(port->dev); + struct sc16is7xx_one *one = to_sc16is7xx_one(port, port); + + lockdep_assert_held_once(&port->lock); + + one->config.flags |= SC16IS7XX_RECONF_IER; + one->config.ier_mask |= bit; + one->config.ier_val |= bit; + kthread_queue_work(&s->kworker, &one->reg_work); +} + +static void sc16is7xx_stop_tx(struct uart_port *port) +{ + sc16is7xx_ier_clear(port, SC16IS7XX_IER_THRI_BIT); +} + +static void sc16is7xx_stop_rx(struct uart_port *port) +{ + sc16is7xx_ier_clear(port, SC16IS7XX_IER_RDI_BIT); +} + static const struct sc16is7xx_devtype sc16is74x_devtype = { .name = "SC16IS74X", .nr_gpio = 0, @@ -867,42 +900,6 @@ static void sc16is7xx_reg_proc(struct kthread_work *ws) sc16is7xx_reconf_rs485(&one->port); } -static void sc16is7xx_ier_clear(struct uart_port *port, u8 bit) -{ - struct sc16is7xx_port *s = dev_get_drvdata(port->dev); - struct sc16is7xx_one *one = to_sc16is7xx_one(port, port); - - lockdep_assert_held_once(&port->lock); - - one->config.flags |= SC16IS7XX_RECONF_IER; - one->config.ier_mask |= bit; - one->config.ier_val &= ~bit; - kthread_queue_work(&s->kworker, &one->reg_work); -} - -static void sc16is7xx_ier_set(struct uart_port *port, u8 bit) -{ - struct sc16is7xx_port *s = dev_get_drvdata(port->dev); - struct sc16is7xx_one *one = to_sc16is7xx_one(port, port); - - lockdep_assert_held_once(&port->lock); - - one->config.flags |= SC16IS7XX_RECONF_IER; - one->config.ier_mask |= bit; - one->config.ier_val |= bit; - kthread_queue_work(&s->kworker, &one->reg_work); -} - -static void sc16is7xx_stop_tx(struct uart_port *port) -{ - sc16is7xx_ier_clear(port, SC16IS7XX_IER_THRI_BIT); -} - -static void sc16is7xx_stop_rx(struct uart_port *port) -{ - sc16is7xx_ier_clear(port, SC16IS7XX_IER_RDI_BIT); -} - static void sc16is7xx_ms_proc(struct kthread_work *ws) { struct sc16is7xx_one *one = to_sc16is7xx_one(ws, ms_work.work); From patchwork Tue Dec 19 17:19:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugo Villeneuve X-Patchwork-Id: 181141 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp2095270dyi; Tue, 19 Dec 2023 09:24:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IEWiZnctl+jYFxm0tcu6xJrGLGh2EWpP+hnAK+SfwLaaPracQgY8GokOpF0NU5S1zpnhMRv X-Received: by 2002:a17:90a:dac2:b0:28b:a214:7d22 with SMTP id g2-20020a17090adac200b0028ba2147d22mr1716367pjx.93.1703006641886; Tue, 19 Dec 2023 09:24:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703006641; cv=none; d=google.com; s=arc-20160816; b=idxsVPToVi7aKzALhp6Oxhq32ppqz1DczMyMAfRsezIDL0Jzex/cyukiomJTC3LQrA rahLHKEHFb6RXcH2J+S8VnwvGJapE75kYMKOMjstrjXZCY1DuadIyTi595mTSD4DFUR7 tnn7asdlynb9UE4B16qBgLIVo+7uLJM3/VKqEl1X4uJBa0PLpX0sG4KOwd7juyIltJZu E5iFnUNj61ttLSsUlfXAztRAFS/2hdtge6E1/J+909n19gA84YhzvEdKDw1R/2DV//gU y46d3PbHgs21WM5ke8n3i7x7B1QMXUR0eu9lAUCgx7zw4ZTmXdo24Hr0TtLfyfF0sbx5 yQeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=subject:content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:cc:to:from:dkim-signature; bh=LAV8Eb91u5nlbXGPc815zHrr0Ju+hS+JN2T1893nUM8=; fh=cU7nueyVLD6PCX143V/gcz7kaNKnsE7kxUBegEucbAs=; b=jut/htkZ6flZd66zOqS05Fo1pCmaxIYHNBFkyX872f5ju4bE85NxQViOxqT0ovx/lI J3N9gnISjhCAHGIKck3pHaexHp/1lCidP2isA99YOl9bfAs1hnhhdHpCsdCkJ9J4Tx+2 d88wx2ZZvSohvCH6f4ATsXVfB+mhFlI3CJXCOfH/5dR4WA7EEpeXv1Vh+Flc90OgvP9g 3I8xi583fM+9SqXCSVt8oeJRPwcHTegtGlPUHhTdXG9nGl1lpQzadBkfchB5jVOkaNbu 3Gs73tu+ojB5pWRFxCLSa4/zEfm5Jxvv2sJYgf5aS4GJJBMWQBhlzup2wPGf0PRY2EC6 ix4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=e0LaW7Jh; spf=pass (google.com: domain of linux-kernel+bounces-5679-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5679-ouuuleilei=gmail.com@vger.kernel.org" Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id a3-20020a17090a854300b0028b4c107f20si1505000pjw.7.2023.12.19.09.24.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 09:24:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-5679-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=e0LaW7Jh; spf=pass (google.com: domain of linux-kernel+bounces-5679-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5679-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 1C9FF2875B0 for ; Tue, 19 Dec 2023 17:24:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2E3043EA92; Tue, 19 Dec 2023 17:19:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="e0LaW7Jh" X-Original-To: linux-kernel@vger.kernel.org Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 490883174A; Tue, 19 Dec 2023 17:19:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hugovil.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hugovil.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=x; h=Subject:Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Cc:To :From:subject:date:message-id:reply-to; bh=LAV8Eb91u5nlbXGPc815zHrr0Ju+hS+JN2T1893nUM8=; b=e0LaW7JhHDksgVwwyJ4Yd66n+l mqFLQiKhpfZkxoPR0QOtmN+s5ErFGa+Eny4aoJAatOrHmUCTr9BtldN2hl6mmTjFPLRc4qZ1P9DpM wRgYikjhiS6iyRbucVmmDpXiHFyoDq+tyo7d49czu0KzPeiwIvT29bZDp/RS/4pl3EoQ=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168]:40128 helo=pettiford.lan) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1rFdka-0007Ao-Ic; Tue, 19 Dec 2023 12:19:25 -0500 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, jirislaby@kernel.org, jringle@gridpoint.com, kubakici@wp.pl, phil@raspberrypi.org, bo.svangard@embeddedart.se Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, hugo@hugovil.com, Hugo Villeneuve Date: Tue, 19 Dec 2023 12:19:01 -0500 Message-Id: <20231219171903.3530985-18-hugo@hugovil.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231219171903.3530985-1-hugo@hugovil.com> References: <20231219171903.3530985-1-hugo@hugovil.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SA-Exim-Connect-IP: 70.80.174.168 X-SA-Exim-Mail-From: hugo@hugovil.com X-Spam-Level: X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * -0.0 T_SCC_BODY_TEXT_LINE No description available. Subject: [PATCH 17/18] serial: sc16is7xx: refactor EFR lock X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.hugovil.com) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785731892391946501 X-GMAIL-MSGID: 1785731892391946501 From: Hugo Villeneuve Move common code for EFR lock/unlock of mutex into functions for code reuse and clarity. Signed-off-by: Hugo Villeneuve --- drivers/tty/serial/sc16is7xx.c | 104 ++++++++++++++++++--------------- 1 file changed, 56 insertions(+), 48 deletions(-) diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index 9154fd75134a..ab68ee346ec6 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -333,6 +333,7 @@ struct sc16is7xx_one { struct sc16is7xx_one_config config; bool irda_mode; unsigned int old_mctrl; + u8 old_lcr; /* Value before EFR access. */ }; struct sc16is7xx_port { @@ -413,6 +414,49 @@ static void sc16is7xx_power(struct uart_port *port, int on) on ? 0 : SC16IS7XX_IER_SLEEP_BIT); } +/* In an amazing feat of design, the Enhanced Features Register (EFR) + * shares the address of the Interrupt Identification Register (IIR). + * Access to EFR is switched on by writing a magic value (0xbf) to the + * Line Control Register (LCR). Any interrupt firing during this time will + * see the EFR where it expects the IIR to be, leading to + * "Unexpected interrupt" messages. + * + * Prevent this possibility by claiming a mutex while accessing the EFR, + * and claiming the same mutex from within the interrupt handler. This is + * similar to disabling the interrupt, but that doesn't work because the + * bulk of the interrupt processing is run as a workqueue job in thread + * context. + */ +static void sc16is7xx_efr_lock(struct uart_port *port) +{ + struct sc16is7xx_one *one = to_sc16is7xx_one(port, port); + + mutex_lock(&one->efr_lock); + + /* Backup content of LCR. */ + one->old_lcr = sc16is7xx_port_read(port, SC16IS7XX_LCR_REG); + + /* Enable access to Enhanced register set */ + sc16is7xx_port_write(port, SC16IS7XX_LCR_REG, + SC16IS7XX_LCR_CONF_MODE_B); + + /* Disable cache updates when writing to EFR registers */ + regcache_cache_bypass(one->regmap, true); +} + +static void sc16is7xx_efr_unlock(struct uart_port *port) +{ + struct sc16is7xx_one *one = to_sc16is7xx_one(port, port); + + /* Re-enable cache updates when writing to normal registers */ + regcache_cache_bypass(one->regmap, false); + + /* Restore original content of LCR */ + sc16is7xx_port_write(port, SC16IS7XX_LCR_REG, one->old_lcr); + + mutex_unlock(&one->efr_lock); +} + static void sc16is7xx_ier_clear(struct uart_port *port, u8 bit) { struct sc16is7xx_port *s = dev_get_drvdata(port->dev); @@ -523,45 +567,19 @@ static int sc16is7xx_set_baud(struct uart_port *port, int baud) div /= 4; } - /* In an amazing feat of design, the Enhanced Features Register shares - * the address of the Interrupt Identification Register, and is - * switched in by writing a magic value (0xbf) to the Line Control - * Register. Any interrupt firing during this time will see the EFR - * where it expects the IIR to be, leading to "Unexpected interrupt" - * messages. - * - * Prevent this possibility by claiming a mutex while accessing the - * EFR, and claiming the same mutex from within the interrupt handler. - * This is similar to disabling the interrupt, but that doesn't work - * because the bulk of the interrupt processing is run as a workqueue - * job in thread context. - */ - mutex_lock(&one->efr_lock); - - lcr = sc16is7xx_port_read(port, SC16IS7XX_LCR_REG); - - /* Open the LCR divisors for configuration */ - sc16is7xx_port_write(port, SC16IS7XX_LCR_REG, - SC16IS7XX_LCR_CONF_MODE_B); - /* Enable enhanced features */ - regcache_cache_bypass(one->regmap, true); + sc16is7xx_efr_lock(port); sc16is7xx_port_update(port, SC16IS7XX_EFR_REG, SC16IS7XX_EFR_ENABLE_BIT, SC16IS7XX_EFR_ENABLE_BIT); - - regcache_cache_bypass(one->regmap, false); - - /* Put LCR back to the normal mode */ - sc16is7xx_port_write(port, SC16IS7XX_LCR_REG, lcr); - - mutex_unlock(&one->efr_lock); + sc16is7xx_efr_unlock(port); sc16is7xx_port_update(port, SC16IS7XX_MCR_REG, SC16IS7XX_MCR_CLKSEL_BIT, prescaler); - /* Open the LCR divisors for configuration */ + /* Backup LCR and access special register set (DLL/DLH) */ + lcr = sc16is7xx_port_read(port, SC16IS7XX_LCR_REG); sc16is7xx_port_write(port, SC16IS7XX_LCR_REG, SC16IS7XX_LCR_CONF_MODE_A); @@ -571,7 +589,7 @@ static int sc16is7xx_set_baud(struct uart_port *port, int baud) sc16is7xx_port_write(port, SC16IS7XX_DLL_REG, div % 256); regcache_cache_bypass(one->regmap, false); - /* Put LCR back to the normal mode */ + /* Restore LCR and access to general register set */ sc16is7xx_port_write(port, SC16IS7XX_LCR_REG, lcr); return DIV_ROUND_CLOSEST(clk / 16, div); @@ -1049,17 +1067,7 @@ static void sc16is7xx_set_termios(struct uart_port *port, if (!(termios->c_cflag & CREAD)) port->ignore_status_mask |= SC16IS7XX_LSR_BRK_ERROR_MASK; - /* As above, claim the mutex while accessing the EFR. */ - mutex_lock(&one->efr_lock); - - sc16is7xx_port_write(port, SC16IS7XX_LCR_REG, - SC16IS7XX_LCR_CONF_MODE_B); - /* Configure flow control */ - regcache_cache_bypass(one->regmap, true); - sc16is7xx_port_write(port, SC16IS7XX_XON1_REG, termios->c_cc[VSTART]); - sc16is7xx_port_write(port, SC16IS7XX_XOFF1_REG, termios->c_cc[VSTOP]); - port->status &= ~(UPSTAT_AUTOCTS | UPSTAT_AUTORTS); if (termios->c_cflag & CRTSCTS) { flow |= SC16IS7XX_EFR_AUTOCTS_BIT | @@ -1071,16 +1079,16 @@ static void sc16is7xx_set_termios(struct uart_port *port, if (termios->c_iflag & IXOFF) flow |= SC16IS7XX_EFR_SWFLOW1_BIT; - sc16is7xx_port_update(port, - SC16IS7XX_EFR_REG, - SC16IS7XX_EFR_FLOWCTRL_BITS, - flow); - regcache_cache_bypass(one->regmap, false); - /* Update LCR register */ sc16is7xx_port_write(port, SC16IS7XX_LCR_REG, lcr); - mutex_unlock(&one->efr_lock); + /* Update EFR registers */ + sc16is7xx_efr_lock(port); + sc16is7xx_port_write(port, SC16IS7XX_XON1_REG, termios->c_cc[VSTART]); + sc16is7xx_port_write(port, SC16IS7XX_XOFF1_REG, termios->c_cc[VSTOP]); + sc16is7xx_port_update(port, SC16IS7XX_EFR_REG, + SC16IS7XX_EFR_FLOWCTRL_BITS, flow); + sc16is7xx_efr_unlock(port); /* Get baud rate generator configuration */ baud = uart_get_baud_rate(port, termios, old, From patchwork Tue Dec 19 17:19:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugo Villeneuve X-Patchwork-Id: 181146 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp2100032dyi; Tue, 19 Dec 2023 09:31:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IFK063X+hgCNqYcp1BaxTLKvQj4jO7hSMYKlKHTpoJLmz4eTR39R0lZU0PnqnSFQ0cKtIFs X-Received: by 2002:ac2:48b1:0:b0:50e:2f96:4ee with SMTP id u17-20020ac248b1000000b0050e2f9604eemr2502269lfg.36.1703007103696; Tue, 19 Dec 2023 09:31:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703007103; cv=none; d=google.com; s=arc-20160816; b=fxYdDbcLj0MzhFC4cIk2YW/StpJ+rVxjigaJWxFY8YQKZLK34l7pfNtrGcVFLcGR40 /WWkwOOtzmsAwrkG9urHdsyKKn8w3sNoUzITpeis3Xctb6nyz2fVdJOLA4ufFTUKsB1H T4fYuhBoQrOnqOpx5YWsTyFs1pVeCBpRm6EiBx+vhQZAKhMRphhKWK7j2gjJjDI3MzQn Qdak/3+rru8dAPDB9SeDbWUEpahkBxxr1xEba+mpL6oY5KG5ZZOpqO5NwN1CTBc2cjFJ uEMHW19XOB1g8Npdl4EF8f+WNHuVyLvsDilP76URzJFySaqw0AAp9dbmQO0V/Uuc597M dbaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=subject:content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:cc:to:from:dkim-signature; bh=KcYNp1sWTrGWiUqu1nyxva4KTAsY45l/5TWJVZ84DbE=; fh=cU7nueyVLD6PCX143V/gcz7kaNKnsE7kxUBegEucbAs=; b=Y2PN6vGYrkyqa98spg3Oko7856NC6YFhyge7wmnUpnhW7CTOSGYsJ15ILE8q/ym3Ll 7xHjLXoKfgTja7LU04Xj74nW5IG4VrvEy3ZT18weY8RE7HseTsPxu4ZMns1WdizkjRJL tdeRGm9PtNL9QiyTq7OVCbGvtPWYFAQlXQIFzyHo12zKWBjhtJtod+DHphXgX+Pmcvh3 qKZMUmiWp8Cndbe+YIQPE7ZdpSu4CEUGJYChs7nzMRrYJUQmsghqdiFF3XRiP96HVRxZ usCBQEFm6eBFkd39TEIwq4vumiOdbijeUebHBMb0eOVycYvVJNe+p4iJg9hll3eLr81z SaBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=BeZkUDmS; spf=pass (google.com: domain of linux-kernel+bounces-5677-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5677-ouuuleilei=gmail.com@vger.kernel.org" Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id d23-20020a170906c21700b00a1d5063b01fsi10955476ejz.834.2023.12.19.09.31.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 09:31:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-5677-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=BeZkUDmS; spf=pass (google.com: domain of linux-kernel+bounces-5677-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5677-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 130DF1F239AE for ; Tue, 19 Dec 2023 17:24:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 57FB13FB37; Tue, 19 Dec 2023 17:19:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="BeZkUDmS" X-Original-To: linux-kernel@vger.kernel.org Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E980221364; Tue, 19 Dec 2023 17:19:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hugovil.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hugovil.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=x; h=Subject:Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Cc:To :From:subject:date:message-id:reply-to; bh=KcYNp1sWTrGWiUqu1nyxva4KTAsY45l/5TWJVZ84DbE=; b=BeZkUDmS0Qlg0Xyvi2r+RDaD9N GfZJ7MuTv4qhQJwQpz+ywqURzyObSUnrDTmKZzJwjjkoASxaFny29IIrF2XrHRXAV3PQmHJ66TLtD 7HqLnLjfVu0bxFD/5k4ax4Ot23PNzrdHRMLj1IapmfMJafO+wlXEk2Jju+fbPhPQVmos=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168]:40128 helo=pettiford.lan) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1rFdkb-0007Ao-Qt; Tue, 19 Dec 2023 12:19:26 -0500 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, jirislaby@kernel.org, jringle@gridpoint.com, kubakici@wp.pl, phil@raspberrypi.org, bo.svangard@embeddedart.se Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, hugo@hugovil.com, Hugo Villeneuve Date: Tue, 19 Dec 2023 12:19:02 -0500 Message-Id: <20231219171903.3530985-19-hugo@hugovil.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231219171903.3530985-1-hugo@hugovil.com> References: <20231219171903.3530985-1-hugo@hugovil.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SA-Exim-Connect-IP: 70.80.174.168 X-SA-Exim-Mail-From: hugo@hugovil.com X-Spam-Level: X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * -0.0 T_SCC_BODY_TEXT_LINE No description available. Subject: [PATCH 18/18] serial: sc16is7xx: fix whitespace in sc16is7xx_startup() comments X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.hugovil.com) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785732376553252127 X-GMAIL-MSGID: 1785732376553252127 From: Hugo Villeneuve Add missing space at end of comments. Signed-off-by: Hugo Villeneuve --- drivers/tty/serial/sc16is7xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index ab68ee346ec6..a8a78d8f7fcf 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -1139,7 +1139,7 @@ static int sc16is7xx_startup(struct uart_port *port) sc16is7xx_power(port, 1); - /* Reset FIFOs*/ + /* Reset FIFOs */ val = SC16IS7XX_FCR_RXRESET_BIT | SC16IS7XX_FCR_TXRESET_BIT; sc16is7xx_port_write(port, SC16IS7XX_FCR_REG, val); udelay(5);