Re: [RFC PATCH 5/5] leds: multicolor: Introduce a multicolor class definition

From: Dan Murphy
Date: Tue Apr 02 2019 - 07:55:46 EST


Marek

On 4/2/19 12:44 AM, Marek Behun wrote:
> Hi Dan,
>
> On Mon, 1 Apr 2019 12:34:00 -0500
> Dan Murphy <dmurphy@xxxxxx> wrote:
>
>> +static ssize_t sync_store(struct device *dev,
>> + struct device_attribute *sync_attr,
>> + const char *buf, size_t size)
>> +{
>> + struct led_classdev_mc_data *data = container_of(sync_attr,
>> + struct led_classdev_mc_data,
>> + sync_attr);
>> + struct led_classdev_mc *mcled_cdev = data->mcled_cdev;
>> + struct led_classdev *led_cdev = &mcled_cdev->led_cdev;
>> + const struct led_multicolor_ops *ops = mcled_cdev->ops;
>> + struct led_classdev_mc_priv *priv;
>> + unsigned long sync_value;
>> + ssize_t ret = -EINVAL;
>> +
>> + mutex_lock(&led_cdev->led_access);
>> +
>> + if (!mcled_cdev->sync_enabled)
>> + goto unlock;
>
> This lock is redundant, you could just put
> if (mcled_cdev->sync_enabled)
> return ret;
> before the lock.
>

Ack

Thanks the code is just proof of concept code. But I will make this change as well.

Dan

--
------------------
Dan Murphy