Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753418AbbGAKrS (ORCPT ); Wed, 1 Jul 2015 06:47:18 -0400 Received: from mailout4.w1.samsung.com ([210.118.77.14]:32316 "EHLO mailout4.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751125AbbGAKrJ (ORCPT ); Wed, 1 Jul 2015 06:47:09 -0400 X-AuditID: cbfec7f5-f794b6d000001495-a2-5593c529c5e5 Message-id: <5593C526.9070300@samsung.com> Date: Wed, 01 Jul 2015 12:47:02 +0200 From: Jacek Anaszewski User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130804 Thunderbird/17.0.8 MIME-version: 1.0 To: Pavel Machek Cc: linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org, Bryan Wu , Richard Purdie , Stas Sergeev , Sakari Ailus , Andreas Werner , Andrew Lunn , Antonio Ospite , Atsushi Nemoto , Ben Dooks , Chris Boot , Dan Murphy , Daniel Jeong , Daniel Mack , "David S. Miller" , Fabio Baltieri , Felipe Balbi , Florian Fainelli , "G.Shark Jeong" , Guennadi Liakhovetski , Ingi Kim , Jan-Simon Moeller , Johan Hovold , John Lenz , Jonas Gorski , Kim Kyuwon , Kristian Kielhofner , Kristoffer Ericson , Linus Walleij , Mark Brown , Michael Hennerich , Milo Kim , =?ISO-8859-1?Q?M=E1rton_N=E9meth?= , Nate Case , NeilBrown , Nick Forbes , Paul Parsons , Peter Meerwald , Phil Sutter , Philippe Retornaz , Raphael Assenat , Richard Purdie , Rod Whitby , Dave Hansen , Rodolfo Giometti , "Sebastian A. Siewior" , Shuah Khan , Simon Guinot , =?ISO-8859-1?Q?=C1lvaro_Fern=E1ndez_Rojas?= Subject: Re: [PATCH/RFC RESEND] leds: Use set_brightness_work for brightness_set ops that can sleep References: <1435651268-9657-1-git-send-email-j.anaszewski@samsung.com> <20150630115809.GA13605@amd> <5592944B.5020809@samsung.com> <20150630174619.GA1852@amd> <559396B4.9020504@samsung.com> <20150701074327.GB11385@amd> In-reply-to: <20150701074327.GB11385@amd> Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA02Sf0xTVxTHve/e9/po1visyO6Yy7Ymmug2lemyE3QEF01uMpOZqNO4OK36 gGoLpE/M9B8Bf9FigFHsYoNoDIUVGxBhCGUwKetAKjKHMnWCsIFRBHEgWqyKlrqE/z7nnM85 33+OiLV3+WjRkLxHNifrjTpBTfwvW659ssBn27DkaFcUZDfkEejo9mJw2tZD050DUOofI2C/ mo/B7VsNx/v6BfDV/cDBLzUDGDJfDBLIcP3KQWHHIQIFwUIesv3VPBwMJMCTkcsERiqLOLhw 6yUGW72Vh9qbjwX4u7xNgMwbx3iYqMpSQdElCr5mDw8Fz0s56PQUCvDzUDmCQE6NAHnNVSoo fVZO4OHDIIGB3CYVNJxKJ/C0fRLDUK2fB/dtLw/B7HoCOd53wHduFXS2+whU/uPgYODyLQQt rZc4mGjoxVDvGeBhtPoJBxX9ahifiAdLjp3EL2WTVWcQG7y+kv3U082xMVcJYdeflWFW7brJ sSJHK2Elh89iVpwVULHx0UEVq3N0q9ij/75jRc6LmJ0vswjM1nWMZ67OXm7t/M3qFTtlo2Gv bF4ct02dNFxtEVIHZ39vb/iRpKN8yYoiRCotoyOeU1yYo+gfPRWCFalFreREtKL3qCpc3EX0 Wnu7ELI00kLalpGHQkykefTPQP/UtiDF0Il7D6Z4jrSJPvc38mF/Fg3YekiII6UP6L3hUhw6 iqX8mbS4o3Hq0GxJps1Z9jfRfYh2NfW/tkQxQlpAT9yIDjlYWk5d+TUozO/TKvcwzkOSY1qG Y5rmmKadRrgMzZHTdqQq2xNNny5S9CYlLTlx0Y4U03kU/r7xWuT8PdaLJBHp3tIkUdsGLa/f q+wzeREVsS5S8/j465Zmp37fftmcstWcZpQVL3pXJLq3NSc8I+u1UqJ+j7xbllNl8/9TToyI Tkd/LTtZd/h2QstH1uGIL+3LN39R2DcvaDj4WcpQ1+cfm+1rttxZcfW37RsNyhqr/4jFWFv2 YdQm39eZM9u+mYwtWDo6N2HbysrinrjFJcF/vZYtztjc6NUZFxtbYr4VrjyA4OQMxWiKj5ux apd/61eRVos+l104MybMvb/ObXiv1a3VJeqIkqSPWYjNiv4Vv44+LnkDAAA= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2728 Lines: 60 On 07/01/2015 09:43 AM, Pavel Machek wrote: > On Wed 2015-07-01 09:28:52, Jacek Anaszewski wrote: >> 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. > > I understand this "works". > >> 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. > > NAK. > > Because calling two functions with different semantics through same > function pointer is extremely ugly, and _will_ cause lockdep > problems. Talk to the lockdep people for details. Which two functions are you thinking of? There is a single brightness_set op to call. -- Best Regards, Jacek Anaszewski -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/