[PATCH 3/3] gpio: sim: use devm_mutex_init()

Bartosz Golaszewski posted 3 patches 1 year, 8 months ago
[PATCH 3/3] gpio: sim: use devm_mutex_init()
Posted by Bartosz Golaszewski 1 year, 8 months ago
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
Re: [PATCH 3/3] gpio: sim: use devm_mutex_init()
Posted by Andy Shevchenko 1 year, 8 months ago
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
Re: [PATCH 3/3] gpio: sim: use devm_mutex_init()
Posted by Bartosz Golaszewski 1 year, 8 months ago
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!
>
Re: [PATCH 3/3] gpio: sim: use devm_mutex_init()
Posted by Andy Shevchenko 1 year, 8 months ago
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