From: Jacek Anaszewski <j.anaszewski@samsung.com>
To: Pavel Machek <pavel@ucw.cz>
Cc: linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org,
"Bryan Wu" <cooloney@gmail.com>,
"Richard Purdie" <rpurdie@rpsys.net>,
"Stas Sergeev" <stsp@users.sourceforge.net>,
"Sakari Ailus" <sakari.ailus@linux.intel.com>,
"Andreas Werner" <andreas.werner@men.de>,
"Andrew Lunn" <andrew@lunn.ch>,
"Antonio Ospite" <ospite@studenti.unina.it>,
"Atsushi Nemoto" <anemo@mba.ocn.ne.jp>,
"Ben Dooks" <ben@simtec.co.uk>, "Chris Boot" <bootc@bootc.net>,
"Dan Murphy" <dmurphy@ti.com>,
"Daniel Jeong" <daniel.jeong@ti.com>,
"Daniel Mack" <daniel@zonque.org>,
"David S. Miller" <davem@davemloft.net>,
"Fabio Baltieri" <fabio.baltieri@gmail.com>,
"Felipe Balbi" <balbi@ti.com>,
"Florian Fainelli" <florian@openwrt.org>,
"G.Shark Jeong" <gshark.jeong@gmail.com>,
"Guennadi Liakhovetski" <g.liakhovetski@gmx.de>,
"Ingi Kim" <ingi2.kim@samsung.com>,
"Jan-Simon Moeller" <dl9pf@gmx.de>,
"Johan Hovold" <johan@kernel.org>, "John Lenz" <lenz@cs.wisc.edu>,
"Jonas Gorski" <jogo@openwrt.org>,
"Kim Kyuwon" <q1.kim@samsung.com>,
"Kristian Kielhofner" <kris@krisk.org>,
"Kristoffer Ericson" <kristoffer.ericson@gmail.com>,
"Linus Walleij" <linus.walleij@linaro.org>,
"Mark Brown" <broonie@kernel.org>,
"Michael Hennerich" <michael.hennerich@analog.com>,
"Milo Kim" <milo.kim@ti.com>, "Márton Németh" <nm127@freemail.hu>,
"Nate Case" <ncase@xes-inc.com>, NeilBrown <neilb@suse.de>,
"Nick Forbes" <nick.forbes@incepta.com>,
"Paul Parsons" <lost.distance@yahoo.com>,
"Peter Meerwald" <p.meerwald@bct-electronic.com>,
"Phil Sutter" <n0-1@freewrt.org>,
"Philippe Retornaz" <philippe.retornaz@epfl.ch>,
"Raphael Assenat" <raph@8d.com>,
"Richard Purdie" <rpurdie@openedhand.com>,
"Rod Whitby" <rod@whitby.id.au>, "Dave Hansen" <dave@sr71.net>,
"Rodolfo Giometti" <giometti@linux.it>,
"Sebastian A. Siewior" <bigeasy@linutronix.de>,
"Shuah Khan" <shuahkhan@gmail.com>,
"Simon Guinot" <sguinot@lacie.com>,
"Álvaro Fernández Rojas" <noltari@gmail.com>
Subject: Re: [PATCH/RFC RESEND] leds: Use set_brightness_work for brightness_set ops that can sleep
Date: Wed, 01 Jul 2015 09:28:52 +0200 [thread overview]
Message-ID: <559396B4.9020504@samsung.com> (raw)
In-Reply-To: <20150630174619.GA1852@amd>
On 06/30/2015 07:46 PM, Pavel Machek wrote:
> On Tue 2015-06-30 15:06:19, Jacek Anaszewski wrote:
>> On 06/30/2015 01:58 PM, Pavel Machek wrote:
>>> On Tue 2015-06-30 10:01:08, Jacek Anaszewski wrote:
>>>> This patch rearranges the core LED subsystem code, so that it
>>>> now removes from drivers the responsibility of using work queues
>>>> internally in case their brightness_set ops can sleep.
>>>> Addition of two flags: LED_BRIGHTNESS_FAST and LED_BLINK_DISABLE
>>>> as well as new_brightness_value property to the struct led_classdev
>>>> allows for employing existing set_brightness_work to do the job.
>>>> The modifications allow also to get rid of brightness_set_sync op,
>>>> as flash LED devices can now be handled properly only basing on the
>>>> SET_BRIGHTNESS_SYNC flag.
>>>
>>> Are you sure this is good idea?
>>>
>>> You'll now use single callback for blocking and non-blocking
>>> behaviour. I'm pretty sure stuff like lockdep will have some fun with
>>> that.
>>
>> I enabled "Lock Debugging" options and didn't get any warning.
>> Could you describe the use case you are thinking of?
>
> You may get one when one of the sleeping functions uses some lock...
Drivers which use spin_lock in their brightness_set op will have to
set LED_BRIGHTNESS_FAST flag, which will instruct the LED core to
call the op synchronously. On the other hand drivers which can sleep
in their brightness_set op won't set the flag, which will make LED core
delegating the op to the work queue task. It is also possible that
driver with brightness_set op that can sleep set SET_BRIGHTNESS_SYNC
flag - then LED core will call it in a synchronous way from
led_brightness_set and it will schedule work queue task in case
the op is called from triggers.
If you want to NAK the patch, please come up with detailed analysis
on how it can cause problems. Without this I infer that you didn't
spend a second on analyzing the code. This is counterproductive.
> I'm not a lockdep expert, but mixing functions with different
> semantics under one function pointer is wrong thing to do. If it does
> not produce warnings today, it may start producing them tommorow. Just
> don't do it.
--
Best Regards,
Jacek Anaszewski
next prev parent reply other threads:[~2015-07-01 7:29 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-30 8:01 [PATCH/RFC RESEND] leds: Use set_brightness_work for brightness_set ops that can sleep Jacek Anaszewski
2015-06-30 8:27 ` Jacek Anaszewski
2015-06-30 11:41 ` Stas Sergeev
2015-06-30 12:41 ` Jacek Anaszewski
2015-06-30 12:55 ` Stas Sergeev
2015-06-30 11:58 ` Pavel Machek
2015-06-30 13:06 ` Jacek Anaszewski
2015-06-30 17:46 ` Pavel Machek
2015-07-01 7:28 ` Jacek Anaszewski [this message]
2015-07-01 7:43 ` Pavel Machek
2015-07-01 10:47 ` Jacek Anaszewski
2015-07-01 13:37 ` Pavel Machek
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=559396B4.9020504@samsung.com \
--to=j.anaszewski@samsung.com \
--cc=andreas.werner@men.de \
--cc=andrew@lunn.ch \
--cc=anemo@mba.ocn.ne.jp \
--cc=balbi@ti.com \
--cc=ben@simtec.co.uk \
--cc=bigeasy@linutronix.de \
--cc=bootc@bootc.net \
--cc=broonie@kernel.org \
--cc=cooloney@gmail.com \
--cc=daniel.jeong@ti.com \
--cc=daniel@zonque.org \
--cc=dave@sr71.net \
--cc=davem@davemloft.net \
--cc=dl9pf@gmx.de \
--cc=dmurphy@ti.com \
--cc=fabio.baltieri@gmail.com \
--cc=florian@openwrt.org \
--cc=g.liakhovetski@gmx.de \
--cc=giometti@linux.it \
--cc=gshark.jeong@gmail.com \
--cc=ingi2.kim@samsung.com \
--cc=jogo@openwrt.org \
--cc=johan@kernel.org \
--cc=kris@krisk.org \
--cc=kristoffer.ericson@gmail.com \
--cc=lenz@cs.wisc.edu \
--cc=linus.walleij@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=lost.distance@yahoo.com \
--cc=michael.hennerich@analog.com \
--cc=milo.kim@ti.com \
--cc=n0-1@freewrt.org \
--cc=ncase@xes-inc.com \
--cc=neilb@suse.de \
--cc=nick.forbes@incepta.com \
--cc=nm127@freemail.hu \
--cc=noltari@gmail.com \
--cc=ospite@studenti.unina.it \
--cc=p.meerwald@bct-electronic.com \
--cc=pavel@ucw.cz \
--cc=philippe.retornaz@epfl.ch \
--cc=q1.kim@samsung.com \
--cc=raph@8d.com \
--cc=rod@whitby.id.au \
--cc=rpurdie@openedhand.com \
--cc=rpurdie@rpsys.net \
--cc=sakari.ailus@linux.intel.com \
--cc=sguinot@lacie.com \
--cc=shuahkhan@gmail.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