From: Bartosz Golaszewski <brgl@bgdev.pl>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>,
Andy Shevchenko <andy.shevchenko@gmail.com>
Subject: [PATCH 1/3] gpio: sim: use device_match_name() instead of strcmp(dev_name(...
Date: Mon, 10 Jun 2024 16:05:46 +0200 [thread overview]
Message-ID: <20240610140548.35358-2-brgl@bgdev.pl> (raw)
In-Reply-To: <20240610140548.35358-1-brgl@bgdev.pl>
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
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>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
drivers/gpio/gpio-sim.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 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;
+ if (!device_match_name(dev, devname))
+ return NOTIFY_DONE;
- complete(&simdev->probe_completion);
- return NOTIFY_OK;
- }
+ 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;
- return NOTIFY_DONE;
+ complete(&simdev->probe_completion);
+
+ return NOTIFY_OK;
}
static struct gpio_sim_device *to_gpio_sim_device(struct config_item *item)
--
2.40.1
next prev parent reply other threads:[~2024-06-10 14:05 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-10 14:05 [PATCH 0/3] gpio: sim: driver improvements Bartosz Golaszewski
2024-06-10 14:05 ` Bartosz Golaszewski [this message]
2024-06-10 14:05 ` [PATCH 2/3] gpio: sim: drop kernel.h include Bartosz Golaszewski
2024-06-10 14:05 ` [PATCH 3/3] gpio: sim: use devm_mutex_init() Bartosz Golaszewski
2024-06-10 15:23 ` Andy Shevchenko
2024-06-10 15:31 ` Bartosz Golaszewski
2024-06-10 16:26 ` Andy Shevchenko
2024-06-10 16:26 ` [PATCH 0/3] gpio: sim: driver improvements Andy Shevchenko
2024-06-11 19:39 ` Bartosz Golaszewski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240610140548.35358-2-brgl@bgdev.pl \
--to=brgl@bgdev.pl \
--cc=andy.shevchenko@gmail.com \
--cc=bartosz.golaszewski@linaro.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).