Linux-GPIO Archive mirror
 help / color / mirror / Atom feed
From: "Léo DUBOIN" <lduboin@freebox.fr>
To: linus.walleij@linaro.org
Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Léo DUBOIN" <lduboin@freebox.fr>
Subject: [PATCH RESEND 2/2] pinctrl: core: reset gpio_device in loop in pinctrl_pins_show()
Date: Fri, 10 May 2024 18:25:39 +0200	[thread overview]
Message-ID: <c40d0634abefa19e689ffd450e0f48a8d63c4fc4.1714049455.git.lduboin@freebox.fr> (raw)
Message-ID: <20240510162539.o6DNSbRmuA0ef_dn_clUEXs4PIJtcP-Wzjn-sXEF_mQ@z> (raw)
In-Reply-To: <cover.1714049455.git.lduboin@freebox.fr>

We were not resetting the pointer to the associated gpio_device once
we are done displaying a pin's information.

This meant that once we reached the end of a gpio-range, if there
were pins right after it that did not belong to any known range,
they would be associated with the previous range's gpio device.

This resulted in those pins appearing as <4294966783:old_gdev> instead
of the expected <0:?> (due to gpio_num being -1).

Signed-off-by: Léo DUBOIN <lduboin@freebox.fr>
---
 drivers/pinctrl/core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index 901f2f9bf850..ad878196ada9 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -1670,6 +1670,7 @@ static int pinctrl_pins_show(struct seq_file *s, void *what)
 		seq_printf(s, "pin %d (%s) ", pin, desc->name);
 
 #ifdef CONFIG_GPIOLIB
+		gdev = NULL;
 		gpio_num = -1;
 		list_for_each_entry(range, &pctldev->gpio_ranges, node) {
 			if (range->pins != NULL) {
-- 
2.42.0


  parent reply	other threads:[~2024-05-10 16:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-25 13:58 [PATCH 0/2] pinctrl: core: fix untreated named gpio ranges in pinctrl_pins_show() Léo DUBOIN
2024-04-25 13:58 ` [PATCH 1/2] pinctrl: core: take into account the pins array " Léo DUBOIN
2024-05-10 16:25   ` [PATCH RESEND " Léo DUBOIN
2024-04-25 13:58 ` Léo DUBOIN [this message]
2024-05-10 16:25   ` [PATCH RESEND 2/2] pinctrl: core: reset gpio_device in loop " Léo DUBOIN
2024-05-10 16:25 ` [PATCH RESEND 0/2] pinctrl: core: fix untreated named gpio ranges " Léo DUBOIN

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=c40d0634abefa19e689ffd450e0f48a8d63c4fc4.1714049455.git.lduboin@freebox.fr \
    --to=lduboin@freebox.fr \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@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 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 read-only IMAP folder(s) and NNTP newsgroup(s).