Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934114AbbHKJia (ORCPT ); Tue, 11 Aug 2015 05:38:30 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:57698 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934068AbbHKJi0 (ORCPT ); Tue, 11 Aug 2015 05:38:26 -0400 X-AuditID: cbfee61a-f79a06d000005c6f-b8-55c9c2917318 From: Jacek Anaszewski To: linux-leds@vger.kernel.org Cc: linux-kernel@vger.kernel.org, cooloney@gmail.com, rpurdie@rpsys.net, stsp@users.sourceforge.net, Jacek Anaszewski , Andrew Lunn , Sakari Ailus , Pavel Machek Subject: [PATCH/RFC v5 02/57] leds: Add LED_BRIGHTNESS_BLOCKING flag Date: Tue, 11 Aug 2015 11:37:15 +0200 Message-id: <1439285890-27329-3-git-send-email-j.anaszewski@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1439285890-27329-1-git-send-email-j.anaszewski@samsung.com> References: <1439285890-27329-1-git-send-email-j.anaszewski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrLLMWRmVeSWpSXmKPExsVy+t9jQd2Jh06GGtx6w2xx/u4hZoujOycy WfRefc5ocXnXHDaLrW/WMVrcPXWUzWL3rqesFp+2fGOy6OybxuLA6bFz1l12j3knAz127vjM 5LFn/g9Wj74tqxg9Vqz+zu7RdKqd1ePzJrkAjigum5TUnMyy1CJ9uwSujC3H5rAWrOarePTp JnMDYwNPFyMnh4SAicTev4uZIWwxiQv31rN1MXJxCAnMYpS493UVC4Tzk1Gi88k/RpAqNgFD iZ8vXjN1MXJwiAjISew8UwlSwyzwj1Fi1qunbCA1wgIuEkebP7CB1LAIqEr0NomAhHkFPCRe 7boAFpYQUJCYM8kGJMwp4Clx/fkisOlCQCXHZzexTWDkXcDIsIpRIrUguaA4KT3XMC+1XK84 Mbe4NC9dLzk/dxMjOBCfSe1gPLjL/RCjAAejEg+vgOfJUCHWxLLiytxDjBIczEoivIVTgUK8 KYmVValF+fFFpTmpxYcYpTlYlMR5ZTdsDhUSSE8sSc1OTS1ILYLJMnFwSjUwlma9L37DuPnf eubw3acfLO7l9NrkXVTgwveusG+Cq+H9D17r5qoKspbfm6PTIRFxbPPZJRY79A7GhSbXBWwS P7RqssDSIllT/y3s5V63ez6UJL67bnJiyzvPBr9vx8siTyh/Pvev1zI81D/5QTVTg46C4jy1 UymrbuXI+ieGiwmtMBLpEi5TYinOSDTUYi4qTgQArFpcuEACAAA= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2031 Lines: 54 This patch adds LED_BRIGHTNESS_BLOCKING flag to the LED core to make it capable of discerning between drivers that implement brightness_set op in the old manner, i.e. the ones which use work queue internally, and drivers that implement brightness_set op in the new manner, i.e. they are aware that brightness_set op will be called from a work queue task by the LED core. In the new approach all drivers that implement brightness_set op should also set LED_BRIGHTNESS_BLOCKING flag. Signed-off-by: Jacek Anaszewski Cc: Bryan Wu Cc: Andrew Lunn Cc: Sakari Ailus Cc: Pavel Machek Cc: Stas Sergeev --- drivers/leds/led-class.c | 3 +++ include/linux/leds.h | 1 + 2 files changed, 4 insertions(+) diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c index ca51d58..2875e6a 100644 --- a/drivers/leds/led-class.c +++ b/drivers/leds/led-class.c @@ -279,6 +279,9 @@ int led_classdev_register(struct device *parent, struct led_classdev *led_cdev) if (!led_cdev->max_brightness) led_cdev->max_brightness = LED_FULL; + WARN_ON((led_cdev->flags & LED_BRIGHTNESS_BLOCKING) && + !led_cdev->brightness_set); + led_cdev->flags |= SET_BRIGHTNESS_ASYNC; led_update_brightness(led_cdev); diff --git a/include/linux/leds.h b/include/linux/leds.h index c32f1b8..ac9efe1 100644 --- a/include/linux/leds.h +++ b/include/linux/leds.h @@ -48,6 +48,7 @@ struct led_classdev { #define SET_BRIGHTNESS_ASYNC (1 << 21) #define SET_BRIGHTNESS_SYNC (1 << 22) #define LED_DEV_CAP_FLASH (1 << 23) +#define LED_BRIGHTNESS_BLOCKING (1 << 24) /* Set LED brightness level */ /* Must not sleep, use a workqueue if needed */ -- 1.7.9.5 -- 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/