Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752937AbbF3M47 (ORCPT ); Tue, 30 Jun 2015 08:56:59 -0400 Received: from smtp38.i.mail.ru ([94.100.177.98]:34203 "EHLO smtp38.i.mail.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751817AbbF3M4y (ORCPT ); Tue, 30 Jun 2015 08:56:54 -0400 Message-ID: <559291C8.2010504@list.ru> Date: Tue, 30 Jun 2015 15:55:36 +0300 From: Stas Sergeev User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Jacek Anaszewski CC: Stas Sergeev , linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org, Bryan Wu , Richard Purdie , Pavel Machek , 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 , =?UTF-8?B?TcOhcnRvbiBOw6ltZXRo?= , 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 , =?UTF-8?B?w4FsdmFybyBGZXJuw6FuZGV6IFJvamFz?= 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> <559252EC.2050906@samsung.com> <55928054.8070705@list.ru> <55928E7B.2020306@samsung.com> In-Reply-To: <55928E7B.2020306@samsung.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam: Not detected X-Mras: Ok Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2127 Lines: 42 30.06.2015 15:41, Jacek Anaszewski пишет: > On 06/30/2015 01:41 PM, Stas Sergeev wrote: >> 30.06.2015 11:27, Jacek Anaszewski пишет: >>> On 06/29/2015 05:17 PM, Stas Sergeev wrote:> 29.06.2015 17:05, Jacek Anaszewski пишет: >>>>> + * If need to disable soft blinking delegate this to the >>>>> + * work queue task to avoid problems in case we are >>>>> + * called from hard irq context. >>>>> + */ >>>>> + led_cdev->flags |= LED_BLINK_DISABLE; >>>> Wouldn't it be better to just enforce the callers >>>> to explicitly disable software blink, so that it to >>>> never happen from irq context? Something like in this >>>> patch: >>>> https://lkml.org/lkml/2015/5/13/491 >>>> >>> >>> Blinking can be disabled not only by removing trigger explicitly, >>> but also by setting brightness to 0 and led_set_brightness >>> can be called from hard irq context. set_brightness_work >>> was originally introduced exactly for this use case. >> Could you please describe where does this happen? > This in fact doesn't take place in the mainline kernel, > however there are some out of tree users apparently [1]. Oh, IMHO the hooks that are needed only for out-of-tree code require the appropriate comment, at least. I was entirely confused by its existence. IIRC in the past there was even the policy to not include any hooks for out-of-tree code at all. > Modifications I am proposing also need set_brightness_work, > so there is almost no cost of keeping the support for calling led_set_brightness from hard irq context intact. I wonder if there are possible races, eg you schedule disabling of the softblink timer, and someone else at the same time also disables it (and probably also re-enables). Well if you think that code is safe, I would agree that the cost is now very small with your patch, so maybe it is not a big deal any more. -- 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/