Use devm_mutex_init() instead of hand-writing it.
This saves some LoC, improves readability and saves some space in the
generated .o file.
Before:
======
text data bss dec hex filename
3520 1112 64 4696 1258 drivers/platform/x86/xiaomi-wmi.o
After:
=====
text data bss dec hex filename
3069 1040 64 4173 104d drivers/platform/x86/xiaomi-wmi.o
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/bb5d7a57e11eb580f610276a351a01a993341fb8.1757239732.git.christophe.jaillet@wanadoo.fr
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
unsigned int key_code;
};
-static void xiaomi_mutex_destroy(void *data)
-{
- struct mutex *lock = data;
-
- mutex_destroy(lock);
-}
-
static int xiaomi_wmi_probe(struct wmi_device *wdev, const void *context)
{
struct xiaomi_wmi *data;
return -ENOMEM;
dev_set_drvdata(&wdev->dev, data);
- mutex_init(&data->key_lock);
- ret = devm_add_action_or_reset(&wdev->dev, xiaomi_mutex_destroy, &data->key_lock);
+ ret = devm_mutex_init(&wdev->dev, &data->key_lock);
if (ret < 0)
return ret;