Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754716AbcKIVYg (ORCPT ); Wed, 9 Nov 2016 16:24:36 -0500 Received: from mail-wm0-f67.google.com ([74.125.82.67]:33126 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751685AbcKIVYe (ORCPT ); Wed, 9 Nov 2016 16:24:34 -0500 Subject: Re: [PATCH] leds: Add mutex protection in brightness_show() To: Pavel Machek , Jacek Anaszewski References: <1478245962-15706-1-git-send-email-j.anaszewski@samsung.com> <20161109123800.GB3488@amd> Cc: linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org, Hans de Goede , Sakari Ailus , Andrew Lunn From: Jacek Anaszewski Message-ID: Date: Wed, 9 Nov 2016 22:23:51 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.4.0 MIME-Version: 1.0 In-Reply-To: <20161109123800.GB3488@amd> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 725 Lines: 25 Hi, On 11/09/2016 01:38 PM, Pavel Machek wrote: > Hi! > >> Initially the claim about no need for lock in brightness_show() >> was valid as the function was just returning unchanged >> LED brightness. After the addition of led_update_brightness() this > > The claim was probably wrong from the day one, unless brightness is of > type "atomic_t". > > /* Ensures consistent access to the LED Flash Class device */ > struct mutex led_access; > }; > > This should really list fields that are protected by led_access. Originally it was introduced to facilitate disabling LED subsystem sysfs interface, i.e. it protects flags property of struct led_classdev. -- Best regards, Jacek Anaszewski