summaryrefslogtreecommitdiff
path: root/drivers/leds/leds-turris-omnia.c
diff options
context:
space:
mode:
authorMarek BehĂșn <kabel@kernel.org>2023-08-02 19:07:43 +0300
committerLee Jones <lee@kernel.org>2023-08-18 12:18:35 +0300
commit760b6b7925bf09491aafa4727eef74fc6bf738b0 (patch)
tree17fad30db987c7a4d852a791d422f41061a1c122 /drivers/leds/leds-turris-omnia.c
parent72a29725b6f2577fa447ca9059cdcd17100043b4 (diff)
downloadlinux-760b6b7925bf09491aafa4727eef74fc6bf738b0.tar.xz
leds: turris-omnia: Drop unnecessary mutex locking
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@kernel.org> Reviewed-by: Lee Jones <lee@kernel.org> Link: https://lore.kernel.org/r/20230802160748.11208-2-kabel@kernel.org Signed-off-by: Lee Jones <lee@kernel.org>
Diffstat (limited to 'drivers/leds/leds-turris-omnia.c')
-rw-r--r--drivers/leds/leds-turris-omnia.c11
1 files changed, 1 insertions, 10 deletions
diff --git a/drivers/leds/leds-turris-omnia.c b/drivers/leds/leds-turris-omnia.c
index ffcaf228e44a..b8a95a917cfa 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);