diff mbox series

[2/3] gpiolib: fix debugfs dangling chip separator

Message ID 20241028125000.24051-3-johan+linaro@kernel.org
State New
Headers show
Series gpiolib: fix debugfs newline separators | expand

Commit Message

Johan Hovold Oct. 28, 2024, 12:49 p.m. UTC
Add the missing newline after entries for recently removed gpio chips
so that the chip sections are separated by a newline as intended.

Fixes: e348544f7994 ("gpio: protect the list of GPIO devices with SRCU")
Cc: stable@vger.kernel.org	# 6.9
Cc: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
---
 drivers/gpio/gpiolib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Bartosz Golaszewski Oct. 31, 2024, 5:02 p.m. UTC | #1
On Mon, Oct 28, 2024 at 1:50 PM Johan Hovold <johan+linaro@kernel.org> wrote:
>
> Add the missing newline after entries for recently removed gpio chips
> so that the chip sections are separated by a newline as intended.
>
> Fixes: e348544f7994 ("gpio: protect the list of GPIO devices with SRCU")
> Cc: stable@vger.kernel.org      # 6.9
> Cc: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
> ---
>  drivers/gpio/gpiolib.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
> index e27488a90bc9..2b02655abb56 100644
> --- a/drivers/gpio/gpiolib.c
> +++ b/drivers/gpio/gpiolib.c
> @@ -4971,7 +4971,7 @@ static int gpiolib_seq_show(struct seq_file *s, void *v)
>
>         gc = srcu_dereference(gdev->chip, &gdev->srcu);
>         if (!gc) {
> -               seq_printf(s, "%s%s: (dangling chip)",
> +               seq_printf(s, "%s%s: (dangling chip)\n",
>                            priv->newline ? "\n" : "",
>                            dev_name(&gdev->dev));
>                 return 0;
> --
> 2.45.2
>

But with this change we go from an incorrect:

# cat /sys/kernel/debug/gpio
gpiochip0: (dangling chip)
gpiochip1: (dangling chip)
gpiochip2: (dangling chip)root@qemux86-64:~#

to still incorrect:

# cat /sys/kernel/debug/gpio
gpiochip0: (dangling chip)

gpiochip1: (dangling chip)

gpiochip2: (dangling chip)

Bart
Johan Hovold Oct. 31, 2024, 5:07 p.m. UTC | #2
On Thu, Oct 31, 2024 at 06:02:43PM +0100, Bartosz Golaszewski wrote:

> But with this change we go from an incorrect:
> 
> # cat /sys/kernel/debug/gpio
> gpiochip0: (dangling chip)
> gpiochip1: (dangling chip)
> gpiochip2: (dangling chip)root@qemux86-64:~#
> 
> to still incorrect:
> 
> # cat /sys/kernel/debug/gpio
> gpiochip0: (dangling chip)
> 
> gpiochip1: (dangling chip)
> 
> gpiochip2: (dangling chip)

Why do you think this is incorrect? Every chip section is separated by
an empty line, just as it should be:

gpiochip0: GPIOs 512-517, parent: platform/c42d000.spmi:pmic@0:gpio@8800, c42d000.spmi:pmic@0:gpio@8800:
 gpio1 : in   low  normal  vin-0 no pull                     push-pull  low     atest-1 dtest-0
 gpio2 : in   low  normal  vin-0 no pull                     push-pull  low     atest-1 dtest-0
 gpio3 : out  low  func1   vin-0 pull-down 10uA              push-pull  low     atest-1 dtest-0
 gpio4 : in   low  normal  vin-0 pull-down 10uA              push-pull  low     atest-1 dtest-0
 gpio5 : ---
 gpio6 : in   high normal  vin-0 pull-up 30uA                push-pull  low     atest-1 dtest-0

gpiochip1: GPIOs 518-529, parent: platform/c42d000.spmi:pmic@1:gpio@8800, c42d000.spmi:pmic@1:gpio@8800:
 gpio1 : in   low  normal  vin-0 pull-down 10uA              push-pull  low     atest-1 dtest-0
 gpio2 : in   low  normal  vin-0 pull-down 10uA              push-pull  low     atest-1 dtest-0
 gpio3 : ---
 gpio4 : ---
 gpio5 : in   high normal  vin-0 pull-up 30uA                push-pull  low     atest-1 dtest-0
 gpio6 : in   high normal  vin-1 pull-up 30uA                push-pull  low     atest-1 dtest-0
 gpio7 : out  high func1   vin-1 no pull                     push-pull  low     atest-1 dtest-0
 gpio8 : in   low  normal  vin-0 pull-down 10uA              push-pull  low     atest-1 dtest-0
 gpio9 : in   low  normal  vin-0 pull-down 10uA              push-pull  low     atest-1 dtest-0
 gpio10: out  high normal  vin-1 no pull                     push-pull  low     atest-1 dtest-0
 gpio11: out  high normal  vin-1 no pull                     push-pull  low     atest-1 dtest-0
 gpio12: in   low  normal  vin-1 pull-down 10uA              push-pull  low     atest-1 dtest-0

gpiochip2: GPIOs 530-537, parent: platform/c42d000.spmi:pmic@2:gpio@8800, c42d000.spmi:pmic@2:gpio@8800:
 gpio1 : in   low  normal  vin-0 pull-down 10uA              push-pull  low     atest-1 dtest-0
 gpio2 : in   low  normal  vin-0 pull-down 10uA              push-pull  low     atest-1 dtest-0
 gpio3 : in   low  normal  vin-0 pull-down 10uA              push-pull  low     atest-1 dtest-0
 gpio4 : out  high normal  vin-1 pull-down 10uA              push-pull  medium  atest-1 dtest-0
 gpio5 : in   low  normal  vin-1 pull-down 10uA              push-pull  low     atest-1 dtest-0
 gpio6 : out  high normal  vin-1 pull-down 10uA              push-pull  low     atest-1 dtest-0
 gpio7 : in   low  normal  vin-0 pull-down 10uA              push-pull  low     atest-1 dtest-0
 gpio8 : out  low  normal  vin-1 pull-down 10uA              push-pull  low     atest-1 dtest-0

Johan
Bartosz Golaszewski Oct. 31, 2024, 6:08 p.m. UTC | #3
On Thu, Oct 31, 2024 at 6:07 PM Johan Hovold <johan@kernel.org> wrote:
>
> On Thu, Oct 31, 2024 at 06:02:43PM +0100, Bartosz Golaszewski wrote:
>
> > But with this change we go from an incorrect:
> >
> > # cat /sys/kernel/debug/gpio
> > gpiochip0: (dangling chip)
> > gpiochip1: (dangling chip)
> > gpiochip2: (dangling chip)root@qemux86-64:~#
> >
> > to still incorrect:
> >
> > # cat /sys/kernel/debug/gpio
> > gpiochip0: (dangling chip)
> >
> > gpiochip1: (dangling chip)
> >
> > gpiochip2: (dangling chip)
>
> Why do you think this is incorrect? Every chip section is separated by
> an empty line, just as it should be:
>
> gpiochip0: GPIOs 512-517, parent: platform/c42d000.spmi:pmic@0:gpio@8800, c42d000.spmi:pmic@0:gpio@8800:
>  gpio1 : in   low  normal  vin-0 no pull                     push-pull  low     atest-1 dtest-0
>  gpio2 : in   low  normal  vin-0 no pull                     push-pull  low     atest-1 dtest-0
>  gpio3 : out  low  func1   vin-0 pull-down 10uA              push-pull  low     atest-1 dtest-0
>  gpio4 : in   low  normal  vin-0 pull-down 10uA              push-pull  low     atest-1 dtest-0
>  gpio5 : ---
>  gpio6 : in   high normal  vin-0 pull-up 30uA                push-pull  low     atest-1 dtest-0
>
> gpiochip1: GPIOs 518-529, parent: platform/c42d000.spmi:pmic@1:gpio@8800, c42d000.spmi:pmic@1:gpio@8800:
>  gpio1 : in   low  normal  vin-0 pull-down 10uA              push-pull  low     atest-1 dtest-0
>  gpio2 : in   low  normal  vin-0 pull-down 10uA              push-pull  low     atest-1 dtest-0
>  gpio3 : ---
>  gpio4 : ---
>  gpio5 : in   high normal  vin-0 pull-up 30uA                push-pull  low     atest-1 dtest-0
>  gpio6 : in   high normal  vin-1 pull-up 30uA                push-pull  low     atest-1 dtest-0
>  gpio7 : out  high func1   vin-1 no pull                     push-pull  low     atest-1 dtest-0
>  gpio8 : in   low  normal  vin-0 pull-down 10uA              push-pull  low     atest-1 dtest-0
>  gpio9 : in   low  normal  vin-0 pull-down 10uA              push-pull  low     atest-1 dtest-0
>  gpio10: out  high normal  vin-1 no pull                     push-pull  low     atest-1 dtest-0
>  gpio11: out  high normal  vin-1 no pull                     push-pull  low     atest-1 dtest-0
>  gpio12: in   low  normal  vin-1 pull-down 10uA              push-pull  low     atest-1 dtest-0
>
> gpiochip2: GPIOs 530-537, parent: platform/c42d000.spmi:pmic@2:gpio@8800, c42d000.spmi:pmic@2:gpio@8800:
>  gpio1 : in   low  normal  vin-0 pull-down 10uA              push-pull  low     atest-1 dtest-0
>  gpio2 : in   low  normal  vin-0 pull-down 10uA              push-pull  low     atest-1 dtest-0
>  gpio3 : in   low  normal  vin-0 pull-down 10uA              push-pull  low     atest-1 dtest-0
>  gpio4 : out  high normal  vin-1 pull-down 10uA              push-pull  medium  atest-1 dtest-0
>  gpio5 : in   low  normal  vin-1 pull-down 10uA              push-pull  low     atest-1 dtest-0
>  gpio6 : out  high normal  vin-1 pull-down 10uA              push-pull  low     atest-1 dtest-0
>  gpio7 : in   low  normal  vin-0 pull-down 10uA              push-pull  low     atest-1 dtest-0
>  gpio8 : out  low  normal  vin-1 pull-down 10uA              push-pull  low     atest-1 dtest-0
>
> Johan

Ah, makes more sense in the context of mixed good and dangling output.

Nevermind my comment.

Bart
diff mbox series

Patch

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index e27488a90bc9..2b02655abb56 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -4971,7 +4971,7 @@  static int gpiolib_seq_show(struct seq_file *s, void *v)
 
 	gc = srcu_dereference(gdev->chip, &gdev->srcu);
 	if (!gc) {
-		seq_printf(s, "%s%s: (dangling chip)",
+		seq_printf(s, "%s%s: (dangling chip)\n",
 			   priv->newline ? "\n" : "",
 			   dev_name(&gdev->dev));
 		return 0;