diff options
author | Bartosz Golaszewski <bartosz.golaszewski@linaro.org> | 2024-06-10 16:05:48 +0200 |
---|---|---|
committer | Bartosz Golaszewski <bartosz.golaszewski@linaro.org> | 2024-06-11 21:38:42 +0200 |
commit | 413427153921ac8263d3a516bfbdaa42fa058085 (patch) | |
tree | 1ecf5d914bb74815a50f36946d1754491e50a15d | |
parent | b5f5cbee764e2faffe5241445830a5e43084f3a0 (diff) | |
download | lwn-413427153921ac8263d3a516bfbdaa42fa058085.tar.gz lwn-413427153921ac8263d3a516bfbdaa42fa058085.zip |
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 <andy.shevchenko@gmail.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20240610140548.35358-4-brgl@bgdev.pl
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
-rw-r--r-- | drivers/gpio/gpio-sim.c | 11 |
1 files changed, 1 insertions, 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; |