Linux GPIO subsystem development
 help / color / mirror / Atom feed
* [PATCH 1/2] gpio: sim: simplify gpio_sim_device_config_live_store()
@ 2023-08-11 13:14 Bartosz Golaszewski
  2023-08-11 13:14 ` [PATCH 2/2 v2] gpio: sim: simplify code with cleanup helpers Bartosz Golaszewski
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Bartosz Golaszewski @ 2023-08-11 13:14 UTC (permalink / raw)
  To: Linus Walleij, Andy Shevchenko, Kent Gibson
  Cc: linux-gpio, linux-kernel, Bartosz Golaszewski

From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

Simplify the logic when checking the current live value against the user
input.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
This is the same as what Andy suggested for gpio-consumer. Let's save a
line.

 drivers/gpio/gpio-sim.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpio/gpio-sim.c b/drivers/gpio/gpio-sim.c
index dc4097dc0fbc..0177b41e0d72 100644
--- a/drivers/gpio/gpio-sim.c
+++ b/drivers/gpio/gpio-sim.c
@@ -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);
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-08-12 18:32 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-11 13:14 [PATCH 1/2] gpio: sim: simplify gpio_sim_device_config_live_store() Bartosz Golaszewski
2023-08-11 13:14 ` [PATCH 2/2 v2] gpio: sim: simplify code with cleanup helpers Bartosz Golaszewski
2023-08-11 14:24   ` Andy Shevchenko
2023-08-11 14:28     ` Bartosz Golaszewski
2023-08-11 14:31       ` Andy Shevchenko
2023-08-11 14:41     ` Bartosz Golaszewski
2023-08-11 14:03 ` [PATCH 1/2] gpio: sim: simplify gpio_sim_device_config_live_store() Andy Shevchenko
2023-08-12 18:32 ` Bartosz Golaszewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox