linux-leds.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jacek Anaszewski <jacek.anaszewski@gmail.com>
To: Andrew Lunn <andrew@lunn.ch>,
	Jacek Anaszewski <j.anaszewski@samsung.com>
Cc: linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	Pavel Machek <pavel@ucw.cz>,
	Stas Sergeev <stsp@users.sourceforge.net>
Subject: Re: [PATCH/RFC v6 05/36] leds: Improve setting brightness in a non sleeping way
Date: Fri, 21 Aug 2015 22:31:05 +0200	[thread overview]
Message-ID: <55D78A89.2030407@gmail.com> (raw)
In-Reply-To: <20150821174507.GB8193@lunn.ch>

On 08/21/2015 07:45 PM, Andrew Lunn wrote:
> On Fri, Aug 21, 2015 at 11:22:33AM +0200, Jacek Anaszewski wrote:
>> Hi Andrew,
>>
>> Thanks for the review.
>>
>> On 08/20/2015 06:09 PM, Andrew Lunn wrote:
>>> On Thu, Aug 20, 2015 at 04:43:35PM +0200, Jacek Anaszewski wrote:
>>>> This patch replaces led_set_brightness_async with
>>>> led_set_brightness_nosleep in all places where the most vital was setting
>>>> brightness in a non sleeping way but not necessarily asynchronously, which
>>>> is not needed for non-blocking drivers.
>>>
>>> O.K, so i've lost the plot. _sync, _asymc, _nosleep, etc. Too many
>>> changes without a clearly documented vision of what you are trying to
>>> achieve.
>>>
>>> How about splitting this up into at least two patch sets.
>>>
>>> 1) Add the brightness_set_blocking op and the minimum of changes
>>> needed to the core to make it work, and the driver changes taking out
>>> the work queue.
>>
>> The minimum of changes needed includes harnessing existing
>> set_brightness_work for setting brightness instead of the work queues
>> in the drivers.
>
> I'm not sure that is the correct architecture.
>
> The work queue is in the class, not the core. So you need to define
> the core API to not need this work queue.

If we wanted to follow this logic then we should also ask
if led_timer_function shouldn't be placed in the core too.
set_brightness_work was introduced only because of out-of-tree
user which called led_set_brightness from hard irq context,
which caused problems related to locking between hard and
softirq, when timer trigger was enabled.

> What exactly is the core
> API? What does it say about blocking and non-blocking, synchronous and
> non-synchronous?

The core API is everything in linux/leds.h not prefixed with
led_classdev_, i.e functions for controlling brightness, blinking,
and triggers. Until the addition of LED flash class extension
things like sync/async, blocking/non_blocking weren't considered
neither by the API, nor by documentation. There was only a comment
over brightness_set op declaration, that it mustn't sleep.
This requirement stems from the fact that some triggers, e.g. timer,
set brightness from soft irq context.

While implementing LED flash extension we noticed that LED subsystem
doesn't provide a means for setting brightness synchronously,
and we added led_set_brightness_sync API for this, SET_BRIGHTNESS_SYNC,
and SET_BRIGHTNESS_ASYNC flags. Recently we agreed that this is not
a driver that should decide about sync/async way of brightness setting,
but the caller. That's why I am removing the flags and modifying the
sync API. Actually I tried to tell this story in the commit messages of
the patches making up my recent patch set.

> Adding the work queue to the core is the quick and simple way of
> removing it from the drivers. Maybe that is the way forward. You can
> then later come back and sort out the core API and the class API, and
> clean up the documentation.

This work queue from led-class.c is used for setting brightness, when
blink timer is on. Blinking is the functionality from the LED core, so 
the work queue should also belong to the core. It should be moved
there along with led_timer_function, for consistency reasons. In view
of the above, using it for setting brightness by blocking drivers
would be correct from the architectural point of view.

-- 
Best Regards,
Jacek Anaszewski

  reply	other threads:[~2015-08-21 20:31 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-20 14:43 [PATCH/RFC v6 00/36] Remove work queues from LED class drivers Jacek Anaszewski
2015-08-20 14:43 ` [PATCH/RFC v6 01/36] leds: Add brightness_set_blocking op Jacek Anaszewski
2015-08-20 15:21   ` Andrew Lunn
2015-08-24 11:40   ` Pavel Machek
2015-08-20 14:43 ` [PATCH/RFC v6 02/36] leds: Add led_set_brightness_sync to the public LED subsystem API Jacek Anaszewski
2015-08-20 15:43   ` Andrew Lunn
2015-08-20 14:43 ` [PATCH/RFC v6 03/36] leds: Improve asynchronous path of setting brightness Jacek Anaszewski
2015-08-20 14:43 ` [PATCH/RFC v6 04/36] leds: Add an internal led_set_brightness_nosleep function Jacek Anaszewski
2015-08-20 14:43 ` [PATCH/RFC v6 05/36] leds: Improve setting brightness in a non sleeping way Jacek Anaszewski
2015-08-20 16:09   ` Andrew Lunn
2015-08-21  9:22     ` Jacek Anaszewski
2015-08-21 17:45       ` Andrew Lunn
2015-08-21 20:31         ` Jacek Anaszewski [this message]
2015-08-21 20:42           ` Andrew Lunn
2015-08-24  8:11             ` Jacek Anaszewski
2015-08-20 14:43 ` [PATCH/RFC v6 06/36] leds: Drivers shouldn't enforce SYNC/ASYNC brightness setting Jacek Anaszewski
2015-08-20 14:43 ` [PATCH/RFC v6 07/36] Documentation: leds: Add description of brightness_set* ops Jacek Anaszewski
2015-08-20 14:43 ` [PATCH/RFC v6 08/36] leds: ktd2692: Remove work queue Jacek Anaszewski
2015-08-20 14:43 ` [PATCH/RFC v6 09/36] leds: aat1290: " Jacek Anaszewski
2015-08-20 14:43 ` [PATCH/RFC v6 10/36] leds: max77693: " Jacek Anaszewski
2015-08-20 14:43 ` [PATCH/RFC v6 11/36] leds: tlc591xx: " Jacek Anaszewski
2015-08-20 14:43 ` [PATCH/RFC v6 12/36] leds: 88pm860x: " Jacek Anaszewski
2015-08-20 14:43 ` [PATCH/RFC v6 13/36] leds: adp5520: " Jacek Anaszewski
2015-08-20 14:43 ` [PATCH/RFC v6 14/36] leds: bd2802: " Jacek Anaszewski
2015-08-20 14:43 ` [PATCH/RFC v6 15/36] leds: blinkm: " Jacek Anaszewski
2015-08-20 14:43 ` [PATCH/RFC v6 16/36] leds: lm3533: " Jacek Anaszewski
2015-08-20 14:43 ` [PATCH/RFC v6 17/36] leds: lm3642: " Jacek Anaszewski
2015-08-20 14:43 ` [PATCH/RFC v6 18/36] leds: pca9532: Remove work queue for LEDs Jacek Anaszewski
2015-08-20 14:43 ` [PATCH/RFC v6 19/36] leds: lp3944: Remove work queue Jacek Anaszewski
2015-08-21  7:47   ` Antonio Ospite
2015-08-20 14:43 ` [PATCH/RFC v6 20/36] leds: lp55xx: " Jacek Anaszewski
2015-08-20 14:43 ` [PATCH/RFC v6 21/36] leds: lp8788: " Jacek Anaszewski
2015-08-20 14:43 ` [PATCH/RFC v6 22/36] leds: lp8860: " Jacek Anaszewski
2015-08-20 14:43 ` [PATCH/RFC v6 23/36] leds: pca955x: " Jacek Anaszewski
2015-08-20 14:43 ` [PATCH/RFC v6 24/36] leds: pca963x: " Jacek Anaszewski
2015-08-20 14:43 ` [PATCH/RFC v6 25/36] leds: wm831x: " Jacek Anaszewski
2015-08-20 14:43 ` [PATCH/RFC v6 26/36] leds: da903x: " Jacek Anaszewski
2015-08-20 14:43 ` [PATCH/RFC v6 27/36] leds: da9052: " Jacek Anaszewski
2015-08-20 14:43 ` [PATCH/RFC v6 28/36] leds: dac124d085: " Jacek Anaszewski
2015-08-20 14:43 ` [PATCH/RFC v6 29/36] leds: lt3593: " Jacek Anaszewski
2015-08-20 14:44 ` [PATCH/RFC v6 30/36] leds: max8997: Remove unneeded workqueue include Jacek Anaszewski
2015-08-20 14:44 ` [PATCH/RFC v6 31/36] leds: mc13783: Remove work queue Jacek Anaszewski
2015-08-20 14:44 ` [PATCH/RFC v6 32/36] leds: regulator: " Jacek Anaszewski
2015-08-21  7:49   ` Antonio Ospite
2015-08-20 14:44 ` [PATCH/RFC v6 33/36] leds: wm8350: " Jacek Anaszewski
2015-08-20 14:44 ` [PATCH/RFC v6 34/36] leds: gpio: " Jacek Anaszewski
2015-08-20 14:44 ` [PATCH/RFC v6 35/36] leds: pwm: remove " Jacek Anaszewski
2015-08-20 14:44 ` [PATCH/RFC v6 36/36] leds: lm355x: Remove " Jacek Anaszewski
2015-11-16 13:38 ` [PATCH/RFC v6 00/36] Remove work queues from LED class drivers Jacek Anaszewski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55D78A89.2030407@gmail.com \
    --to=jacek.anaszewski@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=j.anaszewski@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=sakari.ailus@linux.intel.com \
    --cc=stsp@users.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).