All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hui Wang <hui.wang@canonical.com>
To: stable@vger.kernel.org, patches@lists.linux.dev,
	gregkh@linuxfoundation.org, sashal@kernel.org
Cc: hvilleneuve@dimonoff.com, hui.wang@canonical.com
Subject: [stable-kernel][5.15.y][PATCH 3/5] serial: sc16is7xx: remove global regmap from struct sc16is7xx_port
Date: Wed, 11 Dec 2024 12:25:42 +0800	[thread overview]
Message-ID: <20241211042545.202482-4-hui.wang@canonical.com> (raw)
In-Reply-To: <20241211042545.202482-1-hui.wang@canonical.com>

From: Hugo Villeneuve <hvilleneuve@dimonoff.com>

commit f6959c5217bd799bcb770b95d3c09b3244e175c6 upstream.

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.

[Hui: fixed some conflict when backporting to 5.15.y]

Fixes: 3837a0379533 ("serial: sc16is7xx: improve regmap debugfs by using one regmap per port")
Cc:  <stable@vger.kernel.org>
Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
Link: https://lore.kernel.org/r/20231211171353.2901416-3-hugo@hugovil.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Hui Wang <hui.wang@canonical.com>
---
 drivers/tty/serial/sc16is7xx.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c
index 35001cc7ec90..90b39ddec082 100644
--- a/drivers/tty/serial/sc16is7xx.c
+++ b/drivers/tty/serial/sc16is7xx.c
@@ -323,7 +323,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;
@@ -1222,6 +1221,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)
@@ -1257,7 +1260,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);
@@ -1272,7 +1274,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) {
-- 
2.34.1


  parent reply	other threads:[~2024-12-11  4:26 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-11  4:25 [stable-kernel][5.15.y][PATCH 0/5] Fix a regression on sc16is7xx Hui Wang
2024-12-11  4:25 ` [stable-kernel][5.15.y][PATCH 1/5] serial: sc16is7xx: improve regmap debugfs by using one regmap per port Hui Wang
2024-12-11 16:32   ` Sasha Levin
2024-12-11  4:25 ` [stable-kernel][5.15.y][PATCH 2/5] serial: sc16is7xx: remove wasteful static buffer in sc16is7xx_regmap_name() Hui Wang
2024-12-11 16:32   ` Sasha Levin
2024-12-11  4:25 ` Hui Wang [this message]
2024-12-11 16:33   ` [stable-kernel][5.15.y][PATCH 3/5] serial: sc16is7xx: remove global regmap from struct sc16is7xx_port Sasha Levin
2024-12-11  4:25 ` [stable-kernel][5.15.y][PATCH 4/5] serial: sc16is7xx: remove unused line structure member Hui Wang
2024-12-11 16:32   ` Sasha Levin
2024-12-11  4:25 ` [stable-kernel][5.15.y][PATCH 5/5] serial: sc16is7xx: change EFR lock to operate on each channels Hui Wang
2024-12-11 16:32   ` Sasha Levin
2024-12-12 13:44 ` [stable-kernel][5.15.y][PATCH 0/5] Fix a regression on sc16is7xx Greg KH
2024-12-12 14:00   ` Hui Wang
2024-12-16 18:36     ` Hugo Villeneuve
2024-12-17  2:45       ` Hui Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241211042545.202482-4-hui.wang@canonical.com \
    --to=hui.wang@canonical.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hvilleneuve@dimonoff.com \
    --cc=patches@lists.linux.dev \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.