summaryrefslogtreecommitdiffstats
path: root/drivers/gpio
diff options
context:
space:
mode:
authorBartosz Golaszewski <bartosz.golaszewski@linaro.org>2024-06-10 16:05:46 +0200
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>2024-06-11 21:38:41 +0200
commit8a05de23adabc4d982dfdeabc184a267f7a50491 (patch)
tree849656b52d9861a4e8105a4d4060f0329d628771 /drivers/gpio
parentdocs: gpio: prefer pread(2) for interrupt reading (diff)
downloadlinux-8a05de23adabc4d982dfdeabc184a267f7a50491.tar.xz
linux-8a05de23adabc4d982dfdeabc184a267f7a50491.zip
gpio: sim: use device_match_name() instead of strcmp(dev_name(...
Use the dedicated helper for comparing device names against strings. While at it: reshuffle the code a bit for less indentation. Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20240610140548.35358-2-brgl@bgdev.pl Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/gpio-sim.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/drivers/gpio/gpio-sim.c b/drivers/gpio/gpio-sim.c
index 2ed5cbe7c8a8..278bb0c54636 100644
--- a/drivers/gpio/gpio-sim.c
+++ b/drivers/gpio/gpio-sim.c
@@ -581,19 +581,19 @@ static int gpio_sim_bus_notifier_call(struct notifier_block *nb,
snprintf(devname, sizeof(devname), "gpio-sim.%u", simdev->id);
- if (strcmp(dev_name(dev), devname) == 0) {
- if (action == BUS_NOTIFY_BOUND_DRIVER)
- simdev->driver_bound = true;
- else if (action == BUS_NOTIFY_DRIVER_NOT_BOUND)
- simdev->driver_bound = false;
- else
- return NOTIFY_DONE;
-
- complete(&simdev->probe_completion);
- return NOTIFY_OK;
- }
+ if (!device_match_name(dev, devname))
+ return NOTIFY_DONE;
+
+ if (action == BUS_NOTIFY_BOUND_DRIVER)
+ simdev->driver_bound = true;
+ else if (action == BUS_NOTIFY_DRIVER_NOT_BOUND)
+ simdev->driver_bound = false;
+ else
+ return NOTIFY_DONE;
+
+ complete(&simdev->probe_completion);
- return NOTIFY_DONE;
+ return NOTIFY_OK;
}
static struct gpio_sim_device *to_gpio_sim_device(struct config_item *item)