Skip to content

Commit 8a05de2

Browse files
author
Bartosz Golaszewski
committed
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 <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bartosz Golaszewski <[email protected]>
1 parent 7f1e45f commit 8a05de2

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

drivers/gpio/gpio-sim.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -581,19 +581,19 @@ static int gpio_sim_bus_notifier_call(struct notifier_block *nb,
581581

582582
snprintf(devname, sizeof(devname), "gpio-sim.%u", simdev->id);
583583

584-
if (strcmp(dev_name(dev), devname) == 0) {
585-
if (action == BUS_NOTIFY_BOUND_DRIVER)
586-
simdev->driver_bound = true;
587-
else if (action == BUS_NOTIFY_DRIVER_NOT_BOUND)
588-
simdev->driver_bound = false;
589-
else
590-
return NOTIFY_DONE;
591-
592-
complete(&simdev->probe_completion);
593-
return NOTIFY_OK;
594-
}
584+
if (!device_match_name(dev, devname))
585+
return NOTIFY_DONE;
586+
587+
if (action == BUS_NOTIFY_BOUND_DRIVER)
588+
simdev->driver_bound = true;
589+
else if (action == BUS_NOTIFY_DRIVER_NOT_BOUND)
590+
simdev->driver_bound = false;
591+
else
592+
return NOTIFY_DONE;
593+
594+
complete(&simdev->probe_completion);
595595

596-
return NOTIFY_DONE;
596+
return NOTIFY_OK;
597597
}
598598

599599
static struct gpio_sim_device *to_gpio_sim_device(struct config_item *item)

0 commit comments

Comments
 (0)