From: Johan Hovold <johan+linaro@kernel.org>
To: Linus Walleij <linus.walleij@linaro.org>,
Bartosz Golaszewski <brgl@bgdev.pl>
Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
Johan Hovold <johan+linaro@kernel.org>,
stable@vger.kernel.org, Thierry Reding <treding@nvidia.com>
Subject: [PATCH 1/3] gpiolib: fix debugfs newline separators
Date: Mon, 28 Oct 2024 13:49:58 +0100 [thread overview]
Message-ID: <20241028125000.24051-2-johan+linaro@kernel.org> (raw)
In-Reply-To: <20241028125000.24051-1-johan+linaro@kernel.org>
The gpiolib debugfs interface exports a list of all gpio chips in a
system and the state of their pins.
The gpio chip sections are supposed to be separated by a newline
character, but a long-standing bug prevents the separator from
being included when output is generated in multiple sessions, making the
output inconsistent and hard to read.
Make sure to only suppress the newline separator at the beginning of the
file as intended.
Fixes: f9c4a31f6150 ("gpiolib: Use seq_file's iterator interface")
Cc: stable@vger.kernel.org # 3.7
Cc: Thierry Reding <treding@nvidia.com>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
---
drivers/gpio/gpiolib.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index d5952ab7752c..e27488a90bc9 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -4926,6 +4926,8 @@ static void *gpiolib_seq_start(struct seq_file *s, loff_t *pos)
return NULL;
s->private = priv;
+ if (*pos > 0)
+ priv->newline = true;
priv->idx = srcu_read_lock(&gpio_devices_srcu);
list_for_each_entry_srcu(gdev, &gpio_devices, list,
--
2.45.2
next prev parent reply other threads:[~2024-10-28 12:50 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-28 12:49 [PATCH 0/3] gpiolib: fix debugfs newline separators Johan Hovold
2024-10-28 12:49 ` Johan Hovold [this message]
2024-10-28 12:49 ` [PATCH 2/3] gpiolib: fix debugfs dangling chip separator Johan Hovold
2024-10-31 17:02 ` Bartosz Golaszewski
2024-10-31 17:07 ` Johan Hovold
2024-10-31 18:08 ` Bartosz Golaszewski
2024-10-28 12:50 ` [PATCH 3/3] gpiolib: clean up debugfs separator handling Johan Hovold
2024-10-31 18:15 ` Bartosz Golaszewski
2024-10-31 18:14 ` (subset) [PATCH 0/3] gpiolib: fix debugfs newline separators Bartosz Golaszewski
2024-11-04 7:51 ` Bartosz Golaszewski
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=20241028125000.24051-2-johan+linaro@kernel.org \
--to=johan+linaro@kernel.org \
--cc=brgl@bgdev.pl \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=treding@nvidia.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).