Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752227AbcKIIoj (ORCPT ); Wed, 9 Nov 2016 03:44:39 -0500 Received: from mailout4.w1.samsung.com ([210.118.77.14]:50189 "EHLO mailout4.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751425AbcKIIog (ORCPT ); Wed, 9 Nov 2016 03:44:36 -0500 X-AuditID: cbfec7f4-f791c6d000006eac-b1-5822e1efa069 Subject: Re: [PATCH v4 1/3] leds: Introduce userspace leds driver To: Pavel Machek Cc: David Lechner , Richard Purdie , linux-kernel@vger.kernel.org, linux-leds@vger.kernel.org, Marcel Holtmann , Hans de Goede From: Jacek Anaszewski Message-id: <0a01e033-b04a-0ffb-b694-ac55649a7623@samsung.com> Date: Wed, 09 Nov 2016 09:44:29 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-version: 1.0 In-reply-to: <20161109070514.GA18969@amd> Content-type: text/plain; charset=windows-1252; format=flowed Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprEKsWRmVeSWpSXmKPExsWy7djP87rvHypFGPzebGCxqEHM4s3x6UwW l3fNYbPY+mYdo8W3T78YLe6eOspmsXvXU1YHdo/1u5eze3zqP8nq8X7fVTaPPfN/sHqsWP2d 3ePzJrkAtigum5TUnMyy1CJ9uwSujP8H1Qrec1VcutbC1MB4j6OLkZNDQsBE4tyxaawQtpjE hXvr2boYuTiEBJYySpw/+YcZwvnMKPFq6hymLkYOsI41b70h4ssYJSasmARV9IxR4nvzdXaQ UcICjhKXHmxiA7FFBOQltvatYAaxmQVuMEpMPmcNYrMJGEr8fPGaCcTmFbCTWLTlHguIzSKg KnHx8D92kGWiAhESu++mQpQISvyYDFLCwcEpoCmxp1cJYqKjxINFO1khbHmJzWvegp0jIbCJ XWLqwXusEDfLSmw6wAzxpItE69+f7BC2sMSr41ugbBmJzo6DTB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QQb0piZVVqUX58UWlOavEhRlOgHyYyS4km5wPjP68k3tDE0NzS0MjYwsLcyEhJnLfk w5VwIYH0xJLU7NTUgtQimD4mDk6pBkYz0cwAe3uvt4x8T4S+5l5YYXj68tannY4bD1RfD+b7 WPFsZU1F4aPVerpNac8XTIz08XBLv/WS0f7xkojNnf72e2Sc1va8tJ1W3suXPPkixwbtfa8W sbtIfhQ7/vjXxKN+RfIv5f/XOjNvl1M3K/NKvrG7eN6e//mcBWmZp8ztmW4/NPhyM0mJpTgj 0VCLuag4EQAGr4ZnxwIAAA== X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20161109084431eucas1p167abe9d47c4a63188d99dc9738d2c513 X-Msg-Generator: CA X-Sender-IP: 182.198.249.179 X-Local-Sender: =?UTF-8?B?SmFjZWsgQW5hc3pld3NraRtTUlBPTC1TeXN0ZW0gRlcgIChN?= =?UTF-8?B?Qikb7IK87ISx7KCE7J6QG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Global-Sender: =?UTF-8?B?SmFjZWsgQW5hc3pld3NraRtTUlBPTC1TeXN0ZW0gRlcgIChN?= =?UTF-8?B?QikbU2Ftc3VuZyBFbGVjdHJvbmljcxtTZW5pb3IgU29mdHdhcmUgRW5naW5l?= =?UTF-8?B?ZXI=?= X-Sender-Code: =?UTF-8?B?QzEwG0VIURtDMTBDRDAyQ0QwMjc1MjY=?= CMS-TYPE: 201P X-HopCount: 7 X-CMS-RootMailID: 20160916191722eucas1p1ceadfd878f28c36bae4c8bf33f582e6b X-RootMTR: 20160916191722eucas1p1ceadfd878f28c36bae4c8bf33f582e6b References: <1474053410-24387-1-git-send-email-david@lechnology.com> <1474053410-24387-2-git-send-email-david@lechnology.com> <0bfdfd46-35e5-321c-5759-0cc96be862fd@samsung.com> <20161109070514.GA18969@amd> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1351 Lines: 40 Hi, On 11/09/2016 08:05 AM, Pavel Machek wrote: > Hi! > >>> +struct uleds_device { >>> + struct uleds_user_dev user_dev; >>> + struct led_classdev led_cdev; >>> + struct mutex mutex; >>> + enum uleds_state state; >>> + wait_queue_head_t waitq; >>> + unsigned char brightness; >> >> I've just noticed that this is wrong, since LED subsystem >> brightness type is enum led_brightness, i.e. int. >> LED_FULL (255) value is a legacy enum value that can be overridden >> by max_brightness property. >> >> Please submit a fix so that I could merge it with the original >> patch before sending it upstream. > > Actually... perhaps you want to wait with merging the userspace driver > till the locking is solved in the LED subsystem? Maybe I'm wrong, but > I have feeling that userspace driver will have unusual requirements > w.r.t. locking, and that it would be good to have that solved, > first... If you think about locking between led_set_brightness() and led_update_brightness() then we have no ready solution for that. Do you have any? If not then we have to live with that until one is devised. After adding the locking in brightness_show the risk of races will be only in case of concurrent calls to led_set_brightness() and led_update_brightness() from kernel, whereas currently there are no such use cases. -- Best regards, Jacek Anaszewski