From patchwork Thu Dec 21 23:18:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugo Villeneuve X-Patchwork-Id: 182470 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2483:b0:fb:cd0c:d3e with SMTP id q3csp742531dyi; Thu, 21 Dec 2023 15:19:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IHqw0YNesLsvsFWAiLU9orDguNDtomIFcq0t5bWheP8+lDb+zglb6eiyhQEQwptN+03ismT X-Received: by 2002:ad4:5fc5:0:b0:67f:9179:5415 with SMTP id jq5-20020ad45fc5000000b0067f91795415mr443605qvb.24.1703200795136; Thu, 21 Dec 2023 15:19:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703200795; cv=none; d=google.com; s=arc-20160816; b=MbG1l6ZJ57NSdaXbCb+GMRirjZy/4fmsgXVMEnmMLR1k/dxdfFFTmt5uDJnULxN6gZ 6kwdM9AnAvYfsZ+LteM5dsZhnzM/h5kdMue4v/mp7r5kwEKWjH21gunE/1ebNu3MmkRn mqr0LWqACnVxz9daDFO3rN2NGUijJFSrZB0fx/bXiVTKFWf0Dc/PYnQV6OYY3Uh9QNYE eLyGAgj0Cl6We8gyngVSmLgcRvcUir4vOp0e7lEzT5Dth6EV9DqLxvA18EzkfgsynXZt B4IDVAfFZLfi+W8QFzupsmxVHIFvoGNO5mW440Z3duLEotKq9yUhm09H6uCLlX0DeZjo SaiQ== 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=zFCvSODRlDhyfhkyYaxqYDprC5OQrJQqCGo9MKePm3A=; fh=wezBxLKzeP89QLmtFJW/GbF5DMoLbBZvPQWVRfEqBGE=; b=bzjb9/vrwAkiRjl8aNqOzIAECtOzmm4Pl1voBG00UeNdOPW3H7SL1JfF1QTvshVSjl 7Pg8ZJZf99pKx0e4gHc+DnZRTrnK3UQ5qXjlsTd0xpo/dZuNaMxdKbM1+7vmwscI8gm6 bAFpY781L8y1I/IljjE4vnr7ARpFX8E4iP7tO/4GNz85Nq+kvbhfMYwkhusOoB6HhAtg gVdrvof2dUSBD4TXmemYagMIphJhena7jgBBt8sFDfLX7+LfN4R7i5O4RYXvGyK39wDi pISNdAiOi+o4Z0k94P9eSDoKVKlzFKDFojQ0W1g1Ki9/5QbnpCFOCiKBgHXKFKcT3Kxi r3Qg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=YZmyiQCH; spf=pass (google.com: domain of linux-kernel+bounces-9159-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9159-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 b17-20020a0cf051000000b0067f61745971si701575qvl.432.2023.12.21.15.19.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 15:19:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-9159-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=YZmyiQCH; spf=pass (google.com: domain of linux-kernel+bounces-9159-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9159-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 AD9D61C20D74 for ; Thu, 21 Dec 2023 23:19:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 732CA7AE93; Thu, 21 Dec 2023 23:18:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="YZmyiQCH" 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 B861078E8F; Thu, 21 Dec 2023 23:18:48 +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=zFCvSODRlDhyfhkyYaxqYDprC5OQrJQqCGo9MKePm3A=; b=YZmyiQCHE5e0ItphwBphKivjgL nVggYMT39w3kM1I/N43fofJjfKo4DXFbuQjJgZEqHiBEJ4R+CfdrCY8onz3tqcghDErcE0V5v1LWs lAlxUVMKR3FmJgkdZ4qcg0kkG+CEe6KmW108t33MEu3/gUzf7wmfZNfKiajkRFYHmni0=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168]:52484 helo=pettiford.lan) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1rGSJF-00025W-G7; Thu, 21 Dec 2023 18:18:34 -0500 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, jirislaby@kernel.org, kubakici@wp.pl, indrakanti_ram@hotmail.com, phil@raspberrypi.org Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, hugo@hugovil.com, Hugo Villeneuve , stable@vger.kernel.org, Yury Norov Date: Thu, 21 Dec 2023 18:18:08 -0500 Message-Id: <20231221231823.2327894-2-hugo@hugovil.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231221231823.2327894-1-hugo@hugovil.com> References: <20231221231823.2327894-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 v2 01/16] 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: 1785935476532932090 X-GMAIL-MSGID: 1785935476532932090 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 --- 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 e40e4a99277e..17b90f971f96 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); @@ -1678,8 +1670,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 Thu Dec 21 23:18:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugo Villeneuve X-Patchwork-Id: 182473 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2483:b0:fb:cd0c:d3e with SMTP id q3csp743218dyi; Thu, 21 Dec 2023 15:21:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IEG/1R38Ds1kl3MG3Ij/+uQVSfy7HUm5WIaL/CvU8BVlxMvuSHrFAg17OKBcOeuLcUwMZ7y X-Received: by 2002:a05:622a:1444:b0:425:74e5:6dbf with SMTP id v4-20020a05622a144400b0042574e56dbfmr662413qtx.67.1703200888175; Thu, 21 Dec 2023 15:21:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703200888; cv=none; d=google.com; s=arc-20160816; b=JH+KA2jyZedGj5p5r32/GCxdF/q+Ojh5VIMmRLse/wvOCWeCGhePG/DlNUFKFgkR3F fbI4joRsldu1GH958zQa10qkbZcMsE3vsBbWU4cvTjngeDu30JkOxyK+S56sa4G9Ajfm OhS56qFaXcod2bdh6cFiyBP/hiAQidrk6Q3j4PbN4lMYAaxotlp5FUxGeyqkIwxd773d OAJ7i4LilAAatck8SVBS7n4NOfa0K07bGar2POWd0EStQ1PkVf4EOqqI7NFK4rQ76vFL pzKOzF3yF09MetevCLWSNtPTCFLX+6eVFKzQQsM0NuB/7Pn60k41Jo2L2J5N2a1OQ7pt qa+Q== 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=PjscCF8fBWxjN74AYw6fohco9v/xt8gTMLeyIf2+SXI=; fh=FreLLvubcnWAsJ61Cb9C//T8tGr4FxZpgr8VYXOob6g=; b=xLDCFz6VyBNy/mZBapCKkvYyIIJq723cArc+6XLMJ4oz6Aj6boR1RraTrSh8S2fwMY Vjd9Pj4T6SY0Jht1mB9kGymzxXxF2qrNYWZghBADa5YlHMkHWSJ/8W6V8ryvBQhlWV4o UvtjM0ZuXKjT3IeGareb6L94Xfubfz7df93bmKPdHiFHOilhAuxQOLB1xHAc48l2HDQM 6w4u4n6GcjxgFnDy5qKUC0p6uvbMaE6X0a5zFN3Fpk2JqLDdGU8KIgj6sH8bwiVtv9Hh a/SYtBevvAAaqcsMhpnrWxJPGKOQCjx+zRPwzScMPTHuIg8WJ/BaDIPFWLs7uBghxdFk JojQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=or7i1bRJ; spf=pass (google.com: domain of linux-kernel+bounces-9162-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9162-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 d12-20020ac85acc000000b004254015c5d2si3229488qtd.519.2023.12.21.15.21.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 15:21:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-9162-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=or7i1bRJ; spf=pass (google.com: domain of linux-kernel+bounces-9162-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9162-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 E05CC1C215DB for ; Thu, 21 Dec 2023 23:21:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 295257CD00; Thu, 21 Dec 2023 23:18:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="or7i1bRJ" 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 F360679466; Thu, 21 Dec 2023 23:18:49 +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=PjscCF8fBWxjN74AYw6fohco9v/xt8gTMLeyIf2+SXI=; b=or7i1bRJN1qBH+1iXsmJRylBME RQRyLBe8FPE1pn88U8Qwxjfaz7Z5xugDkY2xJNYs9PBmnhlhl8Mpn4yn6O1d9C2FDNAwfZTlzDO0/ koH4tvl2Gu8WRv1inFejQW7dhUfZqJ0wLZYs2gMlBVl/QLafoE6XL8LJYzAFDrP5k+hA=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168]:52484 helo=pettiford.lan) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1rGSJG-00025W-Oi; Thu, 21 Dec 2023 18:18:35 -0500 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, jirislaby@kernel.org, kubakici@wp.pl, indrakanti_ram@hotmail.com, phil@raspberrypi.org Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, hugo@hugovil.com, Hugo Villeneuve , stable@vger.kernel.org Date: Thu, 21 Dec 2023 18:18:09 -0500 Message-Id: <20231221231823.2327894-3-hugo@hugovil.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231221231823.2327894-1-hugo@hugovil.com> References: <20231221231823.2327894-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 v2 02/16] serial: sc16is7xx: add check for unsupported SPI modes during probe 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: 1785935574160665288 X-GMAIL-MSGID: 1785935574160665288 From: Hugo Villeneuve The original comment is confusing because it implies that variants other than the SC16IS762 supports other SPI modes beside SPI_MODE_0. Extract from datasheet: The SC16IS762 differs from the SC16IS752 in that it supports SPI clock speeds up to 15 Mbit/s instead of the 4 Mbit/s supported by the SC16IS752... In all other aspects, the SC16IS762 is functionally and electrically the same as the SC16IS752. The same is also true of the SC16IS760 variant versus the SC16IS740 and SC16IS750 variants. For all variants, only SPI mode 0 is supported. Change comment and abort probing if the specified SPI mode is not SPI_MODE_0. Fixes: 2c837a8a8f9f ("sc16is7xx: spi interface is added") Cc: stable@vger.kernel.org Signed-off-by: Hugo Villeneuve --- drivers/tty/serial/sc16is7xx.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index 17b90f971f96..798fa115b28a 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -1733,7 +1733,10 @@ static int sc16is7xx_spi_probe(struct spi_device *spi) /* Setup SPI bus */ spi->bits_per_word = 8; - /* only supports mode 0 on SC16IS762 */ + /* For all variants, only mode 0 is supported */ + if ((spi->mode & SPI_MODE_X_MASK) != SPI_MODE_0) + return dev_err_probe(&spi->dev, -EINVAL, "Unsupported SPI mode\n"); + spi->mode = spi->mode ? : SPI_MODE_0; spi->max_speed_hz = spi->max_speed_hz ? : 15000000; ret = spi_setup(spi); From patchwork Thu Dec 21 23:18:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugo Villeneuve X-Patchwork-Id: 182472 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2483:b0:fb:cd0c:d3e with SMTP id q3csp742805dyi; Thu, 21 Dec 2023 15:20:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IGg2RmMJ4/NWjgAGV1rDKMNs8It4IutB8U/XhBgFdgzU+I9wBYV8vHGPiRnijWB95bbPxLX X-Received: by 2002:aa7:80cd:0:b0:6d9:6081:6011 with SMTP id a13-20020aa780cd000000b006d960816011mr441029pfn.27.1703200833238; Thu, 21 Dec 2023 15:20:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703200833; cv=none; d=google.com; s=arc-20160816; b=CkhJbzrZRRp178bQpRmdHC5JOxCHhG4bJ9MNSHUYv3sCVv9CNtkjYXB2foVJCdX86T qqrvDkBSTANZ7ObTlv7Ec13cTmQFoof3pNlqMT+ePK095R6bHSRvfH8BWOkruwpt8ZsY UyCv3nKNPD8hvZO+IAhYQ/jOatBFYF07pzT6tmM8Cr0cb0PRsi47WPbevBrC0YnIl7G2 yam0XthhDL6E6juogxKU8taHWqW7j5E1mtEBo80ilZknISSnuLmWqd11YRRxv6uPQw0r lJAhPEArgwcC7r2qw6I/dcNuBvva6VGmTBYQuDsB6NPz8MecQJR5Ys/72VSYhskQHjX8 NGYA== 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=yrYKaJQGhaYXoWdlYnZRVsxjxDm0Iq929KaWhEjGpFs=; fh=FreLLvubcnWAsJ61Cb9C//T8tGr4FxZpgr8VYXOob6g=; b=RxfFyEUHIQXFt8Cbx6sj6+YOSH+tRSiDKvtlYy2jokPe/F81/Dyulo7q8PaURCtuW5 MUv+oMOmqQtrDFzIc6qMVjkpMGQ9ZAVBqqm0vO9Rk26ODb1xr/VueZCe0XHvqHVmNHEo PjJBrg7I5taGTcZx8k7O6b8ZXj30Xkfi0g61VflHbtKryLw8KKzJCpPFLs2DRM4cm36k Qxn8vxHT334MRVGb7KX2HgqS8NbRSspxzP6tHsJHjOnMJ1ly79C3crN/vunGG0vyvNrW 1EPCy126/keKyTFO3idOiV5CxJYH9eYPT/cEJ3QNpvZh/wuNuPqZ2GFEMVYuBYwlkDo7 zMMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=md4cdrs0; spf=pass (google.com: domain of linux-kernel+bounces-9160-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9160-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 k64-20020a638443000000b005b8f446408bsi2266544pgd.422.2023.12.21.15.20.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 15:20:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-9160-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=md4cdrs0; spf=pass (google.com: domain of linux-kernel+bounces-9160-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9160-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 E5A7F2888F8 for ; Thu, 21 Dec 2023 23:20:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EEB5A7B3B7; Thu, 21 Dec 2023 23:18:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="md4cdrs0" 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 F36427946F; Thu, 21 Dec 2023 23:18:49 +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=yrYKaJQGhaYXoWdlYnZRVsxjxDm0Iq929KaWhEjGpFs=; b=md4cdrs02lCww75HamjzHWKcn3 XhJfBvD1LGaUNnbj9s9OiQ168DRqkdFO6Fb/8/QG8iYq5r2vXYNdhfgVsLzGB2GAZUoMM3SPothSO iFykqS8+lVJTWF9PupdKmE98ACIjvB81s8x0T75aOvEkxiGAWEcYBLtRKKT3J88n8muY=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168]:52484 helo=pettiford.lan) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1rGSJH-00025W-S4; Thu, 21 Dec 2023 18:18:36 -0500 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, jirislaby@kernel.org, kubakici@wp.pl, indrakanti_ram@hotmail.com, phil@raspberrypi.org Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, hugo@hugovil.com, Hugo Villeneuve , stable@vger.kernel.org Date: Thu, 21 Dec 2023 18:18:10 -0500 Message-Id: <20231221231823.2327894-4-hugo@hugovil.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231221231823.2327894-1-hugo@hugovil.com> References: <20231221231823.2327894-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 v2 03/16] serial: sc16is7xx: set safe default SPI clock frequency 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: 1785935516751400055 X-GMAIL-MSGID: 1785935516751400055 From: Hugo Villeneuve 15 MHz is supported only by 76x variants. If the SPI clock frequency is not specified, use a safe default clock value of 4 MHz that is supported by all variants. Also use HZ_PER_MHZ macro to improve readability. Fixes: 2c837a8a8f9f ("sc16is7xx: spi interface is added") Cc: stable@vger.kernel.org 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 798fa115b28a..ced2446909a2 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" @@ -1738,7 +1739,7 @@ static int sc16is7xx_spi_probe(struct spi_device *spi) return dev_err_probe(&spi->dev, -EINVAL, "Unsupported SPI mode\n"); spi->mode = spi->mode ? : SPI_MODE_0; - spi->max_speed_hz = spi->max_speed_hz ? : 15000000; + spi->max_speed_hz = spi->max_speed_hz ? : 4 * HZ_PER_MHZ; ret = spi_setup(spi); if (ret) return ret; From patchwork Thu Dec 21 23:18:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugo Villeneuve X-Patchwork-Id: 182478 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2483:b0:fb:cd0c:d3e with SMTP id q3csp743454dyi; Thu, 21 Dec 2023 15:22:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IF+go3xWXVQPL7s9xK1oaw+NiJPVsj4h/0YeEUB/P0+d7oIfXCsEyvFeSw0ufL0XgqA2pJ+ X-Received: by 2002:a05:6870:4152:b0:1fb:75b:12ec with SMTP id r18-20020a056870415200b001fb075b12ecmr622093oad.62.1703200920997; Thu, 21 Dec 2023 15:22:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703200920; cv=none; d=google.com; s=arc-20160816; b=CS+nP+FJlcJ8Fu4GljZyrqtnWpkv2WdzWlUstXA6bjQI8jDI2ygNTv20koNo9E7Gam VenW+gBqzDrzMpbOT/kawKwhlgK465Zcu8OXlposZQVNYjL2jJNDv7S+qwi2FEy03/wc 4V3I3WlbLWq9EZqV6iGE20BPb9vvkxU07Fe/rQt6tDXEYPpbq0ZbHc40HZCjyS2G9Dde f3slA06NzL4sZxop66jnhjInVL7sMKFQaAU2z6WsB3et79K88wo0aQzB9xau1kXtjveU UJCTOf1IdFDbjSZK2z/F+nRxhBo+gakaJQmoGjaHnHh5zK5zK8oE+vZVBTxhpx0zwCBY NgrA== 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=NqyaA+da2u2LMAkVhsOx0NUe18UOdygrK1MLZ2OBgRY=; fh=VrdPxeUvMlYH3nPywpJvuymi4CMWfCOu5aFHWZiYuXs=; b=fNo3ugSKl/wFpDZ6mmZXDsTgE1h0FHX3dBNxn26ZFLcAZUnGgONJYqZ6/MwZVVfY7v a466SU4wFf97EuTf1+OeoxgoP2Zq8WGBK/KHd448kkJLNMzSlpaDHwPusEinVsUlFh1x /SvWOlhjluimTnNBDnCzWKblP6gZCydk4wYV05tVZlO3ymB/+10hXNw3IT8pO2KU+8It qWRdp937DlLs+i1nhLtcp2zquo8iaRlkL058+dIfadzR+b7upPcA+V4LZSukPm+CRRJt IrlBwO3qadYg4leX2bc7mrKiQ19+jahVbTX+q6CXWPhIujWnue6DseyYUEO4n5yMXWv1 6/vA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=V5h8PKkc; spf=pass (google.com: domain of linux-kernel+bounces-9167-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9167-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 cm8-20020a056a020a0800b005cd9ebd3b36si2299842pgb.280.2023.12.21.15.22.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 15:22:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-9167-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=V5h8PKkc; spf=pass (google.com: domain of linux-kernel+bounces-9167-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9167-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 BB61E2832A0 for ; Thu, 21 Dec 2023 23:22:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D548A7D60C; Thu, 21 Dec 2023 23:18:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="V5h8PKkc" 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 CAC1E7948F; Thu, 21 Dec 2023 23:18:50 +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=NqyaA+da2u2LMAkVhsOx0NUe18UOdygrK1MLZ2OBgRY=; b=V5h8PKkc85RTZfJ5IhPCC9oz6j YBWoG+wqv9zw+zlALSXf4wx1n/P0k+dwMLwRMZYUWyR575Oazb9RUQ7dYu8y6iBXrzAOAalY04KL5 xB6waXC1vIc/aLu0IylvmtfpnBehkxPJuUOEbKNTn86MNCZDfPGptD9GvFpEfFoovvto=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168]:52484 helo=pettiford.lan) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1rGSJI-00025W-WC; Thu, 21 Dec 2023 18:18:37 -0500 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, jirislaby@kernel.org, kubakici@wp.pl, indrakanti_ram@hotmail.com, phil@raspberrypi.org Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, hugo@hugovil.com, Hugo Villeneuve , stable@vger.kernel.org, Andy Shevchenko Date: Thu, 21 Dec 2023 18:18:11 -0500 Message-Id: <20231221231823.2327894-5-hugo@hugovil.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231221231823.2327894-1-hugo@hugovil.com> References: <20231221231823.2327894-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 v2 04/16] 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: 1785935608877792097 X-GMAIL-MSGID: 1785935608877792097 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 | 81 ++++++++++++++++------------------ 1 file changed, 39 insertions(+), 42 deletions(-) diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index ced2446909a2..44a11c89c949 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -725,58 +725,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); - 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; - /* - * 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; + 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 Thu Dec 21 23:18:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugo Villeneuve X-Patchwork-Id: 182477 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2483:b0:fb:cd0c:d3e with SMTP id q3csp743435dyi; Thu, 21 Dec 2023 15:21:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IHuqhF3Hq8g2lHGNYsX4xTEZlACYj7mzbfTDyHYKIPN497H1Wy4PFTRH1kCzTvJCRiEUxdz X-Received: by 2002:a05:6870:8a27:b0:203:ea4e:38a7 with SMTP id p39-20020a0568708a2700b00203ea4e38a7mr723375oaq.31.1703200918934; Thu, 21 Dec 2023 15:21:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703200918; cv=none; d=google.com; s=arc-20160816; b=W9yOb/EzTjiYSywRzMiGl/gTlftj3EGRHOlwmnuJOPAivD5oYWEZxbWBItBbR0pwVi wJVWQGI8n+sIPZS3GRVF2BM2F5uhZ91fhGABab0Pyro+oq3GbOzcThIcaN5RDzkMhYLY xs8J0BdxW/ox3Aq8t6g36f6jdPsrd6TretUAbq/O9Ie2EIdl/+4b76UkSYSUkzWn7rbE hkqxGqABZDNg3u/59ul8EFuLgXfuaXDda6FvRFb5KOjHebNj5DWu7DZXkCTu55eMCU3c LyfjL4h4rkJbyx+0ZQC2V5hbpJGM2lJkxBmvlvGDb8CgsgAugPIlCWGinPBJqLh6k+Ih 6law== 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=5Gtw+pSsdTFBBEqkupr/ySyhkeLR1vqxZ7FoqKXHAhE=; fh=VrdPxeUvMlYH3nPywpJvuymi4CMWfCOu5aFHWZiYuXs=; b=DLl2njCnAiV3huzJlfql+kSOHQI3PxaTB/zm861ejPNGAm03HUWQ1EO6WhsUojg+49 ieSGkB437OC6AGXrkEeTrIqggN1qeGlrwOHy2HfSCZYBCfaCvgc+UMJQpqp7bbNoiVLf wNTMNAX6GrdFu9fpP8q1tFbnd4gNtMl0dv97rdDFW+WXnl9HY5vGMQHZiK1ab1m9aEeI Xzt4kMMphTHvzcN9vvgteDj2jmJMvBNk8yMDLmb8iEpOjn+0b9ACz1ohWykiZh7mNE12 dBWzPvvAu9iVclmg0H4amsaL4pE1v2aElp79quk2Urw/Uwca4p26Fe3ldnEWK83Tsh3K y3rA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=sPTaPtqJ; spf=pass (google.com: domain of linux-kernel+bounces-9166-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9166-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 y193-20020a638aca000000b005bd66bfc253si2318867pgd.148.2023.12.21.15.21.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 15:21:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-9166-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=sPTaPtqJ; spf=pass (google.com: domain of linux-kernel+bounces-9166-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9166-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 A112C282F37 for ; Thu, 21 Dec 2023 23:21:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C82AE7D606; Thu, 21 Dec 2023 23:18:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="sPTaPtqJ" 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 CABE179463; Thu, 21 Dec 2023 23:18:50 +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=5Gtw+pSsdTFBBEqkupr/ySyhkeLR1vqxZ7FoqKXHAhE=; b=sPTaPtqJ0JI+NyxFj1ERZNv0zR VtAPq/GUzUMACkE7kRBQhBHT5HdUSa/U9j5e2wYa5qBaKdKmeAWUXG24n5rPogH+ibh2vYI/+gpEh 50SbHLlRNKe4pjaqOgXW1UQvkVyFmRafWXtvNAtGs3I5dyDg+Pf//Pis0A+w2UXs8uJc=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168]:52484 helo=pettiford.lan) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1rGSJK-00025W-3w; Thu, 21 Dec 2023 18:18:38 -0500 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, jirislaby@kernel.org, kubakici@wp.pl, indrakanti_ram@hotmail.com, phil@raspberrypi.org Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, hugo@hugovil.com, Hugo Villeneuve , stable@vger.kernel.org, Andy Shevchenko Date: Thu, 21 Dec 2023 18:18:12 -0500 Message-Id: <20231221231823.2327894-6-hugo@hugovil.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231221231823.2327894-1-hugo@hugovil.com> References: <20231221231823.2327894-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 v2 05/16] 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: 1785935606758882212 X-GMAIL-MSGID: 1785935606758882212 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 | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index 44a11c89c949..8d257208cbf3 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -783,17 +783,18 @@ 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 { int i; + keep_polling = false; + 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 Thu Dec 21 23:18:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugo Villeneuve X-Patchwork-Id: 182475 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2483:b0:fb:cd0c:d3e with SMTP id q3csp743395dyi; Thu, 21 Dec 2023 15:21:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IE4DvZhgmPJAK3+Hlrvyfkm9gVfAPxu3cKyMqfTTqE/tliQqbTZ8Iobo9uLAcuyMyaJKQ30 X-Received: by 2002:a05:6e02:1a21:b0:35f:b16e:5701 with SMTP id g1-20020a056e021a2100b0035fb16e5701mr534519ile.36.1703200912995; Thu, 21 Dec 2023 15:21:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703200912; cv=none; d=google.com; s=arc-20160816; b=UdC2biNf7f2uxdXq5TOQjFTXPNdIXFhxoE2nfSD0ZSyXT4P6p/IYx5KBy6Sb6HO2t4 jxr8vB0/WQZIGq1JvQ3o8Z+9rBsF2HDs4xqGjLaBt/FO7XpEEtgfz1yxWYFqDXaayZzC erQbkoXzEju4CMJDjxyB+H1FWc/ffMDYZtk1v41TaGgDXKaQpih3cKhqacHURqzrBrrh SsroHpz9Yx990fRLpodl5LoCfA2gPjtFpPC1gIs8kqF/By//XioEnwWY97DuJ8EPF1F+ uYhA8mGQZANUh36W2yI6YSDDTcGbVsdZnHXPO/pHHyC3ITFH5fNV4vZdcmlkUIhsoORH MDzg== 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=B8RBGDPahS1ur3p/qDWPcwo9Bjx7+cKK6Lcpi1YUSeY=; fh=a+7AZTsUdGs2+AWrQbNEXqvESCr9vB6fImIjtsp44Zg=; b=BQ7H/VoSSZe1zAjNEbyqgeXvbH/GoW4GyjursztWIorJnLI8oqxpPcnKBosMCk+S3w r3TgcHMym2HJWGUP59hTe9fNzaEGsZOARRQ7AUEAWW2g6LRTAS32Ljlp1YjUNWam1v8b 2ZewDcbCasKHmaeyscl+CxL8FSSN4ivW+qRdyoCZa48KG2OhwAap3fceAmnTv5/RzPaL HGWJQp+PElqL/3e8hj2mUJ3D8GRtbsVtu6SP9YxZb0Lw1i0NWIEbGpYe5nTdUJesssjB I+eZ4VCOAlpsybYYNqdglhow4IwXXpSLTTjE+QpCVTE6Wmf1ukeiw3ePm5IlzhKD6c16 UzeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=Z9yr0to8; spf=pass (google.com: domain of linux-kernel+bounces-9165-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9165-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 cm11-20020a056a020a0b00b005c62615924fsi2397049pgb.102.2023.12.21.15.21.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 15:21:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-9165-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=Z9yr0to8; spf=pass (google.com: domain of linux-kernel+bounces-9165-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9165-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 BEDEC282DF9 for ; Thu, 21 Dec 2023 23:21:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9C3537D5EE; Thu, 21 Dec 2023 23:18:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="Z9yr0to8" 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 9BA777996E; Thu, 21 Dec 2023 23:18:51 +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=B8RBGDPahS1ur3p/qDWPcwo9Bjx7+cKK6Lcpi1YUSeY=; b=Z9yr0to82hgy4fEwx7xE+MyGoL i8W04uc9+R/QyDLpaR8MEjtRFyhgx9EHAYJzmbiv1CH3T1ENHW+BPU4orjoWJKpSWioxAvuEL6TDy N8fuIylfXYMeOLaa8oUm2GCCvloikxthW8IQOaWjyrPKq/zsSLh6Dr09eYszDBD8xZlo=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168]:52484 helo=pettiford.lan) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1rGSJL-00025W-83; Thu, 21 Dec 2023 18:18:40 -0500 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, jirislaby@kernel.org, kubakici@wp.pl, indrakanti_ram@hotmail.com, phil@raspberrypi.org Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, hugo@hugovil.com, Hugo Villeneuve , Andy Shevchenko Date: Thu, 21 Dec 2023 18:18:13 -0500 Message-Id: <20231221231823.2327894-7-hugo@hugovil.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231221231823.2327894-1-hugo@hugovil.com> References: <20231221231823.2327894-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 v2 06/16] 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: 1785935600652715772 X-GMAIL-MSGID: 1785935600652715772 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. Reviewed-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 8d257208cbf3..42e1b4c70ed6 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -347,7 +347,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, @@ -1536,7 +1536,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; @@ -1587,7 +1587,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, @@ -1646,7 +1646,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); @@ -1669,7 +1669,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 Thu Dec 21 23:18:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugo Villeneuve X-Patchwork-Id: 182476 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2483:b0:fb:cd0c:d3e with SMTP id q3csp743399dyi; Thu, 21 Dec 2023 15:21:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IEt8npiIBW2TrylBqxwSlRZZSuSCxW0PD1cz9H9IirmXhqKsNcWfevSt+s610t+gql2xIiY X-Received: by 2002:a17:907:9047:b0:a23:63cd:6587 with SMTP id az7-20020a170907904700b00a2363cd6587mr222185ejc.92.1703200913026; Thu, 21 Dec 2023 15:21:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703200913; cv=none; d=google.com; s=arc-20160816; b=M60EEOwbj0dIw0d8QIU/vupV1VQUKykUeU0RaiPcVYjqhs8WYaetcZbT53xEVVvyrp hwzGxQegldI6Xuct4Go3O5wWQoRfT5CalPNSFeWKbx4iUb2DpOqL5uhrnIT5UEIT+qL9 sc8qPYoQG3CWkcv3f+aHmWg+JFHY3/0Ck/vZCKtNhHfWrVZonmzmzYn7GrSyt/DAAEAD NskeZJa9ZTejMFHCeyqpTsvnUKC+ME28lGJq23oLn1GtMXhq04tZKFY/iSJzYAkejdW/ OX4IWgtHdmgI8LczEvL1w9eE8v7/35vgTAUG8vrfAHZ2RBIFpEbxkuMjhbod3c7j8SHN AdpA== 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=1D+dxnnl4V5IiyIxDqSn6oylZMa3p3hHDTTttZBVpxA=; fh=xLWyschydcwW23fRlVvCnAn0jM2rGvhMoJ71MHWBla4=; b=wym9PvKj9O4G7UYCgxPijnLLHAaO5TwNPp2aUZ8njPZpddVGVgOnFjC4YzA1QaCxdf pJZ3dB1H/bJ0rzXxxQ0s12w2gyoFktruBwojnDoAmpHg+M2vUrmNP1K1uF2oJXkpt14O b6VQvwOqgUhc9z+DdHjgW9d7fVQ7zk1e2fKHvr6WbVidP7bkkcB3xpHugwIfzdBFMmr4 5vLL0DCVFM7oT44I/hveefNAAapfhU49pUBgKLmKPdjBVXc0RKDW22fIFuIai7O2P6gP qD9hYgQNhsY+yAhWoodnmi296p6XZZGNKs0H6rKIxrUcm/WY3AJE63aEZ8yPOlcpEktA Hu1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=MVQQxVsu; spf=pass (google.com: domain of linux-kernel+bounces-9164-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9164-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 gi34-20020a1709070ca200b00a1d3eccb0f0si1169295ejc.428.2023.12.21.15.21.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 15:21:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-9164-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=MVQQxVsu; spf=pass (google.com: domain of linux-kernel+bounces-9164-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9164-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 A145E1F22387 for ; Thu, 21 Dec 2023 23:21:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9C0B37D5EC; Thu, 21 Dec 2023 23:18:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="MVQQxVsu" 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 98D0F7996B; Thu, 21 Dec 2023 23:18:51 +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=1D+dxnnl4V5IiyIxDqSn6oylZMa3p3hHDTTttZBVpxA=; b=MVQQxVsuzFn032/hFu/ov74Tzo VH9rvd/gFqcq2AttJTmrumHZIPspMr5p4GikMwwRdIQ+elrPS5lQ6GAO3zFO7fZh1pwZBQyKlbby5 2zvff891t9QTScC+HBqe/mWHcvJMzrlA1ciI4cr3aKLZE3HyuvQGKheio/06TjxHy/UY=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168]:52484 helo=pettiford.lan) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1rGSJM-00025W-Ls; Thu, 21 Dec 2023 18:18:40 -0500 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, jirislaby@kernel.org, kubakici@wp.pl, indrakanti_ram@hotmail.com, phil@raspberrypi.org Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, hugo@hugovil.com, Hugo Villeneuve , Andy Shevchenko Date: Thu, 21 Dec 2023 18:18:14 -0500 Message-Id: <20231221231823.2327894-8-hugo@hugovil.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231221231823.2327894-1-hugo@hugovil.com> References: <20231221231823.2327894-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 v2 07/16] 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: 1785935600757184975 X-GMAIL-MSGID: 1785935600757184975 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, 3 insertions(+), 9 deletions(-) diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index 42e1b4c70ed6..4161d692df40 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -1742,15 +1742,9 @@ 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 = spi_get_device_match_data(spi); + if (!devtype) + return dev_err_probe(&spi->dev, -ENODEV, "Failed to match device\n"); for (i = 0; i < devtype->nr_uart; i++) { regcfg.name = sc16is7xx_regmap_name(i); From patchwork Thu Dec 21 23:18:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugo Villeneuve X-Patchwork-Id: 182480 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2483:b0:fb:cd0c:d3e with SMTP id q3csp743568dyi; Thu, 21 Dec 2023 15:22:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IHJubP4ZHlQYxwVzyCoLTI/Y40gXgFHUiZmOE/kfc7OrSz2jNaAoNSZzUK5KX+yzGoYarSk X-Received: by 2002:a17:907:c99b:b0:a23:2eae:b879 with SMTP id uj27-20020a170907c99b00b00a232eaeb879mr221104ejc.148.1703200938415; Thu, 21 Dec 2023 15:22:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703200938; cv=none; d=google.com; s=arc-20160816; b=Zq7mzTZbl0rLZRr4tXBwRChoc/oPwVE0zdQzoxyHSwgEIeS0gyWcXvIe//fp0uWBWY DpKDbzWn4jQjJLsN/j5d9XnWFT6z1kodBiv3Aruztp7/Ya+Msc+/Jv52L2zza+9cXmAa jgPteLF/UAEOmn6/qZKz9p+c1xBnEAFs8e2+jQynR+QanCDwGB7KVhTJfk4StM9Pmte8 bwUOVatNy65LtI/oNyQhArW7bfCCH09efWO4Gk2ktIQ674qUttitcbfoqhqkzPpVX5Ut 0KSubPD/9kMSibO4EgdVgI1HwyGu9bhlCyjA/0lr0Oo24lbMWcNhXqD9TOF7O7zz9iQv F4Iw== 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=7TEnK/Z3hipz1x5knONUiV1aCkjkJZlxI+yRt9HAk+M=; fh=xLWyschydcwW23fRlVvCnAn0jM2rGvhMoJ71MHWBla4=; b=O65k1der1vHYBFjInXroVOARCt4qeq7aeuEJdqXMXfjf7rw3buHvUdhZyMrZKCopco HYNLBmsrSthieL6QRI8tpHHX+zCozAm0o4fY3zBoBpQh7O2ca9lcMxjTVLK6bk4ZJAtM i4NCwmfcIOI/k6v8B0hnLyKBGrbFjQb5Xs/+wkdBqlSQMcdlCTNfZgzSKREzoz8fVU2o alTyciSN5h6AKLuasyvWRHrG89+5G6ZCjrRbLypp/IB1Gj+Npw32TFxk0z/EbQdahIek T3Jcnm/rDqLCJ7REWg7ShdEJ8t+mE11Kn0DhWUh6fn07thxmBkn2TOTob1hevDJJsqoq 1iLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=b5KtzAvH; spf=pass (google.com: domain of linux-kernel+bounces-9168-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9168-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 ks15-20020a170906f84f00b00a234b6c0e0fsi1237770ejb.746.2023.12.21.15.22.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 15:22:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-9168-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=b5KtzAvH; spf=pass (google.com: domain of linux-kernel+bounces-9168-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9168-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 0E9A11F216C6 for ; Thu, 21 Dec 2023 23:22:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3B1797D890; Thu, 21 Dec 2023 23:18:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="b5KtzAvH" 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 9A4C27996C; Thu, 21 Dec 2023 23:18:51 +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=7TEnK/Z3hipz1x5knONUiV1aCkjkJZlxI+yRt9HAk+M=; b=b5KtzAvHWX5YwMloHiaXHDRnXP E1o52bGKL1LzovEuj8jU5Fm7mwgahKglKYZIt+fKS5RjlAdWDPLPG2t7x/jKJYW14tJvc0tCT8Goe 7M+cT/IU6gxWnwnIdVnMbaCmJR7r1PPbt2DSd7mRukybxGzLEUNLyPNC3XRSKD1d9Fqw=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168]:52484 helo=pettiford.lan) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1rGSJN-00025W-LT; Thu, 21 Dec 2023 18:18:42 -0500 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, jirislaby@kernel.org, kubakici@wp.pl, indrakanti_ram@hotmail.com, phil@raspberrypi.org Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, hugo@hugovil.com, Hugo Villeneuve , Andy Shevchenko Date: Thu, 21 Dec 2023 18:18:15 -0500 Message-Id: <20231221231823.2327894-9-hugo@hugovil.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231221231823.2327894-1-hugo@hugovil.com> References: <20231221231823.2327894-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 v2 08/16] 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: 1785935626830352167 X-GMAIL-MSGID: 1785935626830352167 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, 3 insertions(+), 8 deletions(-) diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index 4161d692df40..e7f3184a70a1 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -1796,18 +1796,13 @@ 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 = i2c_get_match_data(i2c); + if (!devtype) + return dev_err_probe(&i2c->dev, -ENODEV, "Failed to match device\n"); for (i = 0; i < devtype->nr_uart; i++) { regcfg.name = sc16is7xx_regmap_name(i); From patchwork Thu Dec 21 23:18:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugo Villeneuve X-Patchwork-Id: 182484 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2483:b0:fb:cd0c:d3e with SMTP id q3csp744665dyi; Thu, 21 Dec 2023 15:25:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IEIc5j63b46x8MIvcC45n3ij8dSjkQCPLVaeVZVw5DhmzdmhkViQdjnRxQIZQmxg1nZSvCl X-Received: by 2002:a17:903:22d0:b0:1d0:6ffd:e2d8 with SMTP id y16-20020a17090322d000b001d06ffde2d8mr503787plg.114.1703201113352; Thu, 21 Dec 2023 15:25:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703201113; cv=none; d=google.com; s=arc-20160816; b=zxNZDNmnjO3LOCUcQy3vwA2WgUyreV9KrQr+sww6IqTIlhu9t6Rw+dAtTky3x3Ed05 xNVh7pJDi3TOvPEBKb1lZ9p26+rKnMHs1lyzN9dbCbnEgjmuarJ8jDa+IE+3YRooxCt7 9730jKkq+ouQpxxNNmS3n2EMvvkgYfVjsvs1ixz0DZAkgtGAHH1xYAuVfzkwEaKQKgLc 1ciIYruyBsKuigMurs6oAc2tKfgU6/QUXfPd75HLNTiXN30UdyrLcAsxVR9hEl4JpaKN pmBdfu87QCpgSAfIrOsLlFldJ5pCusMz9Hj2YBq7GQCw6Cryfl5ecaAm0xwRzSwdhSTb Kr5A== 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=SlEM2rILNAZB6YQdLheCmIbuxLDabci7Ac0z9IGXTaQ=; fh=a+7AZTsUdGs2+AWrQbNEXqvESCr9vB6fImIjtsp44Zg=; b=D40E1GWCfJ7H8UQ2vz+g6v5chehuxZdWCdtIFFlEu/dsPGS8XGyE0zely/+XROXcuy e0bbdAQ0K4QG/VlKPn5aBvbuxlVIIZM2UOMHJxDHKwWEHyHm6ZbMAb0Klo52P8w8kgVU Ls3hHiqd7CBie/+lwJFxm20E5VToNCgzoCCiXvyZss23BM5atvFPe5j2QRYIoT5GYUU/ jNWl4sRsiPdx+DG5VtHGez0vocL+9z2MdywUFOTgSrQCntaJVVZru2BwBSKpW7m8h9t5 Xh2Dphr9KWfP72skqFT+f+TxE/HGOcbI2DOjKPLCQ/rFpUuScmw77tixFd8cfLtCVgEj s7rA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=klF4EmqZ; spf=pass (google.com: domain of linux-kernel+bounces-9171-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9171-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 h7-20020a170902ac8700b001d09ffdfe1fsi2197371plr.171.2023.12.21.15.25.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 15:25:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-9171-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=klF4EmqZ; spf=pass (google.com: domain of linux-kernel+bounces-9171-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9171-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 D75FEB267D6 for ; Thu, 21 Dec 2023 23:22:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 24ED87E57D; Thu, 21 Dec 2023 23:18:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="klF4EmqZ" 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 8B10E7A20A; Thu, 21 Dec 2023 23:18:53 +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=SlEM2rILNAZB6YQdLheCmIbuxLDabci7Ac0z9IGXTaQ=; b=klF4EmqZJ/0h/Jllt+P6EP6jBp V9teL5n0n6y3tkt+wq97vD5KbOH7dKFP0LGISHmt+NZDR4wCQh7ubp7MmvKVVD4z4fia0lteo8NjS LZ0YMfIX7nYJIArX/a07L2BEytgrkrIUpDN5pXVbaoz9wXOFQHHRCCJpw3YSOEEjV8PE=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168]:52484 helo=pettiford.lan) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1rGSJO-00025W-S0; Thu, 21 Dec 2023 18:18:43 -0500 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, jirislaby@kernel.org, kubakici@wp.pl, indrakanti_ram@hotmail.com, phil@raspberrypi.org Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, hugo@hugovil.com, Hugo Villeneuve , Andy Shevchenko Date: Thu, 21 Dec 2023 18:18:16 -0500 Message-Id: <20231221231823.2327894-10-hugo@hugovil.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231221231823.2327894-1-hugo@hugovil.com> References: <20231221231823.2327894-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 v2 09/16] 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: 1785935810537441250 X-GMAIL-MSGID: 1785935810537441250 From: Hugo Villeneuve Make sure that the driver name is displayed instead of "unknown" when displaying the driver infos: Before: grep ttySC /proc/tty/drivers unknown /dev/ttySC 243 0-7 serial After: grep ttySC /proc/tty/drivers sc16is7xx /dev/ttySC 243 0-7 serial Reviewed-by: Andy Shevchenko 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 e7f3184a70a1..b73fac209f1e 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -351,6 +351,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 Thu Dec 21 23:18:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugo Villeneuve X-Patchwork-Id: 182469 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2483:b0:fb:cd0c:d3e with SMTP id q3csp742507dyi; Thu, 21 Dec 2023 15:19:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IEVUP9BTepOHGmMZgb+ST/uLT3KuU5LQNLW0I/p2Zg6hUiAq6mVmA6PIa41Yw3R4t0kSKJS X-Received: by 2002:a05:622a:1cf:b0:423:8cb4:70c with SMTP id t15-20020a05622a01cf00b004238cb4070cmr504939qtw.25.1703200792519; Thu, 21 Dec 2023 15:19:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703200792; cv=none; d=google.com; s=arc-20160816; b=CXKCov9kRSQg1zMECLYniIerDth8Z6bnO7bfMdN4kdVz7et6gtgVK1RHMGb0OTppas o968MdQpzh7M/mm5sXvhMdAJRWUMETqm7ALnkCi9fXOIkS13b6vX9icGztRBPrE9ovkt 3z7dNonXMOFEwpqMzdZheW1N9XEL3gDvTYP+F9r94czihAZ8ccmemVbI+ktp3hCt4jxD zZKhsDq4Xl/2PiBtdh1lYKboUgitcyFUYzesfdBGPJ6po4DHIAhcAJexjUzT73lwdsON hYAOxZMsFE7refh2n7si6hxzKX5gvRtOYsCqrMTqiaBeA9MDtM48mt9qRmC1/NAy5BBY x4pg== 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=9vLSuwSuinaGR58m/VQBBtnfS0zJHnLEOqbKnjl2e+8=; fh=Ycbn6ef12HpHqEFiWziTSDbqSWr2f8qbHtf8sJuk8ZI=; b=dKYkpgFcdhriZa6fWkb1H7Dx+03dhzU2N7rUcHwc7bkexG7H0vaE/bVD9RjWG0ADSn 6svU4xkRo4+iwJEKxeL2yiTRXfTxk2GMysw35bwdodLgWBAhtWziWEHpIsQUoJreSCns xiaznHLNtEsJIATuLmxSu/159k1r5y+MlCUlwhVYxJ29g411lC4DQnRH4dM57zfbAmmS n309nfmckuP8Si0ub7kGtIuHoDnD2EbskTudXI/2o0FyGgGefxGSNtq+dHE917+qquzB JgMBF07upKADHr0+JVvK1O+9Bte+2GwbN0oDDg4qvLiTBnUTQtAty+Y+MG0a63yHWbZQ /M0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=ZgEVfGWd; spf=pass (google.com: domain of linux-kernel+bounces-9158-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9158-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 v4-20020a05622a014400b004275bd26e1bsi3166136qtw.316.2023.12.21.15.19.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 15:19:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-9158-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=ZgEVfGWd; spf=pass (google.com: domain of linux-kernel+bounces-9158-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9158-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 6752C1C21765 for ; Thu, 21 Dec 2023 23:19:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 392507AE7B; Thu, 21 Dec 2023 23:18:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="ZgEVfGWd" 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 39C8F78E9D; Thu, 21 Dec 2023 23:18:48 +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=9vLSuwSuinaGR58m/VQBBtnfS0zJHnLEOqbKnjl2e+8=; b=ZgEVfGWdU24hPBZ+fO6NHWHieT XR4mtREvX2wJSgur4UyWZ+FFq73SyAPse3C83iW8UrJd1WUebwKpg1FvxB7hbXty516y3s4EvdOvP KEgHVISHsGrI6LAVcxGmxx4GHar12ASqI7O68PpFBZurzwD4PIsruIIZWWyXPibxhlUY=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168]:52484 helo=pettiford.lan) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1rGSJQ-00025W-5C; Thu, 21 Dec 2023 18:18:44 -0500 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, jirislaby@kernel.org, kubakici@wp.pl, indrakanti_ram@hotmail.com, phil@raspberrypi.org Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, hugo@hugovil.com, Hugo Villeneuve Date: Thu, 21 Dec 2023 18:18:17 -0500 Message-Id: <20231221231823.2327894-11-hugo@hugovil.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231221231823.2327894-1-hugo@hugovil.com> References: <20231221231823.2327894-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 v2 10/16] 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: 1785935474112322505 X-GMAIL-MSGID: 1785935474112322505 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 | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index b73fac209f1e..6181cc6f934b 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -29,6 +29,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 */ @@ -1398,7 +1399,7 @@ 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"); @@ -1425,7 +1426,7 @@ 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"); @@ -1727,7 +1728,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; @@ -1798,7 +1799,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 = i2c_get_match_data(i2c); From patchwork Thu Dec 21 23:18:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugo Villeneuve X-Patchwork-Id: 182471 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2483:b0:fb:cd0c:d3e with SMTP id q3csp742686dyi; Thu, 21 Dec 2023 15:20:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IH/WqXBhxsPmAKGxLl4Zm+HxPGseknFFL6onLY2d/T/orEnf/yuFOk0EBLNCJy7ISO9/7n5 X-Received: by 2002:ac8:4e95:0:b0:427:87f6:9436 with SMTP id 21-20020ac84e95000000b0042787f69436mr788202qtp.50.1703200818436; Thu, 21 Dec 2023 15:20:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703200818; cv=none; d=google.com; s=arc-20160816; b=zzwoRU58ic9Yq54GlhvyLQ75WWf/W+zClu//7xHYnqS7oso6l9jAH+w03l8pwGAeH5 D7y5UK7p8D8RoS8SXErqgwsnqvj8mtND9+BunGObWR78/zrZl3ZCYeHTV06YIG247whN 336zjBOFDmMZ1R2+CasWdm5ytDDohdAuhbglpMozCcG4sRZy/noZ/iw3Lyp7gOUN6o0d jTgeMg1zFRd7MCl/4bAMn7tQ53x01akUcp2nxHZdzjPFsTYiqGIF8z2rmE+H0QQszlSN dkg3zCi1cBvhep1gWAZS+ix72S4UB9tRzmAyXvd+vd93SsWcg1I7ks5QAsskaqtfuBxs ohBw== 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=erjmsDZRhrWnaUKZ8qETR02HqNmxBDRKhVazGRk6Y6c=; fh=xLWyschydcwW23fRlVvCnAn0jM2rGvhMoJ71MHWBla4=; b=W/bqrNcR7T6ULUEDrFV0J02ZdAoM9EPGKRVPguxb2iLB+8OEK7pxCRYqWz/5f1iexD 8KLmV+0S7C4EOKYzzaydLWG1fiOLBwSj3bqyi+V03l44vQJ4UG/AGI5HzPCT6L7Q6iVl BMwL4hMMIY26fumTgSeCa+j5fwqzumuRvxspiSXy70yHOsgB+VhBrP4FgAmvtEQlF1C+ IWUSibcCKvFvYwd85RZY1r6E5kWXuToe+1+gGVOVu/ZVgAvH4GgaQaKMfTaqif7nqTcO XhG3wP2zSkgNORWXAQqhVsUaKcUfQ5r5OUtxo02E2H8xTn7kSqY72MIe/xgrsSXSn8Pk ggiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=zMCNLWRH; spf=pass (google.com: domain of linux-kernel+bounces-9161-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9161-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 v4-20020a05622a014400b004275bd26e1bsi3166136qtw.316.2023.12.21.15.20.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 15:20:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-9161-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=zMCNLWRH; spf=pass (google.com: domain of linux-kernel+bounces-9161-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9161-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 3B6391C208CF for ; Thu, 21 Dec 2023 23:20:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3FEA57B3CF; Thu, 21 Dec 2023 23:18:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="zMCNLWRH" 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 5224779476; Thu, 21 Dec 2023 23:18:50 +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=erjmsDZRhrWnaUKZ8qETR02HqNmxBDRKhVazGRk6Y6c=; b=zMCNLWRH1QBvIOWMSl5ucZv1DI OIr0CLz2DSqWjjJKTKBAzopDz3H+yHH0wybHv9e9wmzSugawY6VGj8ZLH0Z7uFuLfGhJTGfRnxB4A klxmadOeZDUji8CZIc5d5fj+NphUD5SH1cfsCWUUfh2KzbuaWRYAae4h//gUCPRmqlHo=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168]:52484 helo=pettiford.lan) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1rGSJR-00025W-KB; Thu, 21 Dec 2023 18:18:46 -0500 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, jirislaby@kernel.org, kubakici@wp.pl, indrakanti_ram@hotmail.com, phil@raspberrypi.org Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, hugo@hugovil.com, Hugo Villeneuve , Andy Shevchenko Date: Thu, 21 Dec 2023 18:18:18 -0500 Message-Id: <20231221231823.2327894-12-hugo@hugovil.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231221231823.2327894-1-hugo@hugovil.com> References: <20231221231823.2327894-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 v2 11/16] 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: 1785935501208103606 X-GMAIL-MSGID: 1785935501208103606 From: Hugo Villeneuve Allows to simplify code by removing the break statement in the default switch/case in some functions. Reviewed-by: Andy Shevchenko 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 6181cc6f934b..da862b8efcbe 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 Thu Dec 21 23:18:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugo Villeneuve X-Patchwork-Id: 182474 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2483:b0:fb:cd0c:d3e with SMTP id q3csp743311dyi; Thu, 21 Dec 2023 15:21:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IHjvtsYifD3lrg1UsyER3SEu56/l8eYJqFz8MzDa4HFOKf6P1Yv5AUYeR50uvLcoxAitVmV X-Received: by 2002:a05:6358:71cd:b0:173:50b:26de with SMTP id u13-20020a05635871cd00b00173050b26demr529363rwu.30.1703200898683; Thu, 21 Dec 2023 15:21:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703200898; cv=none; d=google.com; s=arc-20160816; b=nqKogtTvf2Eb499a468GYNBiK3ZeAB0HDn+0kG3g1w6nan2Zoiyd8LakAWDUwUjqKm Z544Ky+AuddDo0RdVrePhwuDh+/F3mUUjkO2h3TPFX1xCBleW6u5fTWXzahR11yRJyKx 7HEfB25F1D+C2yxkF1sVU/+Dkq1z7mL65Dma4hT+VVQcRVU5Dr+pBrcGMoegt+mSWVDz 1d1UBozUeRMrQdPpWh+TYuUoigy9HG4hcvY80OsSv94ZAMiXLnm3Za8jvsqgB/ivRZen 227lEeaxfzYuCpykquJ8zpfoezsCKqzCDMfUlSEe1pnuOqxZLxPaRujEGrpWnFz97r8c R9uw== 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=HA7+L1TaISt3Svh27a9k0fge85v3P4K87hnDFOUnN00=; fh=xLWyschydcwW23fRlVvCnAn0jM2rGvhMoJ71MHWBla4=; b=I9flJ4N5MWMirWXiX5QpxW1IcSOlnD/v7vzDKu+VYjIZmv0cFQqBBpWVYqpN59xbqr iw2kI7YCmn9klclR42DilfZzzGw6tdQ3SUPtmZfr5qolyThSqAn0VIkyFMve4bkrEqQP pqhxz0JoFmwDDMiOyYGnvSh5Gsds9EKAEYSrWCN+/uJvAFSSAJ7VK+Fkv7NhddJqug7r Rjy7HqgfxMhM0OJVrj7E9ICyHnCKjClLc4/u71imamUzYVJmSf8laXdaMpTpiYFlGGd5 wK/Tmc6W7wGvNRwI1L/ysHfeu9zAab9Kz4DAlzQPQ+/HcQfFrSPjO3PDq9Zq8aGwFVwA KiXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=WxhDJyKs; spf=pass (google.com: domain of linux-kernel+bounces-9163-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9163-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 k82-20020a628455000000b006d97bdcd7cesi1168790pfd.22.2023.12.21.15.21.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 15:21:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-9163-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=WxhDJyKs; spf=pass (google.com: domain of linux-kernel+bounces-9163-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9163-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 18834287EB1 for ; Thu, 21 Dec 2023 23:21:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 212947CCFC; Thu, 21 Dec 2023 23:18:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="WxhDJyKs" 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 5437A79952; Thu, 21 Dec 2023 23:18:51 +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=HA7+L1TaISt3Svh27a9k0fge85v3P4K87hnDFOUnN00=; b=WxhDJyKs79ADXRdCCozlZ+Oghl RsWh0p/tFIL0ge+aBFqSrQGpWaLE4Uoxv2Pv7b3ajnwylfVPjSsWTJ9q5MXlhcTJKJW2LM303nev4 vKANFiPr4La4KHzK1W+lE6nbtqMyUrTHASiiMqKmfj5qDTds9/T7DUr0w3wkK20lMIw8=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168]:52484 helo=pettiford.lan) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1rGSJS-00025W-Sg; Thu, 21 Dec 2023 18:18:47 -0500 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, jirislaby@kernel.org, kubakici@wp.pl, indrakanti_ram@hotmail.com, phil@raspberrypi.org Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, hugo@hugovil.com, Hugo Villeneuve , Andy Shevchenko Date: Thu, 21 Dec 2023 18:18:19 -0500 Message-Id: <20231221231823.2327894-13-hugo@hugovil.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231221231823.2327894-1-hugo@hugovil.com> References: <20231221231823.2327894-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 v2 12/16] 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: 1785935585808037517 X-GMAIL-MSGID: 1785935585808037517 From: Hugo Villeneuve To better show why the limit is what it is, since we have only 16 bits for the divisor. Reviewed-by: Andy Shevchenko 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 da862b8efcbe..3d963fe0e78a 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 Thu Dec 21 23:18:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugo Villeneuve X-Patchwork-Id: 182479 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2483:b0:fb:cd0c:d3e with SMTP id q3csp743557dyi; Thu, 21 Dec 2023 15:22:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IGig/jGOg+Y0Wl89dtZNSJiEwLyXd02cxjQzNrsLMSylnTpdK4HyD5KxVOCRSsiEtAZHOcQ X-Received: by 2002:a05:600c:4715:b0:40d:231c:7f2d with SMTP id v21-20020a05600c471500b0040d231c7f2dmr245979wmo.17.1703200937919; Thu, 21 Dec 2023 15:22:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703200937; cv=none; d=google.com; s=arc-20160816; b=mRUigow58WQaStF+hr/FxtejgOBBWt5WR2NrV1QJC4VNIEHSYAvtOoz69cRWc0OvDJ 0b6WRKNHjU2qmnF7l+UKwzvqBCgjdWKJdPBsDsvsUhkozKzNpKLCwFPwTl3LeU5LvcKA kyaDA3lE+mQ3YVVtZYruOb0FEA4OXILzvQsE1RuHcbZASS+48x9Qze5+9BzidMTiWtXR TmGqkAueZsnJ7eApZunr/JEe3JW4S69aiD8/Mn7ch3oaig+03wZY3HRfVchAm1F4TvIA NDOG+yLTp0E2NKTHof7o01e2MPOnJGBhQL4pa+0GgoX71Af2iNk/EqEOyBfBvNUKhXpI 4cAA== 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=ubrCUzlBwoG/VoXZIQw3xn0XhpqZ/aVnB+8+1Fwbz1A=; fh=xLWyschydcwW23fRlVvCnAn0jM2rGvhMoJ71MHWBla4=; b=LMOwDWCUQHcAdWChbGtBCmBCtc8/kFfCK3N4Nh0BOI6X23Ihdsr1WTcqyY2JckBp8k ta1dIBFoz580PJYIphz8G5f1TPDd7u0ljVnQ1wkkXF5stqXuq1C9lAMtT4e62Rtx/QEV X1QkB/1eq9yYVHgAUGSX8JFIUNNbgwM62RmcBOJSFck2QRRiqMb5yoDKFcCrGhFSy9M9 1IkKWqehxHqRszlcEC03lF8WkAW1GKjfGvA5SXx2nfBs5x1WYvDHQ/8DKFU+jU0nn2Sy pKLOZeujhZg8ich4YGVBAysyX/dapX/ntk3aHdXuuwfop1bz6N6BkwbA/IUBqm5tQO7w TJgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=Wp166NPt; spf=pass (google.com: domain of linux-kernel+bounces-9169-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9169-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 u5-20020a1709060b0500b00a235eb079b9si1337200ejg.633.2023.12.21.15.22.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 15:22:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-9169-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=Wp166NPt; spf=pass (google.com: domain of linux-kernel+bounces-9169-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9169-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 88BF51F2233F for ; Thu, 21 Dec 2023 23:22:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3B14D7D88F; Thu, 21 Dec 2023 23:18:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="Wp166NPt" 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 86BB17A22A; Thu, 21 Dec 2023 23:18:52 +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=ubrCUzlBwoG/VoXZIQw3xn0XhpqZ/aVnB+8+1Fwbz1A=; b=Wp166NPtiYjuSTNBXGg3YH57zY b+3HvQJVzF6QwZr2OOFTwu32hjKpYWBHj1j+l26gmV7Cm3cE2Spa/9ZQ0IftLu4IKLTDBbXPvOJ6F F0+CqVPkdFDWvw6L6wEz1ODKjclGxAQUVi6IXVbhR/ZHC2EYWE1Xw6Oik9HKiFMeVE3E=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168]:52484 helo=pettiford.lan) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1rGSJT-00025W-TR; Thu, 21 Dec 2023 18:18:48 -0500 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, jirislaby@kernel.org, kubakici@wp.pl, indrakanti_ram@hotmail.com, phil@raspberrypi.org Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, hugo@hugovil.com, Hugo Villeneuve , Andy Shevchenko Date: Thu, 21 Dec 2023 18:18:20 -0500 Message-Id: <20231221231823.2327894-14-hugo@hugovil.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231221231823.2327894-1-hugo@hugovil.com> References: <20231221231823.2327894-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 v2 13/16] 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: 1785935626484731216 X-GMAIL-MSGID: 1785935626484731216 From: Hugo Villeneuve The MODULE_DEVICE_TABLE() already creates the proper aliases for the SPI driver. Reviewed-by: Andy Shevchenko 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 3d963fe0e78a..1037a2802360 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -1787,8 +1787,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 Thu Dec 21 23:18:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugo Villeneuve X-Patchwork-Id: 182481 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2483:b0:fb:cd0c:d3e with SMTP id q3csp743668dyi; Thu, 21 Dec 2023 15:22:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IF16LT9/woIhqy70RQLL7exEukGRYZq0EKJ2Tuup163lXDZQacbiUvkwe6ZGjQGZx7nL+AZ X-Received: by 2002:a17:906:8a49:b0:a26:9584:49d0 with SMTP id gx9-20020a1709068a4900b00a26958449d0mr285479ejc.105.1703200952978; Thu, 21 Dec 2023 15:22:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703200952; cv=none; d=google.com; s=arc-20160816; b=NJUOOMRtlxJAVa7dDptn8HsHpYc6VtX+6w63cEyUknjmwMQ8XNnN8O4G+CaOIb/Ka2 r70+37XLL2tvCSg8oprK2wUGe4j2Q0Hu+UtT+8I5fJEk/r5X0tFdJpELB6/bwivF/CF/ xd9DFw2UCAEuJWq3y2kP8NoMkW7sTSTucH3k8qrMomtCgOjW8KZOyfhzplLcWOKjRh1F h86Hafv9UzmoAXqEjX4oPlhzuYUqbcPYBDUMWEwB0MZJTcj7Gz2MKPtjWNRqvGVkH6C8 3OVlTzFH2onSrjEzWUW0If4/aM2Lmh/qnOXn68eC4hKfElaHIXOtTvtoyk+XilcPgZj1 J7yg== 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=O33SuElMyMhi7Xm2MmazMXI7ODmF5cXxahS2czWEZzU=; fh=Ycbn6ef12HpHqEFiWziTSDbqSWr2f8qbHtf8sJuk8ZI=; b=nzP41BSDtawDdiyQAkA4DRVktfBRaYuVhjw0tVz9XsCiKrHJqKSUex7maUbYGabSEr vIUysOQC+JdRGqJ63W+Aotd1XzLSw45CwcjhW/vLCuLrGZLXdED0R00p9XxKZrZbTqgk eN1JsKJig9KQKc72XaUManVOKXcqlbTO96dfVqbowvTJXVW3HSDK3/YwQenoAwaVd4g6 q33dKoksojuHa6ca5xxR629xefIEL5UaNAdIAsvKdpQDIMWkrpumAGAIrPVJyj13YzRO qpKlx5F4om22gmnsaUrm5g0sv0lubrWGuy8UB2pvbQsSRfEgJYXM8u6nZVm0R0pR3n8U qExw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=GPwbhRva; spf=pass (google.com: domain of linux-kernel+bounces-9170-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9170-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 l16-20020a170906079000b00a236414d522si1321517ejc.489.2023.12.21.15.22.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 15:22:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-9170-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=GPwbhRva; spf=pass (google.com: domain of linux-kernel+bounces-9170-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9170-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 989681F2289E for ; Thu, 21 Dec 2023 23:22:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B10FC7D8B6; Thu, 21 Dec 2023 23:18:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="GPwbhRva" 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 B0D507B3A5; Thu, 21 Dec 2023 23:18:53 +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=O33SuElMyMhi7Xm2MmazMXI7ODmF5cXxahS2czWEZzU=; b=GPwbhRvaUzMuoWnaZkDd7JvGNZ 29SV8uLnekInKZ3LQvCrFUKzqmiiJyhbUEKWqGvIhs6wxlLHBD4CVfWx4QFckTczqxTTV+NEI6zui sJgh2DBE7TBt64hkbIT83h+2VMStSL7sL5adGywKiSCc3MAdKDTJ83bVDc+j8AAjugro=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168]:52484 helo=pettiford.lan) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1rGSJU-00025W-Ue; Thu, 21 Dec 2023 18:18:49 -0500 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, jirislaby@kernel.org, kubakici@wp.pl, indrakanti_ram@hotmail.com, phil@raspberrypi.org Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, hugo@hugovil.com, Hugo Villeneuve Date: Thu, 21 Dec 2023 18:18:21 -0500 Message-Id: <20231221231823.2327894-15-hugo@hugovil.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231221231823.2327894-1-hugo@hugovil.com> References: <20231221231823.2327894-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 v2 14/16] serial: sc16is7xx: refactor FIFO access functions to increase commonality 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: 1785935642424799293 X-GMAIL-MSGID: 1785935642424799293 From: Hugo Villeneuve Simplify FIFO access functions by avoiding to declare a struct sc16is7xx_port *s variable within each function. This is mainly done to have more commonality between the max310x and sc16is7xx drivers. Signed-off-by: Hugo Villeneuve --- 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 1037a2802360..26bc595a6ca7 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -379,17 +379,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); /* @@ -399,7 +397,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, @@ -575,7 +573,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; } @@ -664,7 +662,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 Thu Dec 21 23:18:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugo Villeneuve X-Patchwork-Id: 182482 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2483:b0:fb:cd0c:d3e with SMTP id q3csp743799dyi; Thu, 21 Dec 2023 15:22:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IFfZqYeJ7A1S3L4nyRhp9ZSTDhUgun4vxmLWUp5aXqWVIOD/+8JqSMZlSQjPQFriTGFf6iH X-Received: by 2002:a05:620a:210f:b0:77e:fba3:a7b0 with SMTP id l15-20020a05620a210f00b0077efba3a7b0mr600632qkl.142.1703200971252; Thu, 21 Dec 2023 15:22:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703200971; cv=none; d=google.com; s=arc-20160816; b=nm8Lglb3fQX5zqEYUwQVtYARtvxTyUTqS+vZ/wjryq7otyGK+g2VJKh7SEt+TUOVEc lbAAys9+4GPD/nGo19kykcEhRIRFKAmIUPQ5bwNtCjcWXW0fuDmqVhhMEmGv3Q8QDAq5 rKaSL9kIY13nopCA3wMpibhz5m7JvWE6aLD+dxVSazwCwtAUx8nzHt/iRDDFsqg3gO1H E/gBcdux1D51yt4bzII/RW4NMLrFJHJJcmeFZH0B98/a7f4kzYyoRCg30gkT816vrTgv jeMnan1V58//CZi9/43TeWQ8Y47rOnmrqe9iqO9f1et5HhS4I8eF2V1c+cJrC38w7FTG Ovgw== 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=AO8Y/K+LTRewIk9jrkA5Toqk8u/5mxe04ppS5FmxaBY=; fh=a+7AZTsUdGs2+AWrQbNEXqvESCr9vB6fImIjtsp44Zg=; b=w2ltBA401UH91IVjGS20FohiBMFYsuHDH8uy0BfXRML3bKhPz3JM6L5DO2K95FmJp6 Cpq0l2gOydl/DpVBXUS2LrzGyjzXJUgw0dfyZCaBMRFa5rOLf08qLaNfSPVwcOqmjlZA wKSm49zTrDGGNVoR32SHoitaEuKKQHXlDDRbC9G6sG0cP7TPzAhRSH2rJ5W+EhoXWAfK YjojgAE9eQPVRXauHDD4rbghe/C1aHBruPLqYBbZ6A78kEgfHNLmgypqZznioETbp1HV 9EW1ala5ni0Xuz2AcfgxOM/wIePGm0GfdFJZ0BM7GRO3bGFcvek8iHfV5N8bQRp5Fxsz 7asQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=xv+4JDp8; spf=pass (google.com: domain of linux-kernel+bounces-9172-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9172-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 bi12-20020a05620a318c00b007811b0fdfe1si3200002qkb.387.2023.12.21.15.22.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 15:22:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-9172-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=xv+4JDp8; spf=pass (google.com: domain of linux-kernel+bounces-9172-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9172-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 0BCE11C211F3 for ; Thu, 21 Dec 2023 23:22:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 411037A22A; Thu, 21 Dec 2023 23:18:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="xv+4JDp8" 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 C0ED97BEF3; Thu, 21 Dec 2023 23:18:54 +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=AO8Y/K+LTRewIk9jrkA5Toqk8u/5mxe04ppS5FmxaBY=; b=xv+4JDp8bpQ8M3Rmc9bF0Zp+0k y564OEcE2hCkBgOzxTJ1wAwmDaAntzkRSZptvC4NbSfDHFU60oAD28IBvYYhO3ZZK/5Qe6DmrEbM6 MDunfjrQey1UbWLwWSHWLKo+gULKqRcg3JZwfnlk9GK1UHKQxpQprGGQ4GvM0kK2YvX4=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168]:52484 helo=pettiford.lan) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1rGSJW-00025W-1m; Thu, 21 Dec 2023 18:18:50 -0500 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, jirislaby@kernel.org, kubakici@wp.pl, indrakanti_ram@hotmail.com, phil@raspberrypi.org Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, hugo@hugovil.com, Hugo Villeneuve , Andy Shevchenko Date: Thu, 21 Dec 2023 18:18:22 -0500 Message-Id: <20231221231823.2327894-16-hugo@hugovil.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231221231823.2327894-1-hugo@hugovil.com> References: <20231221231823.2327894-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 v2 15/16] 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: 1785935661576097417 X-GMAIL-MSGID: 1785935661576097417 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"). Reviewed-by: Andy Shevchenko Signed-off-by: Hugo Villeneuve --- 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 26bc595a6ca7..15a46c164821 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -357,9 +357,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) @@ -415,6 +412,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 Thu Dec 21 23:18:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugo Villeneuve X-Patchwork-Id: 182483 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2483:b0:fb:cd0c:d3e with SMTP id q3csp743896dyi; Thu, 21 Dec 2023 15:23:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IHf/AmFcr3jECNl32cZXDP+G1gq7o+LJv3yawO1hulyH4K0Vz81orNrWO1wWgeA6fCn1/aV X-Received: by 2002:a05:6808:144c:b0:3bb:86f2:28e0 with SMTP id x12-20020a056808144c00b003bb86f228e0mr500849oiv.85.1703200985767; Thu, 21 Dec 2023 15:23:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703200985; cv=none; d=google.com; s=arc-20160816; b=Q5aPDIw5dwOBGeUBPSrM95eHptTapAIkFSZY+QnAcnMgOeB8WM7WXKjITbVxwabjbF L7bkSP9a9M3utB9Kl8wjAj/zM5Lg8iK1nQl1PFLD4qPJLvvq9pCPq2IQqE6obVBP0Ioa Mu4h5i2f58BjshEpy/1tgr9GJe44hCyIbWVivQkX2Dfq86dbxlM42/LUyQGCDjWUCDFD LszZ1Vx3jk39bMCi6pUYSIvbjxFMhOHJzlCjuQYWr3+hJK9/yGfLb0fduQM5kiSYYr9P QepUc6LNgQnRrFVqc9X6wDbsiB3cqDE0WzwbO0/Qjpm27m5qXnwxVdgK8DdmSTuT2HhM Y7+w== 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=CHMyGddzVX5EESZPdl0w7MVikHG8SKY3XU+skISV4XQ=; fh=Ycbn6ef12HpHqEFiWziTSDbqSWr2f8qbHtf8sJuk8ZI=; b=O3xsWBz74vRJPHVGblgSaPjaRTfs3CUIV5n5IZuDkw17CT6YNa4UqJUiXUF7N+da/3 xUFr8uXUnnt/17Vwk3Xw1kvL7ka6nCrxGgCtxUZsXN1rBusuwif85q7S5C/WvJwh1p0U cgIrUUqvNf5jzz0bPvs+f+kVOeV4JMnnu0jzCrpdzo+Jonff7oTQA7VoXu+2WeZ/+cvI xv/ZtYSpvncFagsR8ow1aFpLCxH2UedMA8xwFqBzwqi5rTsRlZKhtT8E3Vx7NHUakhOp HP+2tNgZq4mvtCeIWkX9k4tBhlC7W/kY4KSXueMpE43JpfSlt5lFwETSiElKJLXLv0o6 wOag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=dNWkMyKP; spf=pass (google.com: domain of linux-kernel+bounces-9173-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9173-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 bi12-20020a05620a318c00b007811b0fdfe1si3200002qkb.387.2023.12.21.15.23.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 15:23:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-9173-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=dNWkMyKP; spf=pass (google.com: domain of linux-kernel+bounces-9173-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9173-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 7B24B1C24E79 for ; Thu, 21 Dec 2023 23:23:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4D97D7E77E; Thu, 21 Dec 2023 23:19:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="dNWkMyKP" 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 4EF5B7D896; Thu, 21 Dec 2023 23:18:57 +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=CHMyGddzVX5EESZPdl0w7MVikHG8SKY3XU+skISV4XQ=; b=dNWkMyKPJ/+Btj1d+DPcah+MWM /3NDTYg0Q3cmgmdNbVjo3iOlSDwyEKSMMiYtGz8r+kowl9QfsyeLPoaKCowq9EKpOxYsBnJdqdZd0 Kp83i5cdVkmbiofDDlTEJaCICS/sjhbcYvLghqiDgg9Bhx2nWxTDOZreniXonMcvYAF8=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168]:52484 helo=pettiford.lan) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1rGSJX-00025W-Cr; Thu, 21 Dec 2023 18:18:52 -0500 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, jirislaby@kernel.org, kubakici@wp.pl, indrakanti_ram@hotmail.com, phil@raspberrypi.org Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, hugo@hugovil.com, Hugo Villeneuve Date: Thu, 21 Dec 2023 18:18:23 -0500 Message-Id: <20231221231823.2327894-17-hugo@hugovil.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231221231823.2327894-1-hugo@hugovil.com> References: <20231221231823.2327894-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 v2 16/16] 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: 1785935677175768450 X-GMAIL-MSGID: 1785935677175768450 From: Hugo Villeneuve Move common code for EFR lock/unlock of mutex into functions for code reuse and clarity. With the addition of old_lcr, move irda_mode within struct sc16is7xx_one to reduce memory usage: Before: /* size: 752, cachelines: 12, members: 10 */ After: /* size: 744, cachelines: 12, members: 10 */ Signed-off-by: Hugo Villeneuve --- drivers/tty/serial/sc16is7xx.c | 106 ++++++++++++++++++--------------- 1 file changed, 57 insertions(+), 49 deletions(-) diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index 15a46c164821..929206a9a6e1 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -330,8 +330,9 @@ struct sc16is7xx_one { struct kthread_work reg_work; struct kthread_delayed_work ms_work; struct sc16is7xx_one_config config; - bool irda_mode; unsigned int old_mctrl; + u8 old_lcr; /* Value before EFR access. */ + bool irda_mode; }; struct sc16is7xx_port { @@ -412,6 +413,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); @@ -522,45 +566,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); @@ -570,7 +588,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,