[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <bb5d7a57e11eb580f610276a351a01a993341fb8.1757239732.git.christophe.jaillet@wanadoo.fr>
Date: Sun, 7 Sep 2025 12:09:09 +0200
From: Christophe JAILLET <christophe.jaillet@...adoo.fr>
To: Hans de Goede <hansg@...nel.org>,
Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
Cc: linux-kernel@...r.kernel.org,
kernel-janitors@...r.kernel.org,
Christophe JAILLET <christophe.jaillet@...adoo.fr>,
platform-driver-x86@...r.kernel.org
Subject: [PATCH] platform/x86: xiaomi-wmi: Use devm_mutex_init()
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@...adoo.fr>
---
drivers/platform/x86/xiaomi-wmi.c | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/drivers/platform/x86/xiaomi-wmi.c b/drivers/platform/x86/xiaomi-wmi.c
index cbed29ca502a..b892007b9863 100644
--- a/drivers/platform/x86/xiaomi-wmi.c
+++ b/drivers/platform/x86/xiaomi-wmi.c
@@ -26,13 +26,6 @@ struct xiaomi_wmi {
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;
@@ -46,8 +39,7 @@ static int xiaomi_wmi_probe(struct wmi_device *wdev, const void *context)
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;
--
2.51.0
Powered by blists - more mailing lists