leds: trigger: gpio: Refresh LED state after GPIO change

The new GPIO may have a different state than the old one.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
This commit is contained in:
Jan Kiszka 2017-05-26 15:17:46 +02:00 committed by Jacek Anaszewski
parent 7678da8ee6
commit 71afe3cb1e
1 changed files with 2 additions and 0 deletions

View File

@ -170,6 +170,8 @@ static ssize_t gpio_trig_gpio_store(struct device *dev,
if (gpio_data->gpio != 0)
free_irq(gpio_to_irq(gpio_data->gpio), led);
gpio_data->gpio = gpio;
/* After changing the GPIO, we need to update the LED. */
schedule_work(&gpio_data->work);
}
return ret ? ret : n;