[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-id: <55CD9F7F.4020706@samsung.com>
Date: Fri, 14 Aug 2015 09:57:51 +0200
From: Jacek Anaszewski <j.anaszewski@...sung.com>
To: Andrew Lunn <andrew@...n.ch>
Cc: linux-leds@...r.kernel.org, linux-kernel@...r.kernel.org,
cooloney@...il.com, rpurdie@...ys.net, stsp@...rs.sourceforge.net,
Sakari Ailus <sakari.ailus@...ux.intel.com>,
Pavel Machek <pavel@....cz>
Subject: Re: [PATCH/RFC v5 01/57] leds: Add brightness_set_nonblocking op
H Andrew,
On 08/13/2015 04:15 PM, Andrew Lunn wrote:
> On Tue, Aug 11, 2015 at 11:37:14AM +0200, Jacek Anaszewski wrote:
>> This patch adds a new brightness_set_nonblocking op to the LED subsystem.
>> The op is intended for drivers that set brightness in a non-blocking way,
>> i.e. they neither sleep nor use delays while setting brightness.
>>
>> Signed-off-by: Jacek Anaszewski <j.anaszewski@...sung.com>
>> Cc: Bryan Wu <cooloney@...il.com>
>> Cc: Andrew Lunn <andrew@...n.ch>
>> Cc: Sakari Ailus <sakari.ailus@...ux.intel.com>
>> Cc: Pavel Machek <pavel@....cz>
>> Cc: Stas Sergeev <stsp@...rs.sourceforge.net>
>> ---
>> include/linux/leds.h | 3 +++
>> 1 file changed, 3 insertions(+)
>>
>> diff --git a/include/linux/leds.h b/include/linux/leds.h
>> index b122eea..c32f1b8 100644
>> --- a/include/linux/leds.h
>> +++ b/include/linux/leds.h
>> @@ -53,6 +53,9 @@ struct led_classdev {
>> /* Must not sleep, use a workqueue if needed */
>> void (*brightness_set)(struct led_classdev *led_cdev,
>> enum led_brightness brightness);
>> + /* Intended for drivers that set brightness in a non-blocking way */
>> + void (*brightness_set_nonblocking)(struct led_classdev *led_cdev,
>> + enum led_brightness brightness);
>
> Hi Jacek
>
>>>From an API design point of view, i'm not sure this is the best way to
> go. You now have two calls which do the same thing, with the plan that
> you want to invert the meaning of brightness_set, the old well known
> API call, sometime later. This inverting the meaning is going to catch
> people out and introduce bugs.
>
> I would rather add a brightness_set_blocking op. Then as you go
> thought the drivers stripping out the work queue, move the driver to
> use this brightness_set_blocking.
There are around 60 drivers in the other kernel subsystems that register
LED class devices. If we chose the way you proposed then we would have
to adjust all of them to the LED core changes, which could complicate
the situation during merge window if there were other modifications in
the affected drivers.
With my approach all old-fashion drivers will be treated by the
LED core in the old-fashion way. This is why I introduced
LED_BRIGHTNESS_BLOCKING flag - only drivers aware of the LED core
changes will set it, which will allow for the LED core to find out
which drivers are aware of brightness_set semantics change and
implement the op accordingly.
This way the change of brightness_set semantics will not be painful.
After all drivers across all subsystems are adapted to the LED core
changes the flag will be made redundant and we will remove it.
--
Best Regards,
Jacek Anaszewski
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists