Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753184AbbHTOod (ORCPT ); Thu, 20 Aug 2015 10:44:33 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:54771 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751738AbbHTOoa (ORCPT ); Thu, 20 Aug 2015 10:44:30 -0400 X-AuditID: cbfee61a-f79a06d000005c6f-00-55d5e7ccc248 From: Jacek Anaszewski To: linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jacek Anaszewski , Andrew Lunn , Sakari Ailus , Pavel Machek , Stas Sergeev Subject: [PATCH/RFC v6 01/36] leds: Add brightness_set_blocking op Date: Thu, 20 Aug 2015 16:43:31 +0200 Message-id: <1440081846-11697-2-git-send-email-j.anaszewski@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1440081846-11697-1-git-send-email-j.anaszewski@samsung.com> References: <1440081846-11697-1-git-send-email-j.anaszewski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprBLMWRmVeSWpSXmKPExsVy+t9jAd0zz6+GGrTfM7E4f/cQs0Xv1eeM Fpd3zWGz2PpmHaPF3VNH2Sw+bfnGZNHZN43Fgd1j3slAj507PjN59G1ZxeixYvV3do+mU+2s Hp83yQWwRXHZpKTmZJalFunbJXBlnLh8mL3gOW/FgoUXWBoYN3J3MXJySAiYSKzZcoQdwhaT uHBvPVsXIweHkMBSRom/TF2MXEDmT0aJi/uvsoDUsAkYSvx88ZoJxBYRsJHonTEJzGYWOMYo 8XNvNIgtLOAksXf9S1YQm0VAVeLxs62MIDavgIfElsbprCDzJQQUJOZMsgEJcwp4Ssyb/xXs BCGgkhfvtzBPYORdwMiwilEitSC5oDgpPdcwL7Vcrzgxt7g0L10vOT93EyM4vJ5J7WA8uMv9 EKMAB6MSD+8F4auhQqyJZcWVuYcYJTiYlUR4bz0DCvGmJFZWpRblxxeV5qQWH2KU5mBREueV 3bA5VEggPbEkNTs1tSC1CCbLxMEp1cCYJb6cf8bFJ4Y7+8vuzjuiJ9Q0R98wIGKxT/rb/9cm 6txl2WH3ea3JZzfZr7uyP+y9OEG54sg1Tg13rmXeP1R6tE4wWrz1tdReoVj+27hG4erWpCs7 g1Xrpik8mJHu8V654UhdZ4h+q5kGt7WJD+PvVNFKtc4r759Mq5EyvLasvuXfmu/lm88psRRn JBpqMRcVJwIADdXu7CsCAAA= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1964 Lines: 53 This patch adds a new brightness_set_blocking op to the LED subsystem. The op is intended for drivers that set brightness in a blocking way, i.e. they either can sleep or use delays while setting brightness. Signed-off-by: Jacek Anaszewski Cc: Andrew Lunn Cc: Sakari Ailus Cc: Pavel Machek Cc: Stas Sergeev --- drivers/leds/led-class.c | 3 +++ include/linux/leds.h | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c index ca51d58..93a2414 100644 --- a/drivers/leds/led-class.c +++ b/drivers/leds/led-class.c @@ -267,6 +267,9 @@ int led_classdev_register(struct device *parent, struct led_classdev *led_cdev) dev_warn(parent, "Led %s renamed to %s due to name collision", led_cdev->name, dev_name(led_cdev->dev)); + WARN_ON(led_cdev->brightness_set && + led_cdev->brightness_set_blocking); + #ifdef CONFIG_LEDS_TRIGGERS init_rwsem(&led_cdev->trigger_lock); #endif diff --git a/include/linux/leds.h b/include/linux/leds.h index b122eea..85fad6b 100644 --- a/include/linux/leds.h +++ b/include/linux/leds.h @@ -54,6 +54,12 @@ struct led_classdev { void (*brightness_set)(struct led_classdev *led_cdev, enum led_brightness brightness); /* + * Intended for drivers that either can sleep or use delays while + * setting brightness. + */ + int (*brightness_set_blocking)(struct led_classdev *led_cdev, + enum led_brightness brightness); + /* * Set LED brightness level immediately - it can block the caller for * the time required for accessing a LED device register. */ -- 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/