* [PATCH 0/3] gpio: sim: driver improvements
@ 2024-06-10 14:05 Bartosz Golaszewski
2024-06-10 14:05 ` [PATCH 1/3] gpio: sim: use device_match_name() instead of strcmp(dev_name( Bartosz Golaszewski
` (4 more replies)
0 siblings, 5 replies; 9+ messages in thread
From: Bartosz Golaszewski @ 2024-06-10 14:05 UTC (permalink / raw)
To: Linus Walleij; +Cc: linux-gpio, linux-kernel, Bartosz Golaszewski
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Andy had some suggestions in his review of the gpio-virtuser that also
apply to gpio-sim so let's use them.
Bartosz Golaszewski (3):
gpio: sim: use device_match_name() instead of strcmp(dev_name(...
gpio: sim: drop kernel.h include
gpio: sim: use devm_mutex_init()
drivers/gpio/gpio-sim.c | 35 +++++++++++++----------------------
1 file changed, 13 insertions(+), 22 deletions(-)
--
2.40.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/3] gpio: sim: use device_match_name() instead of strcmp(dev_name(...
2024-06-10 14:05 [PATCH 0/3] gpio: sim: driver improvements Bartosz Golaszewski
@ 2024-06-10 14:05 ` Bartosz Golaszewski
2024-06-10 14:05 ` [PATCH 2/3] gpio: sim: drop kernel.h include Bartosz Golaszewski
` (3 subsequent siblings)
4 siblings, 0 replies; 9+ messages in thread
From: Bartosz Golaszewski @ 2024-06-10 14:05 UTC (permalink / raw)
To: Linus Walleij
Cc: linux-gpio, linux-kernel, Bartosz Golaszewski, Andy Shevchenko
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
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/3] gpio: sim: drop kernel.h include
2024-06-10 14:05 [PATCH 0/3] gpio: sim: driver improvements Bartosz Golaszewski
2024-06-10 14:05 ` [PATCH 1/3] gpio: sim: use device_match_name() instead of strcmp(dev_name( Bartosz Golaszewski
@ 2024-06-10 14:05 ` Bartosz Golaszewski
2024-06-10 14:05 ` [PATCH 3/3] gpio: sim: use devm_mutex_init() Bartosz Golaszewski
` (2 subsequent siblings)
4 siblings, 0 replies; 9+ messages in thread
From: Bartosz Golaszewski @ 2024-06-10 14:05 UTC (permalink / raw)
To: Linus Walleij
Cc: linux-gpio, linux-kernel, Bartosz Golaszewski, Andy Shevchenko
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
We included kernel.h for ARRAY_SIZE() which has since been moved into
its own header. Use it instead.
Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
drivers/gpio/gpio-sim.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpio/gpio-sim.c b/drivers/gpio/gpio-sim.c
index 278bb0c54636..21ad8d87ef04 100644
--- a/drivers/gpio/gpio-sim.c
+++ b/drivers/gpio/gpio-sim.c
@@ -7,6 +7,7 @@
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+#include <linux/array_size.h>
#include <linux/bitmap.h>
#include <linux/cleanup.h>
#include <linux/completion.h>
@@ -20,7 +21,6 @@
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/irq_sim.h>
-#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/lockdep.h>
#include <linux/minmax.h>
--
2.40.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/3] gpio: sim: use devm_mutex_init()
2024-06-10 14:05 [PATCH 0/3] gpio: sim: driver improvements Bartosz Golaszewski
2024-06-10 14:05 ` [PATCH 1/3] gpio: sim: use device_match_name() instead of strcmp(dev_name( Bartosz Golaszewski
2024-06-10 14:05 ` [PATCH 2/3] gpio: sim: drop kernel.h include Bartosz Golaszewski
@ 2024-06-10 14:05 ` Bartosz Golaszewski
2024-06-10 15:23 ` Andy Shevchenko
2024-06-10 16:26 ` [PATCH 0/3] gpio: sim: driver improvements Andy Shevchenko
2024-06-11 19:39 ` Bartosz Golaszewski
4 siblings, 1 reply; 9+ messages in thread
From: Bartosz Golaszewski @ 2024-06-10 14:05 UTC (permalink / raw)
To: Linus Walleij
Cc: linux-gpio, linux-kernel, Bartosz Golaszewski, Andy Shevchenko
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Drop the hand-coded devres action callback for destroying the mutex in
favor of devm_mutex_init().
Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
drivers/gpio/gpio-sim.c | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
diff --git a/drivers/gpio/gpio-sim.c b/drivers/gpio/gpio-sim.c
index 21ad8d87ef04..4157735ea791 100644
--- a/drivers/gpio/gpio-sim.c
+++ b/drivers/gpio/gpio-sim.c
@@ -308,13 +308,6 @@ static ssize_t gpio_sim_sysfs_pull_store(struct device *dev,
return len;
}
-static void gpio_sim_mutex_destroy(void *data)
-{
- struct mutex *lock = data;
-
- mutex_destroy(lock);
-}
-
static void gpio_sim_put_device(void *data)
{
struct device *dev = data;
@@ -458,9 +451,7 @@ static int gpio_sim_add_bank(struct fwnode_handle *swnode, struct device *dev)
if (ret)
return ret;
- mutex_init(&chip->lock);
- ret = devm_add_action_or_reset(dev, gpio_sim_mutex_destroy,
- &chip->lock);
+ ret = devm_mutex_init(dev, &chip->lock);
if (ret)
return ret;
--
2.40.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 3/3] gpio: sim: use devm_mutex_init()
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
0 siblings, 1 reply; 9+ messages in thread
From: Andy Shevchenko @ 2024-06-10 15:23 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Linus Walleij, linux-gpio, linux-kernel, Bartosz Golaszewski
On Mon, Jun 10, 2024 at 5:05 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
>
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
>
> Drop the hand-coded devres action callback for destroying the mutex in
> favor of devm_mutex_init().
All three LGTM,
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Thanks!
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 3/3] gpio: sim: use devm_mutex_init()
2024-06-10 15:23 ` Andy Shevchenko
@ 2024-06-10 15:31 ` Bartosz Golaszewski
2024-06-10 16:26 ` Andy Shevchenko
0 siblings, 1 reply; 9+ messages in thread
From: Bartosz Golaszewski @ 2024-06-10 15:31 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Linus Walleij, linux-gpio, linux-kernel, Bartosz Golaszewski
On Mon, 10 Jun 2024 at 17:24, Andy Shevchenko <andy.shevchenko@gmail.com> wrote:
>
> On Mon, Jun 10, 2024 at 5:05 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> >
> > From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> >
> > Drop the hand-coded devres action callback for destroying the mutex in
> > favor of devm_mutex_init().
>
> All three LGTM,
Can you leave your tags under the cover letter in such cases? This
will make b4 pick it up for all patches automatically.
Thanks,
Bart
> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> Thanks!
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 0/3] gpio: sim: driver improvements
2024-06-10 14:05 [PATCH 0/3] gpio: sim: driver improvements Bartosz Golaszewski
` (2 preceding siblings ...)
2024-06-10 14:05 ` [PATCH 3/3] gpio: sim: use devm_mutex_init() Bartosz Golaszewski
@ 2024-06-10 16:26 ` Andy Shevchenko
2024-06-11 19:39 ` Bartosz Golaszewski
4 siblings, 0 replies; 9+ messages in thread
From: Andy Shevchenko @ 2024-06-10 16:26 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Linus Walleij, linux-gpio, linux-kernel, Bartosz Golaszewski
Mon, Jun 10, 2024 at 04:05:45PM +0200, Bartosz Golaszewski kirjoitti:
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
>
> Andy had some suggestions in his review of the gpio-virtuser that also
> apply to gpio-sim so let's use them.
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 3/3] gpio: sim: use devm_mutex_init()
2024-06-10 15:31 ` Bartosz Golaszewski
@ 2024-06-10 16:26 ` Andy Shevchenko
0 siblings, 0 replies; 9+ messages in thread
From: Andy Shevchenko @ 2024-06-10 16:26 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Andy Shevchenko, Linus Walleij, linux-gpio, linux-kernel,
Bartosz Golaszewski
Mon, Jun 10, 2024 at 05:31:44PM +0200, Bartosz Golaszewski kirjoitti:
> On Mon, 10 Jun 2024 at 17:24, Andy Shevchenko <andy.shevchenko@gmail.com> wrote:
> >
> > On Mon, Jun 10, 2024 at 5:05 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> > >
> > > From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> > >
> > > Drop the hand-coded devres action callback for destroying the mutex in
> > > favor of devm_mutex_init().
> >
> > All three LGTM,
>
> Can you leave your tags under the cover letter in such cases? This
> will make b4 pick it up for all patches automatically.
For some reason I was thinking there is no cover letter.
But okay, done now.
> > Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> > Thanks!
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 0/3] gpio: sim: driver improvements
2024-06-10 14:05 [PATCH 0/3] gpio: sim: driver improvements Bartosz Golaszewski
` (3 preceding siblings ...)
2024-06-10 16:26 ` [PATCH 0/3] gpio: sim: driver improvements Andy Shevchenko
@ 2024-06-11 19:39 ` Bartosz Golaszewski
4 siblings, 0 replies; 9+ messages in thread
From: Bartosz Golaszewski @ 2024-06-11 19:39 UTC (permalink / raw)
To: Linus Walleij, Bartosz Golaszewski
Cc: Bartosz Golaszewski, linux-gpio, linux-kernel
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
On Mon, 10 Jun 2024 16:05:45 +0200, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
>
> Andy had some suggestions in his review of the gpio-virtuser that also
> apply to gpio-sim so let's use them.
>
> Bartosz Golaszewski (3):
> gpio: sim: use device_match_name() instead of strcmp(dev_name(...
> gpio: sim: drop kernel.h include
> gpio: sim: use devm_mutex_init()
>
> [...]
Applied, thanks!
[1/3] gpio: sim: use device_match_name() instead of strcmp(dev_name(...
commit: 8a05de23adabc4d982dfdeabc184a267f7a50491
[2/3] gpio: sim: drop kernel.h include
commit: b5f5cbee764e2faffe5241445830a5e43084f3a0
[3/3] gpio: sim: use devm_mutex_init()
commit: 413427153921ac8263d3a516bfbdaa42fa058085
Best regards,
--
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2024-06-11 19:39 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-10 14:05 [PATCH 0/3] gpio: sim: driver improvements Bartosz Golaszewski
2024-06-10 14:05 ` [PATCH 1/3] gpio: sim: use device_match_name() instead of strcmp(dev_name( Bartosz Golaszewski
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
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).