Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753341AbbGAH3H (ORCPT ); Wed, 1 Jul 2015 03:29:07 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:18546 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751092AbbGAH26 (ORCPT ); Wed, 1 Jul 2015 03:28:58 -0400 X-AuditID: cbfec7f5-f794b6d000001495-40-559396b70544 Message-id: <559396B4.9020504@samsung.com> Date: Wed, 01 Jul 2015 09:28:52 +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> In-reply-to: <20150630174619.GA1852@amd> Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA02SWUyTWRTHc797v6+lsTOfIHpFE2LjFhJR3HLGLfJgcpN50AdIXOJS9RNU QGwF0dFYtwTBYZAiI01Fo7IUSQ07tGyWVIFqqkEQFSigNQYXFCj76EzBSXj7nfP/nXNejhz7 vucD5IdjTkiaGHWUSlAQx/fHrcvKM/ThK7oN/pBcnUrA2WHDkK0Pg4euc5DrGCCQ8TwNQ4F9 C1zvfieAvfIaB1VlbgwX/uklcN5Uy4HReYlA+riRh2RHCQ8XRw7BUN8TAn2FWRyUv/6OQW9N 4qHi1aAAb8xNAlxou8rDaHGiDLIaKdjrLTykT+Ry0GwxClD6yYxgJKVMgNT6YhnkjpkJfPky TsD910MZVN/SERh++gPDpwoHDwXtNh7Gk60EUmxzoaPJLkDzUzuBwh4DB+4nrxE8bmjkYLS6 C4PV4uahv2SIgwfvFOAZ3QxXUjLI5lXsR/EdxHpbQlleZwfHBkw5hLWM5WNWYnrFsZzL9zG7 lzgiY57+XhmrNHTI2Ndve1hWdh1mRflXBKZvvcozU3MXx9pbq4Rti3cqNhyUog7HS5rlm/Yp Is2Va2OdMxOaGhJ0KO+XJOQjp+Jq2l3iwlM8mz7rfCAkIYXcV8xG1Pjyxs/iPaLnHTc4r6UU g2jbWz3xMhEXUYvDI/OyIIbQ0Q8fJx1/cTudcNTwU/5MOqLvnPRniYG0NCUPe5diMe1Xes9Z g7yBnyjR+sSMn9fuIvr3gFPwBj7iUvq5rmxyGovrqSmtDE1xIC0u+IxTkWiYdsQwTTNM024j nI/8pbgDsdr9EdErg7XqaG1cTETwgWPRRWjq+zwVKPvROhsS5Ug1QxlJ9eG+vDpeeyrahqgc q2YpB6//11IeVJ86LWmO7dXERUlaG5onJ6o5ykxLX5ivGKE+IR2VpFhJ83/KyX0CdChnR4s1 OHPs1pLSFdxvu+fN2dbw577jEVV1efGndfPXN147q615G7qwNtTcUtgja8+0hAyv+2NBLtfP FaWHb9pfPvdOQvdZV+yWl9aA9iGdKtTj9jxzbR3ePrGq/3JY0OLxwd+J8UzC0Ypdt4M3rnlx 84gfg12pQ5rAsA0nXW1FrfONKqKNVIcEYY1W/S9AtX90eQMAAA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2453 Lines: 52 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 -- 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/