lkml.org 
[lkml]   [2019]   [Apr]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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@ti.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.

\
 
 \ /
  Last update: 2019-04-02 07:45    [W:0.117 / U:0.720 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site