Commit 069ced22 authored by Bartosz Golaszewski's avatar Bartosz Golaszewski

pinctrl: sppctl: use gpiochip_dup_line_label()

Use the new gpiochip_dup_line_label() helper to safely retrieve the
descriptor label.
Signed-off-by: default avatarBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Acked-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent c73505c8
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
* Copyright (C) Sunplus Tech / Tibbo Tech. * Copyright (C) Sunplus Tech / Tibbo Tech.
*/ */
#include <linux/cleanup.h>
#include <linux/bitfield.h> #include <linux/bitfield.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/err.h> #include <linux/err.h>
...@@ -500,16 +501,15 @@ static int sppctl_gpio_set_config(struct gpio_chip *chip, unsigned int offset, ...@@ -500,16 +501,15 @@ static int sppctl_gpio_set_config(struct gpio_chip *chip, unsigned int offset,
static void sppctl_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip) static void sppctl_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip)
{ {
const char *label;
int i; int i;
for (i = 0; i < chip->ngpio; i++) { for (i = 0; i < chip->ngpio; i++) {
label = gpiochip_is_requested(chip, i); char *label __free(kfree) = gpiochip_dup_line_label(chip, i);
if (!label) if (IS_ERR(label))
label = ""; continue;
seq_printf(s, " gpio-%03d (%-16.16s | %-16.16s)", i + chip->base, seq_printf(s, " gpio-%03d (%-16.16s | %-16.16s)", i + chip->base,
chip->names[i], label); chip->names[i], label ?: "");
seq_printf(s, " %c", sppctl_gpio_get_direction(chip, i) ? 'I' : 'O'); seq_printf(s, " %c", sppctl_gpio_get_direction(chip, i) ? 'I' : 'O');
seq_printf(s, ":%d", sppctl_gpio_get(chip, i)); seq_printf(s, ":%d", sppctl_gpio_get(chip, i));
seq_printf(s, " %s", sppctl_first_get(chip, i) ? "gpi" : "mux"); seq_printf(s, " %s", sppctl_first_get(chip, i) ? "gpi" : "mux");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment