Skip to content

Commit

Permalink
gpio: sim: simplify gpio_sim_device_config_live_store()
Browse files Browse the repository at this point in the history
Simplify the logic when checking the current live value against the user
input.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
  • Loading branch information
Bartosz Golaszewski committed Aug 12, 2023
1 parent 5f6d199 commit a40fe1f
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/gpio/gpio-sim.c
Original file line number Diff line number Diff line change
Expand Up @@ -986,8 +986,7 @@ gpio_sim_device_config_live_store(struct config_item *item,

mutex_lock(&dev->lock);

if ((!live && !gpio_sim_device_is_live_unlocked(dev)) ||
(live && gpio_sim_device_is_live_unlocked(dev)))
if (live == gpio_sim_device_is_live_unlocked(dev))
ret = -EPERM;
else if (live)
ret = gpio_sim_device_activate_unlocked(dev);
Expand Down

0 comments on commit a40fe1f

Please sign in to comment.