Skip to content

Commit 4134271

Browse files
author
Bartosz Golaszewski
committed
gpio: sim: use devm_mutex_init()
Drop the hand-coded devres action callback for destroying the mutex in favor of devm_mutex_init(). 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 b5f5cbe commit 4134271

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

drivers/gpio/gpio-sim.c

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -308,13 +308,6 @@ static ssize_t gpio_sim_sysfs_pull_store(struct device *dev,
308308
return len;
309309
}
310310

311-
static void gpio_sim_mutex_destroy(void *data)
312-
{
313-
struct mutex *lock = data;
314-
315-
mutex_destroy(lock);
316-
}
317-
318311
static void gpio_sim_put_device(void *data)
319312
{
320313
struct device *dev = data;
@@ -458,9 +451,7 @@ static int gpio_sim_add_bank(struct fwnode_handle *swnode, struct device *dev)
458451
if (ret)
459452
return ret;
460453

461-
mutex_init(&chip->lock);
462-
ret = devm_add_action_or_reset(dev, gpio_sim_mutex_destroy,
463-
&chip->lock);
454+
ret = devm_mutex_init(dev, &chip->lock);
464455
if (ret)
465456
return ret;
466457

0 commit comments

Comments
 (0)