gpio: serial: max310x: Use HW type for gpio_chip's label

Message ID b2421132df00569baa90af8f2d19ad75242e8c48.1516996724.git.jan.kundrat@cesnet.cz
State New
Headers show
Series
  • gpio: serial: max310x: Use HW type for gpio_chip's label
Related show

Commit Message

Jan Kundrát Jan. 26, 2018, 7:02 p.m.
Some debugging tools (/sys/kernel/debug/gpio, `lsgpio`) use the
gpio_chip's label for displaying an additional context. Right now, the
information duplicates stuff which is already available from the
parent's device. This is how e.g. `lsgpio`'s output looks like:

  GPIO chip: gpiochip2, "spi1.2", 16 GPIO lines

Comparing the output of other GPIO expanders that I have available:

  gpiochip4: GPIOs 464-479, parent: spi/spi1.1, mcp23s17, can sleep:
  gpiochip5: GPIOs 448-463, parent: i2c/0-0020, pca9555, can sleep:
  gpiochip2: GPIOs 496-511, parent: spi/spi1.2, spi1.2, can sleep:

This patch ensures that the type of the real HW device is shown instead
of duplicating the SPI path:

  gpiochip2: GPIOs 496-511, parent: spi/spi1.2, MAX14830, can sleep:

Signed-off-by: Jan Kundrát <jan.kundrat@cesnet.cz>
---
 drivers/tty/serial/max310x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Linus Walleij Feb. 7, 2018, 1:36 p.m. | #1
On Fri, Jan 26, 2018 at 8:02 PM, Jan Kundrát <jan.kundrat@cesnet.cz> wrote:

> Some debugging tools (/sys/kernel/debug/gpio, `lsgpio`) use the
> gpio_chip's label for displaying an additional context. Right now, the
> information duplicates stuff which is already available from the
> parent's device. This is how e.g. `lsgpio`'s output looks like:
>
>   GPIO chip: gpiochip2, "spi1.2", 16 GPIO lines
>
> Comparing the output of other GPIO expanders that I have available:
>
>   gpiochip4: GPIOs 464-479, parent: spi/spi1.1, mcp23s17, can sleep:
>   gpiochip5: GPIOs 448-463, parent: i2c/0-0020, pca9555, can sleep:
>   gpiochip2: GPIOs 496-511, parent: spi/spi1.2, spi1.2, can sleep:
>
> This patch ensures that the type of the real HW device is shown instead
> of duplicating the SPI path:
>
>   gpiochip2: GPIOs 496-511, parent: spi/spi1.2, MAX14830, can sleep:
>
> Signed-off-by: Jan Kundrát <jan.kundrat@cesnet.cz>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Greg, pls apply this to your TTY tree.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Greg Kroah-Hartman Feb. 7, 2018, 2:23 p.m. | #2
On Wed, Feb 07, 2018 at 02:36:33PM +0100, Linus Walleij wrote:
> On Fri, Jan 26, 2018 at 8:02 PM, Jan Kundrát <jan.kundrat@cesnet.cz> wrote:
> 
> > Some debugging tools (/sys/kernel/debug/gpio, `lsgpio`) use the
> > gpio_chip's label for displaying an additional context. Right now, the
> > information duplicates stuff which is already available from the
> > parent's device. This is how e.g. `lsgpio`'s output looks like:
> >
> >   GPIO chip: gpiochip2, "spi1.2", 16 GPIO lines
> >
> > Comparing the output of other GPIO expanders that I have available:
> >
> >   gpiochip4: GPIOs 464-479, parent: spi/spi1.1, mcp23s17, can sleep:
> >   gpiochip5: GPIOs 448-463, parent: i2c/0-0020, pca9555, can sleep:
> >   gpiochip2: GPIOs 496-511, parent: spi/spi1.2, spi1.2, can sleep:
> >
> > This patch ensures that the type of the real HW device is shown instead
> > of duplicating the SPI path:
> >
> >   gpiochip2: GPIOs 496-511, parent: spi/spi1.2, MAX14830, can sleep:
> >
> > Signed-off-by: Jan Kundrát <jan.kundrat@cesnet.cz>
> 
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
> 
> Greg, pls apply this to your TTY tree.

Ok, let me wait until 4.16-rc1 is out first :)

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/tty/serial/max310x.c b/drivers/tty/serial/max310x.c
index 39f635812077..efe55a1a0615 100644
--- a/drivers/tty/serial/max310x.c
+++ b/drivers/tty/serial/max310x.c
@@ -1318,7 +1318,7 @@  static int max310x_probe(struct device *dev, struct max310x_devtype *devtype,
 	/* Setup GPIO cotroller */
 	s->gpio.owner		= THIS_MODULE;
 	s->gpio.parent		= dev;
-	s->gpio.label		= dev_name(dev);
+	s->gpio.label		= devtype->name;
 	s->gpio.direction_input	= max310x_gpio_direction_input;
 	s->gpio.get		= max310x_gpio_get;
 	s->gpio.direction_output= max310x_gpio_direction_output;