[<prev] [next>] [day] [month] [year] [list]
Message-ID: <267aba6eab12be67c297fcd52fcf45a0856338bb.1757240150.git.christophe.jaillet@wanadoo.fr>
Date: Sun, 7 Sep 2025 12:16:09 +0200
From: Christophe JAILLET <christophe.jaillet@...adoo.fr>
To: Lee Jones <lee@...nel.org>,
Pavel Machek <pavel@...nel.org>
Cc: linux-kernel@...r.kernel.org,
kernel-janitors@...r.kernel.org,
Christophe JAILLET <christophe.jaillet@...adoo.fr>,
linux-leds@...r.kernel.org
Subject: [PATCH] leds: is31fl319x: 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
20011 6752 128 26891 690b drivers/leds/leds-is31fl319x.o
After:
=====
text data bss dec hex filename
19715 6680 128 26523 679b drivers/leds/leds-is31fl319x.o
Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
---
drivers/leds/leds-is31fl319x.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/drivers/leds/leds-is31fl319x.c b/drivers/leds/leds-is31fl319x.c
index 27bfab3da479..e411cee06dab 100644
--- a/drivers/leds/leds-is31fl319x.c
+++ b/drivers/leds/leds-is31fl319x.c
@@ -483,11 +483,6 @@ static inline int is31fl3196_db_to_gain(u32 dezibel)
return dezibel / IS31FL3196_AUDIO_GAIN_DB_STEP;
}
-static void is31f1319x_mutex_destroy(void *lock)
-{
- mutex_destroy(lock);
-}
-
static int is31fl319x_probe(struct i2c_client *client)
{
struct is31fl319x_chip *is31;
@@ -503,8 +498,7 @@ static int is31fl319x_probe(struct i2c_client *client)
if (!is31)
return -ENOMEM;
- mutex_init(&is31->lock);
- err = devm_add_action_or_reset(dev, is31f1319x_mutex_destroy, &is31->lock);
+ err = devm_mutex_init(dev, &is31->lock);
if (err)
return err;
--
2.51.0
Powered by blists - more mailing lists