Patch "leds: turris-omnia: Drop unnecessary mutex locking" has been added to the 6.5-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    leds: turris-omnia: Drop unnecessary mutex locking

to the 6.5-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     leds-turris-omnia-drop-unnecessary-mutex-locking.patch
and it can be found in the queue-6.5 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 647e2097a16cf65ca8db17029ce0e969a1c04076
Author: Marek Behún <kabel@xxxxxxxxxx>
Date:   Wed Aug 2 18:07:43 2023 +0200

    leds: turris-omnia: Drop unnecessary mutex locking
    
    [ Upstream commit 760b6b7925bf09491aafa4727eef74fc6bf738b0 ]
    
    Do not lock driver mutex in the global LED panel brightness sysfs
    accessors brightness_show() and brightness_store().
    
    The mutex locking is unnecessary here. The I2C transfers are guarded by
    I2C core locking mechanism, and the LED commands itself do not interfere
    with other commands.
    
    Fixes: 089381b27abe ("leds: initial support for Turris Omnia LEDs")
    Signed-off-by: Marek Behún <kabel@xxxxxxxxxx>
    Reviewed-by: Lee Jones <lee@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20230802160748.11208-2-kabel@xxxxxxxxxx
    Signed-off-by: Lee Jones <lee@xxxxxxxxxx>
    Stable-dep-of: 6de283b96b31 ("leds: turris-omnia: Do not use SMBUS calls")
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/leds/leds-turris-omnia.c b/drivers/leds/leds-turris-omnia.c
index 64b2d7b6d3f31..bbd610100e418 100644
--- a/drivers/leds/leds-turris-omnia.c
+++ b/drivers/leds/leds-turris-omnia.c
@@ -156,12 +156,9 @@ static ssize_t brightness_show(struct device *dev, struct device_attribute *a,
 			       char *buf)
 {
 	struct i2c_client *client = to_i2c_client(dev);
-	struct omnia_leds *leds = i2c_get_clientdata(client);
 	int ret;
 
-	mutex_lock(&leds->lock);
 	ret = i2c_smbus_read_byte_data(client, CMD_LED_GET_BRIGHTNESS);
-	mutex_unlock(&leds->lock);
 
 	if (ret < 0)
 		return ret;
@@ -173,7 +170,6 @@ static ssize_t brightness_store(struct device *dev, struct device_attribute *a,
 				const char *buf, size_t count)
 {
 	struct i2c_client *client = to_i2c_client(dev);
-	struct omnia_leds *leds = i2c_get_clientdata(client);
 	unsigned long brightness;
 	int ret;
 
@@ -183,15 +179,10 @@ static ssize_t brightness_store(struct device *dev, struct device_attribute *a,
 	if (brightness > 100)
 		return -EINVAL;
 
-	mutex_lock(&leds->lock);
 	ret = i2c_smbus_write_byte_data(client, CMD_LED_SET_BRIGHTNESS,
 					(u8)brightness);
-	mutex_unlock(&leds->lock);
-
-	if (ret < 0)
-		return ret;
 
-	return count;
+	return ret < 0 ? ret : count;
 }
 static DEVICE_ATTR_RW(brightness);
 



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux