]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
gpio: Remove redundant check for struct gpio_chip
authorTzung-Bi Shih <tzungbi@kernel.org>
Mon, 23 Feb 2026 06:17:22 +0000 (14:17 +0800)
committerBartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Fri, 27 Feb 2026 09:05:20 +0000 (10:05 +0100)
gpiolib_dbg_show() is only called by gpiolib_seq_show() which has
ensured the struct gpio_chip.  Remove the redundant check in
gpiolib_dbg_show().

Reviewed-by: Linus Walleij <linusw@kernel.org>
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
Link: https://patch.msgid.link/20260223061726.82161-3-tzungbi@kernel.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
drivers/gpio/gpiolib.c

index f558211ad84b357ae272679bb13800014575cf94..9408ecbe791370440534512131824c3386f5a3fd 100644 (file)
@@ -5322,23 +5322,14 @@ core_initcall(gpiolib_dev_init);
 
 #ifdef CONFIG_DEBUG_FS
 
-static void gpiolib_dbg_show(struct seq_file *s, struct gpio_device *gdev)
+static void gpiolib_dbg_show(struct seq_file *s, struct gpio_chip *gc)
 {
        bool active_low, is_irq, is_out;
        struct gpio_desc *desc;
        unsigned int gpio = 0;
-       struct gpio_chip *gc;
        unsigned long flags;
        int value;
 
-       guard(srcu)(&gdev->srcu);
-
-       gc = srcu_dereference(gdev->chip, &gdev->srcu);
-       if (!gc) {
-               seq_puts(s, "Underlying GPIO chip is gone\n");
-               return;
-       }
-
        for_each_gpio_desc(gc, desc) {
                guard(srcu)(&desc->gdev->desc_srcu);
                flags = READ_ONCE(desc->flags);
@@ -5451,7 +5442,7 @@ static int gpiolib_seq_show(struct seq_file *s, void *v)
        if (gc->dbg_show)
                gc->dbg_show(s, gc);
        else
-               gpiolib_dbg_show(s, gdev);
+               gpiolib_dbg_show(s, gc);
 
        return 0;
 }