From patchwork Mon Dec 11 17:13:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugo Villeneuve X-Patchwork-Id: 176817 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp7205381vqy; Mon, 11 Dec 2023 09:14:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IE7wKLUmzvpw0kQ3meSvcXXbB5YgN5XqC2sp8zg0JQ+SXg1nqeWyiMs12kU7LG6YEwTwmw1 X-Received: by 2002:a05:6a20:96d0:b0:18f:c76a:993c with SMTP id hq16-20020a056a2096d000b0018fc76a993cmr2400452pzc.98.1702314859667; Mon, 11 Dec 2023 09:14:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702314859; cv=none; d=google.com; s=arc-20160816; b=YZJGNzyYcGYv4FRsrebY8Js+4MNmyNGB+0TAltiDv06QmYyVDGVvYdZ+DIleTGx3Qc uuMFRN3DnTGh5ixBFxRPMbzYNzhUUCfAiT4iyO4gHftJBrdTfobuh41j67qP33sH00Xh oeYB3GWcH+w1/ni6EvAlJnNB7WkUU4x0Y0aiK34Jo7JB1UfNn6a1Zmdt3703lLzXvZ5W 2IGnRL7DS/bz3cjyVeETM/egJAvV+cKnNveWU/2SW1FquE6hM5GK9tXa9CbkZfjNR3cR dzO2+GtiZ3k7yDT078QRFLEhhyRGFpNRGEdoCDRlY9JUAkyF3qU3AfJIi8TXSREp08ut 8QWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:cc:to:from:dkim-signature; bh=4MZPg2i3rujQttpfPCL8eU07qXSR85CK/sdmzfjW7BA=; fh=/BxO6DzE46vpTUzTferjM8Fol+WBex1wIV/O3GDJQ+g=; b=VyMes2DzTmTPzdYJ2Iv2DmE8q5ykAa7In4D5Cu1xI9p6gveW/ozuMR+5bCCNohyQkl zrsL3hGVzcQNWm1a+cSxatfWDV8Mxtn8cDbniqJruUS4zMztmNAQQGmNUJhVR6gREeBM 5OppYcoPgaVtUoheZSJA35dTTBYGg/caMgtbOe6t4Jcj414k/eKSD38DHr+0u/zaNPqe p/N7GSxssmr+9Rwe6BA2WanzDKaeDYwPFi27tR+etWuc6CZ/w1q+6nr3C+SrgBSmnkma 5sz7cy7bGbhw3ZLl8Y9QrRYiQpSyEg9BwgbDdBDrjYf591m+DjTZ14KVBetf9WgAddZd etrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=DUFKQAyL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id 1-20020a630201000000b0057d7cff25b8si6101428pgc.198.2023.12.11.09.14.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Dec 2023 09:14:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=DUFKQAyL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 168558098624; Mon, 11 Dec 2023 09:14:14 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234938AbjLKROA (ORCPT + 99 others); Mon, 11 Dec 2023 12:14:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230028AbjLKRN7 (ORCPT ); Mon, 11 Dec 2023 12:13:59 -0500 Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1FE81C4; Mon, 11 Dec 2023 09:14:06 -0800 (PST) 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=4MZPg2i3rujQttpfPCL8eU07qXSR85CK/sdmzfjW7BA=; b=DUFKQAyLz+HfJDVdVEG9kezmd1 DA0UHuh7jjvotZvmvN2lncQl85w3Cs6fH26SE4WIdJ+N125wW2QF7oCEi3+NoZ4dXbs42vroZtyfo uH//9auPztSjt3smMtoD7aEVsT2XAIMndYWmo3jVS1Jpv1Ph8LhxZtrsnCwARhD4CdZU=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168]:56730 helo=pettiford.lan) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1rCjqy-0003yC-T5; Mon, 11 Dec 2023 12:14:01 -0500 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, jirislaby@kernel.org, hvilleneuve@dimonoff.com, jringle@gridpoint.com, tomasz.mon@camlingroup.com Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, hugo@hugovil.com, stable@vger.kernel.org, Andy Shevchenko Date: Mon, 11 Dec 2023 12:13:49 -0500 Message-Id: <20231211171353.2901416-3-hugo@hugovil.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231211171353.2901416-1-hugo@hugovil.com> References: <20231211171353.2901416-1-hugo@hugovil.com> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 70.80.174.168 X-SA-Exim-Mail-From: hugo@hugovil.com X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 Subject: [PATCH v2 2/6] serial: sc16is7xx: remove global regmap from struct sc16is7xx_port 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) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Mon, 11 Dec 2023 09:14:14 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785006506329150534 X-GMAIL-MSGID: 1785006506329150534 From: Hugo Villeneuve Remove global struct regmap so that it is more obvious that this regmap is to be used only in the probe function. Also add a comment to that effect in probe function. Fixes: 3837a0379533 ("serial: sc16is7xx: improve regmap debugfs by using one regmap per port") Cc: stable@vger.kernel.org Suggested-by: Andy Shevchenko Signed-off-by: Hugo Villeneuve --- drivers/tty/serial/sc16is7xx.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c index 8d1de4982b65..a4ad3ae8cae2 100644 --- a/drivers/tty/serial/sc16is7xx.c +++ b/drivers/tty/serial/sc16is7xx.c @@ -334,7 +334,6 @@ struct sc16is7xx_one { struct sc16is7xx_port { const struct sc16is7xx_devtype *devtype; - struct regmap *regmap; struct clk *clk; #ifdef CONFIG_GPIOLIB struct gpio_chip gpio; @@ -1434,7 +1433,8 @@ static void sc16is7xx_setup_irda_ports(struct sc16is7xx_port *s) /* * Configure ports designated to operate as modem control lines. */ -static int sc16is7xx_setup_mctrl_ports(struct sc16is7xx_port *s) +static int sc16is7xx_setup_mctrl_ports(struct sc16is7xx_port *s, + struct regmap *regmap) { int i; int ret; @@ -1463,7 +1463,7 @@ static int sc16is7xx_setup_mctrl_ports(struct sc16is7xx_port *s) if (s->mctrl_mask) regmap_update_bits( - s->regmap, + regmap, SC16IS7XX_IOCONTROL_REG, SC16IS7XX_IOCONTROL_MODEM_A_BIT | SC16IS7XX_IOCONTROL_MODEM_B_BIT, s->mctrl_mask); @@ -1495,6 +1495,10 @@ static int sc16is7xx_probe(struct device *dev, * This device does not have an identification register that would * tell us if we are really connected to the correct device. * The best we can do is to check if communication is at all possible. + * + * Note: regmap[0] is used in the probe function to access registers + * common to all channels/ports, as it is guaranteed to be present on + * all variants. */ ret = regmap_read(regmaps[0], SC16IS7XX_LSR_REG, &val); if (ret < 0) @@ -1530,7 +1534,6 @@ static int sc16is7xx_probe(struct device *dev, return -EINVAL; } - s->regmap = regmaps[0]; s->devtype = devtype; dev_set_drvdata(dev, s); mutex_init(&s->efr_lock); @@ -1545,7 +1548,7 @@ static int sc16is7xx_probe(struct device *dev, sched_set_fifo(s->kworker_task); /* reset device, purging any pending irq / data */ - regmap_write(s->regmap, SC16IS7XX_IOCONTROL_REG, + regmap_write(regmaps[0], SC16IS7XX_IOCONTROL_REG, SC16IS7XX_IOCONTROL_SRESET_BIT); for (i = 0; i < devtype->nr_uart; ++i) { @@ -1616,7 +1619,7 @@ static int sc16is7xx_probe(struct device *dev, sc16is7xx_setup_irda_ports(s); - ret = sc16is7xx_setup_mctrl_ports(s); + ret = sc16is7xx_setup_mctrl_ports(s, regmaps[0]); if (ret) goto out_ports;