From: Bartosz Golaszewski <[email protected]>
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
From: Bartosz Golaszewski <[email protected]>
Drop the hand-coded devres action callback for destroying the mutex in
favor of devm_mutex_init().
Suggested-by: Andy Shevchenko <[email protected]>
Signed-off-by: Bartosz Golaszewski <[email protected]>
---
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
From: Bartosz Golaszewski <[email protected]>
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]>
Signed-off-by: Bartosz Golaszewski <[email protected]>
---
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
On Mon, Jun 10, 2024 at 5:05 PM Bartosz Golaszewski <[email protected]> wrote:
>
> From: Bartosz Golaszewski <[email protected]>
>
> Drop the hand-coded devres action callback for destroying the mutex in
> favor of devm_mutex_init().
All three LGTM,
Reviewed-by: Andy Shevchenko <[email protected]>
Thanks!
--
With Best Regards,
Andy Shevchenko
Mon, Jun 10, 2024 at 04:05:45PM +0200, Bartosz Golaszewski kirjoitti:
> From: Bartosz Golaszewski <[email protected]>
>
> 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 <[email protected]>
--
With Best Regards,
Andy Shevchenko
From: Bartosz Golaszewski <[email protected]>
We included kernel.h for ARRAY_SIZE() which has since been moved into
its own header. Use it instead.
Suggested-by: Andy Shevchenko <[email protected]>
Signed-off-by: Bartosz Golaszewski <[email protected]>
---
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
On Mon, 10 Jun 2024 at 17:24, Andy Shevchenko <[email protected]> wrote:
>
> On Mon, Jun 10, 2024 at 5:05 PM Bartosz Golaszewski <[email protected]> wrote:
> >
> > From: Bartosz Golaszewski <[email protected]>
> >
> > 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 <[email protected]>
> Thanks!
>
From: Bartosz Golaszewski <[email protected]>
On Mon, 10 Jun 2024 16:05:45 +0200, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <[email protected]>
>
> 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 <[email protected]>