summaryrefslogtreecommitdiffstats
path: root/drivers/gpio
diff options
context:
space:
mode:
authorKent Gibson <warthog618@gmail.com>2020-09-28 08:27:48 +0800
committerBartosz Golaszewski <bgolaszewski@baylibre.com>2020-09-30 10:56:23 +0200
commit0dc11e3ad353e19b1a119e3146c69c0930ecae5f (patch)
treeccc32c2f31883b4202ae40921ada6ce980b5233a /drivers/gpio
parent42e9acc679105208e001a2911c0241d968ab68e5 (diff)
downloadlinux-0dc11e3ad353e19b1a119e3146c69c0930ecae5f.tar.bz2
gpiolib: cdev: gpio_desc_to_lineinfo() should set info offset
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>
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/gpiolib-cdev.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/gpio/gpiolib-cdev.c b/drivers/gpio/gpiolib-cdev.c
index e6c9b78adfc2..81ce2020f17b 100644
--- a/drivers/gpio/gpiolib-cdev.c
+++ b/drivers/gpio/gpiolib-cdev.c
@@ -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);