1 From 760b6b7925bf09491aafa4727eef74fc6bf738b0 Mon Sep 17 00:00:00 2001
2 From: Marek BehĂșn <kabel@kernel.org>
3 Date: Wed, 2 Aug 2023 18:07:43 +0200
4 Subject: leds: turris-omnia: Drop unnecessary mutex locking
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
9 Do not lock driver mutex in the global LED panel brightness sysfs
10 accessors brightness_show() and brightness_store().
12 The mutex locking is unnecessary here. The I2C transfers are guarded by
13 I2C core locking mechanism, and the LED commands itself do not interfere
16 Fixes: 089381b27abe ("leds: initial support for Turris Omnia LEDs")
17 Signed-off-by: Marek BehĂșn <kabel@kernel.org>
18 Reviewed-by: Lee Jones <lee@kernel.org>
19 Link: https://lore.kernel.org/r/20230802160748.11208-2-kabel@kernel.org
20 Signed-off-by: Lee Jones <lee@kernel.org>
22 drivers/leds/leds-turris-omnia.c | 11 +----------
23 1 file changed, 1 insertion(+), 10 deletions(-)
25 (limited to 'drivers/leds/leds-turris-omnia.c')
27 --- a/drivers/leds/leds-turris-omnia.c
28 +++ b/drivers/leds/leds-turris-omnia.c
29 @@ -156,12 +156,9 @@ static ssize_t brightness_show(struct de
32 struct i2c_client *client = to_i2c_client(dev);
33 - struct omnia_leds *leds = i2c_get_clientdata(client);
36 - mutex_lock(&leds->lock);
37 ret = i2c_smbus_read_byte_data(client, CMD_LED_GET_BRIGHTNESS);
38 - mutex_unlock(&leds->lock);
42 @@ -173,7 +170,6 @@ static ssize_t brightness_store(struct d
43 const char *buf, size_t count)
45 struct i2c_client *client = to_i2c_client(dev);
46 - struct omnia_leds *leds = i2c_get_clientdata(client);
47 unsigned long brightness;
50 @@ -183,15 +179,10 @@ static ssize_t brightness_store(struct d
54 - mutex_lock(&leds->lock);
55 ret = i2c_smbus_write_byte_data(client, CMD_LED_SET_BRIGHTNESS,
57 - mutex_unlock(&leds->lock);
63 + return ret < 0 ? ret : count;
65 static DEVICE_ATTR_RW(brightness);