[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190402074406.0860994a@nic.cz>
Date: Tue, 2 Apr 2019 07:44:06 +0200
From: Marek Behun <marek.behun@....cz>
To: Dan Murphy <dmurphy@...com>
Cc: <robh+dt@...nel.org>, <jacek.anaszewski@...il.com>, <pavel@....cz>,
<linux-kernel@...r.kernel.org>, <linux-leds@...r.kernel.org>
Subject: Re: [RFC PATCH 5/5] leds: multicolor: Introduce a multicolor class
definition
Hi Dan,
On Mon, 1 Apr 2019 12:34:00 -0500
Dan Murphy <dmurphy@...com> 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.
Powered by blists - more mailing lists