From patchwork Wed Apr 15 06:48:31 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacek Anaszewski X-Patchwork-Id: 6218921 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E4CBD9F2EC for ; Wed, 15 Apr 2015 06:49:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 096B620361 for ; Wed, 15 Apr 2015 06:49:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 47FFF2037A for ; Wed, 15 Apr 2015 06:49:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752331AbbDOGt3 (ORCPT ); Wed, 15 Apr 2015 02:49:29 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:25631 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751757AbbDOGtM (ORCPT ); Wed, 15 Apr 2015 02:49:12 -0400 Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NMU00ET65LYU900@mailout1.samsung.com>; Wed, 15 Apr 2015 15:49:10 +0900 (KST) X-AuditID: cbfee61b-f79536d000000f1f-d5-552e09e66850 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 16.56.03871.6E90E255; Wed, 15 Apr 2015 15:49:10 +0900 (KST) Received: from AMDC2362.DIGITAL.local ([106.120.53.23]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0NMU00K795LELQ80@mmp2.samsung.com>; Wed, 15 Apr 2015 15:49:09 +0900 (KST) From: Jacek Anaszewski To: linux-leds@vger.kernel.org, linux-media@vger.kernel.org Cc: kyungmin.park@samsung.com, pavel@ucw.cz, cooloney@gmail.com, rpurdie@rpsys.net, sakari.ailus@iki.fi, s.nawrocki@samsung.com, Jacek Anaszewski Subject: [PATCH v5 01/10] leds: unify the location of led-trigger API Date: Wed, 15 Apr 2015 08:48:31 +0200 Message-id: <1429080520-10687-2-git-send-email-j.anaszewski@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1429080520-10687-1-git-send-email-j.anaszewski@samsung.com> References: <1429080520-10687-1-git-send-email-j.anaszewski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrALMWRmVeSWpSXmKPExsVy+t9jQd1nnHqhBm9XcVgc3TmRyaL36nNG i7NNb9gttr5Zx2jRs2Erq8XdU0fZLHbvespqcfhNO6vFmf0r2Rw4PXbOusvucfjrQhaPPfN/ sHr0bVnF6LFi9Xd2j8+b5ALYorhsUlJzMstSi/TtErgyGh9sYiyYq1CxfL58A+Mc6S5GTg4J AROJA/MaWSFsMYkL99azdTFycQgJTGeU+N3QyQzh/GSUeLL3PyNIFZuAocTPF6+ZQGwRAWuJ WYems4AUMQtsYJS4PKGRBSQhLOAq0de4GqiBg4NFQFVi31RREJNXwEPi1jQVEFNCQEFiziQb kGJOAU+Jez83sIHYQkAVLZ1nGScw8i5gZFjFKJpakFxQnJSea6RXnJhbXJqXrpecn7uJERxu z6R3MK5qsDjEKMDBqMTDu2CBbqgQa2JZcWXuIUYJDmYlEV7jP0Ah3pTEyqrUovz4otKc1OJD jNIcLErivHN05UKFBNITS1KzU1MLUotgskwcnFINjEZXF59rbsr748WyferBYJm/BZzzz2S9 CvPuPLLO9ODxCX/3CRox8PfJpq2af+6GYWrrqqMbd11p4Fc4IP/vTdpyZm6tMllOZkPN+7xL 559kEhEKsw62nfa8evEd8eQ9647O6FG9GPZu8YZvnyIYZxS7z37+ICeE30L1lK7Y3WPVPvcq DETDvZVYijMSDbWYi4oTAdksH48zAgAA Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Part of led-trigger API was in the private drivers/leds/leds.h header. Move it to the include/linux/leds.h header to unify the API location and announce it as public. It has been already exported from led-triggers.c with EXPORT_SYMBOL_GPL macro. The no-op definitions are changed from macros to inline to match the style of the surrounding code. Signed-off-by: Jacek Anaszewski Cc: Bryan Wu Cc: Richard Purdie Acked-by: Sakari Ailus --- drivers/leds/leds.h | 24 ------------------------ include/linux/leds.h | 25 +++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/drivers/leds/leds.h b/drivers/leds/leds.h index 79efe57..bc89d7a 100644 --- a/drivers/leds/leds.h +++ b/drivers/leds/leds.h @@ -13,7 +13,6 @@ #ifndef __LEDS_H_INCLUDED #define __LEDS_H_INCLUDED -#include #include #include @@ -50,27 +49,4 @@ void led_stop_software_blink(struct led_classdev *led_cdev); extern struct rw_semaphore leds_list_lock; extern struct list_head leds_list; -#ifdef CONFIG_LEDS_TRIGGERS -void led_trigger_set_default(struct led_classdev *led_cdev); -void led_trigger_set(struct led_classdev *led_cdev, - struct led_trigger *trigger); -void led_trigger_remove(struct led_classdev *led_cdev); - -static inline void *led_get_trigger_data(struct led_classdev *led_cdev) -{ - return led_cdev->trigger_data; -} - -#else -#define led_trigger_set_default(x) do {} while (0) -#define led_trigger_set(x, y) do {} while (0) -#define led_trigger_remove(x) do {} while (0) -#define led_get_trigger_data(x) (NULL) -#endif - -ssize_t led_trigger_store(struct device *dev, struct device_attribute *attr, - const char *buf, size_t count); -ssize_t led_trigger_show(struct device *dev, struct device_attribute *attr, - char *buf); - #endif /* __LEDS_H_INCLUDED */ diff --git a/include/linux/leds.h b/include/linux/leds.h index 9a2b000..b122eea 100644 --- a/include/linux/leds.h +++ b/include/linux/leds.h @@ -12,6 +12,7 @@ #ifndef __LINUX_LEDS_H_INCLUDED #define __LINUX_LEDS_H_INCLUDED +#include #include #include #include @@ -222,6 +223,11 @@ struct led_trigger { struct list_head next_trig; }; +ssize_t led_trigger_store(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count); +ssize_t led_trigger_show(struct device *dev, struct device_attribute *attr, + char *buf); + /* Registration functions for complex triggers */ extern int led_trigger_register(struct led_trigger *trigger); extern void led_trigger_unregister(struct led_trigger *trigger); @@ -238,6 +244,16 @@ extern void led_trigger_blink_oneshot(struct led_trigger *trigger, unsigned long *delay_on, unsigned long *delay_off, int invert); +extern void led_trigger_set_default(struct led_classdev *led_cdev); +extern void led_trigger_set(struct led_classdev *led_cdev, + struct led_trigger *trigger); +extern void led_trigger_remove(struct led_classdev *led_cdev); + +static inline void *led_get_trigger_data(struct led_classdev *led_cdev) +{ + return led_cdev->trigger_data; +} + /** * led_trigger_rename_static - rename a trigger * @name: the new trigger name @@ -267,6 +283,15 @@ static inline void led_trigger_register_simple(const char *name, static inline void led_trigger_unregister_simple(struct led_trigger *trigger) {} static inline void led_trigger_event(struct led_trigger *trigger, enum led_brightness event) {} +static inline void led_trigger_set_default(struct led_classdev *led_cdev) {} +static inline void led_trigger_set(struct led_classdev *led_cdev, + struct led_trigger *trigger) {} +static inline void led_trigger_remove(struct led_classdev *led_cdev) {} +static inline void *led_get_trigger_data(struct led_classdev *led_cdev) +{ + return NULL; +} + #endif /* CONFIG_LEDS_TRIGGERS */ /* Trigger specific functions */