gpio: refer to gpio device in prints and debugfs
authorLinus Walleij <linus.walleij@linaro.org>
Tue, 20 Oct 2015 09:31:54 +0000 (11:31 +0200)
committerLinus Walleij <linus.walleij@linaro.org>
Tue, 9 Feb 2016 10:09:30 +0000 (11:09 +0100)
We use the new struct device inside gpio_chip to related debug
prints and warnings, and we also add it to the debugfs dump.

Cc: Johan Hovold <johan@kernel.org>
Cc: Michael Welling <mwelling@ieee.org>
Cc: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpiolib.c
drivers/gpio/gpiolib.h

index 3a073ab5e863dafaeb9a13471cf0fd1d89e9feb2..4b94e31a50afd5cd20b69d6fd028c7ce654c98d0 100644 (file)
@@ -304,8 +304,8 @@ static int gpiochip_set_desc_names(struct gpio_chip *gc)
 
                gpio = gpio_name_to_desc(gc->names[i]);
                if (gpio)
-                       dev_warn(gc->parent, "Detected name collision for "
-                                "GPIO name '%s'\n",
+                       dev_warn(&gc->gpiodev->dev,
+                                "Detected name collision for GPIO name '%s'\n",
                                 gc->names[i]);
        }
 
@@ -528,7 +528,7 @@ void gpiochip_remove(struct gpio_chip *chip)
        spin_unlock_irqrestore(&gpio_lock, flags);
 
        if (requested)
-               dev_crit(chip->parent,
+               dev_crit(&chip->gpiodev->dev,
                         "REMOVING GPIOCHIP WITH GPIOS STILL REQUESTED\n");
 
        /* FIXME: need to be moved to gpio_device and held there */
index feea2c823e47e9dce0868f727e2bfd1de33c0586..3f329c922f5bd62710095184e74fc8b94a52a777 100644 (file)
@@ -174,17 +174,17 @@ static int __maybe_unused gpio_chip_hwgpio(const struct gpio_desc *desc)
 /* With chip prefix */
 
 #define chip_emerg(chip, fmt, ...)                                     \
-       pr_emerg("GPIO chip %s: " fmt, chip->label, ##__VA_ARGS__)
+       dev_emerg(&chip->gpiodev->dev, "(%s): " fmt, chip->label, ##__VA_ARGS__)
 #define chip_crit(chip, fmt, ...)                                      \
-       pr_crit("GPIO chip %s: " fmt, chip->label, ##__VA_ARGS__)
+       dev_crit(&chip->gpiodev->dev, "(%s): " fmt, chip->label, ##__VA_ARGS__)
 #define chip_err(chip, fmt, ...)                                       \
-       pr_err("GPIO chip %s: " fmt, chip->label, ##__VA_ARGS__)
+       dev_err(&chip->gpiodev->dev, "(%s): " fmt, chip->label, ##__VA_ARGS__)
 #define chip_warn(chip, fmt, ...)                                      \
-       pr_warn("GPIO chip %s: " fmt, chip->label, ##__VA_ARGS__)
+       dev_warn(&chip->gpiodev->dev, "(%s): " fmt, chip->label, ##__VA_ARGS__)
 #define chip_info(chip, fmt, ...)                                      \
-       pr_info("GPIO chip %s: " fmt, chip->label, ##__VA_ARGS__)
+       dev_info(&chip->gpiodev->dev, "(%s): " fmt, chip->label, ##__VA_ARGS__)
 #define chip_dbg(chip, fmt, ...)                                       \
-       pr_debug("GPIO chip %s: " fmt, chip->label, ##__VA_ARGS__)
+       dev_dbg(&chip->gpiodev->dev, "(%s): " fmt, chip->label, ##__VA_ARGS__)
 
 #ifdef CONFIG_GPIO_SYSFS