]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
gpiolib: cdev: gpio_desc_to_lineinfo() should set info offset
authorKent Gibson <warthog618@gmail.com>
Mon, 28 Sep 2020 00:27:48 +0000 (08:27 +0800)
committerBartosz Golaszewski <bgolaszewski@baylibre.com>
Wed, 30 Sep 2020 08:56:23 +0000 (10:56 +0200)
Set the value of the line info offset in gpio_desc_to_lineinfo(), rather
than relying on it being passed in the info.  This makes the function
behave as you would expect from the name - it generates the line info
corresponding to a given GPIO desc.

Signed-off-by: Kent Gibson <warthog618@gmail.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
drivers/gpio/gpiolib-cdev.c

index e6c9b78adfc26b8791402f6a35e74a3cd6b92f14..81ce2020f17bcb73e4fac8f53065bc8bd6b50c35 100644 (file)
@@ -752,6 +752,8 @@ static void gpio_desc_to_lineinfo(struct gpio_desc *desc,
        bool ok_for_pinctrl;
        unsigned long flags;
 
+       info->line_offset = gpio_chip_hwgpio(desc);
+
        /*
         * This function takes a mutex so we must check this before taking
         * the spinlock.
@@ -933,7 +935,6 @@ static int lineinfo_changed_notify(struct notifier_block *nb,
                return NOTIFY_DONE;
 
        memset(&chg, 0, sizeof(chg));
-       chg.info.line_offset = gpio_chip_hwgpio(desc);
        chg.event_type = action;
        chg.timestamp = ktime_get_ns();
        gpio_desc_to_lineinfo(desc, &chg.info);