Commit 8a05de23 authored by Bartosz Golaszewski's avatar Bartosz Golaszewski
Browse files

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: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20240610140548.35358-2-brgl@bgdev.pl


Signed-off-by: default avatarBartosz Golaszewski <bartosz.golaszewski@linaro.org>
parent 7f1e45f4
Loading
Loading
Loading
Loading
+12 −12
Original line number Diff line number Diff line
@@ -581,7 +581,9 @@ 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 (!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)
@@ -590,10 +592,8 @@ static int gpio_sim_bus_notifier_call(struct notifier_block *nb,
		return NOTIFY_DONE;

	complete(&simdev->probe_completion);
		return NOTIFY_OK;
	}

	return NOTIFY_DONE;
	return NOTIFY_OK;
}

static struct gpio_sim_device *to_gpio_sim_device(struct config_item *item)